Package inra.ijpb.label.distmap
Class ChamferDistanceTransform2DShort
java.lang.Object
inra.ijpb.algo.AlgoStub
inra.ijpb.label.distmap.ChamferDistanceTransform2DShort
- All Implemented Interfaces:
Algo
,ChamferDistanceTransform2D
,DistanceTransform2D
public class ChamferDistanceTransform2DShort extends AlgoStub implements ChamferDistanceTransform2D
Computes distance transform by propagating distances using a ChamferMask2D,
and using 16-bits integer computation.
For binary images, an equivalent algorithm exists within the
inra.ijpb.binary.distmap package.
Example of use:
ChamferMask2D mask = ChamferMask2D.BORGEFORS();
boolean normalize = true;
DistanceTransform dt = new ChamferDistanceTransform2DShort(mask, normalize);
ImageProcessor result = dt.distanceMap(inputImage);
- Author:
- David Legland
- See Also:
ChamferDistanceTransform2DFloat
-
Constructor Summary
Constructors Constructor Description ChamferDistanceTransform2DShort(ChamferMask2D mask)
Creates a new algorithm for computing distance maps based on a chamfer mask.ChamferDistanceTransform2DShort(ChamferMask2D mask, boolean normalize)
Creates a new algorithm for computing distance maps based on a chamfer mask. -
Method Summary
Modifier and Type Method Description ij.process.ShortProcessor
distanceMap(ij.process.ImageProcessor labelImage)
Computes the distance map of the distance to the nearest pixel with a different value.ChamferMask2D
mask()
Return the chamfer mask used by this distance transform algorithm.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
-
ChamferDistanceTransform2DShort
Creates a new algorithm for computing distance maps based on a chamfer mask.- Parameters:
mask
- the chamfer mask to use for propagating distances
-
ChamferDistanceTransform2DShort
Creates a new algorithm for computing distance maps based on a chamfer mask.- Parameters:
mask
- the chamfer mask to use for propagating distancesnormalize
- whether distance map should be normalized by the weight associated to orthogonal shifts
-
-
Method Details
-
mask
Description copied from interface:ChamferDistanceTransform2D
Return the chamfer mask used by this distance transform algorithm.- Specified by:
mask
in interfaceChamferDistanceTransform2D
- Returns:
- the chamfer mask used by this distance transform algorithm.
-
distanceMap
public ij.process.ShortProcessor distanceMap(ij.process.ImageProcessor labelImage)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 interfaceDistanceTransform2D
- Parameters:
labelImage
- a label image with black pixels (0) as foreground- Returns:
- a new instance of ShortProcessor containing:
- 0 for each background pixel
- the (strictly positive) distance to the nearest background pixel otherwise
-