Skip to content

Commit 90d0e7d

Browse files
committed
Update doc. of localreduce
1 parent ab36221 commit 90d0e7d

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

TODO.md

-5
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,8 @@
55
- `localmap` can extract ROI as a vector or a `N`-dimensional sub-array with
66
indices relative to the sliding window.
77

8-
- Consistency: more possibilities for `strel` (like building a kernel) and
9-
`is_morpho_math_box` should yield `true` for any acceptable arguments for `box`.
10-
118
- Check doc. for math. morphology and bilateral filter.
129

13-
- Write doc. for van Herk-Gil-Werman algorithm and make it more direct to found.
14-
1510
- Homogenize names: `LocalFilters.reversed` and `LocalFilters.centered` or
1611
`reverse_kernel` and `center_kernel`. The former makes more sense since the
1712
methods can be applied to other things than a kernel. There should be a

src/localreduce.jl

+25-20
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,21 @@ end
7272
"""
7373
localreduce(op, [T=eltype(A),] A, dims, rngs; kwds...) -> dst
7474
75-
yields the result of applying van Herk-Gil-Werman algorithm to filter array `A` along
76-
dimension(s) `dims` with associative binary operator `op` and contiguous structuring
77-
element(s) defined by the interval(s) `rngs`.
75+
yields the local reduction by the associative binary operator `op` of the values of `A`
76+
into contiguous hyper-rectangular neighborhoods defined by the interval(s) `rngs` along
77+
dimension(s) `dims` of `A`. The algorithm of van Herk-Gil-Werman is used to compute the
78+
reduction.
7879
7980
Optional argument `T` is to specify the element type of the result.
8081
81-
Argument `dims` specifies along which dimension(s) of `A` the filter is to be applied, it
82-
can be a single integer, a tuple of integers, or a colon `:` to apply the operation to all
83-
dimensions. Dimensions are processed in the order given by `dims` (the same dimension may
84-
appear several times) and there must be a matching interval in `rngs` to specify the
85-
structuring element (except that, if `rngs` is a single interval, it is used for every
86-
dimension in `dims`). An interval is either an integer or an integer valued unit range in
87-
the form `kmin:kmax`. An interval specified as a single integer yields an approximately
88-
centered range of this length.
82+
Argument `dims` specifies along which dimension(s) of `A` the local reduction is to be
83+
applied, it can be a single integer, a tuple of integers, or a colon `:` to apply the
84+
operation to all dimensions. Dimensions are processed in the order given by `dims` (the
85+
same dimension may appear several times) and there must be a matching interval in `rngs`
86+
to specify the structuring element (except that, if `rngs` is a single interval, it is
87+
used for every dimension in `dims`). An interval is either an integer or an integer valued
88+
unit range in the form `kmin:kmax`. An interval specified as a single integer is treated
89+
as an approximately centered range of this length.
8990
9091
Keyword `order` specifies the filter direction, `FORWARD_FILTER` by default.
9192
@@ -114,6 +115,10 @@ element of width 7 in every dimension can be obtained by:
114115
115116
localreduce(min, A, :, -3:3)
116117
118+
or equivalently by:
119+
120+
localreduce(min, A, :, 7)
121+
117122
Index interval `0:0` may be specified to do nothing along the corresponding dimension. For
118123
instance, assuming `A` is a three-dimensional array:
119124
@@ -127,10 +132,10 @@ may be obtained with:
127132
128133
where the second dimension is omitted from the list of dimensions.
129134
130-
The *local average* of the two-dimensional array `A` on a centered moving window of size
135+
The *local average* of the two-dimensional array `A` on a centered sliding window of size
131136
11×11 can be computed as:
132137
133-
localreduce(+, A, :, (-5:5, -5:5)) ./ 11
138+
localreduce(+, A, :, (-5:5, -5:5)) ./ 11^2
134139
135140
See [`localreduce!`](@ref) for an in-place version of the method.
136141
@@ -144,13 +149,13 @@ localreduce(op, ::Type{T}, A::AbstractArray, dims::Dimensions, rngs::Ranges; kwd
144149
"""
145150
localreduce!(op, [dst = A,] A, dims, rngs; kwds...)
146151
147-
overwrites the contents of `dst` with the result of applying van Herk-Gil-Werman algorithm
148-
to locally reduce array `A` along dimension(s) `dims` with associative binary operator
149-
`op` and contiguous structuring element(s) defined by the interval(s) `rngs`. Except if a
150-
single dimension of interest is specified by `dims`, the destination `dst` must have the
151-
same indices as the source `A` (that is, `axes(dst) == axes(A)`). Operation may be done
152-
in-place and `dst` and `A` can be the same; this is the default behavior if `dst` is not
153-
specified.
152+
overwrites the contents of `dst` with the local reduction by the associative binary
153+
operator `op` of the values of `A` into contiguous hyper-rectangular neighborhoods defined
154+
by the interval(s) `rngs` along dimension(s) `dims` of `A`. Except if a single dimension
155+
of interest is specified by `dims`, the destination `dst` must have the same indices as
156+
the source `A` (that is, `axes(dst) == axes(A)`). Operation may be done in-place and `dst`
157+
and `A` can be the same; this is the default behavior if `dst` is not specified. The
158+
algorithm of van Herk-Gil-Werman is used to compute the reduction.
154159
155160
See [`localreduce`](@ref) for a full description of the method and for accepted keywords.
156161

0 commit comments

Comments
 (0)