Class SegmentStackIntoObjectsScaleDecode<T,S extends ImageInferenceModel<T>>
Object
org.anchoranalysis.bean.AnchorBean<B>
org.anchoranalysis.bean.initializable.InitializableBean<T,org.anchoranalysis.image.bean.nonbean.init.ImageInitialization>
org.anchoranalysis.image.bean.ImageBean<T>
org.anchoranalysis.image.bean.segment.SegmentationBean<SegmentStackIntoObjectsPooled<T>>
org.anchoranalysis.image.inference.bean.segment.instance.SegmentStackIntoObjectsPooled<S>
org.anchoranalysis.image.inference.bean.segment.instance.SegmentStackIntoObjectsScaleDecode<T,S>
- Type Parameters:
T- tensor-type inputted and outputted to modelS- model-type
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 Summary
Constructors Constructor Description SegmentStackIntoObjectsScaleDecode() -
Method Summary
Modifier and Type Method Description protected abstract TderiveInput(Stack stack, Optional<double[]> subtractMeans)Derives the input tensor from an image.StringgetClassLabelsPath()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.DecodeInstanceSegmentation<T>getDecode()Decodes inference output into segmented objects.org.anchoranalysis.image.bean.displayer.StackDisplayergetDisplayer()How to convert an image to be displayed to the user.org.anchoranalysis.image.bean.interpolator.InterpolatorgetInterpolator()The interpolator to use for scaling images.org.anchoranalysis.image.bean.spatial.ScaleCalculatorgetScaleInput()Any scaling to be applied to the input-image before being input to the model for inference.DoubleListgetSubtractMean()A constant intensity for each respective channel to be subtracted before performing inference.protected abstract Optional<String>inputName()The name of the tensor in the model which the input-image is mapped to.SegmentedObjectssegment(Stack stack, ConcurrentModelPool<S> modelPool, ExecutionTimeRecorder executionTimeRecorder)Segments a stack to produce an object-collection.voidsetClassLabelsPath(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.voidsetDecode(DecodeInstanceSegmentation<T> decode)Decodes inference output into segmented objects.voidsetDisplayer(org.anchoranalysis.image.bean.displayer.StackDisplayer displayer)How to convert an image to be displayed to the user.voidsetInterpolator(org.anchoranalysis.image.bean.interpolator.Interpolator interpolator)The interpolator to use for scaling images.voidsetScaleInput(org.anchoranalysis.image.bean.spatial.ScaleCalculator scaleInput)Any scaling to be applied to the input-image before being input to the model for inference.voidsetSubtractMean(DoubleList subtractMean)A constant intensity for each respective channel to be subtracted before performing inference.Methods inherited from class org.anchoranalysis.image.inference.bean.segment.instance.SegmentStackIntoObjectsPooled
createModelPool, resolve, segmentMethods inherited from class org.anchoranalysis.bean.initializable.InitializableBean
getInitialization, getLogger, getPropertyInitializer, initialize, initializeRecursive, initRecursiveWithInitializer, isInitialized, onInitializationMethods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
SegmentStackIntoObjectsScaleDecode
public SegmentStackIntoObjectsScaleDecode()
-
-
Method Details
-
segment
public SegmentedObjects segment(Stack stack, ConcurrentModelPool<S> modelPool, ExecutionTimeRecorder executionTimeRecorder) throws org.anchoranalysis.image.bean.nonbean.segment.SegmentationFailedExceptionDescription copied from class:SegmentStackIntoObjectsPooledSegments a stack to produce an object-collection.Any created objects will always exist inside the stack's
Extent.- Specified by:
segmentin classSegmentStackIntoObjectsPooled<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:
org.anchoranalysis.image.bean.nonbean.segment.SegmentationFailedException- if anything goes wrong during the segmentation.
-
deriveInput
protected abstract T deriveInput(Stack stack, Optional<double[]> subtractMeans) throws OperationFailedExceptionDerives 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
The name of the tensor in the model which the input-image is mapped to.- Returns:
- the name.
-
getScaleInput
public org.anchoranalysis.image.bean.spatial.ScaleCalculator getScaleInput()Any scaling to be applied to the input-image before being input to the model for inference. -
setScaleInput
public void setScaleInput(org.anchoranalysis.image.bean.spatial.ScaleCalculator scaleInput)Any scaling to be applied to the input-image before being input to the model for inference. -
getDecode
Decodes inference output into segmented objects. -
setDecode
Decodes inference output into segmented objects. -
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
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
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
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 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. -
getDisplayer
public org.anchoranalysis.image.bean.displayer.StackDisplayer getDisplayer()How to convert an image to be displayed to the user. -
setDisplayer
public void setDisplayer(org.anchoranalysis.image.bean.displayer.StackDisplayer displayer)How to convert an image to be displayed to the user.
-