Class SegmentStackIntoObjectsScaleDecode<T,S extends ImageInferenceModel<T>>

Type Parameters:
T - tensor-type inputted and outputted to model
S - model-type
Direct Known Subclasses:
SegmentObjectsFromONNXModel, SegmentObjectsFromTensorFlowModel

public abstract class SegmentStackIntoObjectsScaleDecode<T,S extends ImageInferenceModel<T>> extends SegmentStackIntoObjectsPooled<S>
A SegmentStackIntoObjectsScaleDecode that scales the input image, before performing inference, and then decodes the output.
Author:
Owen Feehan
  • Constructor Details

    • SegmentStackIntoObjectsScaleDecode

      public SegmentStackIntoObjectsScaleDecode()
  • Method Details

    • segment

      public SegmentedObjects segment(Stack stack, ConcurrentModelPool<S> modelPool, ExecutionTimeRecorder executionTimeRecorder) throws SegmentationFailedException
      Description copied from class: SegmentStackIntoObjectsPooled
      Segments a stack to produce an object-collection.

      Any created objects will always exist inside the stack's Extent.

      Specified by:
      segment in class SegmentStackIntoObjectsPooled<S extends ImageInferenceModel<T>>
      Parameters:
      stack - the stack to segment.
      modelPool - the pool of model instances which can each be used for inference (in parallel).
      executionTimeRecorder - measures execution-times of particular operations.
      Returns:
      a collection of objects with corresponding confidence scores.
      Throws:
      SegmentationFailedException - if anything goes wrong during the segmentation.
    • deriveInput

      protected abstract T deriveInput(Stack stack, Optional<double[]> subtractMeans) throws OperationFailedException
      Derives the input tensor from an image.
      Parameters:
      stack - the image which is mapped into an input tensor.
      subtractMeans - respective intensity values that are subtracted from the voxels before being added to the tensor (respectively for each channel).
      Returns:
      the tensor, representing the input image.
      Throws:
      OperationFailedException - if an input tensor cannot be created.
    • inputName

      protected abstract Optional<String> inputName()
      The name of the tensor in the model which the input-image is mapped to.
      Returns:
      the name.
    • getScaleInput

      public ScaleCalculator getScaleInput()
      Any scaling to be applied to the input-image before being input to the model for inference.
    • setScaleInput

      public void setScaleInput(ScaleCalculator scaleInput)
      Any scaling to be applied to the input-image before being input to the model for inference.
    • getDecode

      public DecodeInstanceSegmentation<T> getDecode()
      Decodes inference output into segmented objects.
    • setDecode

      public void setDecode(DecodeInstanceSegmentation<T> decode)
      Decodes inference output into segmented objects.
    • getSubtractMean

      public DoubleList getSubtractMean()
      A constant intensity for each respective channel to be subtracted before performing inference.

      If set, this should create an list, with as many elements as channels inputted to the inference model.

    • setSubtractMean

      public void setSubtractMean(DoubleList subtractMean)
      A constant intensity for each respective channel to be subtracted before performing inference.

      If set, this should create an list, with as many elements as channels inputted to the inference model.

    • getClassLabelsPath

      public String getClassLabelsPath()
      Relative-path to the class-labels file, a text file where each line specifies a class label in order, relative to the models/ directory in the Anchor distribution.

      If empty, then no such file is specified.

    • setClassLabelsPath

      public void setClassLabelsPath(String classLabelsPath)
      Relative-path to the class-labels file, a text file where each line specifies a class label in order, relative to the models/ directory in the Anchor distribution.

      If empty, then no such file is specified.

    • getInterpolator

      public Interpolator getInterpolator()
      The interpolator to use for scaling images.
    • setInterpolator

      public void setInterpolator(Interpolator interpolator)
      The interpolator to use for scaling images.
    • getDisplayer

      public StackDisplayer getDisplayer()
      How to convert an image to be displayed to the user.
    • setDisplayer

      public void setDisplayer(StackDisplayer displayer)
      How to convert an image to be displayed to the user.