Releases: emmt/LocalFilters.jl
v2.0.1
LocalFilters v2.0.1
- Fix import of unused function that has been removed (see PR #9).
Merged pull requests:
- Remove unused import of to_int (#9) (@Octogonapus)
v2.0.0
LocalFilters v2.0.0
This is a major release.
Version 2 of LocalFilters
better integrates in the Julia ecosystem as fewer
custom types are introduced:
-
To represent hyper-rectangular Cartesian sliding windows, former type
RectangularBox
has been replaced byCartesianIndices
. -
Kernels with values or neighborhoods with more complex shape than
hyper-rectangular Cartesian sliding windows are all represented by abstract
arrays (with boolean entries to define a neighborhood). The former type
LocalFilters.Kernel
is no longer provided. To account for offsets in the
indexing, it is recommended to use the
OffsetArrays
package. The
methodLocalFilters.centered(B)
can be called to yield a kernel or a
neighborhood whose index ranges are approximately centered. This method is
not exported to avoid conflicts (for instance, it has a slightly different
semantic inOffsetArrays
).
Version 2 of LocalFilters
provides more general, more consistent, and better
optimized methods:
-
Most filtering operations take an optional ordering argument
ord
right
before the argument, sayB
, specifying the kernel or the neighborhood. If
ord
isForwardFilter
,B
is indexed as in discrete correlations;
otherwise, iford
isReverseFilter
,B
is indexed as in discrete
convolutions. The default ordering isForwardFilter
as this is the most
natural for many filters (except discrete convolutions of course) and as it
yields faster code. For symmetric kernels and neighborhoods, the ordering has
no incidence on the result. InLocalFilters
version 1, indexing as in
discrete convolutions was the only rule. -
The API of
localfilters!
have changed a bit, the syntax is
localfilters!(dst,A,ord=ForwardFilter,B,initial,update,final=identity)
with
dst
the destination,A
the source,ord
the direction of the filter,B
the kernel or neighborhood of the filter,initial
the value of the initial
state variable,update
a method to update the state variable, andfinal
a
method to yield the result to store in the destinationdst
given the value
of the state variable at the end of visiting the neighborhood. -
Constructor
LocalFilters.Indices
and helper method
LocalFilters.localindices
may be used as an alternative tolocalfilters!
to build custom filters. -
In all filters, a simple neighborhood that is a hyper-rectangular Cartesian
sliding window can be specified in many different ways. Such a neighborhood
is represented by an instance ofCartesianIndices
with unit step ranges.
MethodLocalFilters.kernel(Dims{N},args...)
can be called to build such a
N
-dimensional neighborhood from argument(s)args...
. -
Non-exported
LocalFilters.ball
method is now type stable. Call
LocalFilters.ball(Dims{N},r)
instead ofLocalFilters.ball(N,r)
. -
The
strel
method uses uniform arrays from package
StructuredArrays
to
represent structuring elements with the same value for all valid indices. -
In out-of-place filters, the destination array needs not be of the same size
as the source array. The local filtering operation is applied for all indices
of the destination, using boundary conditions to extract the corresponding
value in the source array. Currently only flat boundary conditions are
implemented but this may change in the future.
Guidelines for porting code from version 1 to version 2
If the high level API was used, there should be almost no changes, except for
non-symmetric kernels or neighborhoods for which ReverseFilter
ordering must
be specified to mimic the former behavior.
At a lower level, the following changes should be done:
-
Non-exported union
LocalFilters.IndexInterval
has been replaced by
LocalFilters.Axis
to represent the type of any argument that can be used to
define a sliding window axis: an integer length or an integer-valued index
range. -
Non-exported method
LocalFilters.ismmbox
has been replaced by
LocalFilters.is_morpho_math_box
. -
Non-exported method
LocalFilters.cartesian_region
has been replaced by the
more general and better designed exported methodkernel
. -
Replace
Neighborhood{N}(args...)
bykernel(Dims{N}, args...)
and
Neighborhood{N}
orRectangularBox{N}
byLocalFilters.Box{N}
. -
Replace
LocalFilters.Kernel
byOffsetArrays.OffsetArray
. -
Update the arguments of
localfilters!
:initial
is no longer a method but
the initial state value,update
has the same semantics, andfinal
just
yields the result of the local filter given the last state value. By default,
final
isidentity
. -
Replace
LocalFilters.ball(N,r)
byLocalFilters.ball(Dims{N},r)
which is
type-stable.
Release 1.2.0 of LocalFilters
- Scalar and array element type restrictions have been relaxed for most filter methods. This is to let users apply these methods to non-standard types.
- Some optimizations.
- Syntax
Kernel(T,G,B)
has been deprecated in favor ofKernel{T}(G,B)
. - Rename some unexported methods.
v1.1.0
Release 1.0.0 of LocalFilters
New features and changes:
-
Compatibility with Julia 0.6 to 1.1 without loss of efficiency (thanks to the
newcartesianregion
method). -
Add van Herk / Gil & Werman algorithm. Some filters have a huge speed-up
when this algorithm can be used. -
Add the bilateral filter.
-
Provide the
strel
method to build structuring elements. -
Method
cartesianregion
is provided to return either aCartesianIndices{N}
or aCartesianRange{CartesianIndex{N}}
(whichever is the most efficient
depending on Julia version) to loop over theN
-dimensional indices of
anything whose type belongs toCartesianRegion{N}
. Type
CartesianRegion{N}
is an union of the types of anything suitable to define
a Cartesian region of indices. -
Method
anchor
has been removed because its result depends on the indexing
of the embedded array of kernel coefficients.
First official release of LocalFilters.jl
This package implements multi-dimensional local filters for Julia (convolution, mathematical morphology, etc.). Local filters are defined by specific operations combining each value of a source array with the values in a local neighborhood which may have any size, shape and dimensionality. Predefined local filters are provided as well as means to simply implement custom filters.