Skip to content

Commit 62fef9d

Browse files
authored
Bump DataStructures version and fix doctests on nightly (#55)
* Fix find_root! depwarn This became a depwarn with DataStructures 0.18 but was available in 0.17.11. * Generalize some docstrings Julia 1.6 changes how array types are printed.
1 parent dd88106 commit 62fef9d

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ImageSegmentation"
22
uuid = "80713f31-8817-5129-9cf8-209ff8fb23e1"
3-
version = "1.4.5"
3+
version = "1.4.6"
44

55
[deps]
66
Clustering = "aaaa29a8-35af-508c-8bc3-b662a17a0fe5"
@@ -17,7 +17,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1717

1818
[compat]
1919
Clustering = "0.10, 0.11, 0.12, 0.13, 0.14"
20-
DataStructures = "0.12, 0.13, 0.14, 0.15, 0.16, 0.17"
20+
DataStructures = "0.17.11, 0.18"
2121
Distances = "0.8"
2222
Documenter = "0.24, 0.25"
2323
ImageFiltering = "0.6"

src/core.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ function prune_segments(s::SegmentedImage, is_rem::Function, diff_fn::Function)
238238

239239
segments = Set{Int}()
240240
for i in 1:nv(G)
241-
push!(segments, find_root(u, i))
241+
push!(segments, find_root!(u, i))
242242
end
243243

244244
result = similar(s.image_indexmap)
@@ -253,7 +253,7 @@ function prune_segments(s::SegmentedImage, is_rem::Function, diff_fn::Function)
253253
end
254254

255255
for p in CartesianIndices(axes(result))
256-
result[p] = find_root(u, vert_map[s.image_indexmap[p]])
256+
result[p] = find_root!(u, vert_map[s.image_indexmap[p]])
257257
region_pix_count[result[p]] = get(region_pix_count, result[p], 0) + 1
258258
region_means[result[p]] = get(region_means, result[p], zero(m_type)) + (s.segment_means[s.image_indexmap[p]] - get(region_means, result[p], zero(m_type)))/(region_pix_count[result[p]])
259259
end

src/fast_scanning.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ julia> img[:,2] .= 0.6;
5050
julia> seg = fast_scanning(img, 0.2);
5151
5252
julia> labels_map(seg)
53-
3×3 Array{Int64,2}:
53+
3×3 $(Matrix{Int}):
5454
1 4 5
5555
4 4 4
5656
3 4 6
@@ -88,15 +88,15 @@ function fast_scanning(img::AbstractArray{CT,N}, threshold::Union{AbstractArray,
8888
prev_label = 0
8989
for p in neighbourhood(point)
9090
if checkbounds(Bool, img, p)
91-
root_p = find_root(temp_labels, result[p])
91+
root_p = find_root!(temp_labels, result[p])
9292
if diff_fn(region_means[root_p], img[point]) < getscalar(threshold, point, block_length)
9393
if prev_label == 0
9494
prev_label = root_p
9595
elseif prev_label != root_p
9696
same_label = false
9797
end
9898
sz += 1
99-
v_neigh[sz] = find_root(temp_labels, root_p)
99+
v_neigh[sz] = find_root!(temp_labels, root_p)
100100
end
101101
end
102102
end
@@ -138,7 +138,7 @@ function fast_scanning(img::AbstractArray{CT,N}, threshold::Union{AbstractArray,
138138
end
139139

140140
for point in CartesianIndices(axes(img))
141-
result[point] = find_root(temp_labels, result[point])
141+
result[point] = find_root!(temp_labels, result[point])
142142
end
143143

144144
SegmentedImage(result, unique(temp_labels.parents), region_means, region_pix_count)

src/felzenszwalb.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ function felzenszwalb(edges::Array{ImageEdge}, num_vertices::Int, k::Real, min_s
4141

4242
for edge in edges
4343
w = edge.weight
44-
a = find_root(G, edge.index1)
45-
b = find_root(G, edge.index2)
44+
a = find_root!(G, edge.index1)
45+
b = find_root!(G, edge.index2)
4646
if a!=b
4747
if w <= min(threshold[a], threshold[b])
4848
merged_root = union!(G, a, b)
@@ -54,16 +54,16 @@ function felzenszwalb(edges::Array{ImageEdge}, num_vertices::Int, k::Real, min_s
5454

5555
#merge small segments
5656
for edge in edges
57-
a = find_root(G, edge.index1)
58-
b = find_root(G, edge.index2)
57+
a = find_root!(G, edge.index1)
58+
b = find_root!(G, edge.index2)
5959
if a!=b && (set_size[a] < min_size || set_size[b] < min_size)
6060
union!(G, a, b)
6161
end
6262
end
6363

6464
segments = OrderedSet()
6565
for i in 1:num_vertices
66-
push!(segments, find_root(G, i))
66+
push!(segments, find_root!(G, i))
6767
end
6868

6969
num_sets = length(segments)
@@ -74,7 +74,7 @@ function felzenszwalb(edges::Array{ImageEdge}, num_vertices::Int, k::Real, min_s
7474

7575
index_map = Array{Int}(undef, num_vertices)
7676
for i in 1:num_vertices
77-
index_map[i] = segments2index[find_root(G, i)]
77+
index_map[i] = segments2index[find_root!(G, i)]
7878
end
7979

8080
return index_map, num_sets

src/region_growing.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ julia> seeds = [(CartesianIndex(3,1),1),(CartesianIndex(2,2),2)];
4040
julia> seg = seeded_region_growing(img, seeds);
4141
4242
julia> labels_map(seg)
43-
4×4 Array{Int64,2}:
43+
4×4 $(Matrix{Int}):
4444
1 1 1 1
4545
1 2 2 2
4646
1 2 2 2
@@ -150,7 +150,7 @@ function seeded_region_growing(img::AbstractArray{CT,N}, seeds::AbstractVector{T
150150
if curr_diff < mindiff
151151
mindiff = curr_diff
152152
mindifflabel = result[point]
153-
elseif isapprox(curr_diff, mindiff) #, atol=1e-8)
153+
elseif isapprox(curr_diff, mindiff) #, atol=1e-8)
154154
mindifflabel = 0
155155
end
156156
end
@@ -221,7 +221,7 @@ julia> img[2:4,2:4] .= 1;
221221
julia> seg = unseeded_region_growing(img, 0.2);
222222
223223
julia> labels_map(seg)
224-
4×4 Array{Int64,2}:
224+
4×4 $(Matrix{Int}):
225225
1 1 1 1
226226
1 2 2 2
227227
1 2 2 2

0 commit comments

Comments
 (0)