Class DecodeLabels<T>

Object
DecodeLabels<T>
Type Parameters:
T - element-type (an object-mask, or some class containing an object-mask).

public class DecodeLabels<T> extends Object
Decodes a labelled raster into derived objects or object-like elements.
Author:
Owen Feehan
  • Constructor Details

    • DecodeLabels

      public DecodeLabels(Voxels<?> voxels, int minLabelInclusive, int maxLabelInclusive, DecodeLabels.CreateElementFromScaledObject<T> createScaledElement)
      Creates a new DecodeLabels instance.
      Parameters:
      voxels - Voxels each labelled with an integer (sequentially increasing from 1) to represent an object.
      minLabelInclusive - Minimum label-value inclusive.
      maxLabelInclusive - Maximum label-value inclusive.
      createScaledElement - Create scaled element from a scaled-object and corresponding index.
  • Method Details

    • create

      public Map<T,T> create(Map<Integer,T> labelMap, UnaryOperator<T> operationAfterScaling) throws CreateException
      Creates a map of elements to other elements that are labelled with unique integers (sequentially increasing) in voxels.
      Parameters:
      labelMap - a map from a label to what becomes the key in the output map (each label should map to a unique key).
      operationAfterScaling - an operation to apply after labelling, but before the element is placed in the map.
      Returns:
      a map constructed key from labelMap and value as the element is derived from the label - for each label.
      Throws:
      CreateException - if bounding-boxes cannot be derived.
    • create

      public List<T> create(int smallVolumeThreshold) throws CreateException
      Creates a list of elements from voxels that are labelled with unique integers (sequentially increasing).
      Parameters:
      smallVolumeThreshold - minimum volume of bounding-box otherwise a label is ignored.
      Returns:
      a list of respective elements, one for each label.
      Throws:
      CreateException - if bounding-boxes cannot be derived.