Skip to content

Commit 17bf0e7

Browse files
committed
Restore docstring deleted in #73
1 parent e18aea6 commit 17bf0e7

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

src/fast_scanning.jl

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,44 @@ getscalar(A::AbstractArray{T,N}, i::CartesianIndex{N}, block_length::CartesianIn
2020

2121
getscalar(a::Real, i...) = a
2222

23+
"""
24+
seg_img = fast_scanning(img, threshold, [diff_fn])
25+
26+
Segments the N-D image using a fast scanning algorithm and returns a
27+
[`SegmentedImage`](@ref) containing information about the segments.
28+
29+
# Arguments:
30+
* `img` : N-D image to be segmented (arbitrary axes are allowed)
31+
* `threshold` : Upper bound of the difference measure (δ) for considering
32+
pixel into same segment; an `AbstractArray` can be passed
33+
having same number of dimensions as that of `img` for adaptive
34+
thresholding
35+
* `diff_fn` : (Optional) Function that returns a difference measure (δ)
36+
between the mean color of a region and color of a point
37+
38+
# Examples:
39+
40+
```jldoctest; setup = :(using ImageCore, ImageMorphology, ImageSegmentation)
41+
julia> img = zeros(Float64, (3,3));
42+
43+
julia> img[2,:] .= 0.5;
44+
45+
julia> img[:,2] .= 0.6;
46+
47+
julia> seg = fast_scanning(img, 0.2);
48+
49+
julia> labels_map(seg)
50+
3×3 $(Matrix{Int}):
51+
1 4 5
52+
4 4 4
53+
3 4 6
54+
```
55+
56+
# Citation:
57+
58+
Jian-Jiun Ding, Cheng-Jin Kuo, Wen-Chih Hong,
59+
"An efficient image segmentation technique by fast scanning and adaptive merging"
60+
"""
2361
fast_scanning(img::AbstractArray{CT,N}, block::NTuple{N,Int} = ntuple(i->4,Val(N))) where {CT<:ImageCore.NumberLike,N} =
2462
fast_scanning(img, adaptive_thres(img, block))
2563

0 commit comments

Comments
 (0)