ImFusion C++ SDK 4.5.0
ImFusion::Cranial::HypothalamusSegmentationAlgorithm Class Reference

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

Algorithm for segmenting hypothalamus sub-regions and surrounding structures in T1 MR volumes. More...

Inheritance diagram for ImFusion::Cranial::HypothalamusSegmentationAlgorithm:

Detailed Description

Algorithm for segmenting hypothalamus sub-regions and surrounding structures in T1 MR volumes.

Public Member Functions

 HypothalamusSegmentationAlgorithm (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.
const SharedImageSetensembleConfidenceMap () const
 Confidence score map for the ensemble mixture (null unless p_estimateConfidenceScore is enabled).
const SharedImageSetensembleLabelMap () const
 Label map from the ensemble mixture (null unless p_estimateConfidenceScore is enabled).
const std::map< uint8_t, float > & classConfidenceScores () const
 Mean per-voxel confidence per predicted output label class (empty if p_estimateConfidenceScore is disabled).
const LabelDataComponentlabelDataComponent () const
 Generate the label configuration for all possible FastSurfer labels.
bool checkConfigurationParameters () const
 Returns whether the parameters are properly set (if not, the algorithm will not produce any output).
void compute () override
 Standard methods for the Algorithm interface.
void configure (const Properties *p) override
 Configure this object instance by de-serializing the given Properties.
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 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
Public Member Functions inherited from ImFusion::SignalReceiver
 SignalReceiver ()=default
 Default constructor.
 SignalReceiver (const SignalReceiver &other)
 Copy constructor, does not copy any existing signal connections from other.
SignalReceiveroperator= (SignalReceiver rhs)
 Assignment operator, disconnects all existing connections, does not copy any existing signal connections from rhs.
virtual ~SignalReceiver ()
 Virtual destructor disconnects from all connected signals.

Static Public Member Functions

static bool createCompatible (const DataList &data, Algorithm **a=0)
static const LabelDataComponentproducibleLabels ()
 Returns label data component describing all labels this algorithm can produce (27 structures).
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.
bool shouldFlipAxialSlices () const override
 Models have different pre-processing and orientation so we need to control whether axial slices should be flipped.
const char * axialModelIdentifier () const override
 Specify the model identifiers for the axial, coronal, and sagittal slices.
const char * coronalModelIdentifier () const override
const char * sagittalModelIdentifier () const override
bool shouldForceModelToCpu (const char *modelIdentifier) const override
 Allows derived algorithms to force selected models to run on CPU.
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)
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.
Protected Member Functions inherited from ImFusion::SignalReceiver
void disconnectAll ()
 Disconnects all existing connections.

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_modelSet = {"modelSet", Models::Latest::ModelSetName, this}
 Model set to use for segmentation.
Parameter< std::stringp_modelSetVersion = {"modelSetVersion", Models::Latest::ModelSetVersion, this}
 Version of the model set to use for segmentation.
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 / confidence maps have the same resolution as the input image.
Parameter< bool > p_extractMeshes = {"extractMeshes", false, this}
 If disabled, the algorithm skips mesh extraction and only outputs the segmentation label map.
Parameter< bool > p_exportLabelMap = {"exportLabelMap", true, this}
 If enabled, export the label map as a separate data.
Parameter< int > p_batchSlices = {"batchSlices", 32, this}
 Number of slices to process in each batch (lower values reduce memory usage). Must be >= 1.
Parameter< bool > p_estimateConfidenceScore = {"estimateConfidenceScore", false, this}
 If enabled, compute confidence-score outputs.
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
std::unique_ptr< SharedImageSetm_ensembleMixtureConfidence
std::unique_ptr< SharedImageSetm_ensembleMixtureLabelMap
std::map< uint8_t, float > m_classConfidenceScores
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

◆ producibleLabels()

const LabelDataComponent & ImFusion::Cranial::HypothalamusSegmentationAlgorithm::producibleLabels ( )
static

Returns label data component describing all labels this algorithm can produce (27 structures).

Thread-safe cached singleton - safe to call repeatedly without performance penalty.

◆ outputStructureIdentifier()

std::string ImFusion::Cranial::HypothalamusSegmentationAlgorithm::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::HypothalamusSegmentationAlgorithm::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::HypothalamusSegmentationAlgorithm::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::HypothalamusSegmentationAlgorithm::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.

◆ shouldFlipAxialSlices()

bool ImFusion::Cranial::HypothalamusSegmentationAlgorithm::shouldFlipAxialSlices ( ) const
inlineoverrideprotectedvirtual

Models have different pre-processing and orientation so we need to control whether axial slices should be flipped.

Reimplemented from ImFusion::Cranial::FastSurferSegmentationAlgorithm.

◆ axialModelIdentifier()

const char * ImFusion::Cranial::HypothalamusSegmentationAlgorithm::axialModelIdentifier ( ) const
inlineoverrideprotectedvirtual

Specify the model identifiers for the axial, coronal, and sagittal slices.

Implements ImFusion::Cranial::FastSurferSegmentationAlgorithm.

◆ coronalModelIdentifier()

const char * ImFusion::Cranial::HypothalamusSegmentationAlgorithm::coronalModelIdentifier ( ) const
inlineoverrideprotectedvirtual

◆ sagittalModelIdentifier()

const char * ImFusion::Cranial::HypothalamusSegmentationAlgorithm::sagittalModelIdentifier ( ) const
inlineoverrideprotectedvirtual

◆ shouldForceModelToCpu()

bool ImFusion::Cranial::HypothalamusSegmentationAlgorithm::shouldForceModelToCpu ( const char * modelIdentifier) const
overrideprotectedvirtual

Allows derived algorithms to force selected models to run on CPU.

Reimplemented from ImFusion::Cranial::FastSurferSegmentationAlgorithm.


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