Class SegmentStackIntoObjectsScaleDecode<T,S extends ImageInferenceModel<T>>
Object
AnchorBean<SegmentStackIntoObjectsPooled<S>>
InitializableBean<SegmentStackIntoObjectsPooled<S>,ImageInitialization>
ImageBean<SegmentStackIntoObjectsPooled<S>>
SegmentationBean<SegmentStackIntoObjectsPooled<S>>
SegmentStackIntoObjectsPooled<S>
SegmentStackIntoObjectsScaleDecode<T,S>
- Type Parameters:
T
- tensor-type inputted and outputted to modelS
- 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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract T
deriveInput
(Stack stack, Optional<double[]> subtractMeans) Derives the input tensor from an image.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.Decodes inference output into segmented objects.How to convert an image to be displayed to the user.The interpolator to use for scaling images.Any scaling to be applied to the input-image before being input to the model for inference.A constant intensity for each respective channel to be subtracted before performing inference.The name of the tensor in the model which the input-image is mapped to.segment
(Stack stack, ConcurrentModelPool<S> modelPool, ExecutionTimeRecorder executionTimeRecorder) Segments a stack to produce an object-collection.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.void
setDecode
(DecodeInstanceSegmentation<T> decode) Decodes inference output into segmented objects.void
setDisplayer
(StackDisplayer displayer) How to convert an image to be displayed to the user.void
setInterpolator
(Interpolator interpolator) The interpolator to use for scaling images.void
setScaleInput
(ScaleCalculator scaleInput) Any scaling to be applied to the input-image before being input to the model for inference.void
setSubtractMean
(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, segment
Methods inherited from class org.anchoranalysis.bean.initializable.InitializableBean
getInitialization, getLogger, getPropertyInitializer, initialize, initializeRecursive, initRecursiveWithInitializer, isInitialized, onInitialization
Methods 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 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 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:
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
The name of the tensor in the model which the input-image is mapped to.- Returns:
- the name.
-
getScaleInput
Any scaling to be applied to the input-image before being input to the model for inference. -
setScaleInput
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
The interpolator to use for scaling images. -
setInterpolator
The interpolator to use for scaling images. -
getDisplayer
How to convert an image to be displayed to the user. -
setDisplayer
How to convert an image to be displayed to the user.
-