Package inra.ijpb.binary.distmap
Class DistanceTransform5x5Float
java.lang.Object
inra.ijpb.algo.AlgoStub
inra.ijpb.binary.distmap.DistanceTransform5x5Float
- All Implemented Interfaces:
Algo
,DistanceTransform
@Deprecated public class DistanceTransform5x5Float extends AlgoStub implements DistanceTransform
Deprecated.
replaced by ChamferDistanceTransform2DFloat (since 1.5.0)
Computes Chamfer distances in a 5x5 neighborhood using a FloatProcessor object for storing result.
Uses 5x5 chamfer map, with two passes (one forward, one backward). Three different weights are provided for orthogonal, diagonal, and "chess-knight" moves. Weights equal to (5,7,11) usually give nice results.
Example of use:
float[] floatWeights = ChamferWeights.CHESSKNIGHT.getFloatWeights();
boolean normalize = true;
DistanceTransform dt = new DistanceTransform5x5Float(floatWeights, normalize);
ImageProcessor result = dt.distanceMap(inputImage);
// or:
ImagePlus resultPlus = BinaryImages.distanceMap(imagePlus, floatWeights, normalize);
- Author:
- David Legland
- See Also:
BinaryImages.distanceMap(ImageProcessor, float[], boolean)
,DistanceTransform5x5Short
,DistanceTransform
-
Constructor Summary
Constructors Constructor Description DistanceTransform5x5Float()
Deprecated.Default constructor with predefined chamfer weights.DistanceTransform5x5Float(float[] weights)
Deprecated.Default constructor that specifies the chamfer weights.DistanceTransform5x5Float(float[] weights, boolean normalize)
Deprecated.Constructor specifying the chamfer weights and the optional normalization.DistanceTransform5x5Float(ChamferWeights weights)
Deprecated.Constructor specifying the chamfer weights and the optional normalization.DistanceTransform5x5Float(ChamferWeights weights, boolean normalize)
Deprecated.Constructor specifying the chamfer weights and the optional normalization. -
Method Summary
Modifier and Type Method Description ij.process.FloatProcessor
distanceMap(ij.process.ImageProcessor labelImage)
Deprecated.Computes the distance map of the distance to the nearest pixel with a different value.Methods inherited from class inra.ijpb.algo.AlgoStub
addAlgoListener, removeAlgoListener
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface inra.ijpb.algo.Algo
addAlgoListener, removeAlgoListener
-
Constructor Details
-
DistanceTransform5x5Float
public DistanceTransform5x5Float()Deprecated.Default constructor with predefined chamfer weights. -
DistanceTransform5x5Float
Deprecated.Constructor specifying the chamfer weights and the optional normalization.- Parameters:
weights
- a set of chamfer weights with at least three values
-
DistanceTransform5x5Float
public DistanceTransform5x5Float(float[] weights)Deprecated.Default constructor that specifies the chamfer weights.- Parameters:
weights
- an array of two weights for orthogonal and diagonal directions
-
DistanceTransform5x5Float
Deprecated.Constructor specifying the chamfer weights and the optional normalization.- Parameters:
weights
- an array of two weights for orthogonal and diagonal directionsnormalize
- flag indicating whether the final distance map should be normalized by the first weight
-
DistanceTransform5x5Float
public DistanceTransform5x5Float(float[] weights, boolean normalize)Deprecated.Constructor specifying the chamfer weights and the optional normalization.- Parameters:
weights
- an array of two weights for orthogonal and diagonal directionsnormalize
- flag indicating whether the final distance map should be normalized by the first weight
-
-
Method Details
-
distanceMap
public ij.process.FloatProcessor distanceMap(ij.process.ImageProcessor labelImage)Deprecated.Computes the distance map of the distance to the nearest pixel with a different value. The function returns a new short processor the same size as the input, with values greater or equal to zero.- Specified by:
distanceMap
in interfaceDistanceTransform
- Parameters:
labelImage
- a label image with black pixels (0) as foreground- Returns:
- a new instance of FloatProcessor containing:
- 0 for each background pixel
- the (strictly positive) distance to the nearest background pixel otherwise
-