8686_prepare_reconstruct_ops(:: op ) where {op} = error(" operation `$(op. instance) ` is not supported for `mreconstruct`" )
8787_prepare_reconstruct_ops(:: typeof (dilate)) = (max, min)
8888_prepare_reconstruct_ops(:: typeof (erode)) = (min, max)
89- @inline _should_enqueue (:: typeof (max)) = <
90- @inline _should_enqueue (:: typeof (min)) = >
89+ @inline _should_push (:: typeof (max)) = <
90+ @inline _should_push (:: typeof (min)) = >
9191
9292# Single-CPU version, references are [1] and section 6.2 of [2]
9393function _mreconstruct!((select_se, select_marker), out, marker, mask, se)
@@ -135,7 +135,7 @@ function _mreconstruct!((select_se, select_marker), out, marker, mask, se)
135135 @inbounds out[i] = select_marker(curr_val, mask[i])
136136 end
137137 # backward scan
138- should_enqueue = _should_enqueue (select_se)
138+ should_push = _should_push (select_se)
139139 for i in reverse(R)
140140 @inbounds curr_val = out[i]
141141 for Δi in lower_se # examine neighborhoods
@@ -148,21 +148,21 @@ function _mreconstruct!((select_se, select_marker), out, marker, mask, se)
148148 for Δi in lower_se # examine neighborhoods
149149 ii = i + Δi
150150 if checkbounds(Bool, R, ii) # check that we are in the image
151- @inbounds if should_enqueue (out[ii], out[i]) && should_enqueue (out[ii], mask[ii])
152- enqueue !(queue, i)
151+ @inbounds if should_push (out[ii], out[i]) && should_push (out[ii], mask[ii])
152+ push !(queue, i)
153153 end
154154 end
155155 end
156156 end
157157 # Loop until all pixel have been examined
158158 while ! isempty(queue)
159- curr_idx = dequeue !(queue)
159+ curr_idx = popfirst !(queue)
160160 for Δi in se # examine neighborhoods
161161 ii = curr_idx + Δi
162162 if checkbounds(Bool, R, ii) # check that we are in the image
163- @inbounds if should_enqueue (out[ii], out[curr_idx]) && mask[ii] != out[ii]
163+ @inbounds if should_push (out[ii], out[curr_idx]) && mask[ii] != out[ii]
164164 out[ii] = select_marker(out[curr_idx], mask[ii])
165- enqueue !(queue, ii)
165+ push !(queue, ii)
166166 end
167167 end
168168 end
0 commit comments