Skip to content

Commit 061acb4

Browse files
authored
Merge pull request #102 from Tokazama/source
Update ImageMetadata documentation
2 parents 305cfe4 + 6656af5 commit 061acb4

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

docs/src/imagemetadata.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ julia> img = ImageMeta(fill(RGB(1,0,0), 3, 2), date=Date(2016, 7, 31), time="hig
1717
RGB ImageMeta with:
1818
data: 3×2 Array{RGB{N0f8},2} with eltype RGB{Normed{UInt8,8}}
1919
properties:
20-
time: high noon
2120
date: 2016-07-31
21+
time: high noon
2222
```
2323

2424
```@meta
@@ -38,18 +38,18 @@ RGB{N0f8}(1.0,0.0,0.0)
3838
and access and set properties like this:
3939

4040
```jldoctest
41-
julia> img["time"]
41+
julia> img.time
4242
"high noon"
4343
44-
julia> img["time"] = "evening"
44+
julia> img.time = "evening"
4545
"evening"
4646
4747
julia> img
4848
RGB ImageMeta with:
4949
data: 3×2 Array{RGB{N0f8},2} with eltype RGB{Normed{UInt8,8}}
5050
properties:
51-
time: evening
5251
date: 2016-07-31
52+
time: evening
5353
```
5454

5555
You can extract the data matrix with `data(img)`:
@@ -66,9 +66,9 @@ and the properties dictionary with `properties`:
6666

6767
```jldoctest
6868
julia> properties(img)
69-
Dict{String,Any} with 2 entries:
70-
"time" => "high noon"
71-
"date" => 2016-07-31
69+
Dict{Symbol,Any} with 2 entries:
70+
:date => 2016-07-31
71+
:time => "high noon"
7272
```
7373

7474
Properties are not accessed or modified by most of Images'
@@ -86,8 +86,8 @@ julia> c = img[1:2, 1:2]
8686
RGB ImageMeta with:
8787
data: 2×2 Array{RGB{N0f8},2} with eltype RGB{Normed{UInt8,8}}
8888
properties:
89-
time: high noon
9089
date: 2016-07-31
90+
time: high noon
9191
```
9292

9393
This copies both the data (just the relevant portions) and the properties dictionary. In contrast,
@@ -97,8 +97,8 @@ julia> v = view(img, 1:2, 1:2)
9797
RGB ImageMeta with:
9898
data: 2×2 view(::Array{RGB{N0f8},2}, 1:2, 1:2) with eltype RGB{Normed{UInt8,8}}
9999
properties:
100-
time: high noon
101100
date: 2016-07-31
101+
time: high noon
102102
```
103103

104104
shares both the data and the properties with the original image
@@ -134,19 +134,19 @@ julia> A = reshape(1:15, 3, 5)
134134
2 5 8 11 14
135135
3 6 9 12 15
136136
137-
julia> img = ImageMeta(A, spatialproperties=Set(["maxsum"]), maxsum=[maximum(sum(A,dims=1)), maximum(sum(A,dims=2))])
137+
julia> img = ImageMeta(A, spatialproperties=Set([:maxsum]), maxsum=[maximum(sum(A,dims=1)), maximum(sum(A,dims=2))])
138138
Int64 ImageMeta with:
139139
data: 3×5 reshape(::UnitRange{Int64}, 3, 5) with eltype Int64
140140
properties:
141141
maxsum: [42, 45]
142-
spatialproperties: Set(["maxsum"])
142+
spatialproperties: Set(Symbol[:maxsum])
143143
144144
julia> imgp = permutedims(img, (2,1))
145145
Int64 ImageMeta with:
146146
data: 5×3 Array{Int64,2}
147147
properties:
148148
maxsum: [45, 42]
149-
spatialproperties: Set(["maxsum"])
149+
spatialproperties: Set(Symbol[:maxsum])
150150
151151
julia> maximum(sum(imgp, dims=1))
152152
45

0 commit comments

Comments
 (0)