Medical Imaging Interaction Toolkit
2016.11.0
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... | |
Public Member Functions inherited from mitk::Tool | |
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 (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 |
Public Member Functions inherited from mitk::EventStateMachine | |
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... | |
Public Member Functions inherited from mitk::InteractionEventHandler | |
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... | |
Public Member Functions inherited from mitk::InteractionEventObserver | |
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 Public Member Functions inherited from mitk::EventStateMachine | |
static const char * | GetStaticNameOfClass () |
Static Public Member Functions inherited from mitk::InteractionEventHandler | |
static const char * | GetStaticNameOfClass () |
Protected Member Functions | |
SegTool2D () | |
SegTool2D (const char *) | |
virtual | ~SegTool2D () |
virtual 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 (std::vector< SliceInformation > sliceList, bool writeSliceToVolume=true) |
void | WritePreviewOnWorkingImage (Image *targetSlice, Image *sourceSlice, Image *workingImage, int paintingPixelValue, int timestep) |
void | WriteSliceToVolume (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) |
Protected Member Functions inherited from mitk::Tool | |
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 *) | |
virtual | ~Tool () |
virtual void | Notify (InteractionEvent *interactionEvent, bool isHandled) override |
bool | FilterEvents (InteractionEvent *, DataNode *) override |
Protected Member Functions inherited from mitk::EventStateMachine | |
EventStateMachine () | |
virtual | ~EventStateMachine () |
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... | |
Protected Member Functions inherited from mitk::InteractionEventHandler | |
InteractionEventHandler () | |
virtual | ~InteractionEventHandler () |
PropertyList::Pointer | GetAttributes () const |
std::string | MapToEventVariant (InteractionEvent *interactionEvent) |
virtual void | ConfigurationChanged () |
Protected Attributes | |
BaseRenderer * | m_LastEventSender |
unsigned int | m_LastEventSlice |
Protected Attributes inherited from mitk::Tool | |
std::string | m_EventConfig |
Let subclasses change their event configuration. More... | |
ToolManager * | m_ToolManager |
Protected Attributes inherited from mitk::EventStateMachine | |
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 58 of file mitkSegTool2D.h.
|
protected |
|
protected |
Definition at line 63 of file mitkSegTool2D.cpp.
References mitk::Tool::m_EventConfig.
|
protectedvirtual |
Definition at line 69 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 445 of file mitkSegTool2D.cpp.
References mitk::BaseGeometry::GetCenter(), us::GetModuleContext(), ModuleContext::GetService(), ModuleContext::GetServiceReference(), mitk::BaseGeometry::GetSpacing(), mitk::PlaneGeometry::Map(), mitk::BoolProperty::New(), mitk::PlanarCircle::New(), mitk::NodePredicateProperty::New(), mitk::StringProperty::New(), and mitk::DataNode::New().
Referenced by mitk::LiveWireTool2D::OnFinish().
|
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 84 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 73 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 207 of file mitkSegTool2D.cpp.
References mitk::BaseRenderer::GetCurrentWorldPlaneGeometry(), mitk::InteractionEvent::GetSender(), and mitk::BaseRenderer::GetTimeStep().
Referenced by mitk::PaintbrushTool::CheckIfCurrentSliceHasChanged(), mitk::SetRegionTool::OnMouseReleased(), mitk::ContourTool::OnMouseReleased(), and mitk::CorrectorTool2D::OnMouseReleased().
|
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 220 of file mitkSegTool2D.cpp.
References mitk::TimeGeometry::GetGeometryForTimeStep(), mitk::BaseData::GetTimeGeometry(), mitk::New(), and mitk::ExtractSliceFilter::New().
|
protected |
Extract the slice of the currently selected reference image that the user just scribbles on.
Definition at line 269 of file mitkSegTool2D.cpp.
Referenced by mitk::RegionGrowingTool::OnMousePressed().
|
protected |
Extract the slice of the currently selected working image that the user just scribbles on.
Definition at line 252 of file mitkSegTool2D.cpp.
Referenced by mitk::SetRegionTool::OnMousePressed(), and mitk::RegionGrowingTool::OnMousePressed().
|
protected |
Definition at line 525 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 440 of file mitkSegTool2D.cpp.
Referenced by QmitkSurfaceBasedInterpolatorWidget::OnToggleWidgetActivation().
void mitk::SegTool2D::SetShowMarkerNodes | ( | bool | status | ) |
Definition at line 435 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 149 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().
|
protected |
Definition at line 295 of file mitkSegTool2D.cpp.
References mitk::BaseRenderer::GetCurrentWorldPlaneGeometry(), mitk::InteractionEvent::GetSender(), and mitk::BaseRenderer::GetTimeStep().
Referenced by mitk::ContourTool::OnMouseReleased(), and mitk::CorrectorTool2D::OnMouseReleased().
|
protected |
Definition at line 313 of file mitkSegTool2D.cpp.
References mitk::RenderingManager::GetInstance(), and mitk::RenderingManager::RequestUpdateAll().
|
protected |
Definition at line 333 of file mitkSegTool2D.cpp.
References mitk::SurfaceInterpolationController::AddNewContours(), mitk::SurfaceInterpolationController::GetInstance(), mitk::RenderingManager::GetInstance(), mitk::ImageTimeSelector::New(), mitk::ImageToContourFilter::New(), mitk::RenderingManager::RequestUpdateAll(), and mitk::SegTool2D::SliceInformation::slice.
|
protected |
Definition at line 622 of file mitkSegTool2D.cpp.
References AccessFixedDimensionByItk_3, and InternalWritePreviewOnWorkingImage().
Referenced by mitk::CorrectorTool2D::OnMouseReleased().
|
protected |
Definition at line 370 of file mitkSegTool2D.cpp.
References mitk::UndoController::GetCurrentUndoModel(), mitk::UndoStackItem::IncCurrGroupEventId(), mitk::UndoStackItem::IncCurrObjectEventId(), mitk::New(), mitk::ExtractSliceFilter::New(), mitk::SegTool2D::SliceInformation::plane, mitk::UndoModel::SetOperationEvent(), mitk::SegTool2D::SliceInformation::slice, and mitk::SegTool2D::SliceInformation::timestep.
|
protected |
Definition at line 183 of file mitkSegTool2D.h.
|
protected |
Definition at line 184 of file mitkSegTool2D.h.