Package inra.ijpb.binary.distmap
Class ChamferDistanceTransform2DShort
java.lang.Object
inra.ijpb.algo.AlgoStub
inra.ijpb.binary.distmap.ChamferDistanceTransform2DShort
- All Implemented Interfaces:
Algo
,ChamferDistanceTransform2D
,DistanceTransform
public class ChamferDistanceTransform2DShort extends AlgoStub implements ChamferDistanceTransform2D
Computes distance transform by propagating distances using a ChamferMask2D,
and using 16-bits integer computation.
For label maps, an equivalent algorithm exists within the
inra.ijpb.label.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
,ChamferDistanceTransform2DShort
-
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 binaryImage)
Computes the distance map of the distance to the nearest background pixel.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 binaryImage)Computes the distance map of the distance to the nearest background pixel. The function returns a new instance ofShortProcessor
the same size as the input, with values greater or equal to zero.- Specified by:
distanceMap
in interfaceDistanceTransform
- Parameters:
binaryImage
- a binary image with black pixels (0) as background- Returns:
- a new instance of ShortProcessor containing:
- 0 for each background pixel
- the (strictly positive) distance to the nearest background pixel otherwise
-