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
  • Field Details

    • CHESSBOARD

      public static final ChamferMask3D CHESSBOARD
      Use weights equal to 1 for all neighbors.
    • CITY_BLOCK

      public static final ChamferMask3D CITY_BLOCK
      Use weights 1 for orthogonal neighbors, 2 for square-diagonal neighbors, and 3 for cube-diagonals.
    • BORGEFORS

      public static final 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).
    • QUASI_EUCLIDEAN

      public static final ChamferMask3D 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

      public static final 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. Good approximation using only four weights, and keeping low value for orthogonal weight.
  • Constructor Details

    • ChamferMask3D

      public ChamferMask3D()
  • Method Details

    • fromWeights

      public static final ChamferMask3D fromWeights​(int[] weights)
      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

      public static final ChamferMask3D fromWeights​(short[] weights)
      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

      public static final ChamferMask3D fromWeights​(float[] weights)
      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

      public java.util.Collection<ChamferMask3D.ShortOffset> getOffsets()
      Returns:
      the whole collection of offsets defined by this ChamferWeights3D.
    • getFloatOffsets

      public java.util.Collection<ChamferMask3D.FloatOffset> getFloatOffsets()
      Returns:
      the whole collection of offsets using floating-point weights defined by this ChamferWeights3D.
    • getForwardOffsets

      public abstract java.util.Collection<ChamferMask3D.ShortOffset> getForwardOffsets()
      Returns:
      the set of offsets defined by this ChamferWeights3D for forward iteration using integer weights.
    • getBackwardOffsets

      public abstract java.util.Collection<ChamferMask3D.ShortOffset> getBackwardOffsets()
      Returns:
      the set of offsets defined by this ChamferWeights3D for backward iteration using integer weights.
    • getForwardFloatOffsets

      public java.util.Collection<ChamferMask3D.FloatOffset> getForwardFloatOffsets()
      Returns:
      the set of offsets defined by this ChamferWeights3D for forward iteration using floating-point weights.
    • getBackwardFloatOffsets

      public java.util.Collection<ChamferMask3D.FloatOffset> 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.