Skip to content

Commit 421e2da

Browse files
authored
update documentation with Julia 1.6 (#188)
1 parent 35337fa commit 421e2da

File tree

6 files changed

+79
-73
lines changed

6 files changed

+79
-73
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ docs/build/
22
docs/site/
33
Manifest.toml
44
docs/src/democards
5+
docs/src/examples

docs/src/pkgs/metadata/index.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ julia> using Colors, ImageMetadata, Dates
1515
1616
julia> img = ImageMeta(fill(RGB(1,0,0), 3, 2), date=Date(2016, 7, 31), time="high noon")
1717
RGB ImageMeta with:
18-
data: 3×2 Array{RGB{N0f8},2} with eltype RGB{Normed{UInt8,8}}
18+
data: 3×2 Array{RGB{N0f8},2} with eltype RGB{N0f8}
1919
properties:
2020
date: 2016-07-31
2121
time: high noon
@@ -46,7 +46,7 @@ julia> img.time = "evening"
4646
4747
julia> img
4848
RGB ImageMeta with:
49-
data: 3×2 Array{RGB{N0f8},2} with eltype RGB{Normed{UInt8,8}}
49+
data: 3×2 Array{RGB{N0f8},2} with eltype RGB{N0f8}
5050
properties:
5151
date: 2016-07-31
5252
time: evening
@@ -56,7 +56,7 @@ You can extract the data matrix with `arraydata(img)`:
5656

5757
```jldoctest
5858
julia> arraydata(img)
59-
3×2 Array{RGB{N0f8},2} with eltype RGB{FixedPointNumbers.Normed{UInt8,8}}:
59+
3×2 Array{RGB{N0f8},2} with eltype RGB{FixedPointNumbers.N0f8}:
6060
RGB{N0f8}(1.0,0.0,0.0) RGB{N0f8}(1.0,0.0,0.0)
6161
RGB{N0f8}(1.0,0.0,0.0) RGB{N0f8}(1.0,0.0,0.0)
6262
RGB{N0f8}(1.0,0.0,0.0) RGB{N0f8}(1.0,0.0,0.0)
@@ -66,7 +66,7 @@ and the properties dictionary with `properties`:
6666

6767
```jldoctest
6868
julia> properties(img)
69-
Dict{Symbol,Any} with 2 entries:
69+
Dict{Symbol, Any} with 2 entries:
7070
:date => Date("2016-07-31")
7171
:time => "high noon"
7272
```
@@ -84,7 +84,7 @@ of that pixel. But if you index a range, you get another `ImageMeta`:
8484
```jldoctest
8585
julia> c = img[1:2, 1:2]
8686
RGB ImageMeta with:
87-
data: 2×2 Array{RGB{N0f8},2} with eltype RGB{Normed{UInt8,8}}
87+
data: 2×2 Array{RGB{N0f8},2} with eltype RGB{N0f8}
8888
properties:
8989
date: 2016-07-31
9090
time: high noon
@@ -95,7 +95,7 @@ This copies both the data (just the relevant portions) and the properties dictio
9595
```jldoctest
9696
julia> v = view(img, 1:2, 1:2)
9797
RGB ImageMeta with:
98-
data: 2×2 view(::Array{RGB{N0f8},2}, 1:2, 1:2) with eltype RGB{Normed{UInt8,8}}
98+
data: 2×2 view(::Array{RGB{N0f8},2}, 1:2, 1:2) with eltype RGB{N0f8}
9999
properties:
100100
date: 2016-07-31
101101
time: high noon
@@ -143,7 +143,7 @@ Int64 ImageMeta with:
143143
144144
julia> imgp = permutedims(img, (2,1))
145145
Int64 ImageMeta with:
146-
data: 5×3 Array{Int64,2}
146+
data: 5×3 Matrix{Int64}
147147
properties:
148148
maxsum: [45, 42]
149149
spatialproperties: Set([:maxsum])

docs/src/pkgs/segmentation/index.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ segments = seeded_region_growing(img, seeds)
3939
# output
4040
4141
Segmented Image with:
42-
labels map: 240×360 Array{Int64,2}
42+
labels map: 240×360 Matrix{Int64}
4343
number of labels: 3
4444
```
4545

@@ -61,7 +61,7 @@ julia> length(segment_labels(segments))
6161
3
6262
6363
julia> segment_mean(segments)
64-
Dict{Int64,RGB{Float64}} with 3 entries:
64+
Dict{Int64, RGB{Float64}} with 3 entries:
6565
2 => RGB{Float64}(0.793598,0.839543,0.932374)
6666
3 => RGB{Float64}(0.329863,0.35779,0.237457)
6767
1 => RGB{Float64}(0.0646509,0.0587034,0.0743471)
@@ -100,12 +100,12 @@ julia> img = load("src/pkgs/segmentation/assets/horse.jpg");
100100
101101
julia> segments = felzenszwalb(img, 100)
102102
Segmented Image with:
103-
labels map: 240×360 Array{Int64,2}
103+
labels map: 240×360 Matrix{Int64}
104104
number of labels: 43
105105
106106
julia> segments = felzenszwalb(img, 10) #smaller segments but noisy segmentation
107107
Segmented Image with:
108-
labels map: 240×360 Array{Int64,2}
108+
labels map: 240×360 Matrix{Int64}
109109
number of labels: 312
110110
```
111111

@@ -141,7 +141,7 @@ julia> img = fill(1, 4, 4);
141141
julia> img[1:2,1:2] .= 2;
142142
143143
julia> img
144-
4×4 Array{Int64,2}:
144+
4×4 Matrix{Int64}:
145145
2 2 1 1
146146
2 2 1 1
147147
1 1 1 1
@@ -150,14 +150,14 @@ julia> img
150150
julia> seg = fast_scanning(img, 0.5);
151151
152152
julia> labels_map(seg) # returns the assigned labels map
153-
4×4 Array{Int64,2}:
153+
4×4 Matrix{Int64}:
154154
1 1 3 3
155155
1 1 3 3
156156
3 3 3 3
157157
3 3 3 3
158158
159159
julia> segment_labels(seg) # returns a list of all assigned labels
160-
2-element Array{Int64,1}:
160+
2-element Vector{Int64}:
161161
1
162162
3
163163
@@ -193,7 +193,7 @@ julia> seeds = [(CartesianIndex(104, 48), 1), (CartesianIndex( 49, 40), 1),
193193
194194
julia> seg = seeded_region_growing(img, seeds)
195195
Segmented Image with:
196-
labels map: 183×275 Array{Int64,2}
196+
labels map: 183×275 Matrix{Int64}
197197
number of labels: 2
198198
```
199199
**Original** [(source)](https://upload.wikimedia.org/wikipedia/commons/thumb/6/6d/Davidraju_Worm_Snake.jpg/275px-Davidraju_Worm_Snake.jpg):
@@ -241,7 +241,7 @@ julia> img = load("src/pkgs/segmentation/assets/tree.jpg");
241241
242242
julia> seg = unseeded_region_growing(img, 0.05) # here 0.05 is the threshold
243243
Segmented Image with:
244-
labels map: 320×480 Array{Int64,2}
244+
labels map: 320×480 Matrix{Int64}
245245
number of labels: 698
246246
```
247247

@@ -266,7 +266,7 @@ julia> img = Gray.(testimage("house"));
266266
267267
julia> segments = felzenszwalb(img, 300, 100) # k=300 (the merging threshold), min_size = 100 (smallest number of pixels/region)
268268
Segmented Image with:
269-
labels map: 512×512 Array{Int64,2}
269+
labels map: 512×512 Matrix{Int64}
270270
number of labels: 11
271271
```
272272

@@ -296,7 +296,7 @@ julia> img = imresize(img, (128, 128));
296296
297297
julia> segments = meanshift(img, 16, 8/255) # parameters are smoothing radii: spatial=16, intensity-wise=8/255
298298
Segmented Image with:
299-
labels map: 128×128 Array{Int64,2}
299+
labels map: 128×128 Matrix{Int64}
300300
number of labels: 44
301301
```
302302
![img1](assets/small_house.jpg) ![img2](assets/meanshift.jpg)
@@ -328,12 +328,12 @@ julia> img = testimage("camera");
328328
329329
julia> seg = fast_scanning(img, 0.1) # threshold = 0.1
330330
Segmented Image with:
331-
labels map: 512×512 Array{Int64,2}
331+
labels map: 512×512 Matrix{Int64}
332332
number of labels: 2538
333333
334334
julia> seg = prune_segments(seg, i->(segment_pixel_count(seg,i)<50), (i,j)->(-segment_pixel_count(seg,j)))
335335
Segmented Image with:
336-
labels map: 512×512 Array{Int64,2}
336+
labels map: 512×512 Matrix{Int64}
337337
number of labels: 65
338338
```
339339

@@ -357,7 +357,7 @@ be used to create a segmented image.
357357

358358
###### Demo
359359

360-
```jldoctest
360+
```julia
361361
julia> using TestImages, ImageSegmentation
362362

363363
julia> img = testimage("lena_gray");
@@ -370,7 +370,7 @@ homogeneous (generic function with 1 method)
370370

371371
julia> seg = region_splitting(img, homogeneous)
372372
Segmented Image with:
373-
labels map: 256×256 Array{Int64,2}
373+
labels map: 256×256 Matrix{Int64}
374374
number of labels: 8836
375375
```
376376

@@ -449,7 +449,7 @@ julia> markers = label_components(dist .< -15);
449449
450450
julia> segments = watershed(dist, markers)
451451
Segmented Image with:
452-
labels map: 312×252 Array{Int64,2}
452+
labels map: 312×252 Matrix{Int64}
453453
number of labels: 24
454454
455455
julia> imshow(map(i->get_random_color(i), labels_map(segments)) .* (1 .-bw)) #shows segmented image
@@ -516,7 +516,7 @@ julia> function homogeneous(img)
516516
homogeneous (generic function with 1 method)
517517
518518
julia> t = region_tree(img, homogeneous) # `img` is an image
519-
Cell: RegionTrees.HyperRectangle{2,Float64}([1.0, 1.0], [300.0, 300.0])
519+
Cell: RegionTrees.HyperRectangle{2, Float64}([1.0, 1.0], [300.0, 300.0])
520520
```
521521

522522
For more information regarding `RegionTrees`, see [this](https://github.com/rdeits/RegionTrees.jl#regiontreesjl-quadtrees-octrees-and-their-n-dimensional-cousins).
@@ -546,14 +546,14 @@ julia> img[1:2,3:4] .= 3;
546546
julia> seg = fast_scanning(img, 0.5);
547547
548548
julia> labels_map(seg)
549-
4×4 Array{Int64,2}:
549+
4×4 Matrix{Int64}:
550550
1 1 3 3
551551
1 1 3 3
552552
2 2 2 2
553553
2 2 2 2
554554
555555
julia> seg.image_indexmap
556-
4×4 Array{Int64,2}:
556+
4×4 Matrix{Int64}:
557557
1 1 3 3
558558
1 1 3 3
559559
2 2 2 2
@@ -564,7 +564,7 @@ julia> diff_fn(rem_label, neigh_label) = segment_pixel_count(seg,rem_label) - se
564564
julia> new_seg = prune_segments(seg, [3], diff_fn);
565565
566566
julia> labels_map(new_seg)
567-
4×4 Array{Int64,2}:
567+
4×4 Matrix{Int64}:
568568
1 1 2 2
569569
1 1 2 2
570570
2 2 2 2
@@ -583,7 +583,7 @@ neighbouring segment having least `diff_fn` value.
583583

584584
```jldoctest prune
585585
julia> seg.image_indexmap
586-
4×4 Array{Int64,2}:
586+
4×4 Matrix{Int64}:
587587
1 1 3 3
588588
1 1 3 3
589589
2 2 2 2
@@ -594,7 +594,7 @@ julia> diff_fn(rem_label, neigh_label) = segment_pixel_count(seg,rem_label) - se
594594
julia> rem_segment!(seg, 3, diff_fn);
595595
596596
julia> labels_map(new_seg)
597-
4×4 Array{Int64,2}:
597+
4×4 Matrix{Int64}:
598598
1 1 2 2
599599
1 1 2 2
600600
2 2 2 2

docs/src/tutorials/arrays_colors.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ example,
1515

1616
```jldoctest
1717
julia> img = rand(2,2)
18-
2×2 Array{Float64,2}:
18+
2×2 Matrix{Float64}:
1919
0.366796 0.210256
2020
0.523879 0.819338
2121
```
@@ -30,7 +30,7 @@ you're new to Julia, if `a` is an array of integers:
3030

3131
```jldoctest
3232
julia> a = [1,2,3,4]
33-
4-element Array{Int64,1}:
33+
4-element Vector{Int64}:
3434
1
3535
2
3636
3
@@ -48,7 +48,7 @@ For example,
4848

4949
```julia
5050
julia> Float64.(a)
51-
4-element Array{Float64,1}:
51+
4-element Vector{Float64}:
5252
1.0
5353
2.0
5454
3.0
@@ -243,7 +243,7 @@ unsigned integer `UInt8`
243243

244244
```julia
245245
julia> dump(r)
246-
FixedPointNumbers.Normed{UInt8,8}
246+
FixedPointNumbers.N0f8
247247
i: UInt8 193
248248
```
249249

0 commit comments

Comments
 (0)