ImFusion C++ SDK 4.4.0
ImFusion::ML Namespace Reference

Namespace containing all the classes relevant for the data processing and the execution of machine learning models. More...

Detailed Description

Namespace containing all the classes relevant for the data processing and the execution of machine learning models.

See also
ImFusionML

Classes

class  AddPositionAsChannelAlgorithm
 Algorithm to add a new channel to a given image containing each pixel's position. More...
struct  ParamException
 Special type for handling exceptions during parameter configuration. More...
class  AdvancedParameter
 The AdvancedParameter class extends the Parameter class by providing some additional functionalities used in ML::Operation and ML::ImageROISampler classes, like specifying whether a parameter is required for the object to work, and automatically logging an error message in case the user doesn't provide it. More...
struct  Box
 Bounding Box for ML tasks Since bounding boxes are axis aligned by definition, a Box is represented by its center and its extent. More...
class  BoundingBoxSet
 Class for managing sets of bounding boxes within a BoundingBoxElement The class is meant to be used in parallel with SharedImageSet. More...
struct  CudaComputeCapability
 Helper struct to store the CUDA compute capability. More...
class  CudaDeviceManager
 Singleton class that helps getting a compatible CUDA device. More...
struct  DataElementException
 Custom exception thrown by some DataElement. More...
class  DataElement
 Main interface for data elements used for wrapping other ImFusion types and use them in a machine learning specific workflow. More...
struct  DataItemException
 Custom exception thrown by DataItem. More...
class  DataItem
 Class for holding a map of heterogeneous DataElements, see DataElement. More...
class  DataItemDisplayHandler
 DataDisplayHandler for DataItems. More...
struct  DataLoaderException
 Custom exception thrown by DataLoader. More...
class  DataLoader
 Interface for all data loaders, establishing the mechanism for loading and processing data. More...
class  DataReader
 Base class for data readers. More...
struct  DataLoaderSpecs
class  Dataset
 Class for creating an iterable dataset by chaining data loading and transforming operations executed in a lazy fashion. More...
class  Engine
 Generic interface for machine learning models serialized by specific frameworks (PyTorch, ONNX, etc.). More...
class  EngineConfiguration
class  GenerateBoxSegmentationTrainingDataAlgorithm
 Algorithm to generate learning data for box segmentation network. More...
class  Singleton
 Base class for singletons. More...
class  Registry
class  Factory
 Generic factory class for registering polymorphic types Usage: More...
class  GroupToDataItemAlgorithm
 Groups a list of Data into a DataItem. More...
struct  RegionOfInterest
 Helper struct to represent a region of interest. More...
struct  ImageSamplersException
 Custom exception. More...
class  ImageROISampler
 Interface for samplers used during training of machine learning models. More...
class  KeypointExtractionAlgorithm
 Algorithm for extracting keypoints from blobs representing the probability distribution of the keypoint location. More...
class  KeypointSet
 Class for managing sets of keypoints within a KeypointsElement The class is meant to be used in parallel with SharedImageSet. More...
class  KeypointSetIoAlgorithm
 Io Algorithm to load/save KeypointSet. More...
class  BoundingBoxSetIoAlgorithm
 Io Algorithm to load/save BoundingBoxSet. More...
class  LandmarkPredictionAlgorithm
 Algorithm to predict landmarks in an image. More...
class  ClassificationLearningEvaluation
 Class for evaluation of a binary classification method. More...
class  MultiClassificationLearningEvaluation
 Class for evaluation of a multi-label classification method. More...
class  RegressionLearningEvaluation
 Class for evaluation of a regression method. More...
class  LocalConvolutionalNetworkAlgorithm
 Algorithm to perform a Local (possibly augmented) prediction using a fully convolutional network around a central point. More...
class  LocalizeSegmentAlgorithm
 Localize & Segment Algorithm Runs an initial low resolution pixelwise segmentation to find a bounding box. More...
struct  MLModelException
 Custom exception thrown by MachineLearningModel. More...
class  MachineLearningModel
 Class for managing and executing a machine learning model on generic input data. More...
class  MachineLearningModelAlgorithm
 Generic algorithm to apply a machine learning model. More...
class  MarkovChain
class  MatrixBasedOperation
 Extension of the Operation class for operations based on a geometric transformation using a matrix (e.g. More...
class  Metric
 The Metric interface is a key part of our pipeline for standardized evaluations of a machine learning pipeline, or an algorithm in general. More...
struct  MetricException
 Custom exception for metrics. More...
class  MetricAlgorithm
 Algorithm to compute metrics from a generic list of data The selected metric need to be set via the configure method: DataList algoInput = {labelMap1.get(), labelMap2.get()}; MetricAlgorithm metricAlgo(algoInput); Properties algoProps; algoProps.setParam("metricName", "DiceMetric"); metricAlgo.configure(&algoProps); metricAlgo.compute(); std::vector<Metric::Record> results = metricAlgo.metricOutput();. More...
class  ImagewiseClassificationMetrics
 Compute the confusion matrix for a multi-class classification. More...
class  DiceMetric
 Compute the Dice score between a label map and a ground truth segmentation. More...
class  SurfaceDistancesMetric
 Compute a set of distance-based metrics between a label map and a ground truth segmentation. More...
class  PixelwiseClassificationMetrics
 Compute dense classification related metrics between a label map and a ground truth segmentation Precisely, computes the sensitivity, specificity, precision and recall. More...
struct  ElementTypeHash
 Hash function for the ElementType enum class. More...
class  TargetTag
 Simple data component to identify data that must be considered as learning target. More...
struct  Status
 Convenience tool for returning error messages together with statuses. More...
class  ModalitySynthesisAlgorithm
 Class for running an algorithm that that given an image in one modality generates the corresponding image in another modality. (e.g. MR to CT). More...
class  SamplingConfiguration
class  ModelConfiguration
 Configuration class for MachineLearningModel parameters. More...
class  MRIBiasFieldCorrectionAlgorithm
 Algorithm to perform bias field correction using an implicitly trained neural network This algorithm addresses the problem of intensity inhomogeneities "bias fields" in magnetic resonance imaging (MRI). More...
class  NetworkTrainingFileGenerator
 Generator of a Caffe neural network architecture text file from a set of the training data and some user-defined parameters This class is called from the GenerateCaffeTrainingDataAlgorithm to automatically produce a sample network suitable for training. More...
class  FileNotFoundError
class  IOError
struct  OperationException
 Custom exception to be used by Operation. More...
class  Operation
 Class to define a pre-post processing operation on data items. More...
class  InvertibleOperation
 Base class for operations that support inversion. More...
class  OperationsSequence
 Class to execute a sequence of Operation, depending on the workflow phase (training, validation, etc.). More...
class  OperationsSequenceAlgorithm
 Algorithm for running operations sequence on data. More...
class  OrderedMap
 Class for an insertion ordered map in order to mimic a python dictionary in C++ This is a convenience class which provides a similar interface to std::map and std::unordered_map It should be only used if there are not many elements to store or performance is not critical Due to its simple implementation it performs lookup only in O(N). More...
class  ProcessingRecordComponent
 Data component for keeping track of the data's origin. More...
class  RandomOperation
 Abstract class for random operations that build upon another one In order to create a randomized version of a BaseOperation, you need to derive from RandomOperation<BaseOperation> and just implement the method randomizeOperation. More...
class  Tensor
 Implementation of a Tensor class; used in TensorDataElement to directly present data to a neural network. More...
class  TensorSet
 Class for managing sets of tensors, one for each frame in the set. More...
struct  ReferenceImageDataComponent
 Data component used to store a reference image. More...
class  ImageResampler
 Helper class to run resampling algorithms within operations The class holds two permanent algorithm instances (one for images, one for labels) for the sake of efficiency Images with more 4 channels are properly handled so that GPU execution is still possible. More...
class  InverseOperation
 Operation that inverts a specific operation by using the InversionComponent. More...
class  AddCenterBoxOperation
 Add an additional channel to the input image with a binary box at its center. More...
class  AddPixelwisePredictionChannelOperation
 Run an existing pixelwise model and add result to the input image as additional channels. More...
class  AddPositionChannelOperation
 Add additional channels with the position of the pixels. More...
class  AddRandomNoiseOperation
 Apply a pixelwise random noise to the image intensities. More...
class  AdjustShiftScaleOperation
 Apply a shift and scale to each channel of the input image. More...
class  ApplyTopDownFlagOperation
 Flip the input image if it has a topDown flag set to false. More...
class  ApproximateToHigherResolutionOperation
 Replicate the input image from the original reference image (in ReferenceImageDataComponent). More...
class  ArgMaxOperation
 Create a label map with the indices corresponding of the input channel with the highest value. More...
class  AxisFlipOperation
 Flip image content along specified set of axes. More...
class  AxisRotationOperation
 Rotate image around image axis with axis-specific rotation angles that are signed multiples of 90 degrees. More...
class  BakeDeformationOperation
 Deform an image with its attached Deformation and store the result into the returned output image. More...
class  BakePhotometricInterpretationOperation
 Bake the Photometric Interpretation into the intensities of the image. More...
class  BakeTransformationOperation
 Apply the rotation contained in the matrix of the input volume. More...
class  BlobsFromKeypointsOperation
 Transforms keypoints into an actual image (blob map with the same size of the image). More...
class  CheckDataOperation
 Checks if all input data match a set of expected conditions. More...
class  ClipOperation
 Clip the intensities to a minimum and maximum value. More...
class  ConvertSlicesToVolumeOperation
 Stacks a set of 2D images extracted along a specified axis into an actual 3D volume. More...
class  ConvertToGrayOperation
 Convert the input image to a single channel image by averaging all channels. More...
class  ConvertVolumeToSlicesOperation
 Unstacks a 3D volume to a set of 2D images extracted along one of the axes. More...
class  ConvolutionalCRFOperation
 Adapt segmentation map or raw output of model to image content. More...
class  CopyOperation
 Copies a set of fields of a data item. More...
class  CropAroundLabelMapOperation
 Selects the given label from a multi-label, and crops the image and labels around it. More...
class  AddDegradedLabelAsChannelOperation
 Operation to add a channel with blobs whose sign depends on the label. More...
class  CropOperation
 Crop input images and label maps with a given size and offset. More...
class  CutOutOperation
 Cut out input images and label maps with a given size, offset and fill values. More...
class  DeformationOperation
 Apply a deformation to the image using a specified control point grid and specified displacements. More...
class  EnsureExplicitMaskOperation
 Converts the existing mask of all input images into explicit masks. More...
class  EnsureOneToOneMatrixMappingOperation
 Ensures that it is possible to get/set the matrix of each frame of the input image set independently. More...
class  ExtractRandomSubsetOperation
 Extracts a random subset from a SharedImageSet. More...
class  ExtractSubsetOperation
 Extracts a subset from a SharedImageSet. More...
class  GammaCorrectionOperation
 Apply a gamma correction which changes the overall contrast. More...
class  GenerateRandomKeypointsOperation
 Generate uniformly distributed random keypoints in the image. More...
class  HighPassOperation
 Smooths the input image with a Gaussian kernel with half_kernel_size, then subtracts the smoothed image from the input, resulting in a reduction of low-frequency components. More...
class  ImageMathOperation
 Computes a specified formula involving images from the input dataitem. More...
class  ImageMattingOperation
 Refine edges of label-map based on the intensities of the input image. More...
class  InvertOperation
 Invert the intensities of the image. More...
class  KeypointsFromBlobsOperation
 Extracts keypoints from a blob image Requires an image called label keypoints_field_name (str): Field name of the output keypoints keypoint_extraction_mode (int): Extraction mode: 0: Max, 1: Mean, 2: Local Max. More...
class  KeepLargestComponentOperation
 Create a label map with the largest components above the specified threshold. More...
class  ForegroundGuidedLabelUpsamplingOperation
 Operation that generates a label map by upsampling or resampling a multi-class one-hot encoded image (such as a softmax model prediction) to the space of a binary image (such as a sigmoid model prediction). More...
class  LinearIntensityMappingOperation
 Apply a linear shift and scale to the image intensities. More...
class  MRIBiasFieldCorrectionOperation
 Operation to perform bias field correction using an implicitly trained neural network (see MRIBiasFieldCorrectionAlgorithm for more details and the parameters description). More...
class  MRIBiasFieldGenerationOperation
 Apply or generate a multiplicative intensity modulation field. More...
class  MakeFloatOperation
 Convert the input image to float with original values (internal shifts and scales are baked in). More...
class  TagDataElementOperation
 Operation for changing data element tags. More...
class  MarkAsTargetOperation
 Mark elements from the input data item as "target" which might affect the behavior of subsequent operations that rely on Operation::ProcessingPolicy or use other custom target-specific logic. More...
class  UnmarkAsTargetOperation
 Remove the target tag from the elements of the input data item. More...
class  MergeAsChannelsOperation
 Merge multiple images into one along the channel dimension. More...
class  MorphologicalFilterOperation
 Runs a morphological operation on the input. More...
class  ConcatenateNeighboringFramesToChannelsOperation
 This function iterates over each frame, augmenting the channel dimension by appending or adding information from neighboring frames from both sides. More...
class  NormalizeMADOperation
 Normalize the input image based on robust statistics. More...
class  NormalizeNormalOperation
 Normalize the input image so that it has a zero-mean and a unit-standard deviation. More...
class  NormalizePercentileOperation
 Normalize the input image based on its intensity distribution, in particular on a lower and upper percentile. More...
class  NormalizeUniformOperation
 Normalize the input image based on their minimum/maximum intensity so that the output image has a [min; max] range. More...
class  OneHotOperation
 Encode a single channel label image to a one-hot representation with multiple channels. More...
class  PadOperation
 Pad an image to a specific padding size in each dimension. More...
class  PadDimsOperation
 Pad an image to specific target dimensions. More...
class  PadDimsToNextMultipleOperation
 Pads each dimension of the input image to the next multiple of the specified divisor. More...
class  PolyCropOperation
 Masks the image with a convex polygon as described in Markova et al. More...
class  RandomAddDegradedLabelAsChannelOperation
 Operation to add a channel with randomly distributed blobs, whose sign is positive if a blob is in the label and else negative. More...
class  RandomAddRandomNoiseOperation
 Apply AddRandomNoiseOperation to images with randomized intensity parameter. More...
class  RandomAxisFlipOperation
 Flip image content along specified set of axes, with independent sampling for each axis. More...
class  RandomAxisRotationOperation
 Rotate image around image axis with independently drawn axis-specific random rotation angle of +-{90, 180, 270} degrees. More...
class  RandomChoiceOperation
 Meta-operation that picks one operation from its configuration randomly and executes it This is particularly useful for image samplers, where we might want to alternate between different ways of sampling the input images The operationWeights argument allows to parameterize the operation selection probability distribution, if not specified, uniform sampling is used. More...
class  RandomCropAroundLabelMapOperation
 Random version of CropAroundLabelMapOperation that selects a single random label value and crops around it. More...
class  RandomCropOperation
 Crop input images and label maps with a matching random size and offset. More...
class  RandomCutOutOperation
 Apply a random cutout to the image. More...
class  RandomDeformationOperation
 Apply a deformation to the image using a specified control point grid and random displacements. More...
class  RandomGammaCorrectionOperation
 Apply a random gamma correction to the image intensities. More...
class  RandomImageFromLabelOperation
 Creates a random image from a label map, each label is sampled from a Gaussian distribution. More...
class  RandomInvertOperation
 Operation that randomly inverts an image with a default probability of 50% (can be changed). More...
class  RandomKeypointJitterOperation
 Adds an individually and randomly sampled offset to each keypoint of each KeypointElement. More...
class  RandomLinearIntensityMappingOperation
 Apply a random linear shift and scale to the image intensities. More...
class  RandomMRIBiasFieldGenerationOperation
 Apply or generate a random multiplicative intensity modulation field. More...
class  RandomPolyCropOperation
 Masks the image with a random convex polygon as described in Markova et al. More...
class  RandomResolutionReductionOperation
 Downsamples the image to a target_spacing and upsamples again to the original spacing to reduce image information. More...
class  RandomRotationOperation
 Rotate input images and label maps with random angles. More...
class  RandomScalingOperation
 Scale input images and label maps with random factors. More...
class  RandomSmoothOperation
 Apply a random smoothing on the image (Gaussian kernel). More...
class  RandomTemplateInpaintingOperation
 Inpaints a template into an image with randomly selected spatial and intensity transformation in a given range. More...
class  RecombinePatchesOperation
 Operation to recombine image patches back into a full image. More...
class  RectifyRotationOperation
 Sets the image matrix to the closest xyz-axis aligned rotation, effectively making every rotation angle a multiple of 90 degrees. More...
class  RemoveOperation
 Removes a set of fields from a data item. More...
class  RemoveMaskOperation
 Removes the mask of all input images. More...
class  RenameOperation
 Renames a set of fields of a data item. More...
class  ReplaceLabelsValuesOperation
 Replace some label values with other values (only works for integer-typed labels). More...
class  ResampleDimsOperation
 Resample the input to fixed target dimensions. More...
class  ResampleKeepingAspectRatioOperation
 Resample input to target dimensions while keeping aspect ratio of original images. More...
class  ResampleOperation
 Resample the input to a fixed target resolution. More...
class  ResampleToInputOperation
 Resample the input image with respect to the image in ReferenceImageDataComponent. More...
class  ResolutionReductionOperation
 Downsamples the image to the target_spacing and upsamples again to the original spacing to reduce image information. More...
class  RotationOperation
 Rotate input images and label maps with fixed angles. More...
class  RunModelOperation
 Run a machine learning model on the input item and merge the prediction to the input item. More...
class  ScalingOperation
 Scale input images and label maps with fixed factors. More...
class  SelectChannelsOperation
 Keeps a subset of the input channels specified by the selected channel indices (0-based indexing). More...
class  SetModalityOperation
 Sets the input modality. More...
class  SetLabelModalityOperation
 Sets the input modality. More...
class  SetMatrixToIdentityOperation
 Set the matrices of all images to identity (associated landmarks and boxes will be moved accordingly). More...
class  SetSpacingOperation
 Modify images so that image elements have specified spacing (associated landmarks and boxes will be moved accordingly). More...
class  SigmoidOperation
 Apply a sigmoid function on the input image. More...
class  SmoothOperation
 Run a convolution with a Gaussian kernel on the input image. More...
class  SoftmaxOperation
 Computes channel-wise softmax on input. More...
class  SplitIntoPatchesOperation
 Operation which splits the input image into overlapping patches for sliding window inference. More...
class  StandardizeImageAxesOperation
 Reorganize the memory buffer of a medical image to ensure anatomical consistency. More...
class  SwapImageAndLabelsOperation
 Swaps image and label map. More...
class  SyncOperation
 Synchronizes shared memory (CPU <-> OpenGL) of images. More...
class  TanhOperation
 Apply a tanh function on the input image. More...
class  TemplateInpaintingOperation
 Inpaints a template into an image with specified spatial and intensity transformation. More...
class  ThresholdOperation
 Threshold the input image to a binary map with only 0 or 1 values. More...
class  UndoPaddingOperation
 Apply the inverse of a previously applied padding operation. More...
class  CenterROISampler
 Sampler which samples one ROI from the input image and label map with a target size. More...
class  DefaultROISampler
 Sampler which simply returns the image and the label map, after padding of a specified dimension divisor: each spatial dimension of the output arrays will be divisible by dimensionDivisor. More...
class  LabelROISampler
 Sampler which samples ROIs from the input image and label map, such that one particular label appears. More...
class  OrientedROISampler
 The OrientedROISampler samples m_numSamples samples of size m_roiSize from each dataset with an efficient GPU sampler. More...
class  RandomROISampler
 Sampler which randomly samples ROIs from the input image and label map with a target The images will be padded if the target size is larger than the input image. More...
class  SplitROISampler
 Sampler which splits the input image into overlapping ROIs for sliding window inference. More...
class  BatchDataLoader
 Batches the items in the nested loader into batches of the specified size. More...
class  CacheDataLoader
 Caches the dataset loaded until now. More...
class  FilterDataLoader
 Filters the items according to user defined criterion. More...
class  FilterEmptyElementContentDataLoader
 Filters the items out if any of the selected fields is holding a DataElement with empty content. More...
class  InterleaveDataLoader
 Routes DataItems from different pipelines into one active pipeline. More...
class  MapDataLoader
 Applies a mapping to each item in the nested loader. More...
class  PersistentCacheDataLoader
 Caches the dataset loaded until now in a persistent manner (on a disk location). More...
class  PrefetchDataLoader
 Prefetch the next items in a background thread. More...
class  PreprocessDataLoader
 Applies a preprocessing pipeline to each item in the nested loader. More...
class  RepeatDataLoader
 Repeats items coming from a nested loader. More...
class  RandomizeDataLoader
 Maintains a fixed-size buffer that provides randomized items through iterative replacement. More...
class  SampleDataLoader
 Extract samples from each item in the nested loader. More...
class  ShuffleDataLoader
 Shuffles the next specified items in the nested loader. More...
class  SplitDataLoader
 Splits the items in the nested loader into DataItems containing a single image (batch size of 1). More...
class  BoundingBoxElement
 DataElement based on BoundingBoxSet. More...
class  ImageElement
 DataElement for 2D and 3D images. More...
class  KeypointsElement
 DataElement based on KeypointSet. More...
class  SISBasedElement
 Interface for DataElement based on SharedImageSet. More...
class  TensorSetElement
 DataElements for Raw Tensors (Experimental) Unlike ImageElements, these elements will go into the ML engine in the shape that they are created (i.e. More...
class  VectorElement
 DataElement for non-image data (such as imagewise labels), represented as 1D images (i.e. More...
struct  FileReaderColumn
 This struct represents a "column" of filenames in a filelist, like those contained in datalist_training.txt/data_list_validation.txt produced by ImFusionLabels. More...
class  FileReader
 Loads data by reading the files from a list of data "columns" (see above). More...
class  DataListReader
 DataReader to directly read data from a given datalist where each column corresponds to a (single) field of the DataItem. More...
class  InversionComponent
 Data component for storing operation inversion information. More...
class  PaddingDoneInfo
 Struct for geometrical information about how the patches were extracted from the original images. More...
class  PaddingDoneDataComponent
 Data component for keeping track of the original location of a patch in the original image. More...
struct  PatchInfo
 Struct for storing the descriptor of the image a patch was extracted from and the region of interest in the original image. More...
class  PatchesFromImageDataComponent
 Data component for keeping track of the original location of a patch in the original image. More...
class  PixelwiseLearningStream
 Stream running a pixelwise learning model on another stream. More...
class  MeshSegmentationAlgorithm
 Mesh segmentation algorithm based on a graph neural networks Converts an input Mesh to a Graph and runs a provided GNN model. More...
class  LabelsProjectDataReader
 Data loader for training pipelines that load data directly from a Labels project. More...

Typedefs

template<typename ParamType>
using LoaderParam = ML::AdvancedParameter<ParamType, DataLoader>
using DataLoaderList = std::vector<std::unique_ptr<DataLoader>>
using DataLoaderDecoratorFactory = ML::Singleton<ML::Factory<DataLoader, DataLoaderList, const Properties&>>
using DataReaderFactory = Singleton<Factory<DataReader, const Properties&>>
using EngineFactory = Singleton<Registry<Factory<Engine, const Properties&>>>
 Engine Factory, this is instantiated in GenericFactory.cpp.
using EngineSubFactory = Factory<Engine, const Properties&>
 Sub-factories (e.g. C++, Python) of the main factory.
template<typename ParamType>
using EngineParameter = AdvancedParameter<ParamType, EngineConfiguration>
using MetricFactory = Singleton<Factory<Metric, const Properties&>>
 Machine Learning Operation registry typedef.
template<typename ParamType>
using SamplingParameter = AdvancedParameter<ParamType, SamplingConfiguration>
template<typename ParamType>
using ModelParameter = AdvancedParameter<ParamType, ModelConfiguration>
template<typename ParamType>
using OpParam = ML::AdvancedParameter<ParamType, Operation>
using OperationFactory = Singleton<Registry<Factory<Operation, std::optional<const Properties>>>>
 Machine Learning Operation registry typedef.
using OperationSubFactory = Factory<Operation, std::optional<const Properties>>
 Sub-factories (e.g. C++, Python) for the main factory.
using FilterFunction = std::function<bool(const DataItem&)>
using FilterFunctionRegistry = Singleton<Registry<FilterFunction>>
using MapFunction = std::function<void(DataItem&)>
using MapFunctionRegistry = Singleton<Registry<MapFunction>>
using KeyMapping = std::unordered_map<size_t, DataItem::Field>
 Maps the indices in a DataList to field names to be used in the data item Note: the FileReader uses ML::open to load the content of a file, so in order to fill a DataItem with the data in the datalist we need to assign them to a field specified by the user.

Enumerations

enum class  ParamRequired { Yes , No }
 Enum to specify whether the parameter is required when configuring the parent class via the configure method.
enum class  ParamUnit { MM = 0 , Fraction = 1 , Voxel = 2 }
 Enum for the different types of parameter units. More...
enum class  Cardinality { Fixed = 0 , Dynamic = 1 , Infinite = 2 }
 Specifies the type of cardinality (or length) of a Dataset or a DataLoader, in particular whether the amount of produced items is fixed. More...
enum class  ExecutionProvider {
  CPU = 0 , Custom = 1 , CUDA = 2 , DirectML = 3 ,
  OpenVino = 4 , MPS = 5
}
 Options for acceleration providers used by engines.
enum class  ComputingDevice { ForceCPU = 0 , GPUIfGlImage , GPUIfOpenGl , ForceGPU }
 Computing device strategy. More...
enum class  Phase { Training = 1 , Validation = 2 , Inference = 4 , Always = Training | Validation | Inference }
 Various phases of a ML model - they can be used to control if some processing operations must be executed. More...
enum class  ModelType { Unknown = -1 , RandomForest , NeuralNetwork }
 Enum for different learning models. More...
enum class  PredictionType { Unknown = -1 , Classification , Regression , ObjectDetection }
 Types of prediction type. More...
enum class  PredictionOutput {
  Unknown = -1 , Vector , Image , Keypoints ,
  BoundingBoxes , Tensor
}
 Types of prediction output. More...
enum class  ElementType {
  Image = 0 , BoundingBox = 1 , Keypoint = 2 , Vector = 3 ,
  Tensor = 4
}
 Types of elements that a data item might contain. More...
enum class  InterleaveMode { Alternate , Proportional , Unknown }
 Enum used to determine the behaviour of the InterleaveDataLoader. More...
enum class  ResetCriterion { Fixed , SmallestLoader , LargestLoader , Unknown }
 Reset criterion determines when interleaving dataloaders are reset. More...
enum class  RecombineMode { Default = 0 , Weighted }
 Recombination mode for handling overlapping patches when reconstructing an image from patches. More...

Functions

std::string paramUnitToString (ParamUnit unit)
ParamUnit stringToParamUnit (const std::string &unitStr)
bool isCudaComputeCapabilitySupported (int deviceCCmajor, int deviceCCminor, int cudaRuntimeMajor, int cudaRuntimeMinor, const std::vector< CudaComputeCapability > &supportedComputeCapabilities)
 Check if the device is supported by the CUDA runtime.
Cardinality operator&& (Cardinality first, Cardinality second)
void debugMermaidOutput (DataLoader const &dataLoader, std::ostream &out)
 Output a Mermaid compatible flow graph to visualize the data flow.
std::optional< std::stringisPythonOperationUsed (const std::vector< std::string > &opNames)
 Utility function for checking whether a python operation is used.
std::vector< DataLoaderSpecspropertyToDataLoaderSpecs (const Properties &properties)
std::vector< DataLoaderSpecspropertyListToDataLoaderSpecs (const PropertyList &propertyList)
std::vector< std::unique_ptr< Properties > > dataLoaderSpecsToPropertyList (const std::vector< DataLoaderSpecs > &specs)
EngineSubFactorygetSubEngineFactory (const std::string &subFactoryName)
 Get (and create if it does not exist yet) a sub-factory from a name.
EngineSubFactorygetCppEngineFactory ()
 Helper function to get the C++ factory from the registry.
bool isNotEmpty (DataItem const &dataItem)
 Returns false if the input data item is empty.
bool hasNonZeroInputImage (DataItem const &dataItem)
 Returns false if any non-target SharedImageSets in the dataitem are images with only zeros in them, otherwise true.
bool hasNonZeroTargetImage (DataItem const &dataItem)
 Returns false if any target SharedImageSets in the dataitem are images with only zeros in them, otherwise true.
template<typename MetricType>
std::unique_ptr< MetricType > createMetric (const Properties &p)
OwningDataList open (const std::string &filename)
 Similar to ApplicationController::open but does not require an ApplicationController.
std::optional< KeypointSetloadKeypoints (const std::string &path)
 Helper methods to load keypoints and bounding boxes.
std::optional< BoundingBoxSetloadBoundingBoxes (const std::string &path)
bool saveKeypoints (const KeypointSet &keypoints, const std::string &path)
bool saveBoundingBoxes (const BoundingBoxSet &bboxes, const std::string &path)
bool landmarksToJson (const std::string &path, const KeypointSet &lms)
 Helper methods to load keypoints and bounding boxes from json files this allows to load keypoints and bboxes exported from ImFusionLabels as KeypointSet and BoundingBoxes.
bool boundingBoxesToJson (const std::string &path, const BoundingBoxSet &bbs)
std::optional< KeypointSetlandmarksFromJson (const std::string &path)
std::optional< BoundingBoxSetboundingBoxesFromJson (const std::string &path)
OperationSubFactorygetSubOperationFactory (const std::string &subFactoryName)
 Get (and create if it does not exist yet) a sub-factory from a name.
OperationSubFactorygetCppOperationFactory ()
 Helper function to get the C++ factory from the registry.
template<typename Op>
std::unique_ptr< Op > makeUniqueOperation (std::optional< const Properties > p)
template<typename Op>
std::shared_ptr< Op > makeOperation (std::optional< const Properties > p)
void recordOperationForInversion (Operation &op, DataElement *element)
std::vector< Operation::SpecspropertyToProcessingSpecs (const Properties &properties)
std::vector< Operation::SpecspropertyListToProcessingSpecs (const PropertyList &propertyList)
std::vector< std::unique_ptr< Properties > > processingSpecsToPropertyList (const std::vector< Operation::Specs > &specs)
bool isTarget (const SharedImageSet &input)
 Check if an image is marked as a target.
void tagAsTarget (SharedImageSet &input)
 Tag an image as a target.
void untagAsTarget (SharedImageSet &input)
 Untag an image as label.
bool isSemanticSegmentationMap (const SharedImageSet &input)
 Check if the image is a segmentation label map (with discrete values). This function should be used to determine how algorithms like downsampling/interpolation/etc. should treat this image, e.g. use nearest neighbor instead of linear interpolation.
ML::ComputingDevice stringToDevice (const std::string &s)
 Convert string input to a computing device.
std::string deviceToString (ML::ComputingDevice device)
 Convert computing device to string.
Phase stringToPhase (const std::string &s)
 Convert string input to a phase.
std::string phaseToString (Phase phase)
 Convert phase to a string.
std::string modelTypeToString (ML::ModelType type)
 Convert prediction type to a string.
ML::ModelType stringToModelType (const std::string &type)
 Convert prediction type to a string.
std::string predictionTypeToString (ML::PredictionType type)
 Convert prediction type to a string.
ML::PredictionType stringToPredictionType (const std::string &type)
 Convert prediction type to a string.
std::string predictionOutputToString (ML::PredictionOutput type)
 Convert prediction output to a string.
ML::PredictionOutput stringToPredictionOutput (const std::string &type)
 Convert string to prediction output.
std::string elementTypeToString (ML::ElementType type)
 Convert ElementType to a string.
ML::ElementType stringToElementType (const std::string &type)
 Convert string to ElementType.
std::string interleaveModeToString (ML::InterleaveMode mode)
 Convert InterleaveMode to a string representation.
ML::InterleaveMode stringToInterleaveMode (const std::string &type)
 Convert string representation to a InterleaveMode.
std::string resetCriterionToString (ML::ResetCriterion mode)
 Convert ResetCriterion to a string representation.
ML::ResetCriterion stringToResetCriterion (const std::string &type)
 Convert string representation to a ResetCriterion.
bool shouldRunOnGPU (ML::ComputingDevice deviceStrategy, const SharedImageSet *image, bool allowMoreThan4Channels=false, std::function< void(std::string &&)> &&warnFunc=[](std::string &&) {})
 Return whether an algorithm should choose the GPU implementation.
std::map< std::string, std::vector< std::string > > readDataList (std::string path, std::vector< std::string > prependKeys={"dataPath", "labelPath"})
 Read a data list file from an exported Labels project.
std::vector< std::vector< float > > convertSharedImageSetToVectors (const SharedImageSet &input)
 Convert a shared image set to a vector of vector (useful for imagewise predictions).
std::string modelPathToAbsoluteIfNotResource (const std::string &path, const std::string &refConfigFile="")
 Convert a model path to an absolute path, taking into account multiple special behaviour (sanitize path obtained by copy/pasting and "copying as path" from Windows explorer, i.e.
std::string recombineModeToString (RecombineMode mode)
 Convert RecombineMode to a string.
RecombineMode stringToRecombineMode (const std::string &str)
 Convert a string to RecombineMode.
bool operator== (const PaddingDoneInfo &lhs, const PaddingDoneInfo &rhs)
bool operator!= (const PaddingDoneInfo &lhs, const PaddingDoneInfo &rhs)
bool operator== (const PatchInfo &lhs, const PatchInfo &rhs)
bool operator!= (const PatchInfo &lhs, const PatchInfo &rhs)

Typedef Documentation

◆ KeyMapping

using ImFusion::ML::KeyMapping = std::unordered_map<size_t, DataItem::Field>

Maps the indices in a DataList to field names to be used in the data item Note: the FileReader uses ML::open to load the content of a file, so in order to fill a DataItem with the data in the datalist we need to assign them to a field specified by the user.

Example1 : load(myfile.txt) -> DataList{sis1, sis2, sis3} a possible key mapping could be {{0, "data"}, {1, "label"}, {2, "mask"}}. The resulting DataItem will be: {{"data", sis1}, {"label", sis2}, {"mask", sis3}}

If you don't need all the data in the datalist, you can skip some by not specifying an index mapping for the data you want to skip

Example 2: load(myfile.txt) -> DataList{sis1, sis2, sis3} mapping: {{0, "data"}, {2, "mask"}}. The resulting DataItem will be: {{"data", sis1}, {"mask", sis3}}

Enumeration Type Documentation

◆ ParamUnit

enum class ImFusion::ML::ParamUnit
strong

Enum for the different types of parameter units.

Enumerator
MM 

parameter provided in mm

Fraction 

parameter provided in fractional units of the image extent

Voxel 

parameter provided in voxel units

◆ Cardinality

enum class ImFusion::ML::Cardinality
strong

Specifies the type of cardinality (or length) of a Dataset or a DataLoader, in particular whether the amount of produced items is fixed.

For instance, a data loader that splits a set of images into individual images cannot know in advance the number of items to be produced since it depends on the actual content of the loaded files.

Enumerator
Fixed 

The number of items to be produced can be determined in advance (i.e. without depending on the item content).

Dynamic 

The number of items to be produced cannot be determined in advance but is guaranteed to be finite.

Infinite 

The number of items to be produced is infinite.

◆ ComputingDevice

enum class ImFusion::ML::ComputingDevice
strong

Computing device strategy.

Enumerator
ForceCPU 

Force computation on the CPU.

GPUIfGlImage 

Use GPU only if the image has already been uploaded to the GPU.

GPUIfOpenGl 

Use GPU only if an OpenGL context is available.

ForceGPU 

Force computation on the GPU (throws if not possible).

◆ Phase

enum class ImFusion::ML::Phase
strong

Various phases of a ML model - they can be used to control if some processing operations must be executed.

For instance, input normalization should always be executed, but random augmentations would typically only be executed at training time.

Enumerator
Training 

Training of the model, i.e. when its parameter are optimized.

Validation 

Evaluation of the model during training (only to compute the metrics on a held out dataset).

Inference 

When the model is actually deployed and ran on a new input.

Always 

Convenience value to include all phases.

◆ ModelType

enum class ImFusion::ML::ModelType
strong

Enum for different learning models.

Enumerator
Unknown 

Default, invalid value.

RandomForest 

Random forest (not supported anymore).

NeuralNetwork 

Neural network (standard value).

◆ PredictionType

enum class ImFusion::ML::PredictionType
strong

Types of prediction type.

Enumerator
Unknown 

Default, invalid value.

Classification 

Prediction is categorical.

Regression 

Prediction is a continuous value.

ObjectDetection 

Prediction is a set of BoundingBox, plus optionally Keypoints and Masks.

◆ PredictionOutput

enum class ImFusion::ML::PredictionOutput
strong

Types of prediction output.

Enumerator
Unknown 

Default, invalid value.

Vector 

Output size does not depend on the input size.

Image 

Output has the same size as the input.

Keypoints 

Output is a set of keypoints.

BoundingBoxes 

Output is a set of bounding boxes.

Tensor 

Output is a set of tensors.

◆ ElementType

enum class ImFusion::ML::ElementType
strong

Types of elements that a data item might contain.

Enumerator
Image 

Element representing a set of 2D or 3D images.

BoundingBox 

Element representing a set of 2D or 3D bounding boxes.

Keypoint 

Element representing a set of 2D or 3D landmarks.

Vector 

Element representing a set of scalar (1D) values.

Tensor 

Element representing an arbitrary array of values, for instance used for graphs.

◆ InterleaveMode

enum class ImFusion::ML::InterleaveMode
strong

Enum used to determine the behaviour of the InterleaveDataLoader.

Enumerator
Alternate 

Continuously interleaves each dataloader one dataitem at a time regardless of size until the reset criterion is met.

Proportional 

Interleaves dataloaders proportional to their size.

Unknown 

Default, invalid value.

◆ ResetCriterion

enum class ImFusion::ML::ResetCriterion
strong

Reset criterion determines when interleaving dataloaders are reset.

Enumerator
Fixed 

Use a fixed parameter to control the epoch size.

SmallestLoader 

Stop as soon as the smallest loader is exhausted.

LargestLoader 

Stop when the largest loader is exhausted.

Unknown 

Default, invalid value.

◆ RecombineMode

enum class ImFusion::ML::RecombineMode
strong

Recombination mode for handling overlapping patches when reconstructing an image from patches.

This determines how pixel values from overlapping patches are combined. See RecombinePatchesOperation for more details on each mode.

Enumerator
Default 

Simple averaging of patch voxels in overlapping regions.

Weighted 

Each patch is decayed at its borders with a Gaussian function.

Function Documentation

◆ isCudaComputeCapabilitySupported()

bool ImFusion::ML::isCudaComputeCapabilitySupported ( int deviceCCmajor,
int deviceCCminor,
int cudaRuntimeMajor,
int cudaRuntimeMinor,
const std::vector< CudaComputeCapability > & supportedComputeCapabilities )

Check if the device is supported by the CUDA runtime.

Parameters
deviceCCmajorThe major version of the GPU
deviceCCminorThe minor version of the GPU
cudaRuntimeMajorThe major version of the CUDA runtime
cudaRuntimeMinorThe minor version of the CUDA runtime
supportedComputeCapabilitiesThe list of supported Compute Capabilities of the CUDA library

◆ open()

OwningDataList ImFusion::ML::open ( const std::string & filename)

Similar to ApplicationController::open but does not require an ApplicationController.

Cannot open all files that ApplicationController supports (e.g. workspaces).

◆ isTarget()

bool ImFusion::ML::isTarget ( const SharedImageSet & input)

Check if an image is marked as a target.

This function should be used to determine whether it is an input data or a target data. Note: if an image is tagged with deprecated LabelTag, this function consideres it a target and returns true.

◆ untagAsTarget()

void ImFusion::ML::untagAsTarget ( SharedImageSet & input)

Untag an image as label.

Note: if an image is tagged with deprecated LabelTag, this function removes the LabelTag as well

◆ readDataList()

std::map< std::string, std::vector< std::string > > ImFusion::ML::readDataList ( std::string path,
std::vector< std::string > prependKeys = {"dataPath", "labelPath"} )

Read a data list file from an exported Labels project.

Returns a string to vector map, where the keys are defined by the header of the file.

◆ modelPathToAbsoluteIfNotResource()

std::string ImFusion::ML::modelPathToAbsoluteIfNotResource ( const std::string & path,
const std::string & refConfigFile = "" )

Convert a model path to an absolute path, taking into account multiple special behaviour (sanitize path obtained by copy/pasting and "copying as path" from Windows explorer, i.e.

remove file:/// prefix and double quotes, or prepending the ML default model path). When calling this function on a sidecar file, the original path to the configuration file can be provided so that the sidecar file can be searched in the same folder.

Search Tab / S to search, Esc to close