Object
WatershedEncoding
All Implemented Interfaces:
EncodeDirection

public class WatershedEncoding extends Object implements EncodeDirection
Encodes watershed-related information in an integer range.

This class encodes three types of information:

  • A number of state-machine-type constants
  • 27 Directions representing [-1,0,-1]X[-1,0,-1]X[-1,0,-1]
  • A sequence of connected components IDs starting at 0
  • Field Details

    • CODE_UNVISITED

      public static final int CODE_UNVISITED
      Code representing an unvisited voxel.
      See Also:
    • CODE_TEMPORARY

      public static final int CODE_TEMPORARY
      Code representing a temporary voxel.
      See Also:
    • CODE_MINIMA

      public static final int CODE_MINIMA
      Code representing a minima voxel.
      See Also:
    • CODE_PLATEAU

      public static final int CODE_PLATEAU
      Code representing a plateau voxel.
      See Also:
  • Constructor Details

    • WatershedEncoding

      public WatershedEncoding()
  • Method Details

    • encodeDirection

      public int encodeDirection(int x, int y, int z)
      Encodes a 3D direction into an integer representation.
      Specified by:
      encodeDirection in interface EncodeDirection
      Parameters:
      x - the x-component of the direction
      y - the y-component of the direction
      z - the z-component of the direction
      Returns:
      an integer encoding of the direction
    • chainCodes

      public Point3i chainCodes(int chainCode)
      Decodes a chain-code into a point.
      Parameters:
      chainCode - the chain-code to decode
      Returns:
      a new Point3i (always newly created) for the given chain-code
    • encodeConnectedComponentID

      public int encodeConnectedComponentID(int connectedComponentID)
      Encodes a connected component ID.
      Parameters:
      connectedComponentID - the ID of the connected component to encode
      Returns:
      the encoded value for the connected component ID
    • isDirectionChainCode

      public boolean isDirectionChainCode(int code)
      Checks if the given code represents a direction chain code.
      Parameters:
      code - the code to check
      Returns:
      true if the code represents a direction chain code, false otherwise
    • isConnectedComponentIDCode

      public boolean isConnectedComponentIDCode(int code)
      Checks if the given code represents a connected component ID.
      Parameters:
      code - the code to check
      Returns:
      true if the code represents a connected component ID, false otherwise
    • decodeConnectedComponentID

      public int decodeConnectedComponentID(int code)
      Decodes a connected component ID from its encoded form.
      Parameters:
      code - the encoded connected component ID
      Returns:
      the decoded connected component ID