Skip to content

Commit c6ba026

Browse files
authored
Update compat for DataStructures 0.19, bump julia compat to 1.10 (#110)
Also: * Require ImageMorphology 0.4.7 * Update CI workflow to use 'lts' and 'pre' version * Fix doctest that checked anonymous function name Fixes #108
1 parent a88132e commit c6ba026

7 files changed

Lines changed: 18 additions & 19 deletions

File tree

.github/workflows/CI.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
version:
16-
- '1.6'
16+
- 'lts'
1717
- '1'
18-
# - 'nightly'
18+
- 'pre'
1919
os:
2020
- ubuntu-latest
2121
- macOS-latest

Project.toml

Lines changed: 4 additions & 4 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.9.0"
3+
version = "1.10.0"
44

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

2020
[compat]
2121
Clustering = "0.15"
22-
DataStructures = "0.17.11, 0.18"
22+
DataStructures = "0.19"
2323
Distances = "0.8, 0.9.2, 0.10"
2424
Documenter = "1"
2525
Graphs = "1.4.1"
2626
ImageCore = "0.10"
2727
ImageFiltering = "0.6, 0.7"
28-
ImageMorphology = "0.2.6, 0.3, 0.4"
28+
ImageMorphology = "0.4.7"
2929
MetaGraphs = "0.7, 0.8"
3030
RegionTrees = "0.2, 0.3"
3131
SimpleWeightedGraphs = "1.2"
3232
StaticArrays = "0.9, 0.10, 0.11, 0.12, 1.0"
33-
julia = "1.6"
33+
julia = "1.10"
3434

3535
[extras]
3636
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"

src/core.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ defined for objects of the type of `d`.
260260
function prune_segments(s::SegmentedImage, is_rem::Function, diff_fn::Function)
261261

262262
G, vert_map = region_adjacency_graph(s, (i,j)->1)
263-
u = IntDisjointSets(nv(G))
263+
u = IntDisjointSet(nv(G))
264264
for v in vertices(G)
265265
if is_rem(s.segment_labels[v])
266266
neigh = neighbors(G, v)
@@ -334,8 +334,7 @@ Return a function that constructs a diamond-shaped iterable region.
334334
335335
# Examples
336336
```jldoctest; setup=:(using ImageSegmentation), filter=r"#\\d+"
337-
julia> fiter = ImageSegmentation.diamond_iterator((3, 3))
338-
#18 (generic function with 1 method)
337+
julia> fiter = ImageSegmentation.diamond_iterator((3, 3));
339338
340339
julia> center = CartesianIndex(17, 24)
341340
CartesianIndex(17, 24)

src/fast_scanning.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function fast_scanning!(result, img::AbstractArray{CT,N}, threshold::Union{Abstr
7878
TM = meantype(CT)
7979
region_means = Dict{Int, TM}() # A map conatining (label, mean) pairs
8080
region_pix_count = Dict{Int, Int}() # A map conatining (label, count) pairs
81-
temp_labels = IntDisjointSets(0) # Disjoint set to map labels to their equivalence class
81+
temp_labels = IntDisjointSet(0) # Disjoint set to map labels to their equivalence class
8282
v_neigh = MVector{N,Int}(undef) # MVector to store valid neighbours
8383

8484
block_length = CartesianIndex(ntuple(i->ceil(Int,length(axes(img,i))/size(threshold,i)), Val(N)))

src/felzenszwalb.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Parameters:
1414
function felzenszwalb(edges::Array{ImageEdge}, num_vertices::Int, k::Float64, min_size::Int = 0)
1515

1616
num_edges = length(edges)
17-
G = IntDisjointSets(num_vertices)
17+
G = IntDisjointSet(num_vertices)
1818
set_size = ones(num_vertices)
1919
threshold = fill(convert(Float64,k), num_vertices)
2020

src/region_growing.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ function seeded_region_growing(img::AbstractArray{CT,N}, seeds::AbstractVector{<
127127

128128
# Get the pixels with minimum δ from `pq` and add them to `holdingq` and their labels to `labelsq`
129129
if !isempty(pq)
130-
δ_min = peek(pq)[2]
130+
δ_min = first(pq)[2]
131131
end
132-
while (!isempty(pq) && isapprox(peek(pq)[2], δ_min)) #, atol=1e-8))
133-
p = cil[dequeue!(pq)]
132+
while (!isempty(pq) && isapprox(first(pq)[2], δ_min)) #, atol=1e-8))
133+
p = cil[popfirst!(pq)[1]]
134134
@assert result[p] <= 0
135135
@inbounds imgp = img[p]
136136
mindifflabel = -1
@@ -262,12 +262,12 @@ function unseeded_region_growing(img::AbstractArray{CT,N}, threshold::Real, neig
262262
# Enqueue neighouring points of `start_point`
263263
for p in neighbourhood(start_point)
264264
if p != start_point && checkbounds(Bool, img, p) && result[p] == -1
265-
enqueue!(neighbours, lic[p], diff_fn(region_means[result[start_point]], img[p]))
265+
push!(neighbours, lic[p] => diff_fn(region_means[result[start_point]], img[p]))
266266
end
267267
end
268268

269269
while !isempty(neighbours)
270-
point = cil[dequeue!(neighbours)]
270+
point = cil[popfirst!(neighbours)[1]]
271271
δ = Inf
272272
minlabel = -1
273273
pixelval = img[point]
@@ -322,7 +322,7 @@ function unseeded_region_growing(img::AbstractArray{CT,N}, threshold::Real, neig
322322
δ = min(δ, diff_fn(region_means[result[tp]], img[p]))
323323
end
324324
end
325-
enqueue!(neighbours, lic[p], δ)
325+
push!(neighbours, lic[p] => δ)
326326
end
327327
end
328328

src/watershed.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ function watershed(img::AbstractArray{T, N},
6767
for j in _colon(max(Istart,i-_oneunit(i)), min(i+_oneunit(i),Iend))
6868
if segments[j] == 0
6969
segments[j] = markers[i]
70-
enqueue!(pq, j, PK(img[i], time_step, j))
70+
push!(pq, j => PK(img[i], time_step, j))
7171
time_step += 1
7272
end
7373
end
7474
end
7575
end
7676

7777
while !isempty(pq)
78-
curr_idx, curr_elem = dequeue_pair!(pq)
78+
curr_idx, curr_elem = popfirst!(pq)
7979
segments_current = segments[curr_idx]
8080

8181
# If we're using the compact algorithm, we need assign grouping for a given location

0 commit comments

Comments
 (0)