Package inra.ijpb.binary.distmap
Class ChamferMask3D
java.lang.Object
inra.ijpb.binary.distmap.ChamferMask3D
- Direct Known Subclasses:
ChamferMask3DW3
,ChamferMask3DW3Float
,ChamferMask3DW4
,ChamferMask3DW5
,ChamferMask3DW6
public abstract class ChamferMask3D
extends java.lang.Object
A collection of weighted offsets for computing distance maps from 3D binary
images.
Each offset is defined by a (x,y,z) triplet and by a weight. The weights can
be defined as integers (making it possible to store result in
ShortProcessors) or as floating point values (could be more precise).
- Author:
- dlegland
- See Also:
ChamferMask2D
,ChamferDistanceTransform3D
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ChamferMask3D.FloatOffset
The shift to a neighbor of a reference voxel, as a triplet (dx,dy,dz), and the associated weights given as a float.static class
ChamferMask3D.ShortOffset
The shift to a neighbor of a reference voxel, as a triplet (dx,dy,dz), and the associated weights given as a short. -
Field Summary
Fields Modifier and Type Field Description static ChamferMask3D
BORGEFORS
Use weights 3 for orthogonal neighbors, 4 for square-diagonal neighbors, and 5 for cube-diagonals (best approximation for 3-by-3-by-3 masks).static ChamferMask3D
CHESSBOARD
Use weights equal to 1 for all neighbors.static ChamferMask3D
CITY_BLOCK
Use weights 1 for orthogonal neighbors, 2 for square-diagonal neighbors, and 3 for cube-diagonals.static ChamferMask3D
QUASI_EUCLIDEAN
Use weights 1 for orthogonal neighbors, sqrt(2) for square-diagonal neighbors, and sqrt(3) for cube-diagonals.static ChamferMask3D
SVENSSON_3_4_5_7
Use weights 3 for orthogonal neighbors, 4 for square-diagonal neighbors, 5 for cube-diagonals, and 7 for (2,1,1) shifts. -
Constructor Summary
Constructors Constructor Description ChamferMask3D()
-
Method Summary
Modifier and Type Method Description static ChamferMask3D
fromWeights(float[] weights)
Creates a new Chamfer mask from a list of weights.static ChamferMask3D
fromWeights(int[] weights)
Creates a new Chamfer mask from a list of weights.static ChamferMask3D
fromWeights(short[] weights)
Creates a new Chamfer mask from a list of weights.java.util.Collection<ChamferMask3D.FloatOffset>
getBackwardFloatOffsets()
abstract java.util.Collection<ChamferMask3D.ShortOffset>
getBackwardOffsets()
java.util.Collection<ChamferMask3D.FloatOffset>
getFloatOffsets()
java.util.Collection<ChamferMask3D.FloatOffset>
getForwardFloatOffsets()
abstract java.util.Collection<ChamferMask3D.ShortOffset>
getForwardOffsets()
double
getNormalizationWeight()
java.util.Collection<ChamferMask3D.ShortOffset>
getOffsets()
abstract short
getShortNormalizationWeight()
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
CHESSBOARD
Use weights equal to 1 for all neighbors. -
CITY_BLOCK
Use weights 1 for orthogonal neighbors, 2 for square-diagonal neighbors, and 3 for cube-diagonals. -
BORGEFORS
Use weights 3 for orthogonal neighbors, 4 for square-diagonal neighbors, and 5 for cube-diagonals (best approximation for 3-by-3-by-3 masks). -
QUASI_EUCLIDEAN
Use weights 1 for orthogonal neighbors, sqrt(2) for square-diagonal neighbors, and sqrt(3) for cube-diagonals. Use 10, 14 and 17 for short version. -
SVENSSON_3_4_5_7
Use weights 3 for orthogonal neighbors, 4 for square-diagonal neighbors, 5 for cube-diagonals, and 7 for (2,1,1) shifts. Good approximation using only four weights, and keeping low value for orthogonal weight.
-
-
Constructor Details
-
ChamferMask3D
public ChamferMask3D()
-
-
Method Details
-
fromWeights
Creates a new Chamfer mask from a list of weights. The size of the chamfer mask depends on the length of the array:- single element: chamfer mask is 3-by-3-by-3, the element value corresponds to the weight of orthogonal offsets
- two elements: chamfer mask is 3-by-3-by-3, the second element corresponds to the weight of square-diagonal offsets
- three elements: chamfer mask is 3-by-3-by-3, the third element corresponds to the weight of cube-diagonal offsets
- four elements: chamfer mask is 5-by-5-by-5, the fourth element corresponds to the weight of (1,1,2) offset and its permutations and symmetries
- Parameters:
weights
- the list of weights used for building the chamfer mask- Returns:
- the chamfer mask corresponding to the weights
-
fromWeights
Creates a new Chamfer mask from a list of weights. The size of the chamfer mask depends on the length of the array:- single element: chamfer mask is 3-by-3-by-3, the element value corresponds to the weight of orthogonal offsets
- two elements: chamfer mask is 3-by-3-by-3, the second element corresponds to the weight of square-diagonal offsets
- three elements: chamfer mask is 3-by-3-by-3, the third element corresponds to the weight of cube-diagonal offsets
- four elements: chamfer mask is 5-by-5-by-5, the fourth element corresponds to the weight of (1,1,2) offset and its permutations and symmetries
- Parameters:
weights
- the list of weights used for building the chamfer mask- Returns:
- the chamfer mask corresponding to the weights
-
fromWeights
Creates a new Chamfer mask from a list of weights. The size of the chamfer mask depends on the length of the array:- single element: chamfer mask is 3-by-3-by-3, the element value corresponds to the weight of orthogonal offsets
- two elements: chamfer mask is 3-by-3-by-3, the second element corresponds to the weight of square-diagonal offsets
- three elements: chamfer mask is 3-by-3-by-3, the third element corresponds to the weight of cube-diagonal offsets
- four elements: chamfer mask is 5-by-5-by-5, the fourth element corresponds to the weight of (1,1,2) offset and its permutations and symmetries
- Parameters:
weights
- the list of weights used for building the chamfer mask- Returns:
- the chamfer mask corresponding to the weights
-
getOffsets
- Returns:
- the whole collection of offsets defined by this ChamferWeights3D.
-
getFloatOffsets
- Returns:
- the whole collection of offsets using floating-point weights defined by this ChamferWeights3D.
-
getForwardOffsets
- Returns:
- the set of offsets defined by this ChamferWeights3D for forward iteration using integer weights.
-
getBackwardOffsets
- Returns:
- the set of offsets defined by this ChamferWeights3D for backward iteration using integer weights.
-
getForwardFloatOffsets
- Returns:
- the set of offsets defined by this ChamferWeights3D for forward iteration using floating-point weights.
-
getBackwardFloatOffsets
- Returns:
- the set of offsets defined by this ChamferWeights3D for backward iteration using floating-point weights.
-
getNormalizationWeight
public double getNormalizationWeight()- Returns:
- the weight associated to orthogonal offsets, that can be used to normalize the distance map.
-
getShortNormalizationWeight
public abstract short getShortNormalizationWeight()- Returns:
- the weight associated to orthogonal offsets, that can be used to normalize the distance map.
-