Enum ChamferMasks3D

java.lang.Object
java.lang.Enum<ChamferMasks3D>
inra.ijpb.binary.distmap.ChamferMasks3D
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<ChamferMasks3D>, java.lang.constant.Constable

public enum ChamferMasks3D
extends java.lang.Enum<ChamferMasks3D>

A pre-defined set of weights that can be used to compute 3D distance transform using chamfer approximations of euclidean metric.

Provides methods to access weight values either as float array or as short array.

Example of use:


 float[] floatWeights = ChamferWeights3D2.BORGEFORS.getFloatWeights();
 boolean normalize = true;
 DistanceTransform3D dt = new DistanceTransform3DFloat(floatWeights, normalize);
 ImageStack result = dt.distanceMap(inputStack);
 
See Also:
BinaryImages.distanceMap(ij.ImageStack), ChamferDistanceTransform3DShort
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    java.lang.Enum.EnumDesc<E extends java.lang.Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant Description
    BORGEFORS
    Use weights 3 for orthogonal neighbors and 4 for diagonal neighbors, and 5 for cube-diagonals (best approximation for 3-by-3-by-3 masks).
    CHESSBOARD
    Use weight equal to 1 for all neighbors
    CITY_BLOCK
    Use weights 1 for orthogonal neighbors and 2 for diagonal neighbors, and 3 for cube-diagonals.
    QUASI_EUCLIDEAN
    Use floating-point weights 1.0 for orthogonal neighbors and sqrt(2) for diagonal neighbors, and sqrt(3) for cube-diagonals.
    SVENSSON_3_4_5_7
    Use weights 3 for orthogonal neighbors and 4 for diagonal neighbors, and 5 for cube-diagonals, and 7 for (2,1,1) shifts.
    WEIGHTS_10_14_17_22_34_30
    Use six types of weights, with a |Emax| error of around 0.0408.
    WEIGHTS_13_18_22_29_31
    Use five types of weights, with a |Emax| error of around 0.0397.
    WEIGHTS_7_10_12_16_17_21
    Use six types of weights, with a |Emax| error of around 0.0524.
    WEIGHTS_8_11_14_18_20
    Use five types of weights, with a |Emax| error of around 0.0653.
  • Method Summary

    Modifier and Type Method Description
    static ChamferMasks3D fromLabel​(java.lang.String label)
    Determines the operation type from its label.
    static java.lang.String[] getAllLabels()  
    ChamferMask3D getMask()  
    java.lang.String toString()  
    static ChamferMasks3D valueOf​(java.lang.String name)
    Returns the enum constant of this type with the specified name.
    static ChamferMasks3D[] values()
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Enum

    compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, valueOf

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • CHESSBOARD

      public static final ChamferMasks3D CHESSBOARD
      Use weight equal to 1 for all neighbors
    • CITY_BLOCK

      public static final ChamferMasks3D CITY_BLOCK
      Use weights 1 for orthogonal neighbors and 2 for diagonal neighbors, and 3 for cube-diagonals. Results in a |Emax| error of around 0.2679.
    • QUASI_EUCLIDEAN

      public static final ChamferMasks3D QUASI_EUCLIDEAN
      Use floating-point weights 1.0 for orthogonal neighbors and sqrt(2) for diagonal neighbors, and sqrt(3) for cube-diagonals. Use 10, 14 and 17 for the 16-bits integer version.
    • BORGEFORS

      public static final ChamferMasks3D BORGEFORS
      Use weights 3 for orthogonal neighbors and 4 for diagonal neighbors, and 5 for cube-diagonals (best approximation for 3-by-3-by-3 masks). Results in a |Emax| error of around 0.1181.
    • SVENSSON_3_4_5_7

      public static final ChamferMasks3D SVENSSON_3_4_5_7
      Use weights 3 for orthogonal neighbors and 4 for diagonal neighbors, and 5 for cube-diagonals, and 7 for (2,1,1) shifts. Good approximation using only four weights, and keeping low value of orthogonal weight. Results in a |Emax| error of around 0.0809.
    • WEIGHTS_8_11_14_18_20

      public static final ChamferMasks3D WEIGHTS_8_11_14_18_20
      Use five types of weights, with a |Emax| error of around 0.0653.
    • WEIGHTS_13_18_22_29_31

      public static final ChamferMasks3D WEIGHTS_13_18_22_29_31
      Use five types of weights, with a |Emax| error of around 0.0397.
    • WEIGHTS_7_10_12_16_17_21

      public static final ChamferMasks3D WEIGHTS_7_10_12_16_17_21
      Use six types of weights, with a |Emax| error of around 0.0524.
    • WEIGHTS_10_14_17_22_34_30

      public static final ChamferMasks3D WEIGHTS_10_14_17_22_34_30
      Use six types of weights, with a |Emax| error of around 0.0408.
  • Method Details

    • values

      public static ChamferMasks3D[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static ChamferMasks3D valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
      java.lang.NullPointerException - if the argument is null
    • getMask

      public ChamferMask3D getMask()
      Returns:
      the 3D chamfer mask associated to this enumeration entry
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Enum<ChamferMasks3D>
    • getAllLabels

      public static java.lang.String[] getAllLabels()
      Returns:
      the array of labels for this enumeration
    • fromLabel

      public static ChamferMasks3D fromLabel​(java.lang.String label)
      Determines the operation type from its label.
      Parameters:
      label - the name of a chamfer weight
      Returns:
      the ChamferWeights3D2 enum corresponding to the given name
      Throws:
      java.lang.IllegalArgumentException - if label name is not recognized.