Class SegmentInstanceWithModel<T extends org.anchoranalysis.inference.InferenceModel>

Object
org.anchoranalysis.bean.AnchorBean<org.anchoranalysis.experiment.bean.task.Task<T,​S>>
org.anchoranalysis.experiment.bean.task.Task<org.anchoranalysis.image.io.stack.input.StackSequenceInput,​SharedStateSegmentInstance<T>>
org.anchoranalysis.plugin.image.task.bean.segment.SegmentInstanceWithModel<T>
Type Parameters:
T - model-type in pool

public class SegmentInstanceWithModel<T extends org.anchoranalysis.inference.InferenceModel>
extends org.anchoranalysis.experiment.bean.task.Task<org.anchoranalysis.image.io.stack.input.StackSequenceInput,​SharedStateSegmentInstance<T>>
Using a model-pool, performs instance segmentation on an image producing zero, one or more objects per image.

Various visualizations and export types are supported.

  • Segmentation results in vairous forms (HDF5) for input into other scripts. (in HDF5 form and as a mask).
  • Visualizations of the instances found (outlines, thumbnails etc.)
  • A table of basic features (CSV) for each instance.

Specifically, the following outputs are produced:

Output NameDefault?Description
"input"noThe input image for segmentation.
"objects"yesSegmented object-masks encoded into HDF5.
"mask"yesA binary-mask image that binary ors each voxel across the segmented object-masks (scaled to match the input image for model inference).
"outline"yesA RGB image showing the outline of segmented-objects on top of the input image (scaled to match the input image for model inference).
"mask""InputScale"noLike mask but on the full-scale input image.
"outline""InputScale"noLike outline but on on the full-scale input image.
"summary"yesA CSV file showing basic feature of all segmented-objects across all input images.
"thumbnails"yesA directory of thumbnails showing the outline of all segmented objects on top of an extracted portion of the respective input-image.
outputs inherited from Task
Author:
Owen Feehan
  • Constructor Summary

    Constructors 
    Constructor Description
    SegmentInstanceWithModel()  
  • Method Summary

    Modifier and Type Method Description
    void afterAllJobsAreExecuted​(SharedStateSegmentInstance<T> sharedState, org.anchoranalysis.io.output.outputter.InputOutputContext context)  
    SharedStateSegmentInstance<T> beforeAnyJobIsExecuted​(org.anchoranalysis.io.output.outputter.Outputter outputter, org.anchoranalysis.inference.concurrency.ConcurrencyPlan plan, List<org.anchoranalysis.image.io.stack.input.StackSequenceInput> inputs, org.anchoranalysis.experiment.task.ParametersExperiment parameters)  
    org.anchoranalysis.io.output.enabled.OutputEnabledMutable defaultOutputs()  
    void doJobOnInput​(org.anchoranalysis.experiment.task.InputBound<org.anchoranalysis.image.io.stack.input.StackSequenceInput,​SharedStateSegmentInstance<T>> input)  
    List<org.anchoranalysis.bean.NamedBean<org.anchoranalysis.feature.bean.list.FeatureListProvider<org.anchoranalysis.image.feature.input.FeatureInputSingleObject>>> getFeatures()
    Features to calculate for objects in the features output.
    org.anchoranalysis.image.bean.interpolator.Interpolator getInterpolator()
    The interpolator to use for scaling images.
    org.anchoranalysis.bean.shared.color.RGBColorBean getOutlineColor()
    The color of the outline.
    int getOutlineWidth()
    The width of the outline.
    org.anchoranalysis.image.inference.bean.segment.instance.SegmentStackIntoObjectsPooled<T> getSegment()
    The segmentation algorithm.
    ExportFeaturesStyle getStyle()
    Visual style for how feature export occurs.
    boolean hasVeryQuickPerInputExecution()  
    org.anchoranalysis.experiment.task.InputTypesExpected inputTypesExpected()  
    boolean isIgnoreNoObjects()
    When true, then the outputs (outline, mask, image etc.) are not written for images that produce no objects.
    boolean isVaryColors()
    When true, the colors change for different objects in the image (using a default color set).
    void setFeatures​(List<org.anchoranalysis.bean.NamedBean<org.anchoranalysis.feature.bean.list.FeatureListProvider<org.anchoranalysis.image.feature.input.FeatureInputSingleObject>>> features)
    Features to calculate for objects in the features output.
    void setIgnoreNoObjects​(boolean ignoreNoObjects)
    When true, then the outputs (outline, mask, image etc.) are not written for images that produce no objects.
    void setInterpolator​(org.anchoranalysis.image.bean.interpolator.Interpolator interpolator)
    The interpolator to use for scaling images.
    void setOutlineColor​(org.anchoranalysis.bean.shared.color.RGBColorBean outlineColor)
    The color of the outline.
    void setOutlineWidth​(int outlineWidth)
    The width of the outline.
    void setSegment​(org.anchoranalysis.image.inference.bean.segment.instance.SegmentStackIntoObjectsPooled<T> segment)
    The segmentation algorithm.
    void setStyle​(ExportFeaturesStyle style)
    Visual style for how feature export occurs.
    void setVaryColors​(boolean varyColors)
    When true, the colors change for different objects in the image (using a default color set).

    Methods inherited from class org.anchoranalysis.experiment.bean.task.Task

    executeJob, isInputCompatibleWith

    Methods inherited from class org.anchoranalysis.bean.AnchorBean

    checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

  • Method Details

    • inputTypesExpected

      public org.anchoranalysis.experiment.task.InputTypesExpected inputTypesExpected()
      Specified by:
      inputTypesExpected in class org.anchoranalysis.experiment.bean.task.Task<org.anchoranalysis.image.io.stack.input.StackSequenceInput,​SharedStateSegmentInstance<T extends org.anchoranalysis.inference.InferenceModel>>
    • beforeAnyJobIsExecuted

      public SharedStateSegmentInstance<T> beforeAnyJobIsExecuted​(org.anchoranalysis.io.output.outputter.Outputter outputter, org.anchoranalysis.inference.concurrency.ConcurrencyPlan plan, List<org.anchoranalysis.image.io.stack.input.StackSequenceInput> inputs, org.anchoranalysis.experiment.task.ParametersExperiment parameters) throws org.anchoranalysis.experiment.ExperimentExecutionException
      Specified by:
      beforeAnyJobIsExecuted in class org.anchoranalysis.experiment.bean.task.Task<org.anchoranalysis.image.io.stack.input.StackSequenceInput,​SharedStateSegmentInstance<T extends org.anchoranalysis.inference.InferenceModel>>
      Throws:
      org.anchoranalysis.experiment.ExperimentExecutionException
    • doJobOnInput

      public void doJobOnInput​(org.anchoranalysis.experiment.task.InputBound<org.anchoranalysis.image.io.stack.input.StackSequenceInput,​SharedStateSegmentInstance<T>> input) throws org.anchoranalysis.experiment.JobExecutionException
      Specified by:
      doJobOnInput in class org.anchoranalysis.experiment.bean.task.Task<org.anchoranalysis.image.io.stack.input.StackSequenceInput,​SharedStateSegmentInstance<T extends org.anchoranalysis.inference.InferenceModel>>
      Throws:
      org.anchoranalysis.experiment.JobExecutionException
    • afterAllJobsAreExecuted

      public void afterAllJobsAreExecuted​(SharedStateSegmentInstance<T> sharedState, org.anchoranalysis.io.output.outputter.InputOutputContext context) throws org.anchoranalysis.experiment.ExperimentExecutionException
      Specified by:
      afterAllJobsAreExecuted in class org.anchoranalysis.experiment.bean.task.Task<org.anchoranalysis.image.io.stack.input.StackSequenceInput,​SharedStateSegmentInstance<T extends org.anchoranalysis.inference.InferenceModel>>
      Throws:
      org.anchoranalysis.experiment.ExperimentExecutionException
    • hasVeryQuickPerInputExecution

      public boolean hasVeryQuickPerInputExecution()
      Specified by:
      hasVeryQuickPerInputExecution in class org.anchoranalysis.experiment.bean.task.Task<org.anchoranalysis.image.io.stack.input.StackSequenceInput,​SharedStateSegmentInstance<T extends org.anchoranalysis.inference.InferenceModel>>
    • defaultOutputs

      public org.anchoranalysis.io.output.enabled.OutputEnabledMutable defaultOutputs()
      Overrides:
      defaultOutputs in class org.anchoranalysis.experiment.bean.task.Task<org.anchoranalysis.image.io.stack.input.StackSequenceInput,​SharedStateSegmentInstance<T extends org.anchoranalysis.inference.InferenceModel>>
    • getSegment

      public org.anchoranalysis.image.inference.bean.segment.instance.SegmentStackIntoObjectsPooled<T> getSegment()
      The segmentation algorithm.
    • setSegment

      public void setSegment​(org.anchoranalysis.image.inference.bean.segment.instance.SegmentStackIntoObjectsPooled<T> segment)
      The segmentation algorithm.
    • getOutlineColor

      public org.anchoranalysis.bean.shared.color.RGBColorBean getOutlineColor()
      The color of the outline.
    • setOutlineColor

      public void setOutlineColor​(org.anchoranalysis.bean.shared.color.RGBColorBean outlineColor)
      The color of the outline.
    • isVaryColors

      public boolean isVaryColors()
      When true, the colors change for different objects in the image (using a default color set).

      This takes precedence over outlineColor.

    • setVaryColors

      public void setVaryColors​(boolean varyColors)
      When true, the colors change for different objects in the image (using a default color set).

      This takes precedence over outlineColor.

    • getOutlineWidth

      public int getOutlineWidth()
      The width of the outline.
    • setOutlineWidth

      public void setOutlineWidth​(int outlineWidth)
      The width of the outline.
    • getFeatures

      public List<org.anchoranalysis.bean.NamedBean<org.anchoranalysis.feature.bean.list.FeatureListProvider<org.anchoranalysis.image.feature.input.FeatureInputSingleObject>>> getFeatures()
      Features to calculate for objects in the features output.

      If unspecified, default features of bounding-box coordinates and number of voxels are selected.

    • setFeatures

      public void setFeatures​(List<org.anchoranalysis.bean.NamedBean<org.anchoranalysis.feature.bean.list.FeatureListProvider<org.anchoranalysis.image.feature.input.FeatureInputSingleObject>>> features)
      Features to calculate for objects in the features output.

      If unspecified, default features of bounding-box coordinates and number of voxels are selected.

    • isIgnoreNoObjects

      public boolean isIgnoreNoObjects()
      When true, then the outputs (outline, mask, image etc.) are not written for images that produce no objects.
    • setIgnoreNoObjects

      public void setIgnoreNoObjects​(boolean ignoreNoObjects)
      When true, then the outputs (outline, mask, image etc.) are not written for images that produce no objects.
    • getStyle

      public ExportFeaturesStyle getStyle()
      Visual style for how feature export occurs.
    • setStyle

      public void setStyle​(ExportFeaturesStyle style)
      Visual style for how feature export occurs.
    • getInterpolator

      public org.anchoranalysis.image.bean.interpolator.Interpolator getInterpolator()
      The interpolator to use for scaling images.
    • setInterpolator

      public void setInterpolator​(org.anchoranalysis.image.bean.interpolator.Interpolator interpolator)
      The interpolator to use for scaling images.