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

Public Member Functions

 BaseSegmentorController (IBaseView *view)
 
virtual ~BaseSegmentorController ()
 
virtual void SetupGUI (QWidget *parent) override
 Sets up the GUI. This function has to be called from the CreateQtPartControl function of the view. More...
 
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 ()=0
 Called from niftkSegmentationSelectorWidget when the 'Start/restart segmentation' button is clicked. More...
 

Protected Member Functions

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 bool IsASegmentationImage (const mitk::DataNode::Pointer node)
 Returns true if node represents an image that is binary, and false otherwise. More...
 
virtual bool IsAWorkingImage (const mitk::DataNode::Pointer node)
 Returns true if node represents an image that is binary, and false otherwise. More...
 
virtual std::vector
< mitk::DataNode * > 
GetWorkingDataFromSegmentationNode (const mitk::DataNode::Pointer node)
 Assumes that a Working Node == a Segmentation Node, so simply returns the input node. More...
 
virtual mitk::DataNode * GetSegmentationNodeFromWorkingData (const mitk::DataNode::Pointer node)
 Assumes that a Working Node == a Segmentation Node, so simply returns the input node. More...
 
virtual bool CanStartSegmentationForBinaryNode (const mitk::DataNode::Pointer node)=0
 Subclasses decide if they can restart the segmentation for a binary node. 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...
 
virtual void OnDataManagerSelectionChanged (const QList< mitk::DataNode::Pointer > &nodes)
 Called when the selection changes in the data manager. 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...
 
virtual BaseGUICreateGUI (QWidget *parent)=0
 Creates the widget that holds the GUI components of the view. This function is called from CreateQtPartControl. Derived classes should provide their implementation that returns an object whose class derives from niftk::BaseGUI. 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 OnNodeRemoved (const mitk::DataNode *node)
 Called when a data node has been removed from the data storage. 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...
 
virtual void OnNodeVisibilityChanged (const mitk::DataNode *node, const mitk::BaseRenderer *renderer)
 Called when the visibility of a data node in the data storage has changed. The renderer is nullptr if the global visibility has changed. 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...
 

Friends

class BaseSegmentorView
 

Constructor & Destructor Documentation

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

Member Function Documentation

void niftk::BaseSegmentorController::ApplyDisplayOptions ( mitk::DataNode *  node)
protectedvirtual

Decorates a DataNode according to the user preference settings, or requirements for binary images.

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

Subclasses decide if they can restart the segmentation for a binary node.

Implemented in niftk::GeneralSegmentorController, and niftk::MorphologicalSegmentorController.

mitk::DataNode * niftk::BaseSegmentorController::CreateNewSegmentation ( )
protectedvirtual

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.

Returns
mitk::DataNode* A new segmentation or NULL if the user cancels the dialog box.
bool niftk::BaseSegmentorController::EventFilter ( const mitk::StateEvent *  stateEvent) const
overridevirtual

Returns true if the event should be filtered, i.e. not processed, otherwise false.

Reimplemented from niftk::StateMachineEventFilter.

bool niftk::BaseSegmentorController::EventFilter ( mitk::InteractionEvent *  event) const
overridevirtual

Returns true if the event should be filtered, i.e. not processed, otherwise false.

Reimplemented from niftk::StateMachineEventFilter.

mitk::DataNode * niftk::BaseSegmentorController::FindReferenceNodeFromSegmentationNode ( const mitk::DataNode::Pointer  segmentationNode)
protected

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.

const QColor & niftk::BaseSegmentorController::GetDefaultSegmentationColour ( ) const

Default colour to be displayed in the new segmentation dialog box.

mitk::Image * niftk::BaseSegmentorController::GetReferenceImage ( )
protected

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.

int niftk::BaseSegmentorController::GetReferenceImageSliceAxis ( )
protected

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.

int niftk::BaseSegmentorController::GetReferenceImageSliceAxis ( ImageOrientation  orientation)
protected

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.

int niftk::BaseSegmentorController::GetReferenceImageSliceIndex ( )
protected

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.

int niftk::BaseSegmentorController::GetReferenceImageSliceUpDirection ( )
protected

Returns the "Up" direction which is the anterior, superior or right direction depending on which orientation you are interested in.

mitk::DataNode * niftk::BaseSegmentorController::GetReferenceNode ( )
protected

Gets the reference node from the tool manager or nullptr if it can't be found.

mitk::DataNode * niftk::BaseSegmentorController::GetSegmentationNodeFromWorkingData ( const mitk::DataNode::Pointer  node)
protectedvirtual

Assumes that a Working Node == a Segmentation Node, so simply returns the input node.

Reimplemented in niftk::MorphologicalSegmentorController.

BaseSegmentorGUI * niftk::BaseSegmentorController::GetSegmentorGUI ( ) const
protected

Gets the segmentor widget that holds the GUI components of the view.

template<class ToolType >
ToolType * niftk::BaseSegmentorController::GetToolByType ( )
mitk::ToolManager * niftk::BaseSegmentorController::GetToolManager ( ) const

Returns the segmentation tool manager used by the segmentor.

std::vector< mitk::DataNode * > niftk::BaseSegmentorController::GetWorkingData ( )
protected

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.

std::vector< mitk::DataNode * > niftk::BaseSegmentorController::GetWorkingDataFromSegmentationNode ( const mitk::DataNode::Pointer  node)
protectedvirtual

Assumes that a Working Node == a Segmentation Node, so simply returns the input node.

Reimplemented in niftk::GeneralSegmentorController, and niftk::MorphologicalSegmentorController.

mitk::Image * niftk::BaseSegmentorController::GetWorkingImage ( int  index)
protected

Gets a single binary image registered with the ToolManager. Returns nullptr if it can't be found or is not an image.

bool niftk::BaseSegmentorController::HasInitialisedWorkingData ( )
protected

Utility method to check that we have initialised all the working data such as contours, region growing images etc.

bool niftk::BaseSegmentorController::IsAReferenceImage ( const mitk::DataNode::Pointer  node)
protectedvirtual

Returns true if node represent an image that is non binary, and false otherwise.

bool niftk::BaseSegmentorController::IsASegmentationImage ( const mitk::DataNode::Pointer  node)
protectedvirtual

Returns true if node represents an image that is binary, and false otherwise.

Reimplemented in niftk::GeneralSegmentorController, and niftk::MorphologicalSegmentorController.

bool niftk::BaseSegmentorController::IsAWorkingImage ( const mitk::DataNode::Pointer  node)
protectedvirtual

Returns true if node represents an image that is binary, and false otherwise.

Reimplemented in niftk::MorphologicalSegmentorController.

void niftk::BaseSegmentorController::OnActiveToolChanged ( )
protectedvirtual

Called from niftkToolSelectorWidget when a tool changes.

Note: The view is not created when the GUI is set up, therefore we cannot initialise this variable at another place.

Set the focus back to the main window. This is needed so that the keyboard shortcuts (like 'a' and 'z' for changing slice) keep on working.

void niftk::BaseSegmentorController::OnDataManagerSelectionChanged ( const QList< mitk::DataNode::Pointer > &  nodes)
protectedvirtual

Called when the selection changes in the data manager.

See also
QmitkAbstractView::OnSelectionChanged.

It is not allowed to work on several segmentation at a time, simultaneously. If you are already working on a segmentation, you have to finalise it (OK) or discard it (Cancel) before you can start segmenting another image. (Or making another segmentation of the same image.)

Reimplemented in niftk::MorphologicalSegmentorController.

virtual void niftk::BaseSegmentorController::OnNewSegmentationButtonClicked ( )
protectedpure virtualslot

Called from niftkSegmentationSelectorWidget when the 'Start/restart segmentation' button is clicked.

void niftk::BaseSegmentorController::OnViewGetsActivated ( )
overridevirtual

Called when the BlueBerry view that hosts the GUI for this controller gets activated.

Reimplemented from niftk::BaseController.

void niftk::BaseSegmentorController::SetDefaultSegmentationColour ( const QColor &  defaultSegmentationColour)

Default colour to be displayed in the new segmentation dialog box.

void niftk::BaseSegmentorController::SetReferenceImageSelected ( )
protected

Makes sure the reference image is the selected one.

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

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

Reimplemented from niftk::BaseController.

Reimplemented in niftk::GeneralSegmentorController, and niftk::MorphologicalSegmentorController.

Friends And Related Function Documentation

friend class BaseSegmentorView
friend

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