NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
niftk::MorphologicalSegmentorPipelineManager Class Reference

Class to contain all the ITK/MITK logic for the MIDAS Morphological Segmentor pipeline, to separate from MorphologicalSegmentationView to make unit testing easier. More...

Inheritance diagram for niftk::MorphologicalSegmentorPipelineManager:
Inheritance graph
[legend]
Collaboration diagram for niftk::MorphologicalSegmentorPipelineManager:
Collaboration graph
[legend]

Public Member Functions

 mitkClassMacroItkParent (MorphologicalSegmentorPipelineManager, itk::Object) static Pointer New()
 
void SetDataStorage (mitk::DataStorage::Pointer dataStorage)
 Sets the mitk::DataStorage on this object. More...
 
mitk::DataStorage::Pointer GetDataStorage () const
 Gets the DataStorage pointer from this object. More...
 
void SetToolManager (mitk::ToolManager::Pointer toolManager)
 Sets the mitk::ToolManager on this object. More...
 
mitk::ToolManager::Pointer GetToolManager () const
 Gets the mitk::ToolManager from this object. More...
 
void OnThresholdingValuesChanged (double lowerThreshold, double upperThreshold, int axialSliceNumber)
 Sets the thresholding parameters. More...
 
void OnErosionsValuesChanged (double upperThreshold, int numberOfErosions)
 Sets the conditional erosion parameters. More...
 
void OnDilationsValuesChanged (double lowerPercentage, double upperPercentage, int numberOfDilations)
 Sets the conditional dilation parameters. More...
 
void OnRethresholdingValuesChanged (int boxSize)
 Sets the re-thresholding parameters. More...
 
void OnTabChanged (int tabIndex)
 Called when we step to another stage of the pipeline, either fore or backwards. More...
 
bool HasSegmentationNode () const
 Returns true if the segmentation node can be found which implicitly means we are "in progress". More...
 
mitk::Image::ConstPointer GetReferenceImage () const
 Retrieves the reference image from the tool manager. More...
 
mitk::Image::Pointer GetWorkingImage (unsigned int dataIndex) const
 Used to retrieve the working image from the tool manager. More...
 
mitk::DataNode::Pointer GetSegmentationNode () const
 Used to retrieve the actual node of the image being segmented. More...
 
mitk::Image::Pointer GetSegmentationImage () const
 Used to retrieve the segmentation image. More...
 
void GetPipelineParamsFromSegmentationNode (MorphologicalSegmentorPipelineParams &params) const
 Finds the segmentation node, and if present will populate params with the parameters found on the segmentation node. More...
 
virtual bool IsNodeASegmentationImage (const mitk::DataNode::Pointer node) const
 For Morphological Editing, a Segmentation image should have a grey scale parent, and two binary children called SUBTRACTIONS_NAME and ADDITIONS_NAME. More...
 
virtual bool IsNodeAWorkingImage (const mitk::DataNode::Pointer node) const
 For Morphological Editing, a Working image should be called either SUBTRACTIONS_NAME and ADDITIONS_NAME, and have a binary image parent. More...
 
virtual bool CanStartSegmentationForBinaryNode (const mitk::DataNode::Pointer node) const
 For any binary image, we return true if the property midas.morph.stage is present, and false otherwise. More...
 
virtual std::vector
< mitk::DataNode * > 
GetWorkingDataFromSegmentationNode (const mitk::DataNode::Pointer node) const
 Assumes input is a valid segmentation node, then searches for the derived children of the node, looking for binary images called SUBTRACTIONS_NAME and ADDITIONS_NAME. Returns empty list if both not found. More...
 
virtual mitk::DataNode * GetSegmentationNodeFromWorkingData (const mitk::DataNode::Pointer node) const
 Assumes input is a valid working node, then searches for a binary parent node, returns NULL if not found. More...
 
void SetSegmentationNodePropsFromReferenceImage ()
 Looks up the reference image, and sets default property values onto the segmentation node, which are later used to update GUI controls. More...
 
void UpdateSegmentation ()
 Calls update on the ITK pipeline using the MITK AccessByItk macros. More...
 
void FinalizeSegmentation ()
 Copies the final image out of the pipeline, and then disconnects the pipeline to stop it updating. More...
 
void ClearWorkingData ()
 Clears both images of the working data. More...
 
void RemoveWorkingData ()
 Removes the images we are using for editing during connection breaker from the DataStorage. More...
 
void DestroyPipeline (mitk::Image::Pointer segmentation)
 Completely removes the current pipeline. More...
 

Static Public Attributes

static const std::string PROPERTY_MIDAS_MORPH_SEGMENTATION_FINISHED = "midas.morph.finished"
 A static string, (to avoid code duplication), to hold the name of the property that determines if a morphological segmentation is finished. More...
 
static const std::string SEGMENTATION_OF_LAST_STAGE_NAME = "MORPHO_SEGMENTATION_OF_LAST_STAGE"
 The output of the previous stage of the segmentation pipeline. More...
 

Protected Member Functions

 MorphologicalSegmentorPipelineManager ()
 
virtual ~MorphologicalSegmentorPipelineManager ()
 
 MorphologicalSegmentorPipelineManager (const MorphologicalSegmentorPipelineManager &)
 
MorphologicalSegmentorPipelineManageroperator= (const MorphologicalSegmentorPipelineManager &)
 

Detailed Description

Class to contain all the ITK/MITK logic for the MIDAS Morphological Segmentor pipeline, to separate from MorphologicalSegmentationView to make unit testing easier.

This pipeline implements the paper:

"Interactive algorithms for the segmentation and quantification of 3-D MRI brain scans" by P. A. Freeborough, N. C. Fox and R. I. Kitney, published in Computer Methods and Programs in Biomedicine 53 (1997) 15-25.

See also
niftkBaseSegmentorController
MorphologicalSegmentationView
MorphologicalSegmentorPipeline
MorphologicalSegmentorPipelineInterface
MorphologicalSegmentorPipelineParams

Constructor & Destructor Documentation

niftk::MorphologicalSegmentorPipelineManager::MorphologicalSegmentorPipelineManager ( )
protected
niftk::MorphologicalSegmentorPipelineManager::~MorphologicalSegmentorPipelineManager ( )
protectedvirtual
niftk::MorphologicalSegmentorPipelineManager::MorphologicalSegmentorPipelineManager ( const MorphologicalSegmentorPipelineManager )
protected

Member Function Documentation

bool niftk::MorphologicalSegmentorPipelineManager::CanStartSegmentationForBinaryNode ( const mitk::DataNode::Pointer  node) const
virtual

For any binary image, we return true if the property midas.morph.stage is present, and false otherwise.

void niftk::MorphologicalSegmentorPipelineManager::ClearWorkingData ( )

Clears both images of the working data.

void niftk::MorphologicalSegmentorPipelineManager::DestroyPipeline ( mitk::Image::Pointer  segmentation)

Completely removes the current pipeline.

void niftk::MorphologicalSegmentorPipelineManager::FinalizeSegmentation ( )

Copies the final image out of the pipeline, and then disconnects the pipeline to stop it updating.

mitk::DataStorage::Pointer niftk::MorphologicalSegmentorPipelineManager::GetDataStorage ( ) const

Gets the DataStorage pointer from this object.

void niftk::MorphologicalSegmentorPipelineManager::GetPipelineParamsFromSegmentationNode ( MorphologicalSegmentorPipelineParams params) const

Finds the segmentation node, and if present will populate params with the parameters found on the segmentation node.

mitk::Image::ConstPointer niftk::MorphologicalSegmentorPipelineManager::GetReferenceImage ( ) const

Retrieves the reference image from the tool manager.

mitk::Image::Pointer niftk::MorphologicalSegmentorPipelineManager::GetSegmentationImage ( ) const

Used to retrieve the segmentation image.

mitk::DataNode::Pointer niftk::MorphologicalSegmentorPipelineManager::GetSegmentationNode ( ) const

Used to retrieve the actual node of the image being segmented.

mitk::DataNode * niftk::MorphologicalSegmentorPipelineManager::GetSegmentationNodeFromWorkingData ( const mitk::DataNode::Pointer  node) const
virtual

Assumes input is a valid working node, then searches for a binary parent node, returns NULL if not found.

mitk::ToolManager::Pointer niftk::MorphologicalSegmentorPipelineManager::GetToolManager ( ) const

Gets the mitk::ToolManager from this object.

std::vector< mitk::DataNode * > niftk::MorphologicalSegmentorPipelineManager::GetWorkingDataFromSegmentationNode ( const mitk::DataNode::Pointer  node) const
virtual

Assumes input is a valid segmentation node, then searches for the derived children of the node, looking for binary images called SUBTRACTIONS_NAME and ADDITIONS_NAME. Returns empty list if both not found.

mitk::Image::Pointer niftk::MorphologicalSegmentorPipelineManager::GetWorkingImage ( unsigned int  dataIndex) const

Used to retrieve the working image from the tool manager.

bool niftk::MorphologicalSegmentorPipelineManager::HasSegmentationNode ( ) const

Returns true if the segmentation node can be found which implicitly means we are "in progress".

bool niftk::MorphologicalSegmentorPipelineManager::IsNodeASegmentationImage ( const mitk::DataNode::Pointer  node) const
virtual

For Morphological Editing, a Segmentation image should have a grey scale parent, and two binary children called SUBTRACTIONS_NAME and ADDITIONS_NAME.

bool niftk::MorphologicalSegmentorPipelineManager::IsNodeAWorkingImage ( const mitk::DataNode::Pointer  node) const
virtual

For Morphological Editing, a Working image should be called either SUBTRACTIONS_NAME and ADDITIONS_NAME, and have a binary image parent.

niftk::MorphologicalSegmentorPipelineManager::mitkClassMacroItkParent ( MorphologicalSegmentorPipelineManager  ,
itk::Object   
)
void niftk::MorphologicalSegmentorPipelineManager::OnDilationsValuesChanged ( double  lowerPercentage,
double  upperPercentage,
int  numberOfDilations 
)

Sets the conditional dilation parameters.

Parameters
lowerPercentagethe lower percentage of the mean intensity value within the current region of interest, below which voxels are not dilated.
upperPercentagethe upper percentage of the mean intensity value within the current region of interest, below which voxels are not dilated.
numberOfDilationsthe number of dilation iterations to perform
void niftk::MorphologicalSegmentorPipelineManager::OnErosionsValuesChanged ( double  upperThreshold,
int  numberOfErosions 
)

Sets the conditional erosion parameters.

Parameters
upperThresholdthe highest greyscale intensity value, above which the binary volume is not eroded
numberOfErosionsthe number of erosion iterations to perform
void niftk::MorphologicalSegmentorPipelineManager::OnRethresholdingValuesChanged ( int  boxSize)

Sets the re-thresholding parameters.

Parameters
boxSizethe size of the re-thresholding box (see paper).
void niftk::MorphologicalSegmentorPipelineManager::OnTabChanged ( int  tabIndex)

Called when we step to another stage of the pipeline, either fore or backwards.

Parameters
stagethe new stage where we stepped to
void niftk::MorphologicalSegmentorPipelineManager::OnThresholdingValuesChanged ( double  lowerThreshold,
double  upperThreshold,
int  axialSliceNumber 
)

Sets the thresholding parameters.

Parameters
lowerThresholdthe lowest intensity value included in the segmentation
upperThresholdthe upper intensity value included in the segmentation
axialSliceNumberthe number of the first slice, counting from the inferior end of the imaging volume to include in the imaging volume.
MorphologicalSegmentorPipelineManager& niftk::MorphologicalSegmentorPipelineManager::operator= ( const MorphologicalSegmentorPipelineManager )
protected
void niftk::MorphologicalSegmentorPipelineManager::RemoveWorkingData ( )

Removes the images we are using for editing during connection breaker from the DataStorage.

void niftk::MorphologicalSegmentorPipelineManager::SetDataStorage ( mitk::DataStorage::Pointer  dataStorage)

Sets the mitk::DataStorage on this object.

void niftk::MorphologicalSegmentorPipelineManager::SetSegmentationNodePropsFromReferenceImage ( )

Looks up the reference image, and sets default property values onto the segmentation node, which are later used to update GUI controls.

void niftk::MorphologicalSegmentorPipelineManager::SetToolManager ( mitk::ToolManager::Pointer  toolManager)

Sets the mitk::ToolManager on this object.

void niftk::MorphologicalSegmentorPipelineManager::UpdateSegmentation ( )

Calls update on the ITK pipeline using the MITK AccessByItk macros.

Note: We pass NULLs to the pipeline for the inputs that have not been changed. This is to avoid unnecessary conversions.

Note:

We have to set the IgnoreLock option on the read accessors here, so that the paintbrush tool can apply its write lock on the same images. Here, we keep smart pointers to these images throughout the life of the pipeline. Releasing the smart pointers would result in releasing the read lock (and therefore no conflict with the paintbrush tool) but it would also mean that we need to re-connect the pipeline over and over again and we would need to re-execute filters even if their input images have not changed. (The whole pipeline approach would become senseless.)

As we are bypassing the locking mechanism, we must ensure it by the GUI logic that the paintbrush interactor and the pipeline update are not working at the same time.

Member Data Documentation

const std::string niftk::MorphologicalSegmentorPipelineManager::PROPERTY_MIDAS_MORPH_SEGMENTATION_FINISHED = "midas.morph.finished"
static

A static string, (to avoid code duplication), to hold the name of the property that determines if a morphological segmentation is finished.

const std::string niftk::MorphologicalSegmentorPipelineManager::SEGMENTATION_OF_LAST_STAGE_NAME = "MORPHO_SEGMENTATION_OF_LAST_STAGE"
static

The output of the previous stage of the segmentation pipeline.


The documentation for this class was generated from the following files: