Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
|
Implementation of the PointSetInteractor. More...
#include <mitkPointSetDataInteractor.h>
Public Types | |
typedef PointSetDataInteractor | Self |
typedef DataInteractor | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer< const Self > | ConstPointer |
Public Types inherited from mitk::DataInteractor | |
typedef DataInteractor | Self |
typedef EventStateMachine | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer< const Self > | ConstPointer |
Public Types inherited from mitk::EventStateMachine | |
typedef EventStateMachine | Self |
typedef InteractionEventHandler | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer< const Self > | ConstPointer |
typedef std::map< std::string, TActionFunctor * > | ActionFunctionsMapType |
typedef itk::SmartPointer< StateMachineState > | StateMachineStateType |
Public Types inherited from mitk::InteractionEventHandler | |
typedef InteractionEventHandler | Self |
typedef itk::Object | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer< const Self > | ConstPointer |
Public Member Functions | |
virtual std::vector< std::string > | GetClassHierarchy () const override |
virtual const char * | GetClassName () const |
Pointer | Clone () const |
void | SetAccuracy (float accuracy) |
void | SetMaxPoints (unsigned int maxNumber=0) |
SetMaxPoints Sets the maximal number of points for the pointset Default ist zero, which result in infinite number of allowed points. More... | |
Public Member Functions inherited from mitk::DataInteractor | |
Pointer | Clone () const |
DataNode * | GetDataNode () const |
virtual void | SetDataNode (DataNode *dataNode) |
int | GetLayer () const |
ProcessEventMode | GetMode () const |
Public Member Functions inherited from mitk::EventStateMachine | |
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... | |
Static Public Member Functions | |
static const char * | GetStaticNameOfClass () |
static Pointer | New () |
Static Public Member Functions inherited from mitk::DataInteractor | |
static const char * | GetStaticNameOfClass () |
static Pointer | New () |
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 | |
PointSetDataInteractor () | |
virtual | ~PointSetDataInteractor () |
virtual void | ConnectActionsAndFunctions () override |
virtual void | DataNodeChanged () override |
virtual int | GetPointIndexByPosition (Point3D position, unsigned int time=0, float accuracy=-1) |
Return index in PointSet of the point that is within given accuracy to the provided position. More... | |
virtual bool | CheckSelection (const InteractionEvent *interactionEvent) |
virtual void | AddPoint (StateMachineAction *, InteractionEvent *event) |
virtual void | RemovePoint (StateMachineAction *, InteractionEvent *interactionEvent) |
virtual void | IsClosedContour (StateMachineAction *, InteractionEvent *) |
virtual void | MovePoint (StateMachineAction *, InteractionEvent *) |
virtual void | InitMove (StateMachineAction *, InteractionEvent *interactionEvent) |
virtual void | FinishMove (StateMachineAction *, InteractionEvent *) |
virtual void | SelectPoint (StateMachineAction *, InteractionEvent *) |
virtual void | UnSelectPointAtPosition (StateMachineAction *, InteractionEvent *) |
virtual void | UnSelectAll (StateMachineAction *, InteractionEvent *) |
virtual void | UpdatePointSet (StateMachineAction *stateMachineAction, InteractionEvent *) |
UpdatePointSet Updates the member variable that holds the point set, evaluating the time step of the sender. More... | |
virtual void | Abort (StateMachineAction *, InteractionEvent *) |
void | UnselectAll (unsigned int timeStep, ScalarType timeInMs) |
void | SelectPoint (int position, unsigned int timeStep, ScalarType timeInMS) |
Protected Member Functions inherited from mitk::DataInteractor | |
DataInteractor () | |
virtual | ~DataInteractor () |
virtual void | NotifyStart () |
Sends StartInteraction event via the mitk::DataNode. More... | |
virtual void | NotifyResultReady () |
NotifyResultReady Sends ResultReady event via the mitk::DataNode. More... | |
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) |
virtual bool | FilterEvents (InteractionEvent *interactionEvent, DataNode *dataNode) |
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 | |
Point3D | m_LastPoint |
to calculate a direction vector from last point and actual point More... | |
Vector3D | m_SumVec |
summ-vector for Movement More... | |
PointSet::Pointer | m_PointSet |
int | m_MaxNumberOfPoints |
float | m_SelectionAccuracy |
Protected Attributes inherited from mitk::EventStateMachine | |
bool | m_IsActive |
UndoController * | m_UndoController |
bool | m_UndoEnabled |
Additional Inherited Members | |
Static Public Attributes inherited from mitk::DataInteractor | |
static const std::string | IntDeactivateMe |
static const std::string | IntLeaveWidget |
static const std::string | IntEnterWidget |
Protected Types inherited from mitk::EventStateMachine | |
typedef MessageAbstractDelegate2< StateMachineAction *, InteractionEvent *, void > | ActionFunctionDelegate |
typedef MessageAbstractDelegate1< const InteractionEvent *, bool > | ConditionFunctionDelegate |
Implementation of the PointSetInteractor.
Class PointSetDataInteractor Interactor operates on a point set and supports to:
in 2d and 3d render windows.
If this Interactor is assigned (SetDataNode) an empty mitk::DataNode it creates a point set, changing the point set of the assigned mitk::DataNode after this assignment will cause the mitk::PointSetDataInteractor to not work properly. So the usage has follow this general scheme:
Definition at line 67 of file mitkPointSetDataInteractor.h.
typedef itk::SmartPointer<const Self> mitk::PointSetDataInteractor::ConstPointer |
Definition at line 70 of file mitkPointSetDataInteractor.h.
Definition at line 70 of file mitkPointSetDataInteractor.h.
Definition at line 70 of file mitkPointSetDataInteractor.h.
Definition at line 70 of file mitkPointSetDataInteractor.h.
|
protected |
Definition at line 155 of file mitkPointSetDataInteractor.cpp.
|
protectedvirtual |
Definition at line 159 of file mitkPointSetDataInteractor.cpp.
|
protectedvirtual |
Calls for inactivation of the DataInteractor
Definition at line 375 of file mitkPointSetDataInteractor.cpp.
References mitk::BaseRenderer::GetDispatcher(), mitk::InteractionEvent::GetSender(), and mitk::InternalEvent::New().
|
protectedvirtual |
Adds a point at the given coordinates. Every time a point is added it is also checked if the maximal number of points is reached, and if so an InternalEvent with the signal name "MaxNumberOfPoints" is triggered.
Reimplemented in mitk::SinglePointDataInteractor.
Definition at line 46 of file mitkPointSetDataInteractor.cpp.
References GetData(), mitk::BaseRenderer::GetDispatcher(), mitk::InteractionPositionEvent::GetPositionInWorld(), mitk::BaseRenderer::GetRenderingManager(), mitk::InteractionEvent::GetSender(), mitk::BaseRenderer::GetTime(), mitk::BaseRenderer::GetTimeStep(), mitk::UndoStackItem::IncCurrObjectEventId(), mitk::InternalEvent::New(), mitk::OpINSERT, mitk::OpREMOVE, and mitk::RenderingManager::RequestUpdateAll().
Referenced by ConnectActionsAndFunctions().
|
protectedvirtual |
Definition at line 530 of file mitkPointSetDataInteractor.cpp.
References mitk::InteractionPositionEvent::GetPositionInWorld(), mitk::InteractionEvent::GetSender(), and mitk::BaseRenderer::GetTimeStep().
Referenced by ConnectActionsAndFunctions().
Pointer mitk::PointSetDataInteractor::Clone | ( | ) | const |
|
overrideprotectedvirtual |
Here actions strings from the loaded state machine pattern are mapped to functions of the DataInteractor. These functions are called when an action from the state machine pattern is executed.
Reimplemented from mitk::DataInteractor.
Definition at line 31 of file mitkPointSetDataInteractor.cpp.
References AddPoint(), CheckSelection(), CONNECT_CONDITION, CONNECT_FUNCTION, FinishMove(), InitMove(), MovePoint(), RemovePoint(), SelectPoint(), UnSelectAll(), and UnSelectPointAtPosition().
|
overrideprotectedvirtual |
This function is called when a DataNode has been set/changed. It is used to initialize the DataNode, e.g. if no PointSet exists yet it is created and added to the DataNode.
Reimplemented from mitk::DataInteractor.
Reimplemented in mitk::SinglePointDataInteractor.
Definition at line 384 of file mitkPointSetDataInteractor.cpp.
References mitk::PointSet::New().
|
protectedvirtual |
Is called when a movement is finished, changes back to regular color.
Definition at line 426 of file mitkPointSetDataInteractor.cpp.
References GetData(), mitk::BaseRenderer::GetRenderingManager(), mitk::InteractionEvent::GetSender(), mitk::BaseRenderer::GetTime(), mitk::BaseRenderer::GetTimeStep(), mitk::UndoStackItem::IncCurrObjectEventId(), mitk::OpMOVE, and mitk::RenderingManager::RequestUpdateAll().
Referenced by ConnectActionsAndFunctions().
|
inlineoverridevirtual |
Reimplemented from mitk::DataInteractor.
Reimplemented in mitk::SinglePointDataInteractor.
Definition at line 70 of file mitkPointSetDataInteractor.h.
|
virtual |
Reimplemented from mitk::DataInteractor.
Reimplemented in mitk::SinglePointDataInteractor.
|
protectedvirtual |
Return index in PointSet of the point that is within given accuracy to the provided position.
Assumes that the DataNode contains a PointSet, if so it iterates over all points in the DataNode to check if it contains a point near the pointer position. If a point is found its index-position is returned, else -1 is returned.
Definition at line 499 of file mitkPointSetDataInteractor.cpp.
References mitk::PointSet::GetPoint(), and mitk::PointSet::GetPointSet().
|
inlinestatic |
Definition at line 70 of file mitkPointSetDataInteractor.h.
|
protectedvirtual |
Initializes the movement, stores starting position.
Definition at line 408 of file mitkPointSetDataInteractor.cpp.
References mitk::InteractionPositionEvent::GetPositionInWorld(), and mitk::ColorProperty::New().
Referenced by ConnectActionsAndFunctions().
|
protectedvirtual |
Checks if new point is close enough to an old one, if so, trigger the ClosedContour signal which can be caught by the state machine.
Definition at line 209 of file mitkPointSetDataInteractor.cpp.
References GetData(), mitk::BaseRenderer::GetDispatcher(), mitk::InteractionPositionEvent::GetPositionInWorld(), mitk::InteractionEvent::GetSender(), mitk::BaseRenderer::GetTimeStep(), and mitk::InternalEvent::New().
|
protectedvirtual |
Moves the currently selected point to the new coodinates.
Definition at line 226 of file mitkPointSetDataInteractor.cpp.
References GetData(), mitk::InteractionPositionEvent::GetPositionInWorld(), mitk::BaseRenderer::GetRenderingManager(), mitk::InteractionEvent::GetSender(), mitk::BaseRenderer::GetTime(), mitk::BaseRenderer::GetTimeStep(), mitk::OpMOVE, and mitk::RenderingManager::RequestUpdateAll().
Referenced by ConnectActionsAndFunctions().
|
static |
|
protectedvirtual |
Removes point that is selected
Definition at line 163 of file mitkPointSetDataInteractor.cpp.
References GetData(), mitk::InteractionPositionEvent::GetPositionInWorld(), mitk::BaseRenderer::GetRenderingManager(), mitk::InteractionEvent::GetSender(), mitk::BaseRenderer::GetTime(), mitk::BaseRenderer::GetTimeStep(), mitk::UndoStackItem::IncCurrObjectEventId(), mitk::OpINSERT, mitk::OpREMOVE, and mitk::RenderingManager::RequestUpdateAll().
Referenced by ConnectActionsAndFunctions().
|
protectedvirtual |
Selects a point from the PointSet as currently active.
Definition at line 117 of file mitkPointSetDataInteractor.cpp.
References GetData(), mitk::InteractionPositionEvent::GetPositionInWorld(), mitk::BaseRenderer::GetRenderingManager(), mitk::InteractionEvent::GetSender(), mitk::BaseRenderer::GetTime(), mitk::BaseRenderer::GetTimeStep(), mitk::OpSELECTPOINT, and mitk::RenderingManager::RequestUpdateAll().
Referenced by ConnectActionsAndFunctions().
|
protected |
Definition at line 593 of file mitkPointSetDataInteractor.cpp.
References mitk::PointSet::ExecuteOperation(), mitk::PointSet::GetSize(), and mitk::OpSELECTPOINT.
void mitk::PointSetDataInteractor::SetAccuracy | ( | float | accuracy | ) |
Sets the maximum distance that is accepted when looking for a point at a certain position using the GetPointIndexByPosition function.
Definition at line 489 of file mitkPointSetDataInteractor.cpp.
void mitk::PointSetDataInteractor::SetMaxPoints | ( | unsigned int | maxNumber = 0 | ) |
SetMaxPoints Sets the maximal number of points for the pointset Default ist zero, which result in infinite number of allowed points.
maxNumber |
Definition at line 494 of file mitkPointSetDataInteractor.cpp.
|
protectedvirtual |
Unselects all points out of reach.
Definition at line 312 of file mitkPointSetDataInteractor.cpp.
References GetData(), mitk::InteractionPositionEvent::GetPositionInWorld(), mitk::InteractionEvent::GetSender(), mitk::BaseRenderer::GetTime(), mitk::BaseRenderer::GetTimeStep(), and mitk::OpDESELECTPOINT.
Referenced by ConnectActionsAndFunctions().
|
protected |
Definition at line 545 of file mitkPointSetDataInteractor.cpp.
References mitk::PointSet::ExecuteOperation(), mitk::PointSet::GetPointSet(), mitk::OpDESELECTPOINT, mitk::PTUNDEFINED, and mitk::PointSet::PointDataType::selected.
|
protectedvirtual |
Unselects a point at the given coordinate.
Definition at line 279 of file mitkPointSetDataInteractor.cpp.
References GetData(), mitk::InteractionPositionEvent::GetPositionInWorld(), mitk::InteractionEvent::GetSender(), mitk::BaseRenderer::GetTime(), mitk::BaseRenderer::GetTimeStep(), and mitk::OpDESELECTPOINT.
Referenced by ConnectActionsAndFunctions().
|
protectedvirtual |
UpdatePointSet Updates the member variable that holds the point set, evaluating the time step of the sender.
Definition at line 363 of file mitkPointSetDataInteractor.cpp.
References MITK_ERROR.
|
protected |
to calculate a direction vector from last point and actual point
Definition at line 173 of file mitkPointSetDataInteractor.h.
|
protected |
Definition at line 180 of file mitkPointSetDataInteractor.h.
|
protected |
Definition at line 179 of file mitkPointSetDataInteractor.h.
|
protected |
Definition at line 181 of file mitkPointSetDataInteractor.h.
|
protected |
summ-vector for Movement
Definition at line 176 of file mitkPointSetDataInteractor.h.