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

Paint brush tool used during editing on the morphological editor screen (a.k.a connection breaker). More...

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

Public Types

enum  { EROSIONS_ADDITIONS, EROSIONS_SUBTRACTIONS, DILATIONS_ADDITIONS, DILATIONS_SUBTRACTIONS }
 Constants that identify the data needed for the morphological edit tools. They should be used for indexing the vector of working data. More...
 
typedef itk::Image
< mitk::Tool::DefaultSegmentationDataType, 3 > 
ImageType
 
typedef
itk::MIDASImageUpdatePixelWiseSingleValueProcessor
< mitk::Tool::DefaultSegmentationDataType, 3 > 
ProcessorType
 

Public Member Functions

 mitkClassMacro (PaintbrushTool, mitk::SegTool2D) static Pointer New()
 
virtual void InitializeStateMachine ()
 
virtual const char * GetName () const
 
virtual const char ** GetXPM () const
 
int GetCursorSize () const
 Gets the cursor size. Default size is 1 pixel. More...
 
void SetCursorSize (int cursorSize)
 Sets the cursor size. More...
 
bool GetErosionMode () const
 Gets the erosion mode. If true, we are editing image 0,1, and if false, we are editing image 2,3. Default true. More...
 
void SetErosionMode (bool erosionMode)
 Sets the erosion mode. If true, we are editing image 0,1, and if false, we are editing image 2,3. Default true. More...
 
virtual void ExecuteOperation (mitk::Operation *operation)
 
virtual bool StartAddingAddition (mitk::StateMachineAction *action, mitk::InteractionEvent *event)
 
virtual bool KeepAddingAddition (mitk::StateMachineAction *action, mitk::InteractionEvent *event)
 
virtual bool StopAddingAddition (mitk::StateMachineAction *action, mitk::InteractionEvent *event)
 
virtual bool StartAddingSubtraction (mitk::StateMachineAction *action, mitk::InteractionEvent *event)
 
virtual bool KeepAddingSubtraction (mitk::StateMachineAction *action, mitk::InteractionEvent *event)
 
virtual bool StopAddingSubtraction (mitk::StateMachineAction *action, mitk::InteractionEvent *event)
 
virtual bool StartRemovingSubtraction (mitk::StateMachineAction *action, mitk::InteractionEvent *event)
 
virtual bool KeepRemovingSubtraction (mitk::StateMachineAction *action, mitk::InteractionEvent *event)
 
virtual bool StopRemovingSubtraction (mitk::StateMachineAction *action, mitk::InteractionEvent *event)
 
- Public Member Functions inherited from niftk::FilteringStateMachine
 FilteringStateMachine ()
 Constructs a FilteringStateMachine object. More...
 
virtual ~FilteringStateMachine ()
 Destructs the FilteringStateMachine object. More...
 
float CanHandleEvent (const mitk::StateEvent *event) const
 This function is to replace the original CanHandleEvent function to support event filtering. More...
 
bool CanHandleEvent (mitk::InteractionEvent *event)
 
virtual void InstallEventFilter (StateMachineEventFilter *eventFilter)
 Installs an event filter that can reject a state machine event or let it pass through. More...
 
virtual void RemoveEventFilter (StateMachineEventFilter *eventFilter)
 Removes an event filter that can reject a state machine event or let it pass through. More...
 
std::vector
< StateMachineEventFilter * > 
GetEventFilters () const
 Gets the list of the installed event filters. More...
 
bool IsFiltered (const mitk::StateEvent *stateEvent) const
 Tells if the event is rejected by the installed event filters or they let it pass through. More...
 
bool IsFiltered (mitk::InteractionEvent *event)
 Tells if the event is rejected by the installed event filters or they let it pass through. More...
 

Public Attributes

mitk::Message1< intCursorSizeChanged
 
mitk::Message1< intSegmentationEdited
 

Static Public Attributes

static const std::string EROSIONS_ADDITIONS_NAME = "MIDAS_EDITS_EROSIONS_ADDITIONS"
 Stores the name of the MIDAS additions image, used in Morphological Editor. More...
 
static const std::string EROSIONS_SUBTRACTIONS_NAME = "MIDAS_EDITS_EROSIONS_SUBTRACTIONS"
 Stores the name of the MIDAS connection breaker image, used in Morphological Editor. More...
 
static const std::string DILATIONS_ADDITIONS_NAME = "MIDAS_EDITS_DILATIONS_ADDITIONS"
 Stores the name of the MIDAS additions image, used in Morphological Editor. More...
 
static const std::string DILATIONS_SUBTRACTIONS_NAME = "MIDAS_EDITS_DILATIONS_SUBTRACTIONS"
 Stores the name of the MIDAS connection breaker image, used in Morphological Editor. More...
 
static const std::string REGION_PROPERTY_NAME = std::string("midas.morph.editing.region")
 

Protected Member Functions

 PaintbrushTool ()
 
virtual ~PaintbrushTool ()
 
virtual void ConnectActionsAndFunctions ()
 Connects state machine actions to functions. More...
 
bool FilterEvents (mitk::InteractionEvent *event, mitk::DataNode *dataNode)
 Tells if this tool can handle the given event. More...
 
virtual void Activated ()
 Called when the tool gets activated (registered to mitk::GlobalInteraction). More...
 
virtual void Deactivated ()
 Called when the tool gets deactivated (unregistered from mitk::GlobalInteraction). More...
 
- Protected Member Functions inherited from niftk::FilteringStateMachine
virtual float CanHandle (const mitk::StateEvent *stateEvent) const
 
virtual bool CanHandle (mitk::InteractionEvent *event)
 

Detailed Description

Paint brush tool used during editing on the morphological editor screen (a.k.a connection breaker).

Note the following:

1.) Writes into 4 images, so ToolManager must have 4 working volume to edit into.
    We define Working Image[0] = "additions image for erosions", which is added to the main segmentation to add stuff back into the volume.
    We define Working Image[1] = "subtractions image for erosions", which is subtracted from the main segmentation to do connection breaking.
    We define Working Image[2] = "additions image for dilations", which is added to the main segmentation to add stuff back into the volume.
    We define Working Image[3] = "subtractions image for dilations", which is subtracted from the main segmentation to do connection breaking.
2.) Then:
    Left mouse = paint into the "additions image".
    Middle mouse = paint into the "subtractions image".
    Right mouse = subtract from the "subtractions image".
3.) We derive from SegTool2D to keep things simple, as we just need to convert from mm world points to voxel points, and paint.
4.) Derives from mitk::OperationActor, so this tool supports undo/redo.

This class is a MITK tool with a GUI defined in niftk::PaintbrushToolGUI, and instantiated using the object factory described in Maleike et. al. doi:10.1016/j.cmpb.2009.04.004.

To effectively use this tool, you need a 3 button mouse.

Trac 1695, 1700, 1701, 1706: Fixing up dilations: We change pipeline so that WorkingData 0,1 are applied during erosions phase, and WorkingData 2,3 are applied during dilations phase.

Member Typedef Documentation

typedef itk::Image<mitk::Tool::DefaultSegmentationDataType, 3> niftk::PaintbrushTool::ImageType

Member Enumeration Documentation

anonymous enum

Constants that identify the data needed for the morphological edit tools. They should be used for indexing the vector of working data.

Enumerator
EROSIONS_ADDITIONS 
EROSIONS_SUBTRACTIONS 
DILATIONS_ADDITIONS 
DILATIONS_SUBTRACTIONS 

Constructor & Destructor Documentation

niftk::PaintbrushTool::PaintbrushTool ( )
protected
niftk::PaintbrushTool::~PaintbrushTool ( )
protectedvirtual

Member Function Documentation

void niftk::PaintbrushTool::Activated ( )
protectedvirtual

Called when the tool gets activated (registered to mitk::GlobalInteraction).

Derived tools should call their parents implementation.

void niftk::PaintbrushTool::ConnectActionsAndFunctions ( )
protectedvirtual

Connects state machine actions to functions.

void niftk::PaintbrushTool::Deactivated ( )
protectedvirtual

Called when the tool gets deactivated (unregistered from mitk::GlobalInteraction).

Derived tools should call their parents implementation.

void niftk::PaintbrushTool::ExecuteOperation ( mitk::Operation *  operation)
virtual

Method to enable this class to interact with the Undo/Redo framework.

bool niftk::PaintbrushTool::FilterEvents ( mitk::InteractionEvent *  event,
mitk::DataNode *  dataNode 
)
protected

Tells if this tool can handle the given event.

This implementation delegates the call to FilteringStateMachine::CanHandleEvent(), that checks if the event is filtered by one of the installed event filters and if not, calls CanHandle() and returns with its result.

Note that this function is purposefully not virtual. Eventual subclasses should override the CanHandle function.

int niftk::PaintbrushTool::GetCursorSize ( ) const

Gets the cursor size. Default size is 1 pixel.

bool niftk::PaintbrushTool::GetErosionMode ( ) const

Gets the erosion mode. If true, we are editing image 0,1, and if false, we are editing image 2,3. Default true.

const char * niftk::PaintbrushTool::GetName ( ) const
virtual

Strings to help the tool identify itself in GUI.

const char ** niftk::PaintbrushTool::GetXPM ( ) const
virtual
void niftk::PaintbrushTool::InitializeStateMachine ( )
virtual
bool niftk::PaintbrushTool::KeepAddingAddition ( mitk::StateMachineAction *  action,
mitk::InteractionEvent *  event 
)
virtual
bool niftk::PaintbrushTool::KeepAddingSubtraction ( mitk::StateMachineAction *  action,
mitk::InteractionEvent *  event 
)
virtual
bool niftk::PaintbrushTool::KeepRemovingSubtraction ( mitk::StateMachineAction *  action,
mitk::InteractionEvent *  event 
)
virtual
niftk::PaintbrushTool::mitkClassMacro ( PaintbrushTool  ,
mitk::SegTool2D   
)
void niftk::PaintbrushTool::SetCursorSize ( int  cursorSize)

Sets the cursor size.

void niftk::PaintbrushTool::SetErosionMode ( bool  erosionMode)

Sets the erosion mode. If true, we are editing image 0,1, and if false, we are editing image 2,3. Default true.

bool niftk::PaintbrushTool::StartAddingAddition ( mitk::StateMachineAction *  action,
mitk::InteractionEvent *  event 
)
virtual

Process all mouse events.

bool niftk::PaintbrushTool::StartAddingSubtraction ( mitk::StateMachineAction *  action,
mitk::InteractionEvent *  event 
)
virtual
bool niftk::PaintbrushTool::StartRemovingSubtraction ( mitk::StateMachineAction *  action,
mitk::InteractionEvent *  event 
)
virtual
bool niftk::PaintbrushTool::StopAddingAddition ( mitk::StateMachineAction *  action,
mitk::InteractionEvent *  event 
)
virtual
bool niftk::PaintbrushTool::StopAddingSubtraction ( mitk::StateMachineAction *  action,
mitk::InteractionEvent *  event 
)
virtual
bool niftk::PaintbrushTool::StopRemovingSubtraction ( mitk::StateMachineAction *  action,
mitk::InteractionEvent *  event 
)
virtual

Member Data Documentation

mitk::Message1<int> niftk::PaintbrushTool::CursorSizeChanged

Used to send messages when the cursor size is changed or should be updated in a GUI.

const std::string niftk::PaintbrushTool::DILATIONS_ADDITIONS_NAME = "MIDAS_EDITS_DILATIONS_ADDITIONS"
static

Stores the name of the MIDAS additions image, used in Morphological Editor.

const std::string niftk::PaintbrushTool::DILATIONS_SUBTRACTIONS_NAME = "MIDAS_EDITS_DILATIONS_SUBTRACTIONS"
static

Stores the name of the MIDAS connection breaker image, used in Morphological Editor.

const std::string niftk::PaintbrushTool::EROSIONS_ADDITIONS_NAME = "MIDAS_EDITS_EROSIONS_ADDITIONS"
static

Stores the name of the MIDAS additions image, used in Morphological Editor.

const std::string niftk::PaintbrushTool::EROSIONS_SUBTRACTIONS_NAME = "MIDAS_EDITS_EROSIONS_SUBTRACTIONS"
static

Stores the name of the MIDAS connection breaker image, used in Morphological Editor.

const std::string niftk::PaintbrushTool::REGION_PROPERTY_NAME = std::string("midas.morph.editing.region")
static

We store the name of a property that stores the image region.

mitk::Message1<int> niftk::PaintbrushTool::SegmentationEdited

Message sent when the user modified the segmentation using this tool


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