![]() |
ImFusion SDK 4.3
|
#include <ImFusion/ML/Operation.h>
Class to define a pre-post processing operation on data items. More...
Inherited by RandomOperation< ConeBeamSimulationOperation >, RandomOperation< SimulateCBCTOperation >, RandomOperation< XRayFixtureOperation >, RandomOperation< XRaySamplingOperation >, RandomOperation< XRayUndoLogConversionOperation >, RandomOperation< ExtractSubsetOperation >, RandomOperation< AddDegradedLabelAsChannelOperation >, RandomOperation< AddRandomNoiseOperation >, RandomOperation< AxisFlipOperation >, RandomOperation< AxisRotationOperation >, RandomOperation< CropAroundLabelMapOperation >, RandomOperation< CropOperation >, RandomOperation< CutOutOperation >, RandomOperation< DeformationOperation >, RandomOperation< GammaCorrectionOperation >, RandomOperation< InvertOperation >, RandomOperation< LinearIntensityMappingOperation >, RandomOperation< MRIBiasFieldGenerationOperation >, RandomOperation< PolyCropOperation >, RandomOperation< ResolutionReductionOperation >, RandomOperation< RotationOperation >, RandomOperation< ScalingOperation >, RandomOperation< SmoothOperation >, RandomOperation< TemplateInpaintingOperation >, RandomOperation< FrameFromVolumeOperation >, ConeBeamSimulationOperation, SimulateCBCTOperation, SmoothCTEdgesOperation, XRayFixtureOperation, XRaySamplingOperation, XRayUndoLogConversionOperation, CropAroundVertebraeOperation, AddCenterBoxOperation, AddDegradedLabelAsChannelOperation, AddPixelwisePredictionChannelOperation, AddPositionChannelOperation, AddRandomNoiseOperation, AdjustShiftScaleOperation, ApproximateToHigherResolutionOperation, ArgMaxOperation, BakeDeformationOperation, BakePhotometricInterpretationOperation, BakeTransformationOperation, BlobsFromKeypointsOperation, CheckDataOperation, ClipOperation, ConcatenateNeighboringFramesToChannelsOperation, ConvertSlicesToVolumeOperation, ConvertToGrayOperation, ConvertVolumeToSlicesOperation, ConvolutionalCRFOperation, CopyOperation, CropAroundLabelMapOperation, CropOperation, CutOutOperation, DeformationOperation, EnsureExplicitMaskOperation, EnsureOneToOneMatrixMappingOperation, ExtractSubsetOperation, ForegroundGuidedLabelUpsamplingOperation, GammaCorrectionOperation, GenerateRandomKeypointsOperation, HighPassOperation, ImageMathOperation, ImageMattingOperation, ImageROISampler, InverseOperation, InvertOperation, InvertibleOperation, KeepLargestComponentOperation, KeypointsFromBlobsOperation, LinearIntensityMappingOperation, MRIBiasFieldCorrectionOperation, MRIBiasFieldGenerationOperation, MakeFloatOperation, MatrixBasedOperation, MergeAsChannelsOperation, MorphologicalFilterOperation, NormalizeMADOperation, NormalizeNormalOperation, NormalizePercentileOperation, NormalizeUniformOperation, OneHotOperation, PolyCropOperation, RandomChoiceOperation, RandomImageFromLabelOperation, RandomKeypointJitterOperation, RandomOperation< BaseOp >, RecombinePatchesOperation, RemoveMaskOperation, RemoveOperation, RenameOperation, ReplaceLabelsValuesOperation, ResampleDimsOperation, ResampleKeepingAspectRatioOperation, ResampleOperation, ResampleToInputOperation, ResolutionReductionOperation, RunModelOperation, SelectChannelsOperation, SetModalityOperation, SetSpacingOperation, SigmoidOperation, SmoothOperation, SoftmaxOperation, SplitIntoPatchesOperation, StandardizeImageAxesOperation, SwapImageAndLabelsOperation, SyncOperation, TagDataElementOperation, TanhOperation, TemplateInpaintingOperation, ThresholdOperation, UndoPaddingOperation, and FrameFromVolumeOperation.
Class to define a pre-post processing operation on data items.
This class is the base interface for specifying an operation that transform input data contained in a DataItem. Unlike the Algorithm class, an Operation is constructed by specifying its parameters, while the actual data to process are passed as argument to the function process, which is the main entry point of the class. This allows the user to flexibly setup a processing pipeline based on operation beforehand, and later apply it to a collection of data. This is particularly useful when processing a dataset containing a large number of data, and it makes sense to specify a processing pipeline in advance.
Operations can be constructed in two ways:
Once an operation is set up it can be run via the process function, which takes a DataItem as input and manipulate it in-place. If all you need is processing a SharedImageSet, you can use utilities overload of the process function, this will pack the input image in a DataItem, call the main process function on it, and retrieve the result:
The main process function has a default implementation which loops over each element in the input data item and according to the element type (see DataItem) calls a delegate process function which acts on that element type. The delegate functions are:
In most of the cases, when implementing your own operation, all you have to do is to overload one of the delegate function. If a delegate function is not implemented, the default version will be used, which does nothing on the data.
Example:
In some cases though, you want to write an Operation that adds/remove/swaps/change/rename/reorder fields or element in the input DataItem. In those cases, the user can directly overload the main process function, like in the following example
Classes | |
| struct | Specs |
| Specifications required to fully instantiate an operation. More... | |
Public Types | |
| enum | ProcessingPolicy { EverythingExceptLabels = 0 , Everything , OnlyLabels } |
| Policy used by default when selecting on the fields on which the operation will be applied Note that "Labels" here refers to the target tag, not to be confused with Data::Modality::LABEL. More... | |
| using | PreProcessHook = std::function<void(Operation&, DataElement*)> |
| using | PostProcessHook = std::function<void(Operation&, DataElement*)> |
Public Member Functions | |
| Operation (std::string name, ProcessingPolicy processingPolicy) | |
| Derived classes must specify a name and whether, by default, the operation should also be applied to label maps. | |
| virtual void | process (DataItem &item) |
| Main function that processes a DataItem in-place, may throw OperationException The data to be processed is determined by the active fields (if set) and the processing policy otherwise (if set), otherwise all fields are processed. | |
| virtual std::shared_ptr< SharedImageSet > | process (std::shared_ptr< SharedImageSet > input) |
| Utility function to directly apply an operation on a SharedImageSet irrespective of active fields and processing policy. | |
| virtual std::shared_ptr< KeypointSet > | process (std::shared_ptr< KeypointSet > input) |
| Utility function to directly apply an operation on a set of KeypointSet irrespective of active fields and processing policy. | |
| virtual std::shared_ptr< BoundingBoxSet > | process (std::shared_ptr< BoundingBoxSet > input) |
| Utility function to directly apply an operation on a set of BoundingBoxSet irrespective of active fields and processing policy. | |
| virtual std::unique_ptr< SharedImageSet > | process (std::unique_ptr< SharedImageSet > input) final |
| Utility function with unique_ptr as input and output to avoid breaking changes (must not be overridden) | |
| void | addTemporaryPreProcessHook (PreProcessHook hook) |
| Add a temporary hook that will only be active for the next process call and then automatically removed after the DataItem is processed. | |
| void | addTemporaryPostProcessHook (PostProcessHook hook) |
| Add a temporary hook that will only be active for the next process call and then automatically removed after the DataItem is processed. | |
| virtual bool | checkRequiredItemsTypes (const DataItem &item) const |
| Checks if the data item holds fields with types required by the operation. | |
| const std::string & | name () const |
| Returns the name of the operation. | |
| virtual bool | configure (const Properties &properties) |
| Configure an Operation with the given properties and return whether the configuration was successful. | |
| virtual Properties | configuration () const |
| Return the Operation configuration. | |
| void | setActiveFields (std::optional< std::unordered_set< std::string > > activeFields) |
| std::optional< std::unordered_set< std::string > > | activeFields () const |
| virtual void | setProcessingPolicy (ProcessingPolicy policy) |
| ProcessingPolicy | processingPolicy () const |
| std::optional< uint32_t > | seed () const |
| Return the current seed (if there is one) | |
| virtual void | seedRandomEngine (uint32_t seed) |
| Set a seed for the random generator. | |
| ML::ComputingDevice | computingDevice () const |
| Get the computing device. | |
| virtual void | setComputingDevice (ML::ComputingDevice device) |
| Set the computing device selection strategy. | |
| void | configFailed (const std::string &missingParam) const |
| Helper function to show an error message due to a bad configuration. | |
| void | logDeprecatedParam (const std::string &oldName, const std::string &newName) const |
| Helper function to print a warning because of a deprecated parameter has been specified. | |
| bool | errorOnUnexpectedBehaviour () const |
| Get the policy whether to treat unexpected behavior warnings as errors. | |
| virtual void | setErrorOnUnexpectedBehaviour (bool error) |
| Treat unexpected behavior warnings as errors. | |
| void | registerParameter (ParameterBase *param) |
| Register a parameter so that the operation knows about it, and can automatically configure it (unless it has been marked as manually configured parameter via the Operation::setManuallyConfiguredParameters method). | |
| std::vector< ParameterBase * > | parameters () const |
| Return the list of registered parameters. | |
| virtual bool | doesNotModifyInput () const |
| Returns whether the operation is guaranteed to not modify its input element, either because it computes its output out-of-place or because it is a no-op. | |
| virtual bool | supportsInversion () const |
Whether the operation supports inversion. Returns False unless the operation derives from InvertibleOperation. | |
| const std::string & | recordIdentifier () const |
| Get the operation's record identifier. | |
| virtual void | setRecordIdentifier (const std::string &recordIdentifier) |
| Set the operation's record identifier. | |
| const std::string & | logDomain () const |
| Log domain for AdvancedParameter. | |
| std::optional< std::unordered_set< std::string > > | selectedFields (const DataItem &item) |
| Get the fields on which the operation will be applied. | |
Static Public Member Functions | |
| static std::string | processingPolicyToString (const ProcessingPolicy policy) |
| static ProcessingPolicy | stringToProcessingPolicy (const std::string &s) |
| static std::unique_ptr< Operation > | createFromFactories (const Operation::Specs &specs) |
| Helper function to create an operation from any factory (both C++ and Python factories are tested) | |
Protected Member Functions | |
| virtual std::shared_ptr< SharedImageSet > | processImages (std::shared_ptr< SharedImageSet > input) const |
| Virtual function that every subclass should override. | |
| virtual std::shared_ptr< BoundingBoxSet > | processBoxes (std::shared_ptr< BoundingBoxSet > input) const |
| Virtual function that every subclass should override. | |
| virtual std::shared_ptr< KeypointSet > | processPoints (std::shared_ptr< KeypointSet > input) const |
| Virtual function that every subclass should override. | |
| virtual std::shared_ptr< SharedImageSet > | processVectors (std::shared_ptr< SharedImageSet > input) const |
| Virtual function that every subclass should override. | |
| virtual std::shared_ptr< TensorSet > | processTensors (std::shared_ptr< TensorSet > input) const |
| void | throwOperationError (const std::string &msg) const |
| Helper function to throw an exception due to a runtime error. | |
| void | warnOperationUnexpectedBehaviour (const std::string &msg) const |
| Helper function to warn about a behavior different than asked. | |
| bool | inputIsEmptyOrNull (const SharedImageSet *input) const |
| Helper function to check if the input is empty or null and print a warning if so. | |
| virtual bool | useGPU (const SharedImageSet *input) const |
| Helper function that returns which device the operation should choose based on its configuration and a given input. | |
| void | prepareInputForDevice (SharedImageSet &input) const |
| Make sure the input is on the correct device for the current device strategy. | |
| virtual bool | allowChannelBatchOnGPU () const |
| Whether the operation implements channel-batching so that it can still be run on input with more than 4 channels. | |
| bool | configureOnly (const Properties &properties, const std::vector< ParameterBase * > ¶mSelection) noexcept |
| Helper method to configure only a subset of parameters. | |
| void | setManuallyConfiguredParameters (const std::vector< ParameterBase * > &manuallyConfiguredParams) |
| Disable the auto-configuration of some of the parameters so that they can be parsed manually (in the configure function of the derived class). | |
| void | applyPreProcessHooks (DataElement *element) |
| Apply the current pre-process hooks to an element. | |
| void | applyPostProcessHooks (DataElement *element) |
| Apply the current post-process hooks to an element. | |
Protected Attributes | |
| std::string | m_name |
| ProcessingPolicy | m_processingFieldsPolicy |
| Flag specifying whether labels should be processed by default (when no active field has been specified) | |
| std::optional< std::unordered_set< std::string > > | m_activeFields |
| Run the Operation only on those fields (if empty, will select suitable fields based on the current processing policy) when calling process() | |
| std::unordered_set< std::string > | m_alreadyWarned |
| Set of warnings about unexpected behavior that have already been printed. | |
| bool | m_errorOnUnexpectedBehaviour = false |
| Whether to throw an exception instead of warning about unexpected behavior. | |
| std::optional< uint32_t > | m_seed |
| Random::Generator | m_randGenerator |
| ML::ComputingDevice | m_device = ML::ComputingDevice::GPUIfOpenGl |
| std::vector< ParameterBase * > | m_params |
| All registered parameters. | |
| std::vector< ParameterBase * > | m_manuallyConfiguredParams |
| All registered parameters that should not be configured automatically. | |
| std::unordered_map< std::string, ElementType > | m_requiredFieldsTypes |
| List of all required field types used by checkRequiredItemsTypes. | |
| std::string | m_recordIdentifier |
| User-provided unique identifier for this operation, used for recording processing history and inversion. | |
| std::vector< PreProcessHook > | m_preProcessHooks |
| std::vector< PostProcessHook > | m_postProcessHooks |
| std::vector< PreProcessHook > | m_temporaryPreProcessHooks |
| Pre-process hooks that will be used for the next processing call only. | |
| std::vector< PostProcessHook > | m_temporaryPostProcessHooks |
| Post-process hooks that will be used for the next processing call only. | |
| enum ProcessingPolicy |
Policy used by default when selecting on the fields on which the operation will be applied Note that "Labels" here refers to the target tag, not to be confused with Data::Modality::LABEL.
| Enumerator | |
|---|---|
| EverythingExceptLabels | all images but label maps |
| Everything | all images |
| OnlyLabels | only label maps |
|
virtual |
Main function that processes a DataItem in-place, may throw OperationException The data to be processed is determined by the active fields (if set) and the processing policy otherwise (if set), otherwise all fields are processed.
Reimplemented in CropAroundVertebraeOperation, ConeBeamSimulationOperation, SimulateCBCTOperation, XRaySamplingOperation, AddDegradedLabelAsChannelOperation, BlobsFromKeypointsOperation, CheckDataOperation, ConvolutionalCRFOperation, CopyOperation, CropAroundLabelMapOperation, DeformationOperation, ForegroundGuidedLabelUpsamplingOperation, GenerateRandomKeypointsOperation, ImageMathOperation, ImageROISampler, InverseOperation, KeepLargestComponentOperation, KeypointsFromBlobsOperation, MatrixBasedOperation, MergeAsChannelsOperation, OrientedROISampler, RandomChoiceOperation, RandomImageFromLabelOperation, RandomOperation< BaseOp >, RandomOperation< AddDegradedLabelAsChannelOperation >, RandomOperation< AddRandomNoiseOperation >, RandomOperation< AxisFlipOperation >, RandomOperation< AxisRotationOperation >, RandomOperation< ConeBeamSimulationOperation >, RandomOperation< CropAroundLabelMapOperation >, RandomOperation< CropOperation >, RandomOperation< CutOutOperation >, RandomOperation< DeformationOperation >, RandomOperation< ExtractSubsetOperation >, RandomOperation< FrameFromVolumeOperation >, RandomOperation< GammaCorrectionOperation >, RandomOperation< InvertOperation >, RandomOperation< LinearIntensityMappingOperation >, RandomOperation< MRIBiasFieldGenerationOperation >, RandomOperation< PolyCropOperation >, RandomOperation< ResolutionReductionOperation >, RandomOperation< RotationOperation >, RandomOperation< ScalingOperation >, RandomOperation< SimulateCBCTOperation >, RandomOperation< SmoothOperation >, RandomOperation< TemplateInpaintingOperation >, RandomOperation< XRayFixtureOperation >, RandomOperation< XRaySamplingOperation >, RandomOperation< XRayUndoLogConversionOperation >, RectifyRotationOperation, RemoveOperation, RenameOperation, RotationOperation, RunModelOperation, SelectChannelsOperation, SetMatrixToIdentityOperation, SetSpacingOperation, SplitIntoPatchesOperation, SwapImageAndLabelsOperation, and TagDataElementOperation.
|
virtual |
Utility function to directly apply an operation on a SharedImageSet irrespective of active fields and processing policy.
Reimplemented in CheckDataOperation, ConvolutionalCRFOperation, InverseOperation, KeepLargestComponentOperation, MatrixBasedOperation, RandomOperation< BaseOp >, RandomOperation< AddDegradedLabelAsChannelOperation >, RandomOperation< AddRandomNoiseOperation >, RandomOperation< AxisFlipOperation >, RandomOperation< AxisRotationOperation >, RandomOperation< ConeBeamSimulationOperation >, RandomOperation< CropAroundLabelMapOperation >, RandomOperation< CropOperation >, RandomOperation< CutOutOperation >, RandomOperation< DeformationOperation >, RandomOperation< ExtractSubsetOperation >, RandomOperation< FrameFromVolumeOperation >, RandomOperation< GammaCorrectionOperation >, RandomOperation< InvertOperation >, RandomOperation< LinearIntensityMappingOperation >, RandomOperation< MRIBiasFieldGenerationOperation >, RandomOperation< PolyCropOperation >, RandomOperation< ResolutionReductionOperation >, RandomOperation< RotationOperation >, RandomOperation< ScalingOperation >, RandomOperation< SimulateCBCTOperation >, RandomOperation< SmoothOperation >, RandomOperation< TemplateInpaintingOperation >, RandomOperation< XRayFixtureOperation >, RandomOperation< XRaySamplingOperation >, RandomOperation< XRayUndoLogConversionOperation >, RectifyRotationOperation, RotationOperation, SelectChannelsOperation, SetMatrixToIdentityOperation, and SplitIntoPatchesOperation.
|
virtual |
Utility function to directly apply an operation on a set of KeypointSet irrespective of active fields and processing policy.
Reimplemented in CheckDataOperation, ConvolutionalCRFOperation, KeepLargestComponentOperation, MatrixBasedOperation, RandomOperation< BaseOp >, RandomOperation< AddDegradedLabelAsChannelOperation >, RandomOperation< AddRandomNoiseOperation >, RandomOperation< AxisFlipOperation >, RandomOperation< AxisRotationOperation >, RandomOperation< ConeBeamSimulationOperation >, RandomOperation< CropAroundLabelMapOperation >, RandomOperation< CropOperation >, RandomOperation< CutOutOperation >, RandomOperation< DeformationOperation >, RandomOperation< ExtractSubsetOperation >, RandomOperation< FrameFromVolumeOperation >, RandomOperation< GammaCorrectionOperation >, RandomOperation< InvertOperation >, RandomOperation< LinearIntensityMappingOperation >, RandomOperation< MRIBiasFieldGenerationOperation >, RandomOperation< PolyCropOperation >, RandomOperation< ResolutionReductionOperation >, RandomOperation< RotationOperation >, RandomOperation< ScalingOperation >, RandomOperation< SimulateCBCTOperation >, RandomOperation< SmoothOperation >, RandomOperation< TemplateInpaintingOperation >, RandomOperation< XRayFixtureOperation >, RandomOperation< XRaySamplingOperation >, RandomOperation< XRayUndoLogConversionOperation >, RectifyRotationOperation, RotationOperation, SelectChannelsOperation, SetMatrixToIdentityOperation, and SplitIntoPatchesOperation.
|
virtual |
Utility function to directly apply an operation on a set of BoundingBoxSet irrespective of active fields and processing policy.
Reimplemented in CheckDataOperation, ConvolutionalCRFOperation, KeepLargestComponentOperation, MatrixBasedOperation, RandomOperation< BaseOp >, RandomOperation< AddDegradedLabelAsChannelOperation >, RandomOperation< AddRandomNoiseOperation >, RandomOperation< AxisFlipOperation >, RandomOperation< AxisRotationOperation >, RandomOperation< ConeBeamSimulationOperation >, RandomOperation< CropAroundLabelMapOperation >, RandomOperation< CropOperation >, RandomOperation< CutOutOperation >, RandomOperation< DeformationOperation >, RandomOperation< ExtractSubsetOperation >, RandomOperation< FrameFromVolumeOperation >, RandomOperation< GammaCorrectionOperation >, RandomOperation< InvertOperation >, RandomOperation< LinearIntensityMappingOperation >, RandomOperation< MRIBiasFieldGenerationOperation >, RandomOperation< PolyCropOperation >, RandomOperation< ResolutionReductionOperation >, RandomOperation< RotationOperation >, RandomOperation< ScalingOperation >, RandomOperation< SimulateCBCTOperation >, RandomOperation< SmoothOperation >, RandomOperation< TemplateInpaintingOperation >, RandomOperation< XRayFixtureOperation >, RandomOperation< XRaySamplingOperation >, RandomOperation< XRayUndoLogConversionOperation >, RectifyRotationOperation, RotationOperation, SelectChannelsOperation, SetMatrixToIdentityOperation, and SplitIntoPatchesOperation.
|
finalvirtual |
Utility function with unique_ptr as input and output to avoid breaking changes (must not be overridden)
Reimplemented in CheckDataOperation, ConvolutionalCRFOperation, KeepLargestComponentOperation, MatrixBasedOperation, RandomOperation< BaseOp >, RandomOperation< AddDegradedLabelAsChannelOperation >, RandomOperation< AddRandomNoiseOperation >, RandomOperation< AxisFlipOperation >, RandomOperation< AxisRotationOperation >, RandomOperation< ConeBeamSimulationOperation >, RandomOperation< CropAroundLabelMapOperation >, RandomOperation< CropOperation >, RandomOperation< CutOutOperation >, RandomOperation< DeformationOperation >, RandomOperation< ExtractSubsetOperation >, RandomOperation< FrameFromVolumeOperation >, RandomOperation< GammaCorrectionOperation >, RandomOperation< InvertOperation >, RandomOperation< LinearIntensityMappingOperation >, RandomOperation< MRIBiasFieldGenerationOperation >, RandomOperation< PolyCropOperation >, RandomOperation< ResolutionReductionOperation >, RandomOperation< RotationOperation >, RandomOperation< ScalingOperation >, RandomOperation< SimulateCBCTOperation >, RandomOperation< SmoothOperation >, RandomOperation< TemplateInpaintingOperation >, RandomOperation< XRayFixtureOperation >, RandomOperation< XRaySamplingOperation >, RandomOperation< XRayUndoLogConversionOperation >, RectifyRotationOperation, RotationOperation, SelectChannelsOperation, SetMatrixToIdentityOperation, and SplitIntoPatchesOperation.
|
inline |
Add a temporary hook that will only be active for the next process call and then automatically removed after the DataItem is processed.
| hook | The hook function to add |
|
inline |
Add a temporary hook that will only be active for the next process call and then automatically removed after the DataItem is processed.
| hook | The hook function to add |
|
virtual |
Configure an Operation with the given properties and return whether the configuration was successful.
Reimplemented in AddPositionChannelOperation, AddRandomNoiseOperation, ApplyTopDownFlagOperation, AxisFlipOperation, AxisRotationOperation, DeformationOperation, InverseOperation, KeepLargestComponentOperation, LabelROISampler, MakeFloatOperation, MorphologicalFilterOperation, MRIBiasFieldCorrectionOperation, NormalizeMADOperation, NormalizePercentileOperation, NormalizeUniformOperation, PadDimsOperation, PadDimsToNextMultipleOperation, PadOperation, RandomAddDegradedLabelAsChannelOperation, RandomAxisFlipOperation, RandomAxisRotationOperation, RandomChoiceOperation, RandomImageFromLabelOperation, RandomOperation< BaseOp >, RandomOperation< AddDegradedLabelAsChannelOperation >, RandomOperation< AddRandomNoiseOperation >, RandomOperation< AxisFlipOperation >, RandomOperation< AxisRotationOperation >, RandomOperation< ConeBeamSimulationOperation >, RandomOperation< CropAroundLabelMapOperation >, RandomOperation< CropOperation >, RandomOperation< CutOutOperation >, RandomOperation< DeformationOperation >, RandomOperation< ExtractSubsetOperation >, RandomOperation< FrameFromVolumeOperation >, RandomOperation< GammaCorrectionOperation >, RandomOperation< InvertOperation >, RandomOperation< LinearIntensityMappingOperation >, RandomOperation< MRIBiasFieldGenerationOperation >, RandomOperation< PolyCropOperation >, RandomOperation< ResolutionReductionOperation >, RandomOperation< RotationOperation >, RandomOperation< ScalingOperation >, RandomOperation< SimulateCBCTOperation >, RandomOperation< SmoothOperation >, RandomOperation< TemplateInpaintingOperation >, RandomOperation< XRayFixtureOperation >, RandomOperation< XRaySamplingOperation >, RandomOperation< XRayUndoLogConversionOperation >, RandomRotationOperation, RandomScalingOperation, ReplaceLabelsValuesOperation, ResampleKeepingAspectRatioOperation, RotationOperation, ScalingOperation, SmoothOperation, SplitIntoPatchesOperation, and SplitROISampler.
|
virtual |
Return the Operation configuration.
Reimplemented in AddRandomNoiseOperation, InverseOperation, RandomChoiceOperation, RandomOperation< BaseOp >, RandomOperation< AddDegradedLabelAsChannelOperation >, RandomOperation< AddRandomNoiseOperation >, RandomOperation< AxisFlipOperation >, RandomOperation< AxisRotationOperation >, RandomOperation< ConeBeamSimulationOperation >, RandomOperation< CropAroundLabelMapOperation >, RandomOperation< CropOperation >, RandomOperation< CutOutOperation >, RandomOperation< DeformationOperation >, RandomOperation< ExtractSubsetOperation >, RandomOperation< FrameFromVolumeOperation >, RandomOperation< GammaCorrectionOperation >, RandomOperation< InvertOperation >, RandomOperation< LinearIntensityMappingOperation >, RandomOperation< MRIBiasFieldGenerationOperation >, RandomOperation< PolyCropOperation >, RandomOperation< ResolutionReductionOperation >, RandomOperation< RotationOperation >, RandomOperation< ScalingOperation >, RandomOperation< SimulateCBCTOperation >, RandomOperation< SmoothOperation >, RandomOperation< TemplateInpaintingOperation >, RandomOperation< XRayFixtureOperation >, RandomOperation< XRaySamplingOperation >, RandomOperation< XRayUndoLogConversionOperation >, RandomRotationOperation, RotationOperation, and SmoothOperation.
|
virtual |
Set a seed for the random generator.
Reimplemented in RandomChoiceOperation, RandomOperation< BaseOp >, RandomOperation< AddDegradedLabelAsChannelOperation >, RandomOperation< AddRandomNoiseOperation >, RandomOperation< AxisFlipOperation >, RandomOperation< AxisRotationOperation >, RandomOperation< ConeBeamSimulationOperation >, RandomOperation< CropAroundLabelMapOperation >, RandomOperation< CropOperation >, RandomOperation< CutOutOperation >, RandomOperation< DeformationOperation >, RandomOperation< ExtractSubsetOperation >, RandomOperation< FrameFromVolumeOperation >, RandomOperation< GammaCorrectionOperation >, RandomOperation< InvertOperation >, RandomOperation< LinearIntensityMappingOperation >, RandomOperation< MRIBiasFieldGenerationOperation >, RandomOperation< PolyCropOperation >, RandomOperation< ResolutionReductionOperation >, RandomOperation< RotationOperation >, RandomOperation< ScalingOperation >, RandomOperation< SimulateCBCTOperation >, RandomOperation< SmoothOperation >, RandomOperation< TemplateInpaintingOperation >, RandomOperation< XRayFixtureOperation >, RandomOperation< XRaySamplingOperation >, and RandomOperation< XRayUndoLogConversionOperation >.
|
inlinevirtual |
Set the computing device selection strategy.
Reimplemented in InverseOperation, RandomChoiceOperation, RandomOperation< BaseOp >, RandomOperation< AddDegradedLabelAsChannelOperation >, RandomOperation< AddRandomNoiseOperation >, RandomOperation< AxisFlipOperation >, RandomOperation< AxisRotationOperation >, RandomOperation< ConeBeamSimulationOperation >, RandomOperation< CropAroundLabelMapOperation >, RandomOperation< CropOperation >, RandomOperation< CutOutOperation >, RandomOperation< DeformationOperation >, RandomOperation< ExtractSubsetOperation >, RandomOperation< FrameFromVolumeOperation >, RandomOperation< GammaCorrectionOperation >, RandomOperation< InvertOperation >, RandomOperation< LinearIntensityMappingOperation >, RandomOperation< MRIBiasFieldGenerationOperation >, RandomOperation< PolyCropOperation >, RandomOperation< ResolutionReductionOperation >, RandomOperation< RotationOperation >, RandomOperation< ScalingOperation >, RandomOperation< SimulateCBCTOperation >, RandomOperation< SmoothOperation >, RandomOperation< TemplateInpaintingOperation >, RandomOperation< XRayFixtureOperation >, RandomOperation< XRaySamplingOperation >, and RandomOperation< XRayUndoLogConversionOperation >.
|
inlinevirtual |
Treat unexpected behavior warnings as errors.
Reimplemented in RandomOperation< BaseOp >, RandomOperation< AddDegradedLabelAsChannelOperation >, RandomOperation< AddRandomNoiseOperation >, RandomOperation< AxisFlipOperation >, RandomOperation< AxisRotationOperation >, RandomOperation< ConeBeamSimulationOperation >, RandomOperation< CropAroundLabelMapOperation >, RandomOperation< CropOperation >, RandomOperation< CutOutOperation >, RandomOperation< DeformationOperation >, RandomOperation< ExtractSubsetOperation >, RandomOperation< FrameFromVolumeOperation >, RandomOperation< GammaCorrectionOperation >, RandomOperation< InvertOperation >, RandomOperation< LinearIntensityMappingOperation >, RandomOperation< MRIBiasFieldGenerationOperation >, RandomOperation< PolyCropOperation >, RandomOperation< ResolutionReductionOperation >, RandomOperation< RotationOperation >, RandomOperation< ScalingOperation >, RandomOperation< SimulateCBCTOperation >, RandomOperation< SmoothOperation >, RandomOperation< TemplateInpaintingOperation >, RandomOperation< XRayFixtureOperation >, RandomOperation< XRaySamplingOperation >, and RandomOperation< XRayUndoLogConversionOperation >.
| void registerParameter | ( | ParameterBase * | param | ) |
Register a parameter so that the operation knows about it, and can automatically configure it (unless it has been marked as manually configured parameter via the Operation::setManuallyConfiguredParameters method).
This function is automatically called by each parameter if they have a parent operation, which should be the standard case.
|
inlinevirtual |
Returns whether the operation is guaranteed to not modify its input element, either because it computes its output out-of-place or because it is a no-op.
This can be used to decide whether a copy of the input should be made before calling the Operation::process function. Note that this only relates to the overloads taking specific elements as inputs (e.g. images, keypoints, etc.), since the Operation::process(DataItem& item) function always modifies its input.
Reimplemented in AddCenterBoxOperation, AddDegradedLabelAsChannelOperation, AddPixelwisePredictionChannelOperation, AddPositionChannelOperation, AddRandomNoiseOperation, AdjustShiftScaleOperation, ApplyTopDownFlagOperation, ApproximateToHigherResolutionOperation, ArgMaxOperation, AxisFlipOperation, AxisRotationOperation, BakeDeformationOperation, BakePhotometricInterpretationOperation, BakeTransformationOperation, BlobsFromKeypointsOperation, CheckDataOperation, ClipOperation, ConcatenateNeighboringFramesToChannelsOperation, ConvertSlicesToVolumeOperation, ConvertToGrayOperation, ConvertVolumeToSlicesOperation, ConvolutionalCRFOperation, CopyOperation, CropAroundLabelMapOperation, CropOperation, CutOutOperation, DeformationOperation, EnsureExplicitMaskOperation, EnsureOneToOneMatrixMappingOperation, ExtractSubsetOperation, ForegroundGuidedLabelUpsamplingOperation, GammaCorrectionOperation, HighPassOperation, ImageMathOperation, ImageMattingOperation, ImageROISampler, InverseOperation, InvertOperation, KeepLargestComponentOperation, KeypointsFromBlobsOperation, LinearIntensityMappingOperation, MakeFloatOperation, MergeAsChannelsOperation, MorphologicalFilterOperation, MRIBiasFieldCorrectionOperation, MRIBiasFieldGenerationOperation, NormalizeMADOperation, NormalizeNormalOperation, NormalizePercentileOperation, NormalizeUniformOperation, OneHotOperation, PadDimsOperation, PadDimsToNextMultipleOperation, PadOperation, PolyCropOperation, RandomChoiceOperation, RandomImageFromLabelOperation, RandomKeypointJitterOperation, RandomOperation< BaseOp >, RandomOperation< AddDegradedLabelAsChannelOperation >, RandomOperation< AddRandomNoiseOperation >, RandomOperation< AxisFlipOperation >, RandomOperation< AxisRotationOperation >, RandomOperation< ConeBeamSimulationOperation >, RandomOperation< CropAroundLabelMapOperation >, RandomOperation< CropOperation >, RandomOperation< CutOutOperation >, RandomOperation< DeformationOperation >, RandomOperation< ExtractSubsetOperation >, RandomOperation< FrameFromVolumeOperation >, RandomOperation< GammaCorrectionOperation >, RandomOperation< InvertOperation >, RandomOperation< LinearIntensityMappingOperation >, RandomOperation< MRIBiasFieldGenerationOperation >, RandomOperation< PolyCropOperation >, RandomOperation< ResolutionReductionOperation >, RandomOperation< RotationOperation >, RandomOperation< ScalingOperation >, RandomOperation< SimulateCBCTOperation >, RandomOperation< SmoothOperation >, RandomOperation< TemplateInpaintingOperation >, RandomOperation< XRayFixtureOperation >, RandomOperation< XRaySamplingOperation >, RandomOperation< XRayUndoLogConversionOperation >, RecombinePatchesOperation, RectifyRotationOperation, RemoveMaskOperation, RemoveOperation, RenameOperation, ReplaceLabelsValuesOperation, ResampleDimsOperation, ResampleKeepingAspectRatioOperation, ResampleOperation, ResampleToInputOperation, ResolutionReductionOperation, RotationOperation, RunModelOperation, ScalingOperation, SelectChannelsOperation, SetMatrixToIdentityOperation, SetModalityOperation, SetSpacingOperation, SigmoidOperation, SmoothOperation, SoftmaxOperation, SplitIntoPatchesOperation, StandardizeImageAxesOperation, SwapImageAndLabelsOperation, SyncOperation, TagDataElementOperation, TanhOperation, TemplateInpaintingOperation, ThresholdOperation, and UndoPaddingOperation.
|
virtual |
Whether the operation supports inversion. Returns False unless the operation derives from InvertibleOperation.
Reimplemented in InvertibleOperation.
|
inlinevirtual |
Set the operation's record identifier.
Reimplemented in PadDimsOperation, and PadDimsToNextMultipleOperation.
| std::optional< std::unordered_set< std::string > > selectedFields | ( | const DataItem & | item | ) |
Get the fields on which the operation will be applied.
If active fields have been specified, will return them. Otherwise, will return the subset of the item's fields based on the default processing policy. A std::nullopt return value means that all fields should be considered.
|
protectedvirtual |
Virtual function that every subclass should override.
Default implementation does nothing, so if those function are not implemented in a derived class, they won't act on the input in any way.
Reimplemented in SmoothCTEdgesOperation, XRayFixtureOperation, XRayUndoLogConversionOperation, AddCenterBoxOperation, AddPixelwisePredictionChannelOperation, AddPositionChannelOperation, AddRandomNoiseOperation, AdjustShiftScaleOperation, ApplyTopDownFlagOperation, ApproximateToHigherResolutionOperation, ArgMaxOperation, AxisFlipOperation, AxisRotationOperation, BakeDeformationOperation, BakePhotometricInterpretationOperation, BakeTransformationOperation, CheckDataOperation, ClipOperation, ConcatenateNeighboringFramesToChannelsOperation, ConvertSlicesToVolumeOperation, ConvertToGrayOperation, ConvertVolumeToSlicesOperation, ConvolutionalCRFOperation, CropOperation, CutOutOperation, DeformationOperation, EnsureExplicitMaskOperation, EnsureOneToOneMatrixMappingOperation, ExtractSubsetOperation, GammaCorrectionOperation, HighPassOperation, ImageMattingOperation, ImageROISampler, InvertOperation, KeepLargestComponentOperation, LinearIntensityMappingOperation, MakeFloatOperation, MorphologicalFilterOperation, MRIBiasFieldCorrectionOperation, MRIBiasFieldGenerationOperation, NormalizeMADOperation, NormalizeNormalOperation, NormalizePercentileOperation, NormalizeUniformOperation, OneHotOperation, PadDimsOperation, PadDimsToNextMultipleOperation, PadOperation, PolyCropOperation, RandomImageFromLabelOperation, RecombinePatchesOperation, RectifyRotationOperation, RemoveMaskOperation, ReplaceLabelsValuesOperation, ResampleDimsOperation, ResampleKeepingAspectRatioOperation, ResampleOperation, ResampleToInputOperation, ResolutionReductionOperation, RotationOperation, ScalingOperation, SelectChannelsOperation, SetMatrixToIdentityOperation, SetModalityOperation, SigmoidOperation, SmoothOperation, SoftmaxOperation, SplitIntoPatchesOperation, StandardizeImageAxesOperation, SyncOperation, TanhOperation, TemplateInpaintingOperation, ThresholdOperation, UndoPaddingOperation, and FrameFromVolumeOperation.
|
protectedvirtual |
Virtual function that every subclass should override.
Default implementation does nothing, so if those function are not implemented in a derived class, they won't act on the input in any way.
Reimplemented in ConvertSlicesToVolumeOperation, ConvertVolumeToSlicesOperation, DeformationOperation, ExtractSubsetOperation, ImageROISampler, MatrixBasedOperation, SelectChannelsOperation, and FrameFromVolumeOperation.
|
protectedvirtual |
Virtual function that every subclass should override.
Default implementation does nothing, so if those function are not implemented in a derived class, they won't act on the input in any way.
Reimplemented in ConvertSlicesToVolumeOperation, ConvertVolumeToSlicesOperation, DeformationOperation, ExtractSubsetOperation, ImageROISampler, MatrixBasedOperation, RandomKeypointJitterOperation, SelectChannelsOperation, and FrameFromVolumeOperation.
|
protectedvirtual |
Virtual function that every subclass should override.
Default implementation does nothing, so if those function are not implemented in a derived class, they won't act on the input in any way.
Reimplemented in AddRandomNoiseOperation, ArgMaxOperation, ClipOperation, ExtractSubsetOperation, ImageROISampler, InvertOperation, LinearIntensityMappingOperation, OneHotOperation, ReplaceLabelsValuesOperation, SelectChannelsOperation, SigmoidOperation, SoftmaxOperation, TanhOperation, and ThresholdOperation.
|
protectedvirtual |
Helper function that returns which device the operation should choose based on its configuration and a given input.
Reimplemented in OneHotOperation.
|
inlineprotectedvirtual |
Whether the operation implements channel-batching so that it can still be run on input with more than 4 channels.
Reimplemented in ForegroundGuidedLabelUpsamplingOperation, MatrixBasedOperation, ResampleDimsOperation, ResampleOperation, ResampleToInputOperation, ResolutionReductionOperation, ScalingOperation, and StandardizeImageAxesOperation.
|
protectednoexcept |
Helper method to configure only a subset of parameters.
Useful when configuring Operations derived from other operations.
|
protected |
Disable the auto-configuration of some of the parameters so that they can be parsed manually (in the configure function of the derived class).
This mechanism is only useful in a small number of cases.
|
protected |
Apply the current pre-process hooks to an element.
| element | The element to apply hooks to |
|
protected |
Apply the current post-process hooks to an element.
| element | The element to apply hooks to |
|
mutableprotected |
Set of warnings about unexpected behavior that have already been printed.
|
protected |
List of all required field types used by checkRequiredItemsTypes.
|
protected |
User-provided unique identifier for this operation, used for recording processing history and inversion.
Setting this parameter to a non-empty string allows the operation to be inverted using InverseOperation if the operation supports inversion.