Class WatershedEncoding
Object
WatershedEncoding
- All Implemented Interfaces:
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Code representing a minima voxel.static final int
Code representing a plateau voxel.static final int
Code representing a temporary voxel.static final int
Code representing an unvisited voxel. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchainCodes
(int chainCode) Decodes a chain-code into a point.int
decodeConnectedComponentID
(int code) Decodes a connected component ID from its encoded form.int
encodeConnectedComponentID
(int connectedComponentID) Encodes a connected component ID.int
encodeDirection
(int x, int y, int z) Encodes a 3D direction into an integer representation.boolean
isConnectedComponentIDCode
(int code) Checks if the given code represents a connected component ID.boolean
isDirectionChainCode
(int code) Checks if the given code represents a direction chain code.
-
Field Details
-
CODE_UNVISITED
public static final int CODE_UNVISITEDCode representing an unvisited voxel.- See Also:
-
CODE_TEMPORARY
public static final int CODE_TEMPORARYCode representing a temporary voxel.- See Also:
-
CODE_MINIMA
public static final int CODE_MINIMACode representing a minima voxel.- See Also:
-
CODE_PLATEAU
public static final int CODE_PLATEAUCode 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 interfaceEncodeDirection
- Parameters:
x
- the x-component of the directiony
- the y-component of the directionz
- the z-component of the direction- Returns:
- an integer encoding of the direction
-
chainCodes
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
-