public class DistanceTransform extends Object
D( p ) = min_q f(q) + d(p,q)
where p,q are points on a grid/image.
The implemented algorithm has complexity O(dn) where d is the number of dimensions of the image, and n is the total number of pixels/voxels.
Modifier and Type | Class and Description |
---|---|
static class |
DistanceTransform.DISTANCE_TYPE
Switch for calling convenience method with pre-defined distances.
|
Constructor and Description |
---|
DistanceTransform() |
Modifier and Type | Method and Description |
---|---|
static <B extends BooleanType<B>,U extends RealType<U>> |
binaryTransform(RandomAccessible<B> source,
RandomAccessibleInterval<U> target,
Distance d)
Create binary distance transform on
source using arbitrary
Distance d. |
static <B extends BooleanType<B>,U extends RealType<U>> |
binaryTransform(RandomAccessible<B> source,
RandomAccessibleInterval<U> target,
Distance d,
ExecutorService es,
int nTasks)
Create binary distance transform on
source using arbitrary
Distance d. |
static <B extends BooleanType<B>,U extends RealType<U>> |
binaryTransform(RandomAccessible<B> source,
RandomAccessibleInterval<U> target,
DistanceTransform.DISTANCE_TYPE distanceType,
double... weights)
Create binary distance transform on
source using squared
Euclidian (L2) or L1 distance. |
static <B extends BooleanType<B>,U extends RealType<U>> |
binaryTransform(RandomAccessible<B> source,
RandomAccessibleInterval<U> target,
DistanceTransform.DISTANCE_TYPE distanceType,
ExecutorService es,
int nTasks,
double... weights)
Create binary distance transform on
source using squared
Euclidian (L2) or L1 distance. |
static <B extends BooleanType<B>,U extends RealType<U>,V extends RealType<V>> |
binaryTransform(RandomAccessible<B> source,
RandomAccessibleInterval<U> tmp,
RandomAccessibleInterval<V> target,
Distance d)
Create binary distance transform on
source using arbitrary
Distance d. |
static <B extends BooleanType<B>,U extends RealType<U>,V extends RealType<V>> |
binaryTransform(RandomAccessible<B> source,
RandomAccessibleInterval<U> tmp,
RandomAccessibleInterval<V> target,
Distance d,
ExecutorService es,
int nTasks)
Create binary distance transform on
source using arbitrary
Distance d. |
static <B extends BooleanType<B>,U extends RealType<U>,V extends RealType<V>> |
binaryTransform(RandomAccessible<B> source,
RandomAccessibleInterval<U> tmp,
RandomAccessibleInterval<V> target,
DistanceTransform.DISTANCE_TYPE distanceType,
double... weights)
Create binary distance transform on
source using squared
Euclidian (L2) or L1 distance. |
static <B extends BooleanType<B>,U extends RealType<U>,V extends RealType<V>> |
binaryTransform(RandomAccessible<B> source,
RandomAccessibleInterval<U> tmp,
RandomAccessibleInterval<V> target,
DistanceTransform.DISTANCE_TYPE distanceType,
ExecutorService es,
int nTasks,
double... weights)
Create binary distance transform on
source using squared
Euclidian (L2) or L1 distance. |
static <B extends BooleanType<B>> |
binaryTransform(RandomAccessibleInterval<B> source,
Distance d,
ExecutorService es,
int nTasks)
Create binary distance transform on
source using arbitrary
Distance d. |
static int |
getLargestDimension(Interval interval)
Convenience method to find largest dimension of
Interval
interval. |
static <T extends RealType<T>,U extends RealType<U>> |
transform(RandomAccessible<T> source,
RandomAccessibleInterval<U> target,
Distance d)
|
static <T extends RealType<T>,U extends RealType<U>> |
transform(RandomAccessible<T> source,
RandomAccessibleInterval<U> target,
Distance d,
ExecutorService es,
int nTasks)
|
static <T extends RealType<T>,U extends RealType<U>> |
transform(RandomAccessible<T> source,
RandomAccessibleInterval<U> target,
DistanceTransform.DISTANCE_TYPE distanceType,
double... weights)
Create
distance
transforms of sampled functions on
source using squared
Euclidian (L2) or L1 distance. |
static <T extends RealType<T>,U extends RealType<U>> |
transform(RandomAccessible<T> source,
RandomAccessibleInterval<U> target,
DistanceTransform.DISTANCE_TYPE distanceType,
ExecutorService es,
int nTasks,
double... weights)
Create
distance
transforms of sampled functions on
source using squared
Euclidian (L2) or L1 distance. |
static <T extends RealType<T>,U extends RealType<U>,V extends RealType<V>> |
transform(RandomAccessible<T> source,
RandomAccessibleInterval<U> tmp,
RandomAccessibleInterval<V> target,
Distance d)
|
static <T extends RealType<T>,U extends RealType<U>,V extends RealType<V>> |
transform(RandomAccessible<T> source,
RandomAccessibleInterval<U> tmp,
RandomAccessibleInterval<V> target,
Distance d,
ExecutorService es,
int nTasks)
|
static <T extends RealType<T>,U extends RealType<U>,V extends RealType<V>> |
transform(RandomAccessible<T> source,
RandomAccessibleInterval<U> tmp,
RandomAccessibleInterval<V> target,
DistanceTransform.DISTANCE_TYPE distanceType,
double... weights)
Create
distance
transforms of sampled functions on
source using squared
Euclidian (L2) or L1 distance. |
static <T extends RealType<T>,U extends RealType<U>,V extends RealType<V>> |
transform(RandomAccessible<T> source,
RandomAccessibleInterval<U> tmp,
RandomAccessibleInterval<V> target,
DistanceTransform.DISTANCE_TYPE distanceType,
ExecutorService es,
int nTasks,
double... weights)
Create
distance
transforms of sampled functions on
source using squared
Euclidian (L2) or L1 distance. |
static <T extends RealType<T>> |
transform(RandomAccessibleInterval<T> source,
Distance d)
|
static <T extends RealType<T>> |
transform(RandomAccessibleInterval<T> source,
Distance d,
ExecutorService es,
int nTasks)
|
static <T extends RealType<T>> |
transform(RandomAccessibleInterval<T> source,
DistanceTransform.DISTANCE_TYPE distanceType,
double... weights)
Create
distance
transforms of sampled functions on
source using squared
Euclidian (L2) or L1 distance. |
static <T extends RealType<T>> |
transform(RandomAccessibleInterval<T> source,
DistanceTransform.DISTANCE_TYPE distanceType,
ExecutorService es,
int nTasks,
double... weights)
Create
distance
transforms of sampled functions on
source using squared
Euclidian (L2) or L1 distance. |
public static <T extends RealType<T>> void transform(RandomAccessibleInterval<T> source, DistanceTransform.DISTANCE_TYPE distanceType, double... weights)
source
using squared
Euclidian (L2) or L1 distance. Intermediate and final results will be
stored in source
(DoubleType
recommended). The distance
can be weighted (individually for each dimension, if desired) against the
image values via the weights parameter.T
- RealType
inputsource
- Input function on which distance transform should be computed.distanceType
- Defines distance to be used: squared Euclidian or L1weights
- Individual weights for each dimension, balancing image values
and distance (when using squared Euclidian distance, weights
should be squared, too).public static <T extends RealType<T>> void transform(RandomAccessibleInterval<T> source, DistanceTransform.DISTANCE_TYPE distanceType, ExecutorService es, int nTasks, double... weights) throws InterruptedException, ExecutionException
source
using squared
Euclidian (L2) or L1 distance. Intermediate and final results will be
stored in source
(DoubleType
recommended). The distance
can be weighted (individually for each dimension, if desired) against the
image values via the weights parameter.T
- RealType
inputsource
- Input function on which distance transform should be computed.distanceType
- Defines distance to be used: squared Euclidian or L1es
- ExecutorService
for parallel execution.nTasks
- Number of tasks/parallelismweights
- Individual weights for each dimension, balancing image values
and distance (when using squared Euclidian distance, weights
should be squared, too).InterruptedException
- if interrupted while waiting, in which case unfinished tasks
are cancelled (distance transform may be computed only
partially)ExecutionException
- if the computation threw an exception (distance transform may
be computed only partially)public static <T extends RealType<T>,U extends RealType<U>> void transform(RandomAccessible<T> source, RandomAccessibleInterval<U> target, DistanceTransform.DISTANCE_TYPE distanceType, double... weights)
source
using squared
Euclidian (L2) or L1 distance. Intermediate results will be stored in
target
(DoubleType
recommended). The distance can be
weighted (individually for each dimension, if desired) against the image
values via the weights parameter.T
- RealType
inputU
- RealType
intermediate resultssource
- Input function on which distance transform should be computed.target
- Intermediate and final results of distance transform.distanceType
- Defines distance to be used: squared Euclidian or L1weights
- Individual weights for each dimension, balancing image values
and distance (when using squared Euclidian distance, weights
should be squared, too).public static <T extends RealType<T>,U extends RealType<U>> void transform(RandomAccessible<T> source, RandomAccessibleInterval<U> target, DistanceTransform.DISTANCE_TYPE distanceType, ExecutorService es, int nTasks, double... weights) throws InterruptedException, ExecutionException
source
using squared
Euclidian (L2) or L1 distance. Intermediate results will be stored in
target
(DoubleType
recommended). The distance can be
weighted (individually for each dimension, if desired) against the image
values via the weights parameter.T
- RealType
inputU
- RealType
intermediate resultssource
- Input function on which distance transform should be computed.target
- Intermediate and final results of distance transform.distanceType
- Defines distance to be used: squared Euclidian or L1es
- ExecutorService
for parallel execution.nTasks
- Number of tasks/parallelismweights
- Individual weights for each dimension, balancing image values
and distance (when using squared Euclidian distance, weights
should be squared, too).InterruptedException
- if interrupted while waiting, in which case unfinished tasks
are cancelled (distance transform may be computed only
partially)ExecutionException
- if the computation threw an exception (distance transform may
be computed only partially)public static <T extends RealType<T>,U extends RealType<U>,V extends RealType<V>> void transform(RandomAccessible<T> source, RandomAccessibleInterval<U> tmp, RandomAccessibleInterval<V> target, DistanceTransform.DISTANCE_TYPE distanceType, double... weights)
source
using squared
Euclidian (L2) or L1 distance. Intermediate results will be stored in
tmp
(DoubleType
recommended). The output will be written
into target
. The distance can be weighted (individually for each
dimension, if desired) against the image values via the weights
parameter.T
- RealType
inputU
- RealType
intermediate resultsV
- RealType
outputsource
- Input function on which distance transform should be computed.tmp
- Storage for intermediate results.target
- Final result of distance transform.distanceType
- Defines distance to be used: squared Euclidian or L1weights
- Individual weights for each dimension, balancing image values
and distance (when using squared Euclidian distance, weights
should be squared, too).public static <T extends RealType<T>,U extends RealType<U>,V extends RealType<V>> void transform(RandomAccessible<T> source, RandomAccessibleInterval<U> tmp, RandomAccessibleInterval<V> target, DistanceTransform.DISTANCE_TYPE distanceType, ExecutorService es, int nTasks, double... weights) throws InterruptedException, ExecutionException
source
using squared
Euclidian (L2) or L1 distance. Intermediate results will be stored in
tmp
(DoubleType
recommended). The output will be written
into target
. The distance can be weighted (individually for each
dimension, if desired) against the image values via the weights
parameter.T
- RealType
inputU
- RealType
intermediate resultsV
- RealType
outputsource
- Input function on which distance transform should be computed.tmp
- Storage for intermediate results.target
- Final result of distance transform.distanceType
- Defines distance to be used: squared Euclidian or L1es
- ExecutorService
for parallel execution.nTasks
- Number of tasks/parallelismweights
- Individual weights for each dimension, balancing image values
and distance (when using squared Euclidian distance, weights
should be squared, too).InterruptedException
- if interrupted while waiting, in which case unfinished tasks
are cancelled (distance transform may be computed only
partially)ExecutionException
- if the computation threw an exception (distance transform may
be computed only partially)public static <T extends RealType<T>> void transform(RandomAccessibleInterval<T> source, Distance d)
source
using arbitrary
Distance
d. Intermediate and final results will be stored in
source
(DoubleType
recommended).public static <T extends RealType<T>> void transform(RandomAccessibleInterval<T> source, Distance d, ExecutorService es, int nTasks) throws InterruptedException, ExecutionException
source
using arbitrary
Distance
d. Intermediate and final results will be stored in
source
(DoubleType
recommended).T
- RealType
inputsource
- Input function on which distance transform should be computed.d
- Distance
between two points.es
- ExecutorService
for parallel execution.nTasks
- Number of tasks/parallelismInterruptedException
- if interrupted while waiting, in which case unfinished tasks
are cancelled (distance transform may be computed only
partially)ExecutionException
- if the computation threw an exception (distance transform may
be computed only partially)public static <T extends RealType<T>,U extends RealType<U>> void transform(RandomAccessible<T> source, RandomAccessibleInterval<U> target, Distance d)
source
using arbitrary
Distance
d. Intermediate and final results will be stored in
target
(DoubleType
recommended).public static <T extends RealType<T>,U extends RealType<U>> void transform(RandomAccessible<T> source, RandomAccessibleInterval<U> target, Distance d, ExecutorService es, int nTasks) throws InterruptedException, ExecutionException
source
using arbitrary
Distance
d. Intermediate and final results will be stored in
target
(DoubleType
recommended).T
- RealType
inputU
- RealType
intermediate resultssource
- Input function on which distance transform should be computed.target
- Final result of distance transform.d
- Distance
between two points.es
- ExecutorService
for parallel execution.nTasks
- Number of tasks/parallelismInterruptedException
- if interrupted while waiting, in which case unfinished tasks
are cancelled (distance transform may be computed only
partially)ExecutionException
- if the computation threw an exception (distance transform may
be computed only partially)public static <T extends RealType<T>,U extends RealType<U>,V extends RealType<V>> void transform(RandomAccessible<T> source, RandomAccessibleInterval<U> tmp, RandomAccessibleInterval<V> target, Distance d)
source
using arbitrary
Distance
d. Intermediate results will be stored in tmp
(DoubleType
recommended). The output will be written into
target
.public static <T extends RealType<T>,U extends RealType<U>,V extends RealType<V>> void transform(RandomAccessible<T> source, RandomAccessibleInterval<U> tmp, RandomAccessibleInterval<V> target, Distance d, ExecutorService es, int nTasks) throws InterruptedException, ExecutionException
source
using arbitrary
Distance
d. Intermediate results will be stored in tmp
(DoubleType
recommended). The output will be written into
target
.T
- RealType
inputU
- RealType
intermediate resultsV
- RealType
outputsource
- Input function on which distance transform should be computed.tmp
- Storage for intermediate results.target
- Final result of distance transform.d
- Distance
between two points.es
- ExecutorService
for parallel execution.nTasks
- Number of tasks/parallelismInterruptedException
- if interrupted while waiting, in which case unfinished tasks
are cancelled (distance transform may be computed only
partially)ExecutionException
- if the computation threw an exception (distance transform may
be computed only partially)public static <B extends BooleanType<B>,U extends RealType<U>> void binaryTransform(RandomAccessible<B> source, RandomAccessibleInterval<U> target, DistanceTransform.DISTANCE_TYPE distanceType, double... weights)
source
using squared
Euclidian (L2) or L1 distance. Intermediate results will be stored in
target
(DoubleType
recommended). The distance can be
weighted (individually for each dimension, if desired) against the image
values via the weights parameter.B
- BooleanType
binary mask inputU
- RealType
intermediate resultssource
- Input function on which distance transform should be computed.target
- Intermediate and final results of distance transform.distanceType
- Defines distance to be used: squared Euclidian or L1weights
- Individual weights for each dimension, balancing image values
and distance (when using squared Euclidian distance, weights
should be squared, too).public static <B extends BooleanType<B>,U extends RealType<U>> void binaryTransform(RandomAccessible<B> source, RandomAccessibleInterval<U> target, DistanceTransform.DISTANCE_TYPE distanceType, ExecutorService es, int nTasks, double... weights) throws InterruptedException, ExecutionException
source
using squared
Euclidian (L2) or L1 distance. Intermediate results will be stored in
target
(DoubleType
recommended). The distance can be
weighted (individually for each dimension, if desired) against the image
values via the weights parameter.B
- BooleanType
binary mask inputU
- RealType
intermediate resultssource
- Input function on which distance transform should be computed.target
- Intermediate and final results of distance transform.distanceType
- Defines distance to be used: squared Euclidian or L1es
- ExecutorService
for parallel execution.nTasks
- Number of tasks/parallelismweights
- Individual weights for each dimension, balancing image values
and distance (when using squared Euclidian distance, weights
should be squared, too).InterruptedException
- if interrupted while waiting, in which case unfinished tasks
are cancelled (distance transform may be computed only
partially)ExecutionException
- if the computation threw an exception (distance transform may
be computed only partially)public static <B extends BooleanType<B>,U extends RealType<U>,V extends RealType<V>> void binaryTransform(RandomAccessible<B> source, RandomAccessibleInterval<U> tmp, RandomAccessibleInterval<V> target, DistanceTransform.DISTANCE_TYPE distanceType, double... weights)
source
using squared
Euclidian (L2) or L1 distance. Intermediate results will be stored in
tmp
(DoubleType
recommended). The output will be written
into target
. The distance can be weighted (individually for each
dimension, if desired) against the image values via the weights
parameter.B
- BooleanType
binary mask inputU
- RealType
intermediate resultsV
- RealType
outputsource
- Input function on which distance transform should be computed.tmp
- Storage for intermediate results.target
- Final result of distance transform.distanceType
- Defines distance to be used: squared Euclidian or L1weights
- Individual weights for each dimension, balancing image values
and distance (when using squared Euclidian distance, weights
should be squared, too).public static <B extends BooleanType<B>,U extends RealType<U>,V extends RealType<V>> void binaryTransform(RandomAccessible<B> source, RandomAccessibleInterval<U> tmp, RandomAccessibleInterval<V> target, DistanceTransform.DISTANCE_TYPE distanceType, ExecutorService es, int nTasks, double... weights) throws InterruptedException, ExecutionException
source
using squared
Euclidian (L2) or L1 distance. Intermediate results will be stored in
tmp
(DoubleType
recommended). The output will be written
into target
. The distance can be weighted (individually for each
dimension, if desired) against the image values via the weights
parameter.B
- BooleanType
binary mask inputU
- RealType
intermediate resultsV
- RealType
outputsource
- Input function on which distance transform should be computed.tmp
- Storage for intermediate results.target
- Final result of distance transform.distanceType
- Defines distance to be used: squared Euclidian or L1es
- ExecutorService
for parallel execution.nTasks
- Number of tasks/parallelismweights
- Individual weights for each dimension, balancing image values
and distance (when using squared Euclidian distance, weights
should be squared, too).InterruptedException
- if interrupted while waiting, in which case unfinished tasks
are cancelled (distance transform may be computed only
partially)ExecutionException
- if the computation threw an exception (distance transform may
be computed only partially)public static <B extends BooleanType<B>> void binaryTransform(RandomAccessibleInterval<B> source, Distance d, ExecutorService es, int nTasks) throws InterruptedException, ExecutionException
source
using arbitrary
Distance
d. Intermediate and final results will be stored in
source (DoubleType
recommended).B
- BooleanType
binary mask inputsource
- Input function on which distance transform should be computed.d
- Distance
between two points.es
- ExecutorService
for parallel execution.nTasks
- Number of tasks/parallelismInterruptedException
- if interrupted while waiting, in which case unfinished tasks
are cancelled (distance transform may be computed only
partially)ExecutionException
- if the computation threw an exception (distance transform may
be computed only partially)public static <B extends BooleanType<B>,U extends RealType<U>> void binaryTransform(RandomAccessible<B> source, RandomAccessibleInterval<U> target, Distance d)
source
using arbitrary
Distance
d. Intermediate and final results will be stored in
target
(DoubleType
recommended).B
- BooleanType
binary mask inputU
- RealType
intermediate resultssource
- Input function on which distance transform should be computed.target
- Final result of distance transform.d
- Distance
between two points.public static <B extends BooleanType<B>,U extends RealType<U>> void binaryTransform(RandomAccessible<B> source, RandomAccessibleInterval<U> target, Distance d, ExecutorService es, int nTasks) throws InterruptedException, ExecutionException
source
using arbitrary
Distance
d. Intermediate and final results will be stored in
target
(DoubleType
recommended).B
- BooleanType
binary mask inputU
- RealType
intermediate resultssource
- Input function on which distance transform should be computed.target
- Final result of distance transform.d
- Distance
between two points.es
- ExecutorService
for parallel execution.nTasks
- Number of tasks/parallelismInterruptedException
- if interrupted while waiting, in which case unfinished tasks
are cancelled (distance transform may be computed only
partially)ExecutionException
- if the computation threw an exception (distance transform may
be computed only partially)public static <B extends BooleanType<B>,U extends RealType<U>,V extends RealType<V>> void binaryTransform(RandomAccessible<B> source, RandomAccessibleInterval<U> tmp, RandomAccessibleInterval<V> target, Distance d)
source
using arbitrary
Distance
d. Intermediate results will be stored in tmp
(DoubleType
recommended). The output will be written into
target
.B
- BooleanType
binary mask inputU
- RealType
intermediate resultsV
- RealType
outputsource
- Input function on which distance transform should be computed.tmp
- Storage for intermediate results.target
- Final result of distance transform.d
- Distance
between two points.public static <B extends BooleanType<B>,U extends RealType<U>,V extends RealType<V>> void binaryTransform(RandomAccessible<B> source, RandomAccessibleInterval<U> tmp, RandomAccessibleInterval<V> target, Distance d, ExecutorService es, int nTasks) throws InterruptedException, ExecutionException
source
using arbitrary
Distance
d. Intermediate results will be stored in tmp
(DoubleType
recommended). The output will be written into
target
.B
- BooleanType
binary mask inputU
- RealType
intermediate resultsV
- RealType
outputsource
- Input function on which distance transform should be computed.tmp
- Storage for intermediate results.target
- Final result of distance transform.d
- Distance
between two points.es
- ExecutorService
for parallel execution.nTasks
- Number of tasks/parallelismInterruptedException
- if interrupted while waiting, in which case unfinished tasks
are cancelled (distance transform may be computed only
partially)ExecutionException
- if the computation threw an exception (distance transform may
be computed only partially)Copyright © 2015–2022 ImgLib2. All rights reserved.