@@ -128,16 +128,16 @@ end
128
128
129
129
130
130
"""
131
- new_seg = rem_segment (seg, label, diff_fn)
131
+ new_seg = remove_segment (seg, label, diff_fn)
132
132
133
133
Removes the segment having label `label` and returns the new `SegmentedImage`.
134
134
For more info, see [`remove_segment!`](@ref)
135
135
136
136
"""
137
- rem_segment (s:: SegmentedImage , args... ) = rem_segment ! (deepcopy (s), args... )
137
+ remove_segment (s:: SegmentedImage , args... ) = remove_segment ! (deepcopy (s), args... )
138
138
139
139
"""
140
- rem_segment !(seg, label, diff_fn)
140
+ remove_segment !(seg, label, diff_fn)
141
141
142
142
In place removal of the segment having label `label`, replacing it with the neighboring
143
143
segment having least `diff_fn` value.
@@ -152,15 +152,15 @@ defined for objects of the type of `d`.
152
152
```julia
153
153
# This removes the label `l` and replaces it with the label of
154
154
# neighbor having maximum pixel count.
155
- julia> rem_segment !(seg, l, (i,j)->(-seg.segment_pixel_count[j]))
155
+ julia> remove_segment !(seg, l, (i,j)->(-seg.segment_pixel_count[j]))
156
156
157
157
# This removes the label `l` and replaces it with the label of
158
158
# neighbor having the least value of euclidian metric.
159
- julia> rem_segment !(seg, l, (i,j)->sum(abs2, seg.segment_means[i]-seg.segment_means[j]))
159
+ julia> remove_segment !(seg, l, (i,j)->sum(abs2, seg.segment_means[i]-seg.segment_means[j]))
160
160
```
161
161
162
162
"""
163
- function rem_segment ! (s:: SegmentedImage , label:: Int , diff_fn:: Function )
163
+ function remove_segment ! (s:: SegmentedImage , label:: Int , diff_fn:: Function )
164
164
haskey (s. segment_means, label) || error (" Label $label not present!" )
165
165
G, vert_map = region_adjacency_graph (s, (i,j)-> 1 )
166
166
vert_label = vert_map[label]
@@ -275,9 +275,9 @@ with a mapping from vertex index in RAG to cartesian index in the image.
275
275
`weight_fn` is used to assign weights to the edges using pixel similarity and spatial proximity,
276
276
where higher weight means greater similarity and thus stronger association. Zero weight is assigned
277
277
to edges between any pair of nodes that are more than `R` pixels apart. `R` can be specified
278
- as a N-dimensional `CartesianIndex`. Alternatively, `R` can be an integer, in which a
278
+ as a N-dimensional `CartesianIndex`. Alternatively, `R` can be an integer, in which a
279
279
N-dimensional `CartesianIndex` with value `R` along each dimension is used. `weight_fn` should have
280
- signature -
280
+ signature -
281
281
282
282
edge_weight = weight_fn(p1::Pair{CartesianIndex{N},T}, p2::Pair{CartesianIndex{N},T}) where {N,T}
283
283
@@ -308,7 +308,7 @@ function region_adjacency_graph(img::AbstractArray{CT,N}, weight_fn::Function, R
308
308
Istart, Iend = first (indices), last (indices)
309
309
for I in indices
310
310
for J in CartesianIndices (map ((i,j)-> i: j, Tuple (max (Istart, I- R)), Tuple (min (Iend, I+ R))))
311
- if I <= J
311
+ if I <= J
312
312
continue
313
313
end
314
314
push! (sources, cartesian2vertex[I])
0 commit comments