Medical Imaging Interaction Toolkit
2018.4.99-389bf124
Medical Imaging Interaction Toolkit
|
Abstract base class for segmentation tools. More...
#include <mitkSegTool2D.h>
Classes | |
struct | SliceInformation |
Public Member Functions | |
mitkClassMacro (SegTool2D, Tool) | |
void | SetShowMarkerNodes (bool) |
void | SetEnable3DInterpolation (bool) |
Enables or disables the 3D interpolation after writing back the 2D segmentation result, and defaults to true. More... | |
![]() | |
mitkClassMacro (Tool, EventStateMachine) | |
virtual const char ** | GetXPM () const =0 |
Returns an icon in the XPM format. More... | |
virtual std::string | GetIconPath () const |
Returns the path of an icon. More... | |
virtual us::ModuleResource | GetCursorIconResource () const |
Returns the path of a cursor icon. More... | |
virtual us::ModuleResource | GetIconResource () const |
Returns the tool button icon of the tool wrapped by a usModuleResource. More... | |
virtual const char * | GetName () const =0 |
Returns the name of this tool. Make it short! More... | |
virtual const char * | GetGroup () const |
Name of a group. More... | |
virtual void | InitializeStateMachine () |
virtual itk::Object::Pointer | GetGUI (const std::string &toolkitPrefix, const std::string &toolkitPostfix) |
Interface for GUI creation. More... | |
virtual NodePredicateBase::ConstPointer | GetReferenceDataPreference () const |
virtual NodePredicateBase::ConstPointer | GetWorkingDataPreference () const |
DataNode::Pointer | CreateEmptySegmentationNode (const Image *original, const std::string &organName, const mitk::Color &color) |
DataNode::Pointer | CreateSegmentationNode (Image *image, const std::string &organName, const mitk::Color &color) |
virtual bool | CanHandle (BaseData *referenceData) const |
![]() | |
virtual std::vector< std::string > | GetClassHierarchy () const override |
virtual const char * | GetClassName () const |
bool | LoadStateMachine (const std::string &filename, const us::Module *module=nullptr) |
Loads XML resource. More... | |
bool | HandleEvent (InteractionEvent *event, DataNode *dataNode) |
void | EnableUndo (bool enable) |
Enables or disabled Undo. More... | |
void | EnableInteraction (bool enable) |
Enables/disables the state machine. In un-enabled state it won't react to any events. More... | |
![]() | |
bool | SetEventConfig (const std::string &filename, const us::Module *module=nullptr) |
Loads a configuration from an XML resource. More... | |
bool | SetEventConfig (const EventConfig &config) |
Loads a configuration from an EventConfig object. More... | |
EventConfig | GetEventConfig () const |
Returns the current configuration. More... | |
bool | AddEventConfig (const std::string &filename, const us::Module *module=nullptr) |
This method extends the configuration. More... | |
bool | AddEventConfig (const EventConfig &config) |
This method extends the configuration. The configuration from the EventConfig object is loaded and only the ones conflicting are replaced by the new one. This way several configurations can be combined. More... | |
![]() | |
InteractionEventObserver () | |
virtual | ~InteractionEventObserver () |
void | Disable () |
void | Enable () |
bool | IsEnabled () const |
Static Public Member Functions | |
static bool | DetermineAffectedImageSlice (const Image *image, const PlaneGeometry *plane, int &affectedDimension, int &affectedSlice) |
Calculates for a given Image and PlaneGeometry, which slice of the image (in index corrdinates) is meant by the plane. More... | |
static void | UpdateSurfaceInterpolation (const Image *slice, const Image *workingImage, const PlaneGeometry *plane, bool detectIntersection) |
Updates the surface interpolation by extracting the contour form the given slice. More... | |
![]() | |
static const char * | GetStaticNameOfClass () |
![]() | |
static const char * | GetStaticNameOfClass () |
Protected Member Functions | |
SegTool2D () | |
SegTool2D (const char *, const us::Module *interactorModule=nullptr) | |
~SegTool2D () override | |
bool | FilterEvents (InteractionEvent *interactionEvent, DataNode *dataNode) override |
Filters events that cannot be handle by 2D segmentation tools. More... | |
Image::Pointer | GetAffectedImageSliceAs2DImage (const InteractionPositionEvent *positionEvent, const Image *image, unsigned int component=0) |
Extract the slice of an image that the user just scribbles on. The given component denotes the vector component of a dwi-image. More... | |
Image::Pointer | GetAffectedImageSliceAs2DImage (const PlaneGeometry *planeGeometry, const Image *image, unsigned int timeStep, unsigned int component=0) |
Extract the slice of an image cut by given plane. The given component denotes the vector component of a dwi-image. More... | |
Image::Pointer | GetAffectedWorkingSlice (const InteractionPositionEvent *) |
Extract the slice of the currently selected working image that the user just scribbles on. More... | |
Image::Pointer | GetAffectedReferenceSlice (const InteractionPositionEvent *) |
Extract the slice of the currently selected reference image that the user just scribbles on. More... | |
void | WriteBackSegmentationResult (const InteractionPositionEvent *, Image *) |
void | WriteBackSegmentationResult (const PlaneGeometry *planeGeometry, Image *, unsigned int timeStep) |
void | WriteBackSegmentationResult (const std::vector< SliceInformation > &sliceList, bool writeSliceToVolume=true) |
void | WritePreviewOnWorkingImage (Image *targetSlice, Image *sourceSlice, Image *workingImage, int paintingPixelValue, int timestep) |
void | WriteSliceToVolume (const SliceInformation &sliceInfo) |
int | AddContourmarker () |
Adds a new node called Contourmarker to the datastorage which holds a mitk::PlanarFigure. By selecting this node the slicestack will be reoriented according to the PlanarFigure's Geometry. More... | |
void | InteractiveSegmentationBugMessage (const std::string &message) |
![]() | |
virtual void | SetToolManager (ToolManager *) |
void | ConnectActionsAndFunctions () override |
virtual void | Activated () |
Called when the tool gets activated. More... | |
virtual void | Deactivated () |
Called when the tool gets deactivated. More... | |
Tool () | |
Tool (const char *, const us::Module *interactorModule=nullptr) | |
~Tool () override | |
void | Notify (InteractionEvent *interactionEvent, bool isHandled) override |
bool | FilterEvents (InteractionEvent *, DataNode *) override |
![]() | |
EventStateMachine () | |
~EventStateMachine () override | |
void | AddActionFunction (const std::string &action, TActionFunctor *functor) |
void | AddActionFunction (const std::string &action, const ActionFunctionDelegate &delegate) |
void | AddConditionFunction (const std::string &condition, const ConditionFunctionDelegate &delegate) |
StateMachineState * | GetCurrentState () const |
void | ResetToStartState () |
ResetToStartState Reset state machine to it initial starting state. More... | |
virtual bool | CheckCondition (const StateMachineCondition &condition, const InteractionEvent *interactionEvent) |
virtual void | ExecuteAction (StateMachineAction *action, InteractionEvent *interactionEvent) |
void | SetMouseCursor (const char *xpm[], int hotspotX, int hotspotY) |
Sets the specified mouse cursor. More... | |
void | ResetMouseCursor () |
Resets the mouse cursor (if modified by the SlicesCoordinator) to its original state. More... | |
StateMachineTransition * | GetExecutableTransition (InteractionEvent *event) |
Returns the executable transition for the given event. More... | |
![]() | |
InteractionEventHandler () | |
~InteractionEventHandler () override | |
PropertyList::Pointer | GetAttributes () const |
std::string | MapToEventVariant (InteractionEvent *interactionEvent) |
virtual void | ConfigurationChanged () |
Protected Attributes | |
BaseRenderer * | m_LastEventSender |
unsigned int | m_LastEventSlice |
![]() | |
std::string | m_EventConfig |
Let subclasses change their event configuration. More... | |
ToolManager * | m_ToolManager |
![]() | |
bool | m_IsActive |
UndoController * | m_UndoController |
bool | m_UndoEnabled |
Abstract base class for segmentation tools.
Implements 2D segmentation specific helper methods, that might be of use to all kind of 2D segmentation tools. At the moment these are:
SegTool2D tries to structure the interaction a bit. If you pass "PressMoveRelease" as the interaction type of your derived tool, you might implement the methods OnMousePressed, OnMouseMoved, and OnMouseReleased. Yes, your guess about when they are called is correct.
$Author$
Definition at line 54 of file mitkSegTool2D.h.
|
protected |
|
protected |
Definition at line 59 of file mitkSegTool2D.cpp.
References mitk::Tool::m_EventConfig.
|
overrideprotected |
Definition at line 65 of file mitkSegTool2D.cpp.
|
protected |
Adds a new node called Contourmarker to the datastorage which holds a mitk::PlanarFigure. By selecting this node the slicestack will be reoriented according to the PlanarFigure's Geometry.
Definition at line 441 of file mitkSegTool2D.cpp.
References mitk::DataStorage::Add(), mitk::SliceNavigationController::GetCurrentGeometry3D(), mitk::ToolManager::GetDataStorage(), mitk::DataStorage::GetDerivations(), us::GetModuleContext(), mitk::Stepper::GetPos(), ModuleContext::GetService(), ModuleContext::GetServiceReference(), mitk::BaseController::GetSlice(), mitk::BaseRenderer::GetSliceNavigationController(), mitk::ToolManager::GetWorkingData(), m_LastEventSender, mitk::Tool::m_ToolManager, mitk::BoolProperty::New(), mitk::PlanarCircle::New(), mitk::NodePredicateProperty::New(), mitk::StringProperty::New(), and mitk::DataNode::New().
Referenced by mitk::LiveWireTool2D::ClearSegmentation(), and WriteBackSegmentationResult().
|
static |
Calculates for a given Image and PlaneGeometry, which slice of the image (in index corrdinates) is meant by the plane.
affectedDimension | The image dimension, which is constant for all points in the plane, e.g. Axial –> 2 |
affectedSlice | The index of the image slice |
Definition at line 80 of file mitkSegTool2D.cpp.
References mitk::eps, mitk::BaseGeometry::GetAxisVector(), mitk::BaseGeometry::GetCenter(), mitk::Image::GetDimension(), mitk::BaseData::GetGeometry(), mitk::PlaneGeometry::GetNormal(), mitk::SlicedData::GetSlicedGeometry(), MITK_DEBUG, mitk::PlaneGeometry::Project(), ROUND, and mitk::BaseGeometry::WorldToIndex().
Referenced by QmitkSliceBasedInterpolatorWidget::AcceptAllInterpolations(), QmitkSlicesInterpolator::AcceptAllInterpolations(), QmitkSliceBasedInterpolatorWidget::Interpolate(), QmitkSlicesInterpolator::Interpolate(), and QmitkSliceBasedInterpolatorWidget::OnAcceptInterpolationClicked().
|
overrideprotectedvirtual |
Filters events that cannot be handle by 2D segmentation tools.
Current an event is discarded if it was not sent by a 2D renderwindow and if it is not of type InteractionPositionEvent
Reimplemented from mitk::EventStateMachine.
Definition at line 69 of file mitkSegTool2D.cpp.
References mitk::BaseRenderer::GetMapperID(), mitk::InteractionEvent::GetSender(), and mitk::BaseRenderer::Standard2D.
|
protected |
Extract the slice of an image that the user just scribbles on. The given component denotes the vector component of a dwi-image.
component | The component to be extracted of a given multi-component image. -1 is the default parameter to denote an invalid component. |
Definition at line 203 of file mitkSegTool2D.cpp.
References mitk::BaseRenderer::GetCurrentWorldPlaneGeometry(), mitk::InteractionEvent::GetSender(), mitk::BaseRenderer::GetTimeStep(), and image.
Referenced by mitk::PaintbrushTool::CheckIfCurrentSliceHasChanged(), mitk::LiveWireTool2D::ConfirmSegmentation(), mitk::FastMarchingTool::ConfirmSegmentation(), GetAffectedReferenceSlice(), GetAffectedWorkingSlice(), mitk::SetRegionTool::OnMouseReleased(), mitk::ContourTool::OnMouseReleased(), mitk::CorrectorTool2D::OnMouseReleased(), and WriteSliceToVolume().
|
protected |
Extract the slice of an image cut by given plane. The given component denotes the vector component of a dwi-image.
component | The component to be extracted of a given multi-component image. -1 is the default parameter to denote an invalid component. |
Definition at line 216 of file mitkSegTool2D.cpp.
References mitk::TimeGeometry::GetGeometryForTimeStep(), mitk::BaseData::GetTimeGeometry(), and mitk::ExtractSliceFilter::New().
|
protected |
Extract the slice of the currently selected reference image that the user just scribbles on.
Definition at line 265 of file mitkSegTool2D.cpp.
References GetAffectedImageSliceAs2DImage(), mitk::ToolManager::GetReferenceData(), and mitk::Tool::m_ToolManager.
Referenced by mitk::FastMarchingTool::BuildITKPipeline(), mitk::LiveWireTool2D::ClearSegmentation(), and mitk::RegionGrowingTool::OnMousePressed().
|
protected |
Extract the slice of the currently selected working image that the user just scribbles on.
Definition at line 248 of file mitkSegTool2D.cpp.
References GetAffectedImageSliceAs2DImage(), mitk::ToolManager::GetWorkingData(), and mitk::Tool::m_ToolManager.
Referenced by mitk::SetRegionTool::OnMousePressed(), and mitk::RegionGrowingTool::OnMousePressed().
|
protected |
Definition at line 521 of file mitkSegTool2D.cpp.
References MITK_ERROR.
void mitk::SegTool2D::SetEnable3DInterpolation | ( | bool | enabled | ) |
Enables or disables the 3D interpolation after writing back the 2D segmentation result, and defaults to true.
Definition at line 436 of file mitkSegTool2D.cpp.
Referenced by QmitkSurfaceBasedInterpolatorWidget::OnToggleWidgetActivation().
void mitk::SegTool2D::SetShowMarkerNodes | ( | bool | status | ) |
Definition at line 431 of file mitkSegTool2D.cpp.
|
static |
Updates the surface interpolation by extracting the contour form the given slice.
slice | the slice from which the contour should be extracted |
workingImage | the segmentation image |
plane | the plane in which the slice lies |
detectIntersection | if true the slice is eroded before contour extraction. If the slice is empty after the erosion it is most likely an intersecting contour an will not be added to the SurfaceInterpolationController |
Definition at line 145 of file mitkSegTool2D.cpp.
References mitk::SurfaceInterpolationController::AddNewContour(), mitk::MorphologicalOperations::Ball, mitk::Image::Clone(), mitk::SurfaceInterpolationController::ContourPositionInformation::contourNormal, mitk::SurfaceInterpolationController::ContourPositionInformation::contourPoint, mitk::MorphologicalOperations::Erode(), mitk::SurfaceInterpolationController::GetInstance(), mitk::PlaneGeometry::GetNormal(), mitk::BaseGeometry::GetOrigin(), mitk::ImageTimeSelector::New(), mitk::ImageToContourFilter::New(), and mitk::SurfaceInterpolationController::RemoveContour().
Referenced by mitk::DiffSliceOperationApplier::ExecuteOperation(), and WriteBackSegmentationResult().
|
protected |
Definition at line 291 of file mitkSegTool2D.cpp.
References mitk::BaseRenderer::GetCurrentWorldPlaneGeometry(), mitk::InteractionEvent::GetSender(), mitk::BaseRenderer::GetTimeStep(), mitk::ToolManager::GetWorkingData(), image, and mitk::Tool::m_ToolManager.
Referenced by mitk::LiveWireTool2D::ConfirmSegmentation(), mitk::FastMarchingTool::ConfirmSegmentation(), mitk::SetRegionTool::OnMouseReleased(), mitk::ContourTool::OnMouseReleased(), mitk::PaintbrushTool::OnMouseReleased(), mitk::CorrectorTool2D::OnMouseReleased(), and mitk::RegionGrowingTool::OnMouseReleased().
|
protected |
Definition at line 309 of file mitkSegTool2D.cpp.
References AddContourmarker(), mitk::RenderingManager::GetInstance(), mitk::ToolManager::GetWorkingData(), image, mitk::Tool::m_ToolManager, mitk::RenderingManager::RequestUpdateAll(), UpdateSurfaceInterpolation(), and WriteSliceToVolume().
|
protected |
Definition at line 329 of file mitkSegTool2D.cpp.
References mitk::SurfaceInterpolationController::AddNewContours(), mitk::SurfaceInterpolationController::GetInstance(), mitk::RenderingManager::GetInstance(), mitk::ToolManager::GetWorkingData(), image, mitk::Tool::m_ToolManager, mitk::ImageTimeSelector::New(), mitk::ImageToContourFilter::New(), mitk::RenderingManager::RequestUpdateAll(), mitk::SegTool2D::SliceInformation::slice, and WriteSliceToVolume().
|
protected |
Definition at line 618 of file mitkSegTool2D.cpp.
References AccessFixedDimensionByItk_3, and InternalWritePreviewOnWorkingImage().
Referenced by mitk::CorrectorTool2D::OnMouseReleased().
|
protected |
Definition at line 366 of file mitkSegTool2D.cpp.
References GetAffectedImageSliceAs2DImage(), mitk::UndoController::GetCurrentUndoModel(), mitk::ToolManager::GetWorkingData(), image, mitk::UndoStackItem::IncCurrGroupEventId(), mitk::UndoStackItem::IncCurrObjectEventId(), mitk::Tool::m_ToolManager, mitk::ExtractSliceFilter::New(), mitk::SegTool2D::SliceInformation::plane, mitk::UndoModel::SetOperationEvent(), mitk::SegTool2D::SliceInformation::slice, and mitk::SegTool2D::SliceInformation::timestep.
Referenced by mitk::LiveWireTool2D::ConfirmSegmentation(), and WriteBackSegmentationResult().
|
protected |
Definition at line 179 of file mitkSegTool2D.h.
Referenced by AddContourmarker(), mitk::LiveWireTool2D::ClearSegmentation(), mitk::FastMarchingTool::OnAddPoint(), mitk::SetRegionTool::OnMousePressed(), mitk::ContourTool::OnMousePressed(), mitk::PaintbrushTool::OnMousePressed(), mitk::CorrectorTool2D::OnMousePressed(), mitk::RegionGrowingTool::OnMousePressed(), and mitk::RegionGrowingTool::OnMousePressedOutside().
|
protected |
Definition at line 180 of file mitkSegTool2D.h.
Referenced by mitk::LiveWireTool2D::ClearSegmentation(), mitk::FastMarchingTool::OnAddPoint(), mitk::SetRegionTool::OnMousePressed(), mitk::ContourTool::OnMousePressed(), mitk::PaintbrushTool::OnMousePressed(), mitk::CorrectorTool2D::OnMousePressed(), and mitk::RegionGrowingTool::OnMousePressed().