NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
Public Member Functions | Protected Slots | Protected Member Functions | List of all members
niftk::MorphologicalSegmentorController Class Reference
Inheritance diagram for niftk::MorphologicalSegmentorController:
Inheritance graph
[legend]
Collaboration diagram for niftk::MorphologicalSegmentorController:
Collaboration graph
[legend]

Public Member Functions

 MorphologicalSegmentorController (IBaseView *view)
 
virtual ~MorphologicalSegmentorController ()
 
virtual void SetupGUI (QWidget *parent) override
 Sets up the GUI. This function has to be called from the CreateQtPartControl function of the view. More...
 
void OnViewGetsClosed ()
 If the user hits the close icon, it is equivalent to a Cancel, and the segmentation is destroyed without warning. More...
 
virtual void OnNodeVisibilityChanged (const mitk::DataNode *node, const mitk::BaseRenderer *renderer) override
 Called when the visibility of a data node has changed. More...
 
virtual void OnNodeRemoved (const mitk::DataNode *node) override
 Called when a data node has been removed. More...
 
virtual void OnSegmentationEdited (int imageIndex)
 Called when the segmentation is manually edited via the paintbrush tool. More...
 
- Public Member Functions inherited from niftk::BaseSegmentorController
 BaseSegmentorController (IBaseView *view)
 
virtual ~BaseSegmentorController ()
 
mitk::ToolManager * GetToolManager () const
 Returns the segmentation tool manager used by the segmentor. More...
 
template<class ToolType >
ToolType * GetToolByType ()
 
virtual bool EventFilter (const mitk::StateEvent *stateEvent) const override
 Returns true if the event should be filtered, i.e. not processed, otherwise false. More...
 
virtual bool EventFilter (mitk::InteractionEvent *event) const override
 Returns true if the event should be filtered, i.e. not processed, otherwise false. More...
 
const QColor & GetDefaultSegmentationColour () const
 Default colour to be displayed in the new segmentation dialog box. More...
 
void SetDefaultSegmentationColour (const QColor &defaultSegmentationColour)
 Default colour to be displayed in the new segmentation dialog box. More...
 
virtual void OnViewGetsActivated () override
 Called when the BlueBerry view that hosts the GUI for this controller gets activated. More...
 
- Public Member Functions inherited from niftk::BaseController
 BaseController (IBaseView *view)
 Constructs a BaseController object. More...
 
virtual ~BaseController ()
 Destructs the BaseController object. More...
 
ImageOrientation GetOrientation () const
 Returns the orientation of the selected render window. Returns IMAGE_ORIENTATION_UNKNOWN if no window is selected or the selected window is a 3D window. More...
 
int GetSliceIndex () const
 Returns the index of the displayed slice in the currently selected window. Returns -1 if no window is selected or the selected window is a 3D window. More...
 
mitk::Point3D GetSelectedPosition () const
 Returns the selected position in the current editor (render window part). The selected position is the voxel at the intersection of the crosshair planes. More...
 
virtual void OnViewGetsDeactivated ()
 Called when the BlueBerry view that hosts the GUI for this controller gets deactivated. More...
 
virtual void OnViewGetsVisible ()
 Called when the BlueBerry view that hosts the GUI for this controller becomes visible. More...
 
virtual void OnViewGetsHidden ()
 Called when the BlueBerry view that hosts the GUI for this controller becomes hidden. More...
 
- Public Member Functions inherited from niftk::StateMachineEventFilter
 mitkClassMacroNoParent (StateMachineEventFilter) StateMachineEventFilter()
 
virtual ~StateMachineEventFilter ()
 

Protected Slots

virtual void OnNewSegmentationButtonClicked () override
 Called when the user hits the button "New segmentation", which creates the necessary reference data. More...
 
void OnThresholdingValuesChanged (double lowerThreshold, double upperThreshold, int axialSliceNumber)
 Called from niftkMorphologicalSegmentorGUI when thresholding sliders or spin boxes changed. More...
 
void OnErosionsValuesChanged (double upperThreshold, int numberOfErosions)
 Called from niftkMorphologicalSegmentorGUI when erosion sliders or spin boxes changed. More...
 
void OnDilationsValuesChanged (double lowerPercentage, double upperPercentage, int numberOfDilations)
 Called from niftkMorphologicalSegmentorGUI when dilation sliders or spin boxes changed. More...
 
void OnRethresholdingValuesChanged (int boxSize)
 Called from niftkMorphologicalSegmentorGUI when re-thresholding widgets changed. More...
 
void OnTabChanged (int i)
 Called from niftkMorphologicalSegmentorGUI when a tab changes. More...
 
void OnOKButtonClicked ()
 Called from niftkMorphologicalSegmentatorControls when OK button is clicked, which should finalise / finish and accept the segmentation. More...
 
void OnRestartButtonClicked ()
 Called from niftkMorphologicalSegmentatorControls when Restart button is clicked, which means "back to start", like a "reset" button. More...
 
void OnCancelButtonClicked ()
 Called from niftkMorphologicalSegmentorGUI when cancel button is clicked, which should mean "throw away" / "abandon" current segmentation. More...
 
- Protected Slots inherited from niftk::BaseSegmentorController
virtual void OnNewSegmentationButtonClicked ()=0
 Called from niftkSegmentationSelectorWidget when the 'Start/restart segmentation' button is clicked. More...
 

Protected Member Functions

virtual bool IsASegmentationImage (const mitk::DataNode::Pointer node) override
 For Morphological Editing, a Segmentation image should have a grey scale parent, and two binary children called SUBTRACTIONS_IMAGE_NAME and ADDITIONS_IMAGE_NAME. More...
 
virtual bool IsAWorkingImage (const mitk::DataNode::Pointer node) override
 For Morphological Editing, a Working image should be called either SUBTRACTIONS_IMAGE_NAME and ADDITIONS_IMAGE_NAME, and have a binary image parent. More...
 
virtual std::vector
< mitk::DataNode * > 
GetWorkingDataFromSegmentationNode (const mitk::DataNode::Pointer node) override
 Assumes input is a valid segmentation node, then searches for the derived children of the node, looking for binary images called SUBTRACTIONS_IMAGE_NAME and ADDITIONS_IMAGE_NAME. Returns empty list if both not found. More...
 
virtual mitk::DataNode * GetSegmentationNodeFromWorkingData (const mitk::DataNode::Pointer node) override
 Assumes input is a valid working node, then searches for a binary parent node, returns NULL if not found. More...
 
virtual bool CanStartSegmentationForBinaryNode (const mitk::DataNode::Pointer node) override
 For any binary image, we return true if the property midas.morph.stage is present, and false otherwise. More...
 
virtual BaseGUICreateGUI (QWidget *parent) override
 Creates the morphological segmentor widget that holds the GUI components of the view. More...
 
virtual void OnDataManagerSelectionChanged (const QList< mitk::DataNode::Pointer > &nodes) override
 Called when the selection changes in the data manager. More...
 
- Protected Member Functions inherited from niftk::BaseSegmentorController
virtual void OnActiveToolChanged ()
 Called from niftkToolSelectorWidget when a tool changes. More...
 
std::vector< mitk::DataNode * > GetWorkingData ()
 Gets a vector of the working data nodes registered with the tool manager. The data nodes normally hold image, but could be surfaces etc. Empty list is returned if this can't be found. More...
 
mitk::Image * GetWorkingImage (int index)
 Gets a single binary image registered with the ToolManager. Returns nullptr if it can't be found or is not an image. More...
 
mitk::DataNode * GetReferenceNode ()
 Gets the reference node from the tool manager or nullptr if it can't be found. More...
 
mitk::Image * GetReferenceImage ()
 Gets the reference image from the tool manager, or nullptr if this doesn't yet exist or is not an image. Assumes that a reference (grey scale) image is always registered with the tool manager. More...
 
mitk::DataNode * FindReferenceNodeFromSegmentationNode (const mitk::DataNode::Pointer segmentationNode)
 Gets the reference node that the segmentation node belongs to. Assumes that the reference (grey scale) node is always the direct parent of the segmentation (binary) node, so we simply search for a non binary parent. More...
 
void SetReferenceImageSelected ()
 Makes sure the reference image is the selected one. More...
 
virtual bool IsAReferenceImage (const mitk::DataNode::Pointer node)
 Returns true if node represent an image that is non binary, and false otherwise. More...
 
virtual void ApplyDisplayOptions (mitk::DataNode *node)
 Decorates a DataNode according to the user preference settings, or requirements for binary images. More...
 
int GetReferenceImageSliceAxis ()
 Returns which image coordinate corresponds to the currently selected orientation. Retrieves the currently active QmitkRenderWindow, and the reference image registered with the ToolManager, and returns the Image axis that the current view is looking along, or -1 if it can not be worked out. More...
 
int GetReferenceImageSliceAxis (ImageOrientation orientation)
 Returns which image coordinate corresponds to the given orientation. Looks up the ReferenceImage registered with ToolManager and returns the axis [0,1,2] that corresponds to the given orientation, or -1 if it can't be found. More...
 
int GetReferenceImageSliceIndex ()
 Returns the slice index in the reference image that corresponds to the currently displayed slice. This might be different to the slice displayed in the viewer, depending on the up direction. More...
 
int GetReferenceImageSliceUpDirection ()
 Returns the "Up" direction which is the anterior, superior or right direction depending on which orientation you are interested in. More...
 
virtual mitk::DataNode * CreateNewSegmentation ()
 Creates from derived classes when the the user hits the "New segmentation", producing a dialog box, and on successful completion of the dialog box, will create a new segmentation image. More...
 
BaseSegmentorGUIGetSegmentorGUI () const
 Gets the segmentor widget that holds the GUI components of the view. More...
 
bool HasInitialisedWorkingData ()
 Utility method to check that we have initialised all the working data such as contours, region growing images etc. More...
 
- Protected Member Functions inherited from niftk::BaseController
mitk::DataStorage * GetDataStorage () const
 
void RequestRenderWindowUpdate () const
 
QList< mitk::DataNode::Pointer > GetDataManagerSelection () const
 
mitk::SliceNavigationController * GetSliceNavigationController () const
 
virtual void OnSelectedSliceChanged (niftk::ImageOrientation orientation, int sliceIndex)
 Called when the selected slice changes. This happens when selected window changes in the current editor (render window part) or when the focus is on a 2D render window in the current editor and the selected slice changes, either through interaction (e.g. by scrolling with the mouse wheel) or through an API call. More...
 
BaseGUIGetGUI () const
 Gets the widget that holds the GUI components of the view. More...
 
IBaseViewGetView () const
 Gets the segmentor BlueBerry view. More...
 
virtual void OnFocusChanged ()
 Called when the window focus changes, and tracks the current mitk::BaseRenderer*. More...
 
virtual mitk::BaseRenderer * GetFocused2DRenderer () const
 Returns the currently focused renderer, as this class is tracking the focus changes. More...
 
virtual void OnNodeAdded (const mitk::DataNode *node)
 Called when a data node is added to the data storage. Empty implementation. Derived classes can override it. More...
 
virtual void OnNodeChanged (const mitk::DataNode *node)
 Called when a data node in the data storage has changed. Empty implementation. Derived classes can override it. More...
 
virtual void OnNodeDeleted (const mitk::DataNode *node)
 Called when a data node has been deleted that has previously been in the data storage. Empty implementation. Derived classes can override it. More...
 
void WaitCursorOn ()
 Convenient method to set and reset a wait cursor ("hourglass") More...
 
void WaitCursorOff ()
 Convenient method to restore the standard cursor. More...
 
void BusyCursorOn ()
 Convenient method to set and reset a busy cursor. More...
 
void BusyCursorOff ()
 Convenient method to restore the standard cursor. More...
 

Constructor & Destructor Documentation

niftk::MorphologicalSegmentorController::MorphologicalSegmentorController ( IBaseView view)
niftk::MorphologicalSegmentorController::~MorphologicalSegmentorController ( )
virtual

Member Function Documentation

bool niftk::MorphologicalSegmentorController::CanStartSegmentationForBinaryNode ( const mitk::DataNode::Pointer  node)
overrideprotectedvirtual

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

Implements niftk::BaseSegmentorController.

BaseGUI * niftk::MorphologicalSegmentorController::CreateGUI ( QWidget *  parent)
overrideprotectedvirtual

Creates the morphological segmentor widget that holds the GUI components of the view.

Implements niftk::BaseController.

mitk::DataNode * niftk::MorphologicalSegmentorController::GetSegmentationNodeFromWorkingData ( const mitk::DataNode::Pointer  node)
overrideprotectedvirtual

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

Reimplemented from niftk::BaseSegmentorController.

std::vector< mitk::DataNode * > niftk::MorphologicalSegmentorController::GetWorkingDataFromSegmentationNode ( const mitk::DataNode::Pointer  node)
overrideprotectedvirtual

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

Reimplemented from niftk::BaseSegmentorController.

bool niftk::MorphologicalSegmentorController::IsASegmentationImage ( const mitk::DataNode::Pointer  node)
overrideprotectedvirtual

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

Reimplemented from niftk::BaseSegmentorController.

bool niftk::MorphologicalSegmentorController::IsAWorkingImage ( const mitk::DataNode::Pointer  node)
overrideprotectedvirtual

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

Reimplemented from niftk::BaseSegmentorController.

void niftk::MorphologicalSegmentorController::OnCancelButtonClicked ( )
protectedslot

Called from niftkMorphologicalSegmentorGUI when cancel button is clicked, which should mean "throw away" / "abandon" current segmentation.

void niftk::MorphologicalSegmentorController::OnDataManagerSelectionChanged ( const QList< mitk::DataNode::Pointer > &  nodes)
overrideprotectedvirtual

Called when the selection changes in the data manager.

See also
QmitkAbstractView::OnSelectionChanged.

Reimplemented from niftk::BaseSegmentorController.

void niftk::MorphologicalSegmentorController::OnDilationsValuesChanged ( double  lowerPercentage,
double  upperPercentage,
int  numberOfDilations 
)
protectedslot

Called from niftkMorphologicalSegmentorGUI when dilation sliders or spin boxes changed.

void niftk::MorphologicalSegmentorController::OnErosionsValuesChanged ( double  upperThreshold,
int  numberOfErosions 
)
protectedslot

Called from niftkMorphologicalSegmentorGUI when erosion sliders or spin boxes changed.

void niftk::MorphologicalSegmentorController::OnNewSegmentationButtonClicked ( )
overrideprotectedvirtualslot

Called when the user hits the button "New segmentation", which creates the necessary reference data.

Note: The 'new segmentation' button is enabled only when a reference image is selected. A reference image gets selected when the selection in the data manager changes to a valid reference image or a segmentation that was created by this segmentor. Hence, we can assume that we have a valid tool manager, paintbrush tool and reference image.

Create the new segmentation, either using a previously selected one, or create a new volume.

Note: The tool selection box tracks the events when the working data changes, and enables and disables the tool buttons accordingly. However, we want to enable the buttons only in the second and third step of the workflow (erosion and dilation). So, since we are at the first step, we have to disable the tool selector that was enabled at the previous call when setting the working data.

void niftk::MorphologicalSegmentorController::OnNodeRemoved ( const mitk::DataNode *  node)
overridevirtual

Called when a data node has been removed.

Reimplemented from niftk::BaseController.

void niftk::MorphologicalSegmentorController::OnNodeVisibilityChanged ( const mitk::DataNode *  node,
const mitk::BaseRenderer *  renderer 
)
overridevirtual

Called when the visibility of a data node has changed.

Reimplemented from niftk::BaseController.

void niftk::MorphologicalSegmentorController::OnOKButtonClicked ( )
protectedslot

Called from niftkMorphologicalSegmentatorControls when OK button is clicked, which should finalise / finish and accept the segmentation.

Remove the axial cut-off plane node from the data storage.

void niftk::MorphologicalSegmentorController::OnRestartButtonClicked ( )
protectedslot

Called from niftkMorphologicalSegmentatorControls when Restart button is clicked, which means "back to start", like a "reset" button.

Reset the axial cut-off plane to the bottom of the image.

void niftk::MorphologicalSegmentorController::OnRethresholdingValuesChanged ( int  boxSize)
protectedslot

Called from niftkMorphologicalSegmentorGUI when re-thresholding widgets changed.

void niftk::MorphologicalSegmentorController::OnSegmentationEdited ( int  imageIndex)
virtual

Called when the segmentation is manually edited via the paintbrush tool.

Parameters
imageIndextells which image has been modified: erosion addition / subtraction or dilation addition / subtraction.
void niftk::MorphologicalSegmentorController::OnTabChanged ( int  i)
protectedslot

Called from niftkMorphologicalSegmentorGUI when a tab changes.

void niftk::MorphologicalSegmentorController::OnThresholdingValuesChanged ( double  lowerThreshold,
double  upperThreshold,
int  axialSliceNumber 
)
protectedslot

Called from niftkMorphologicalSegmentorGUI when thresholding sliders or spin boxes changed.

void niftk::MorphologicalSegmentorController::OnViewGetsClosed ( )

If the user hits the close icon, it is equivalent to a Cancel, and the segmentation is destroyed without warning.

TODO this is not invoked at all. This function was called "ClosePart" before it was moved here from niftkMorphologicalSegmentorView. It was not invoked there, either. I leave this here to remind me that the segmentation should be discarded when the view is closed.

void niftk::MorphologicalSegmentorController::SetupGUI ( QWidget *  parent)
overridevirtual

Sets up the GUI. This function has to be called from the CreateQtPartControl function of the view.

Reimplemented from niftk::BaseSegmentorController.


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