ImFusion C++ SDK 4.4.0
ImFusion::Cranial::WholeBrainSegmentationAlgorithm Class Reference

#include <CranialPlugin/include/ImFusion/Cranial/WholeBrainSegmentationAlgorithm.h>

Algorithm for segmenting all the brain structures in T1 MR volumes. More...

Inheritance diagram for ImFusion::Cranial::WholeBrainSegmentationAlgorithm:

Detailed Description

Algorithm for segmenting all the brain structures in T1 MR volumes.

Public Member Functions

 WholeBrainSegmentationAlgorithm (SharedImageSet &input, AnatomicalStructureCollection *asc=nullptr)
 Constructor. If asc is not null, segmentation results will be written to it.
Public Member Functions inherited from ImFusion::Cranial::FastSurferSegmentationAlgorithm
 FastSurferSegmentationAlgorithm (SharedImageSet &input, AnatomicalStructureCollection *asc=nullptr)
SharedImageSetinput () const
 Returns a reference to the input image used for segmentation.
AnatomicalStructureCollectionasc () const
 Returns a pointer to the anatomical structure collection where results are stored.
const SharedImageSetoutputLabelMap () const
 Returns a pointer to the generated label map (this might be null).
const LabelDataComponentlabelDataComponent () const
 Generate the label configuration for all possible labels in the output. This may be a superset of the labels present in the output label map.
void compute () override
 Standard methods for the Algorithm interface.
OwningDataList takeOutput () override
 Returns (1) the label map image if flag is enabled, (2) the AnatomicalStructureCollection if it has been created by the algorithm.
bool survivesDataDeletion (const Data *) const override
 Indicates whether the algorithm can handle (partial) deletion of the specified data, by default this checks whether the data is in the input list.
Public Member Functions inherited from ImFusion::Algorithm
 Algorithm ()
 Default constructor will registers a single "compute" action that calls compute() and returns status().
virtual void setProgress (Progress *progress)
 Sets a Progress interface the algorithm can use to notify observers about its computing progress.
Progressprogress () const
 Returns the progress interface if set.
virtual int status () const
 Indicates the status of the last call to compute().
const FactoryInfofactoryInfo () const
 Returns the record describing how this Algorithm was instantiated by the AlgorithmFactory.
void setFactoryInfo (const FactoryInfo &value)
 Sets the record describing how this Algorithm was instantiated by the AlgorithmFactory.
Status runAction (const std::string &id)
 Run the action with name id if it exists.
const std::vector< Action > & actions ()
 Get a mapping from Action id to Action as registered in this algorithm.
Public Member Functions inherited from ImFusion::Configurable
virtual void configure (const Properties *p)
 Configure this object instance by de-serializing the given Properties.
virtual void configuration (Properties *p) const
 Serialize the current object configuration into the given Properties object.
virtual void configureDefaults ()
 Retrieve the properties of this object, replaces values with their defaults and sets it again.
void registerParameter (ParameterBase *param)
 Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration().
void unregisterParameter (const ParameterBase *param)
 Remove the given Parameter or SubProperty from the list of registered parameters.
 Configurable (const Configurable &rhs)
 Configurable (Configurable &&rhs) noexcept
Configurable & operator= (const Configurable &)
Configurable & operator= (Configurable &&) noexcept

Static Public Member Functions

static bool createCompatible (const DataList &data, Algorithm **a=0)
Static Public Member Functions inherited from ImFusion::Algorithm
static bool createCompatible (const DataList &data, Algorithm **a=nullptr)
 Factory function to check algorithm compatibility with input data and optionally instantiate it.

Protected Member Functions

std::string outputStructureIdentifier () const override
 Key of the anatomical structure collection under which the results will be written.
std::unique_ptr< SharedImageSetsplitImage (SharedImageSet &feature) override
 This function transforms the pre-processed volume into a series of slices to be fed to the network.
const std::vector< unsigned short > & sagittalChannelsMapping () const override
 Sagittal slices have a left/right ambiguity so most pairs of labels are collapsed to the same value.
const std::vector< unsigned short > & freesurferLabelsMapping () const override
 Extra virtual functions to be implemented by derived algorithmsMapping between neural network output channels of the the axial/coronal outputs (indices) to standardized FreeSurfer anatomical indices (values) defined in CranialPluginKeys.
virtual bool shouldFlipAxialSlices () const
 Models have different pre-processing and orientation so we need to control whether axial slices should be flipped.
std::unique_ptr< SharedImageSetcomputeFastSurfer (const SharedImageSet &inputImage)
 Different steps of the pipelineThis function takes as input the main image and returns an unsigned short label map where structures are represented by a standardized label.
std::unique_ptr< SharedImageSetpreprocess (const SharedImageSet &input)
std::unique_ptr< SharedImageSetpredictImage (std::unique_ptr< SharedImageSet >, std::string)
std::unique_ptr< SharedImageSetargmax (std::unique_ptr< SharedImageSet > output)
std::unique_ptr< SharedImageSetrecombineImages (SharedImageSet &predictionSlices, double spacing)
std::unique_ptr< SharedImageSetfusePredictions (std::pair< std::unique_ptr< SharedImageSet >, std::unique_ptr< SharedImageSet > > predictions, float weight, bool sagittalMap)
Protected Member Functions inherited from ImFusion::Algorithm
void loadDefaults ()
void registerAction (const std::string &id, const std::string &guiName, const std::function< Algorithm::Status(void)> &action)
 Register an action to be run via runAction.
template<typename D>
void registerAction (const std::string &id, const std::string &guiName, Algorithm::Status(D::*action)(void))
 Template version of runAction that can be used with a pointer to a member function.
void registerAction (const Action &action)
 Register an action.

Additional Inherited Members

Public Types inherited from ImFusion::Algorithm
enum  Status {
  Unknown = -1 , Success = 0 , Error = 1 , InvalidInput ,
  IncompleteInput , OutOfMemoryHost , OutOfMemoryGPU , UnsupportedGPU ,
  UnknownAction , AbortedByUser , User = 1000
}
 Status codes. More...
Public Attributes inherited from ImFusion::Cranial::FastSurferSegmentationAlgorithm
Parameter< std::stringp_modelPath = {"modelPath", "", this}
 Path to the folder containing the three models (assumed to be called axial_net.yaml, coronal_net.yaml, sagittal_net.yaml).
Parameter< int > p_imageSize = {"imageSize", 256, this}
 Size of the image that will be used internally as model input.
Parameter< double > p_imageSpacing = {"imageSpacing", 1.0, this}
 Spacing of the image that will be used internally as model input.
Parameter< bool > p_runAxial = {"runAxial", true, this}
 Run the model on the axial slices.
Parameter< bool > p_runCoronal = {"runCoronal", true, this}
 Run the model on the coronal slices.
Parameter< bool > p_runSagittal = {"runSagittal", true, this}
 Run the model on the sagittal slices.
Parameter< bool > p_keepLargestComponent = {"keepLargestComponent", true, this}
 Post-process the result to discard all non-connected components.
Parameter< bool > p_resampleToInput = {"resampleToInput", false, this}
 If enabled, make sure the output label map has the same resolution as the input image.
Parameter< bool > p_extractMeshes = {"extractMeshes", false, this}
 If disabled, the algorithm will not extract meshes but instead only save the segmentation images and keypoints.
Parameter< bool > p_exportLabelMap = {"exportLabelMap", true, this}
 If enabled, export the label map as a separate data.
Public Attributes inherited from ImFusion::Algorithm
Signal signalOutputChanged
 Signal should be emitted by Algorithms when their output/result has changed.
Signal signalParametersChanged
 Signal should be emitted by Algorithms when their parameter configuration has changed.
Public Attributes inherited from ImFusion::Configurable
Signal signalParametersChanged
 Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted.
Protected Attributes inherited from ImFusion::Cranial::FastSurferSegmentationAlgorithm
SharedImageSetm_inputImage
std::unique_ptr< GenericASCm_ascOwned
AnatomicalStructureCollectionm_asc = nullptr
std::unique_ptr< SharedImageSetm_outputLabelMap
mat4 m_correctionMatrix = mat4::Identity()
Protected Attributes inherited from ImFusion::Algorithm
std::string m_name
 Algorithm name.
Progressm_progress = nullptr
 Non-owing pointer to a progress interface. May be a nullptr.
FactoryInfo m_factoryInfo = {}
 Record describing how this algorithm was instantiated by the AlgorithmFactory.
int m_status = Status::Unknown
 Algorithm status after last call to compute().
std::vector< Actionm_actions
 Map of key given by the id of the action, of the available actions of this algorithm.
Protected Attributes inherited from ImFusion::Configurable
std::vector< Paramm_params
 List of all registered Parameter and SubProperty instances.

Member Function Documentation

◆ outputStructureIdentifier()

std::string ImFusion::Cranial::WholeBrainSegmentationAlgorithm::outputStructureIdentifier ( ) const
inlineoverrideprotectedvirtual

Key of the anatomical structure collection under which the results will be written.

Implements ImFusion::Cranial::FastSurferSegmentationAlgorithm.

◆ splitImage()

std::unique_ptr< SharedImageSet > ImFusion::Cranial::WholeBrainSegmentationAlgorithm::splitImage ( SharedImageSet & feature)
overrideprotectedvirtual

This function transforms the pre-processed volume into a series of slices to be fed to the network.

It is virtual because it might depend on the application.

Implements ImFusion::Cranial::FastSurferSegmentationAlgorithm.

◆ sagittalChannelsMapping()

const std::vector< unsigned short > & ImFusion::Cranial::WholeBrainSegmentationAlgorithm::sagittalChannelsMapping ( ) const
overrideprotectedvirtual

Sagittal slices have a left/right ambiguity so most pairs of labels are collapsed to the same value.

This mapping brings original axial/coronal label channel indices to the subset of the sagittal label indices. For instance, {0,1,1} means that 0 is mapped to 0, but both labels 1 and 2 are mapped to the second channel of the sagittal label map. The expected size of the mapping is the number of labels in the axial/coronal output, and the number of different values in the mapping is the number of labels in the sagittal output.

Implements ImFusion::Cranial::FastSurferSegmentationAlgorithm.

◆ freesurferLabelsMapping()

const std::vector< unsigned short > & ImFusion::Cranial::WholeBrainSegmentationAlgorithm::freesurferLabelsMapping ( ) const
overrideprotectedvirtual

Extra virtual functions to be implemented by derived algorithmsMapping between neural network output channels of the the axial/coronal outputs (indices) to standardized FreeSurfer anatomical indices (values) defined in CranialPluginKeys.

Implements ImFusion::Cranial::FastSurferSegmentationAlgorithm.


The documentation for this class was generated from the following file:
  • CranialPlugin/include/ImFusion/Cranial/WholeBrainSegmentationAlgorithm.h
Search Tab / S to search, Esc to close