ImFusion SDK 4.3
OperationsSequence Class Reference

#include <ImFusion/ML/OperationsSequence.h>

Class to execute a sequence of Operation, depending on the workflow phase (training, validation, etc.). More...

Detailed Description

Class to execute a sequence of Operation, depending on the workflow phase (training, validation, etc.).

Public Types

using PhasedOperation = std::pair<std::shared_ptr<Operation>, Phase>
 

Public Member Functions

 OperationsSequence (bool verbose=false)
 
 OperationsSequence (const std::vector< Operation::Specs > &pipelineConfig, bool verbose=false)
 Constructs an operation sequence from a sequence of specification, each for a different operation.
 
 OperationsSequence (const OperationsSequence &that)=delete
 
OperationsSequenceoperator= (const OperationsSequence &that)=delete
 
 OperationsSequence (OperationsSequence &&that)=default
 
OperationsSequenceoperator= (OperationsSequence &&that)=default
 
Status addOperation (const Operation::Specs &specs)
 Add an operation specified by a configuration spec.
 
Status addOperation (std::shared_ptr< Operation > op, Phase phase=Phase::Always)
 Add an existing operation.
 
Status process (DataItem &item, Phase phase=Phase::Always) const
 Apply sequence of operations on all elements of the data item.
 
std::shared_ptr< SharedImageSetprocess (std::shared_ptr< SharedImageSet > input, Phase phase=Phase::Always) const
 Helper function to apply the sequence of operations on one input image.
 
std::pair< std::shared_ptr< SharedImageSet >, std::shared_ptr< SharedImageSet > > process (std::shared_ptr< SharedImageSet > input, std::shared_ptr< SharedImageSet > label, Phase phase=Phase::Always) const
 Helper function to apply the sequence of operations on input image and label.
 
std::vector< std::stringgetOperationNames () const
 Returns the names of the operations added so far.
 
std::vector< std::shared_ptr< Operation > > operations ()
 Returns a vector of shared_ptrs to the operations added so far.
 
bool ok () const
 Returns whether the operations sequence setup was successful.
 
Status status () const
 Returns status of the operations sequence setup.
 
void resetOperationSeeds ()
 Resets the random generator seeding of all the operations that where explicitly configured with a "seed" parameter.
 
void setOperationSeeds (unsigned int seed)
 Sets the random generator seeding of all the operations.
 
void setVerbose (bool verbose)
 Set the verbose flag.
 
void setOperationsComputingDevice (ML::ComputingDevice device)
 Set the computing device of all current operations.
 
void setErrorOnUnexpectedBehaviour (bool treatWarningsAsErrors)
 Treat unexpected behaviour warnings as errors.
 
bool doesNotModifyInput () const
 Returns true if the operation is guaranteed to not modify its input (either because it computes its output out-of-place or because it is a no-op).
 

Constructor & Destructor Documentation

◆ OperationsSequence()

OperationsSequence ( const std::vector< Operation::Specs > & pipelineConfig,
bool verbose = false )
explicit

Constructs an operation sequence from a sequence of specification, each for a different operation.

At each call to process each operation is applied in the order they were specified.

Parameters
pipelineConfigprocessing pipeline configuration sequence

Member Function Documentation

◆ addOperation() [1/2]

Status addOperation ( const Operation::Specs & specs)

Add an operation specified by a configuration spec.

Note
The required operation is created by the OperationFactory

◆ addOperation() [2/2]

Status addOperation ( std::shared_ptr< Operation > op,
Phase phase = Phase::Always )

Add an existing operation.

Parameters
opthe operation to add
phaselimits application of the op to a specific phase (i.e. Training, or Test)

◆ doesNotModifyInput()

bool doesNotModifyInput ( ) const

Returns true if the operation is guaranteed to not modify its input (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 OperationsSequence::process function. Note that this only relates to the overloads taking specific elements as inputs (e.g. images, keypoints, etc.), since the OperationsSequence::process(DataItem& item) function always modifies its input.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close