diff --git a/Core/Code/Controllers/mitkOperationEvent.h b/Core/Code/Controllers/mitkOperationEvent.h index d31167a61e..a3f2ac08b8 100644 --- a/Core/Code/Controllers/mitkOperationEvent.h +++ b/Core/Code/Controllers/mitkOperationEvent.h @@ -1,210 +1,210 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef OPERATIONEVENT_H_HEADER_INCLUDED_C16E83FC #define OPERATIONEVENT_H_HEADER_INCLUDED_C16E83FC #include #include "mitkOperation.h" #include "mitkOperationActor.h" #include "mitkUndoModel.h" #include #include namespace mitk { //##Documentation //## @brief Represents an entry of the undo or redo stack. //## //## This basic entry includes a textual description of the item and a pair of IDs. Static //## member functions handle creation and incrementing of these IDs. //## //## The ObjectEventID is increased by the global EventMapper for most of the events (see //## code for details). Incrementation of the IDs is done in two steps. First the //## EventMapper sets a flag via (possibly multiple calls of) IncCurrObjectEventID(), then //## ExecuteIncrement() does the actual incementation. //## //## The GroupEventID is intended for logical grouping of several related Operations. -//## Currently this is used only by PointSetInteractor. How this is done and when to use +//## Currently this is used only by PointSetDataInteractor. How this is done and when to use //## GroupEventIDs is still undocumented. //## @ingroup Undo class MITK_CORE_EXPORT UndoStackItem { public: UndoStackItem(std::string description = ""); virtual ~UndoStackItem(); //##Documentation //## @brief For combining operations in groups //## //## This ID is used in the undo mechanism. //## For separation of the seperate operations //## If the GroupEventId of two OperationEvents is equal, //## then they share one group and will be undone in case of Undo(fine==false) static int GetCurrGroupEventId(); //##Documentation //## @brief For combining operations in Objects //## //## This ID is used in the Undo-Mechanism. //## For separation of the seperate operations //## If the ObjectEventId of two OperationEvents is equal, //## then they share one Object and will be undone in all cases of Undo(true and false). //## they shal not be seperated, because they were produced to realize one object-change. //## for example: OE_statechange and OE_addlastpoint static int GetCurrObjectEventId(); //##Documentation //## @brief Returns the GroupEventId for this object int GetGroupEventId(); //##Documentation //## @brief Returns the ObjectEventId for this object int GetObjectEventId(); //##Documentation //## @brief Returns the textual description of this object std::string GetDescription(); virtual void ReverseOperations(); virtual void ReverseAndExecute(); //##Documentation //## @brief Sets the current ObjectEventId to be incremended when ExecuteIncrement is called //## For example if a button click generates operations the ObjectEventId has to be incremented to be able to undo the operations. //## Difference between ObjectEventId and GroupEventId: The ObjectEventId capsulates all operations caused by one event. //## A GroupEventId capsulates several ObjectEventIds so that several operations caused by several events can be undone with one Undo call. static void IncCurrObjectEventId(); //##Documentation //## @brief Sets the current GroupEventId to be incremended when ExecuteIncrement is called //## For example if a button click generates operations the GroupEventId has to be incremented to be able to undo the operations. //## Difference between ObjectEventId and GroupEventId: The ObjectEventId capsulates all operations caused by one event. //## A GroupEventId capsulates several ObjectEventIds so that several operations caused by several events can be undone with one Undo call. static void IncCurrGroupEventId(); //##Documentation //## @brief Executes the incrementation of objectEventId and groupEventId if they are set to be incremented static void ExecuteIncrement(); protected: //##Documentation //## @brief true, if operation and undooperation have been swaped/changed bool m_Reversed; private: static int m_CurrObjectEventId; static int m_CurrGroupEventId; static bool m_IncrObjectEventId; static bool m_IncrGroupEventId; int m_ObjectEventId; int m_GroupEventId; std::string m_Description; UndoStackItem(UndoStackItem&); // hide copy constructor void operator=(const UndoStackItem&); // hide operator= }; //##Documentation //## @brief Represents a pair of operations: undo and the according redo. //## //## Additionally to the base class UndoStackItem, which only provides a description of an //## item, OperationEvent does the actual accounting of the undo/redo stack. This class //## holds two Operation objects (operation and its inverse operation) and the corresponding //## OperationActor. The operations may be swapped by the //## undo models, when an OperationEvent is moved from their undo to their redo //## stack or vice versa. //## //## Note, that memory management of operation and undooperation is done by this class. //## Memory of both objects is freed in the destructor. For this, the method IsValid() is needed which holds //## information of the state of m_Destination. In case the object referenced by m_Destination is already deleted, //## isValid() returns false. //## In more detail if the destination happens to be an itk::Object (often the case), OperationEvent is informed as soon //## as the object is deleted - from this moment on the OperationEvent gets invalid. You should //## check this flag before you call anything on destination //## //## @ingroup Undo class MITK_CORE_EXPORT OperationEvent : public UndoStackItem { public: //## @brief default constructor OperationEvent(OperationActor* destination, Operation* operation, Operation* undoOperation, std::string description = "" ); //## @brief default destructor //## //## removes observers if destination is valid //## and frees memory referenced by m_Operation and m_UndoOperation virtual ~OperationEvent(); //## @brief Returns the operation Operation* GetOperation(); //## @brief Returns the destination of the operations OperationActor* GetDestination(); friend class UndoModel; //## @brief Swaps the two operations and sets a flag, //## that it has been swapped and doOp is undoOp and undoOp is doOp virtual void ReverseOperations(); //##reverses and executes both operations (used, when moved from undo to redo stack) virtual void ReverseAndExecute(); //## @brief returns true if the destination still is present //## and false if it already has been deleted virtual bool IsValid(); protected: void OnObjectDeleted(); private: // Has to be observed for itk::DeleteEvents. // When destination is deleted, this stack item is invalid! OperationActor* m_Destination; //## reference to the operation Operation* m_Operation; //## reference to the undo operation Operation* m_UndoOperation; //## hide copy constructor OperationEvent(OperationEvent&); //## hide operator= void operator=(const OperationEvent&); //observertag used to listen to m_Destination unsigned long m_DeleteTag; //## stores if destination is valid or already has been freed bool m_Invalid; }; } //namespace mitk #endif /* OPERATIONEVENT_H_HEADER_INCLUDED_C16E83FC */ diff --git a/Core/Code/Interactions/mitkPointSetDataInteractor.cpp b/Core/Code/Interactions/mitkPointSetDataInteractor.cpp index b368af85b1..7484fc7050 100644 --- a/Core/Code/Interactions/mitkPointSetDataInteractor.cpp +++ b/Core/Code/Interactions/mitkPointSetDataInteractor.cpp @@ -1,679 +1,677 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkPointSetDataInteractor.h" #include "mitkMouseMoveEvent.h" #include "mitkOperationEvent.h" #include #include "mitkInteractionConst.h" // TODO: refactor file #include "mitkRenderingManager.h" #include "mitkInternalEvent.h" // #include "mitkDispatcher.h" #include "mitkBaseRenderer.h" #include "mitkUndoController.h" void mitk::PointSetDataInteractor::ConnectActionsAndFunctions() { // Condition which is evaluated before transition is taken // following actions in the statemachine are only executed if it returns TRUE CONNECT_CONDITION("isoverpoint", CheckSelection); CONNECT_FUNCTION("addpoint", AddPoint); CONNECT_FUNCTION("selectpoint", SelectPoint); CONNECT_FUNCTION("unselect", UnSelectPointAtPosition); CONNECT_FUNCTION("unselectAll", UnSelectAll); CONNECT_FUNCTION("initMove", InitMove); CONNECT_FUNCTION("movePoint", MovePoint); CONNECT_FUNCTION("finishMovement", FinishMove); CONNECT_FUNCTION("removePoint", RemovePoint); - CONNECT_FUNCTION("update", UpdatePointSet) } bool mitk::PointSetDataInteractor::AddPoint(StateMachineAction* stateMachineAction, InteractionEvent* interactionEvent) { unsigned int timeStep = interactionEvent->GetSender()->GetTimeStep(GetDataNode()->GetData()); ScalarType timeInMs = interactionEvent->GetSender()->GetTime(); - if (m_MaxNumberOfPoints > 0 && m_PointSet->GetSize(timeStep) >= m_MaxNumberOfPoints) + // disallow adding of new points if maximum number of points is reached + if (m_MaxNumberOfPoints > 1 && m_PointSet->GetSize(timeStep) >= m_MaxNumberOfPoints) { return false; } - // To add a point the minimal information is the position, this method accepts all InteractionsPositionEvents InteractionPositionEvent* positionEvent = dynamic_cast(interactionEvent); if (positionEvent != NULL) { // 1) Undo/Redo Supports Grouping of Operations that are undone as a set, // this statement indicates that a new Operation starts here mitk::OperationEvent::IncCurrObjectEventId(); mitk::Point3D itkPoint = positionEvent->GetPositionInWorld(); this->UnselectAll( timeStep, timeInMs); int lastPosition = 0; mitk::PointSet::PointsIterator it, end; it = m_PointSet->Begin(); end = m_PointSet->End(); while( it != end ) { - if (!m_PointSet->IndexExists(lastPosition)) + if (!m_PointSet->IndexExists(lastPosition,timeStep)) break; ++it; ++lastPosition; } // Insert a Point to the PointSet // 2) Create the Operation inserting the point PointOperation* doOp = new mitk::PointOperation(OpINSERT,timeInMs, itkPoint, lastPosition); // 3) If Undo is enabled, also create the inverse Operation if (m_UndoEnabled) { PointOperation *undoOp = new mitk::PointOperation( OpREMOVE,timeInMs, itkPoint, lastPosition); // 4) Do and Undo Operations are combined in an Operation event which also contains the target of the operations (here m_PointSet) OperationEvent *operationEvent = new OperationEvent(m_PointSet, doOp, undoOp, "Add point"); // 5) Store the Operation in the UndoController m_UndoController->SetOperationEvent(operationEvent); } // 6) Execute the Operation performs the actual insertion of the point into the PointSet m_PointSet->ExecuteOperation(doOp); // 7) If Undo is not enabled the Do-Operation is to be dropped to prevent memory leaks. if ( !m_UndoEnabled ) delete doOp; - // Request update only in the display in which interaction happened + // Request update interactionEvent->GetSender()->GetRenderingManager()->RequestUpdateAll(); // Check if points form a closed contour now, if so fire an InternalEvent IsClosedContour(stateMachineAction, interactionEvent); if (m_MaxNumberOfPoints > 0 && m_PointSet->GetSize(timeStep) >= m_MaxNumberOfPoints) { // Signal that DataNode is fully filled this->NotifyResultReady(); // Send internal event that can be used by StateMachines to switch in a different state InternalEvent::Pointer event = InternalEvent::New(NULL, this, "MaximalNumberOfPoints"); positionEvent->GetSender()->GetDispatcher()->QueueEvent(event.GetPointer()); } return true; } else { return false; } } bool mitk::PointSetDataInteractor::SelectPoint(StateMachineAction*, InteractionEvent* interactionEvent) { unsigned int timeStep = interactionEvent->GetSender()->GetTimeStep(GetDataNode()->GetData()); ScalarType timeInMs = interactionEvent->GetSender()->GetTime(); InteractionPositionEvent* positionEvent = dynamic_cast(interactionEvent); if (positionEvent != NULL) { Point3D point = positionEvent->GetPositionInWorld(); // iterate over point set and check if it contains a point close enough to the pointer to be selected int index = GetPointIndexByPosition(point, timeStep); if (index != -1) { //first deselect the other points //undoable deselect of all points in the DataList this->UnselectAll( timeStep, timeInMs); - PointOperation* doOp = new mitk::PointOperation(OpSELECTPOINT, point, index); + PointOperation* doOp = new mitk::PointOperation(OpSELECTPOINT,timeInMs, point, index); //Undo if (m_UndoEnabled) { - PointOperation* undoOp = new mitk::PointOperation(OpDESELECTPOINT,point, index); + PointOperation* undoOp = new mitk::PointOperation(OpDESELECTPOINT,timeInMs,point, index); OperationEvent *operationEvent = new OperationEvent(m_PointSet, doOp, undoOp); m_UndoController->SetOperationEvent(operationEvent); } //execute the Operation m_PointSet->ExecuteOperation(doOp); if ( !m_UndoEnabled ) delete doOp; interactionEvent->GetSender()->GetRenderingManager()->RequestUpdateAll(); return true; } } return false; } mitk::PointSetDataInteractor::PointSetDataInteractor() : m_MaxNumberOfPoints(0),m_SelectionAccuracy(3.5) { } mitk::PointSetDataInteractor::~PointSetDataInteractor() { } bool mitk::PointSetDataInteractor::RemovePoint(StateMachineAction*, InteractionEvent* interactionEvent) { - unsigned int timeStep = interactionEvent->GetSender()->GetTimeStep(GetDataNode()->GetData()); ScalarType timeInMs = interactionEvent->GetSender()->GetTime(); InteractionPositionEvent* positionEvent = dynamic_cast(interactionEvent); if (positionEvent != NULL) { mitk::OperationEvent::IncCurrObjectEventId(); mitk::Point3D itkPoint = positionEvent->GetPositionInWorld(); //search the point in the list int position = m_PointSet->SearchPoint( itkPoint , m_SelectionAccuracy, timeStep); if (position>=0)//found a point { PointSet::PointType pt = m_PointSet->GetPoint(position, timeStep); itkPoint[0] = pt[0]; itkPoint[1] = pt[1]; itkPoint[2] = pt[2]; PointOperation* doOp = new mitk::PointOperation(OpREMOVE,timeInMs, itkPoint, position); if (m_UndoEnabled) //write to UndoMechanism { PointOperation* undoOp = new mitk::PointOperation(OpINSERT,timeInMs, itkPoint, position); OperationEvent *operationEvent = new OperationEvent(m_PointSet, doOp, undoOp, "Remove point"); m_UndoController->SetOperationEvent(operationEvent); } //execute the Operation m_PointSet->ExecuteOperation(doOp); if ( !m_UndoEnabled ) delete doOp; /*now select the point "position-1", and if it is the first in list, then continue at the last in list*/ //only then a select of a point is possible! if (m_PointSet->GetSize( timeStep ) > 0) { if (position>0)//not the first in list { this->SelectPoint( position-1, timeStep,timeInMs); } //it was the first point in list, that was removed, so select //the last in list else { position = m_PointSet->GetSize( timeStep ) - 1; //last in list this->SelectPoint( position, timeStep, timeInMs ); } } } interactionEvent->GetSender()->GetRenderingManager()->RequestUpdateAll(); } else { return false; } return true; } bool mitk::PointSetDataInteractor::IsClosedContour(StateMachineAction*, InteractionEvent* interactionEvent) { unsigned int timeStep = interactionEvent->GetSender()->GetTimeStep(GetDataNode()->GetData()); InteractionPositionEvent* positionEvent = dynamic_cast(interactionEvent); if (positionEvent != NULL) { Point3D point = positionEvent->GetPositionInWorld(); // iterate over point set and check if it contains a point close enough to the pointer to be selected if (GetPointIndexByPosition(point, timeStep) != -1 && m_PointSet->GetSize(timeStep) >= 3) { InternalEvent::Pointer event = InternalEvent::New(NULL, this, "ClosedContour"); positionEvent->GetSender()->GetDispatcher()->QueueEvent(event.GetPointer()); return true; } } return false; } bool mitk::PointSetDataInteractor::MovePoint(StateMachineAction* stateMachineAction, InteractionEvent* interactionEvent) { unsigned int timeStep = interactionEvent->GetSender()->GetTimeStep(GetDataNode()->GetData()); - + ScalarType timeInMs = interactionEvent->GetSender()->GetTime(); InteractionPositionEvent* positionEvent = dynamic_cast(interactionEvent); if (positionEvent != NULL) { IsClosedContour(stateMachineAction, interactionEvent); mitk::Point3D newPoint, resultPoint; newPoint = positionEvent->GetPositionInWorld(); // search the elements in the list that are selected then calculate the // vector, because only with the vector we can move several elements in // the same direction // newPoint - lastPoint = vector // then move all selected and set the lastPoint = newPoint. // then add all vectors to a summeryVector (to be able to calculate the // startpoint for undoOperation) mitk::Vector3D dirVector = newPoint - m_LastPoint; //sum up all Movement for Undo in FinishMovement m_SumVec = m_SumVec + dirVector; mitk::PointSet::PointsIterator it, end; it = m_PointSet->Begin(); end = m_PointSet->End(); while( it != end ) { int position = it->Index(); if ( m_PointSet->GetSelectInfo(position, timeStep) )//if selected { PointSet::PointType pt = m_PointSet->GetPoint(position, timeStep); mitk::Point3D sumVec; sumVec[0] = pt[0]; sumVec[1] = pt[1]; sumVec[2] = pt[2]; resultPoint = sumVec + dirVector; - PointOperation doOp(OpMOVE, resultPoint, position); - + PointOperation* doOp = new mitk::PointOperation(OpMOVE,timeInMs, resultPoint, position); //execute the Operation //here no undo is stored, because the movement-steps aren't interesting. // only the start and the end is interisting to store for undo. - m_PointSet->ExecuteOperation(&doOp); + m_PointSet->ExecuteOperation(doOp); + delete doOp; } ++it; } m_LastPoint = newPoint;//for calculation of the direction vector // Update the display interactionEvent->GetSender()->GetRenderingManager()->RequestUpdateAll(); IsClosedContour(stateMachineAction,interactionEvent); return true; } else { return false; } } bool mitk::PointSetDataInteractor::UnSelectPointAtPosition(StateMachineAction*, InteractionEvent* interactionEvent) { unsigned int timeStep = interactionEvent->GetSender()->GetTimeStep(GetDataNode()->GetData()); ScalarType timeInMs = interactionEvent->GetSender()->GetTime(); InteractionPositionEvent* positionEvent = dynamic_cast(interactionEvent); if (positionEvent != NULL) { Point3D point = positionEvent->GetPositionInWorld(); // iterate over point set and check if it contains a point close enough to the pointer to be selected int index = GetPointIndexByPosition(point, timeStep); // here it is ensured that we don't switch from one point being selected to another one being selected, // without accepting the unselect of the current point if (index != -1) { PointOperation* doOp = new mitk::PointOperation(OpDESELECTPOINT,timeInMs, point, index); if (m_UndoEnabled) //write to UndoMechanism { PointOperation* undoOp = new mitk::PointOperation(OpSELECTPOINT,timeInMs, point, index); OperationEvent *operationEvent = new OperationEvent(m_PointSet, doOp, undoOp); m_UndoController->SetOperationEvent(operationEvent); } //execute the Operation m_PointSet->ExecuteOperation(doOp); if ( !m_UndoEnabled ) delete doOp; return true; } } return false; } bool mitk::PointSetDataInteractor::UnSelectAll(mitk::StateMachineAction *, mitk::InteractionEvent *interactionEvent) { unsigned int timeStep = interactionEvent->GetSender()->GetTimeStep(GetDataNode()->GetData()); ScalarType timeInMs = interactionEvent->GetSender()->GetTime(); InteractionPositionEvent* positionEvent = dynamic_cast(interactionEvent); if (positionEvent != NULL) { Point3D positioninWorld = positionEvent->GetPositionInWorld(); PointSet::PointsContainer::Iterator it, end; PointSet::DataType *itkPointSet = m_PointSet->GetPointSet( timeStep ); end = itkPointSet->GetPoints()->End(); for (it = itkPointSet->GetPoints()->Begin(); it != end; it++) { int position = it->Index(); //then declare an operation which unselects this point; //UndoOperation as well! if ( m_PointSet->GetSelectInfo(position,timeStep) ) { float distance = sqrt(positioninWorld.SquaredEuclideanDistanceTo(m_PointSet->GetPoint(position, timeStep))); if (distance > m_SelectionAccuracy) { mitk::Point3D noPoint; noPoint.Fill( 0 ); mitk::PointOperation* doOp = new mitk::PointOperation(OpDESELECTPOINT,timeInMs, noPoint, position); if ( m_UndoEnabled ) { mitk::PointOperation* undoOp = new mitk::PointOperation(OpSELECTPOINT, timeInMs, noPoint, position); OperationEvent *operationEvent = new OperationEvent( m_PointSet, doOp, undoOp ); m_UndoController->SetOperationEvent( operationEvent ); } m_PointSet->ExecuteOperation( doOp ); if ( !m_UndoEnabled ) delete doOp; } } } } else { this->UnselectAll(timeStep,timeInMs); } return true; } bool mitk::PointSetDataInteractor::UpdatePointSet(mitk::StateMachineAction*, mitk::InteractionEvent*) { mitk::PointSet* pointSet = dynamic_cast(this->GetDataNode()->GetData()); if ( pointSet == NULL ) { return false; MITK_ERROR << "PointSetDataInteractor:: No valid point set ."; } m_PointSet = pointSet; return true; } bool mitk::PointSetDataInteractor::Abort(StateMachineAction*, InteractionEvent* interactionEvent) { InternalEvent::Pointer event = InternalEvent::New(NULL, this, IntDeactivateMe); interactionEvent->GetSender()->GetDispatcher()->QueueEvent(event.GetPointer()); return true; } /* * Check whether the DataNode contains a pointset, if not create one and add it. */ void mitk::PointSetDataInteractor::DataNodeChanged() { if (GetDataNode().IsNotNull()) { PointSet* points = dynamic_cast(GetDataNode()->GetData()); if (points == NULL) { m_PointSet = PointSet::New(); GetDataNode()->SetData(m_PointSet); } else { m_PointSet = points; } // load config file parameter: maximal number of points mitk::PropertyList::Pointer properties = GetAttributes(); std::string strNumber; if (properties->GetStringProperty("MaxPoints", strNumber)) { m_MaxNumberOfPoints = atoi(strNumber.c_str()); } } } bool mitk::PointSetDataInteractor::InitMove(StateMachineAction*, InteractionEvent* interactionEvent) { InteractionPositionEvent* positionEvent = dynamic_cast(interactionEvent); if (positionEvent == NULL) return false; mitk::OperationEvent::IncCurrObjectEventId(); // start of the Movement is stored to calculate the undoKoordinate // in FinishMovement m_LastPoint = positionEvent->GetPositionInWorld(); // initialize a value to calculate the movement through all // MouseMoveEvents from MouseClick to MouseRelease m_SumVec.Fill(0); GetDataNode()->SetProperty("contourcolor", ColorProperty::New(1.0, 1.0, 1.0)); return true; } bool mitk::PointSetDataInteractor::FinishMove(StateMachineAction*, InteractionEvent* interactionEvent) { unsigned int timeStep = interactionEvent->GetSender()->GetTimeStep(GetDataNode()->GetData()); ScalarType timeInMs = interactionEvent->GetSender()->GetTime(); InteractionPositionEvent* positionEvent = dynamic_cast(interactionEvent); if (positionEvent != NULL) { //finish the movement: //the final point is m_LastPoint //m_SumVec stores the movement in a vector //the operation would not be necessary, but we need it for the undo Operation. //m_LastPoint is for the Operation //the point for undoOperation calculates from all selected //elements (point) - m_SumVec //search all selected elements and move them with undo-functionality. mitk::PointSet::PointsIterator it, end; it = m_PointSet->Begin(); end = m_PointSet->End(); while( it != end ) { int position = it->Index(); if ( m_PointSet->GetSelectInfo(position, timeStep) )//if selected { PointSet::PointType pt = m_PointSet->GetPoint(position, timeStep); Point3D itkPoint; itkPoint[0] = pt[0]; itkPoint[1] = pt[1]; itkPoint[2] = pt[2]; PointOperation* doOp = new mitk::PointOperation(OpMOVE,timeInMs,itkPoint, position); if ( m_UndoEnabled )//&& (posEvent->GetType() == mitk::Type_MouseButtonRelease) { //set the undo-operation, so the final position is undo-able //calculate the old Position from the already moved position - m_SumVec mitk::Point3D undoPoint = ( itkPoint - m_SumVec ); PointOperation* undoOp = new mitk::PointOperation(OpMOVE,timeInMs, undoPoint, position); OperationEvent *operationEvent = new OperationEvent(m_PointSet, doOp, undoOp, "Move point"); m_UndoController->SetOperationEvent(operationEvent); } //execute the Operation m_PointSet->ExecuteOperation(doOp); if ( !m_UndoEnabled ) delete doOp; } ++it; } // Update the display interactionEvent->GetSender()->GetRenderingManager()->RequestUpdateAll(); OperationEvent::IncCurrGroupEventId(); } else {return false; } this->NotifyResultReady(); return true; } void mitk::PointSetDataInteractor::SetAccuracy(float accuracy) { m_SelectionAccuracy = accuracy; } void mitk::PointSetDataInteractor::SetMaxPoints(unsigned int maxNumber) { m_MaxNumberOfPoints = maxNumber; } int mitk::PointSetDataInteractor::GetPointIndexByPosition(Point3D position, int time, float accuracy) { // iterate over point set and check if it contains a point close enough to the pointer to be selected PointSet* points = dynamic_cast(GetDataNode()->GetData()); int index = -1; if (points == NULL) { return index; } PointSet::PointsContainer* pointsContainer = points->GetPointSet(time)->GetPoints(); float minDistance = m_SelectionAccuracy; if (accuracy != -1 ) minDistance = accuracy; for (PointSet::PointsIterator it = pointsContainer->Begin(); it != pointsContainer->End(); it++) { float distance = sqrt(position.SquaredEuclideanDistanceTo(points->GetPoint(it->Index(), time))); if (distance < minDistance) // if several points fall within the margin, choose the one with minimal distance to position { index = it->Index(); } } return index; } bool mitk::PointSetDataInteractor::CheckSelection(const mitk::InteractionEvent *interactionEvent) { const InteractionPositionEvent* positionEvent = dynamic_cast(interactionEvent); if (positionEvent != NULL) { int timeStep = positionEvent->GetSender()->GetTimeStep(); Point3D point = positionEvent->GetPositionInWorld(); // iterate over point set and check if it contains a point close enough to the pointer to be selected int index = GetPointIndexByPosition(point, timeStep); if (index != -1) return true; } return false; } void mitk::PointSetDataInteractor::UnselectAll(unsigned int timeStep, ScalarType timeInMs) { mitk::PointSet *pointSet = dynamic_cast( GetDataNode()->GetData() ); if ( pointSet == NULL ) { return; } mitk::PointSet::DataType *itkPointSet = pointSet->GetPointSet( timeStep ); if ( itkPointSet == NULL ) { return; } mitk::PointSet::PointsContainer::Iterator it, end; end = itkPointSet->GetPoints()->End(); for (it = itkPointSet->GetPoints()->Begin(); it != end; it++) { int position = it->Index(); PointSet::PointDataType pointData = {0, false, PTUNDEFINED}; itkPointSet->GetPointData( position, &pointData ); //then declare an operation which unselects this point; //UndoOperation as well! if ( pointData.selected ) { mitk::Point3D noPoint; noPoint.Fill( 0 ); mitk::PointOperation *doOp = new mitk::PointOperation(OpDESELECTPOINT,timeInMs, noPoint, position); if ( m_UndoEnabled ) { mitk::PointOperation *undoOp = new mitk::PointOperation(OpSELECTPOINT, timeInMs, noPoint, position); OperationEvent *operationEvent = new OperationEvent( pointSet, doOp, undoOp ); m_UndoController->SetOperationEvent( operationEvent ); } pointSet->ExecuteOperation( doOp ); if ( !m_UndoEnabled ) delete doOp; } } } void mitk::PointSetDataInteractor::SelectPoint(int position, unsigned int timeStep, ScalarType timeInMS) { mitk::PointSet *pointSet = dynamic_cast< mitk::PointSet * >( this->GetDataNode()->GetData() ); - //if List is empty, then no select of a point can be done! + //if List is empty, then no selection of a point can be done! if ( (pointSet == NULL) || (pointSet->GetSize( timeStep ) <= 0) ) { return; } //dummyPoint... not needed anyway mitk::Point3D noPoint; noPoint.Fill(0); mitk::PointOperation *doOp = new mitk::PointOperation( OpSELECTPOINT,timeInMS, noPoint, position); if ( m_UndoEnabled ) { mitk::PointOperation* undoOp = new mitk::PointOperation(OpDESELECTPOINT,timeInMS, noPoint, position); OperationEvent *operationEvent = new OperationEvent(pointSet, doOp, undoOp); m_UndoController->SetOperationEvent(operationEvent); } pointSet->ExecuteOperation( doOp ); if ( !m_UndoEnabled ) delete doOp; } diff --git a/Core/Code/Interactions/mitkPointSetDataInteractor.h b/Core/Code/Interactions/mitkPointSetDataInteractor.h index 4a3631468c..659b6b1c45 100644 --- a/Core/Code/Interactions/mitkPointSetDataInteractor.h +++ b/Core/Code/Interactions/mitkPointSetDataInteractor.h @@ -1,177 +1,172 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef mitkPointSetDataInteractor_h_ #define mitkPointSetDataInteractor_h_ #include "itkObject.h" #include "itkSmartPointer.h" #include "itkObjectFactory.h" #include "mitkCommon.h" #include #include "mitkDataInteractor.h" #include namespace mitk { /** * Class PointSetDataInteractor * \brief Implementation of the PointSetInteractor * * Interactor operates on a point set and supports to: * - add points * - remove points * - move single points * - move complete pointset * - select/unselect a point * * in 2d and 3d render windows. */ // Inherit from DataInteratcor, this provides functionality of a state machine and configurable inputs. class MITK_CORE_EXPORT PointSetDataInteractor: public DataInteractor { public: mitkClassMacro(PointSetDataInteractor, DataInteractor) itkFactorylessNewMacro(Self) itkCloneMacro(Self) + /** + * Sets the maximum distance that is accepted when looking for a point at a certain position using the GetPointIndexByPosition function. + */ + void SetAccuracy(float accuracy); + + + /** + * @brief SetMaxPoints Sets the maximal number of points for the pointset + * Default ist zero, which result in infinite number of allowed points + * @param maxNumber + */ + void SetMaxPoints(unsigned int maxNumber = 0); + protected: PointSetDataInteractor(); virtual ~PointSetDataInteractor(); /** * 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. */ virtual void ConnectActionsAndFunctions(); /** * 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. */ virtual void DataNodeChanged(); - - /** - * Sets the maximum distance that is accepted when looking for a point at a certain position using the GetPointIndexByPosition function. - */ - void SetAccuracy(float accuracy); - - - /** - * @brief SetMaxPoints Sets the maximal number of points for the pointset - * Default ist zero, which result in infinite number of allowed points - * @param maxNumber - */ - void SetMaxPoints(unsigned int maxNumber = 0); - /** * \brief 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. */ virtual int GetPointIndexByPosition(Point3D position, int time = 0, float accuracy = -1); virtual bool CheckSelection( const InteractionEvent* interactionEvent ); /** 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. */ virtual bool AddPoint(StateMachineAction*, InteractionEvent* event); /** Removes point that is selected */ virtual bool RemovePoint(StateMachineAction*, InteractionEvent*interactionEvent); /** * 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. */ virtual bool IsClosedContour(StateMachineAction*, InteractionEvent*); /** * Moves the currently selected point to the new coodinates. */ virtual bool MovePoint(StateMachineAction*, InteractionEvent*); /** * Initializes the movement, stores starting position. */ virtual bool InitMove(StateMachineAction*, InteractionEvent*interactionEvent); /** * Is called when a movement is finished, changes back to regular color. */ virtual bool FinishMove(StateMachineAction*, InteractionEvent*); /** * Selects a point from the PointSet as currently active. */ virtual bool SelectPoint(StateMachineAction*, InteractionEvent*); /** * Unselects a point at the given coordinate. */ virtual bool UnSelectPointAtPosition(StateMachineAction*, InteractionEvent*); /** * Unselects all points out of reach. */ virtual bool UnSelectAll(StateMachineAction*, InteractionEvent*); /** * @brief UpdatePointSet Updates the member variable that holds the point set, evaluating the time step of the sender. */ virtual bool UpdatePointSet(StateMachineAction* stateMachineAction, InteractionEvent*); /** * Calls for inactivation of the DataInteractor */ virtual bool Abort(StateMachineAction*, InteractionEvent*); /** \brief to calculate a direction vector from last point and actual * point */ - Point3D m_LastPoint; /** \brief summ-vector for Movement */ Vector3D m_SumVec; - - private: // DATA PointSet::Pointer m_PointSet; int m_MaxNumberOfPoints; // maximum of allowed number of points - float m_SelectionAccuracy; // accuracy that's needed to select a point // FUNCTIONS void UnselectAll(unsigned int timeStep , ScalarType timeInMs); void SelectPoint(int position, unsigned int timeStep , ScalarType timeInMS); }; } #endif diff --git a/Core/Code/Interactions/mitkSinglePointDataInteractor.cpp b/Core/Code/Interactions/mitkSinglePointDataInteractor.cpp new file mode 100644 index 0000000000..38da417efd --- /dev/null +++ b/Core/Code/Interactions/mitkSinglePointDataInteractor.cpp @@ -0,0 +1,111 @@ +/*=================================================================== + + The Medical Imaging Interaction Toolkit (MITK) + + Copyright (c) German Cancer Research Center, + Division of Medical and Biological Informatics. + All rights reserved. + + This software is distributed WITHOUT ANY WARRANTY; without + even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. + + See LICENSE.txt or http://www.mitk.org for details. + + ===================================================================*/ + +#include "mitkSinglePointDataInteractor.h" +#include "mitkMouseMoveEvent.h" + +#include "mitkOperationEvent.h" +#include +#include "mitkInteractionConst.h" // TODO: refactor file +#include "mitkRenderingManager.h" +#include "mitkInternalEvent.h" +// +#include "mitkDispatcher.h" +#include "mitkBaseRenderer.h" + +#include "mitkUndoController.h" + +mitk::SinglePointDataInteractor::SinglePointDataInteractor() +{ + this->SetMaxPoints(1); +} + +mitk::SinglePointDataInteractor::~SinglePointDataInteractor() +{ + +} + +bool mitk::SinglePointDataInteractor::AddPoint(StateMachineAction* stateMachineAction, InteractionEvent* interactionEvent) +{ + unsigned int timeStep = interactionEvent->GetSender()->GetTimeStep(GetDataNode()->GetData()); + ScalarType timeInMs = interactionEvent->GetSender()->GetTime(); + + // To add a point the minimal information is the position, this method accepts all InteractionsPositionEvents + InteractionPositionEvent* positionEvent = dynamic_cast(interactionEvent); + if (positionEvent != NULL) + { + + PointOperation* doOp; + PointOperation* undoOp; + + if (m_PointSet->IndexExists(0,timeStep)) + { + PointSet::PointType pt = m_PointSet->GetPoint(0, timeStep); + Point3D itkPoint; + itkPoint[0] = pt[0]; + itkPoint[1] = pt[1]; + itkPoint[2] = pt[2]; + + doOp = new mitk::PointOperation(OpMOVE,timeInMs,positionEvent->GetPositionInWorld(), 0); + undoOp = new mitk::PointOperation(OpMOVE,timeInMs,itkPoint, 0); + } + else + { + doOp = new mitk::PointOperation(OpINSERT,timeInMs,positionEvent->GetPositionInWorld(), 0); + undoOp = new mitk::PointOperation(OpREMOVE,timeInMs,positionEvent->GetPositionInWorld(), 0); + } + + + if ( m_UndoEnabled ) + { + OperationEvent *operationEvent = new OperationEvent(m_PointSet, doOp, undoOp, "Move point"); + m_UndoController->SetOperationEvent(operationEvent); + } + //execute the Operation + m_PointSet->ExecuteOperation(doOp); + + if ( !m_UndoEnabled ) + delete doOp; + + // Request update + interactionEvent->GetSender()->GetRenderingManager()->RequestUpdateAll(); + + return true; + } + return false; +} + + +/* + * Check whether the DataNode contains a pointset, if not create one and add it. + */ +void mitk::SinglePointDataInteractor::DataNodeChanged() +{ + if (GetDataNode().IsNotNull()) + { + PointSet* points = dynamic_cast(GetDataNode()->GetData()); + if (points == NULL) + { + m_PointSet = PointSet::New(); + GetDataNode()->SetData(m_PointSet); + } + else + { + points->Clear(); + m_PointSet = points; + } + } +} diff --git a/Core/Code/Interactions/mitkSinglePointDataInteractor.h b/Core/Code/Interactions/mitkSinglePointDataInteractor.h new file mode 100644 index 0000000000..690af888ca --- /dev/null +++ b/Core/Code/Interactions/mitkSinglePointDataInteractor.h @@ -0,0 +1,67 @@ +/*=================================================================== + + The Medical Imaging Interaction Toolkit (MITK) + + Copyright (c) German Cancer Research Center, + Division of Medical and Biological Informatics. + All rights reserved. + + This software is distributed WITHOUT ANY WARRANTY; without + even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. + + See LICENSE.txt or http://www.mitk.org for details. + + ===================================================================*/ + +#ifndef mitkSinglePointDataInteractor_h_ +#define mitkSinglePointDataInteractor_h_ + +#include "itkObject.h" +#include "itkSmartPointer.h" +#include "itkObjectFactory.h" +#include "mitkCommon.h" +#include +#include "mitkPointSetDataInteractor.h" +#include + +namespace mitk +{ + /** + * Class SinglePointDataInteractor + * \brief Implementation of the single point interaction + * + * Interactor operates on a single point set, when a data node is set, its containing point set is clear for initialization. + */ + + // Inherit from DataInteratcor, this provides functionality of a state machine and configurable inputs. + class MITK_CORE_EXPORT SinglePointDataInteractor: public PointSetDataInteractor + { + + public: + mitkClassMacro(SinglePointDataInteractor, PointSetDataInteractor) + itkFactorylessNewMacro(Self) + itkCloneMacro(Self) + + protected: + SinglePointDataInteractor(); + virtual ~SinglePointDataInteractor(); + + /** Adds a point at the given coordinates. + * This function overwrites the behavior of PointSetDataInteractor such that instead of adding new points + * the first points position is updated. All other interaction (move,delete) is still handled by PointSetDataInteractor. + */ + virtual bool AddPoint(StateMachineAction*, InteractionEvent* event); + + /** + * @brief SetMaxPoints Sets the maximal number of points for the pointset + * Overwritten, per design this class will always have a maximal number of one. + * @param maxNumber + */ + virtual void SetMaxPoints(unsigned int maxNumber = 0){}; + + virtual void DataNodeChanged(); + }; + +} +#endif diff --git a/Core/Code/Resources/Interactions/PointSet.xml b/Core/Code/Resources/Interactions/PointSet.xml index 285435563c..4812adf53e 100644 --- a/Core/Code/Resources/Interactions/PointSet.xml +++ b/Core/Code/Resources/Interactions/PointSet.xml @@ -1,40 +1,40 @@ - + diff --git a/Core/Code/Resources/Interactions/PointSetConfig.xml b/Core/Code/Resources/Interactions/PointSetConfig.xml index 37fe42c2ad..f1d66bcc89 100644 --- a/Core/Code/Resources/Interactions/PointSetConfig.xml +++ b/Core/Code/Resources/Interactions/PointSetConfig.xml @@ -1,29 +1,32 @@ + + + diff --git a/Core/Code/Testing/mitkDataNodeTest.cpp b/Core/Code/Testing/mitkDataNodeTest.cpp index 5e75b81bb4..04e71c117c 100644 --- a/Core/Code/Testing/mitkDataNodeTest.cpp +++ b/Core/Code/Testing/mitkDataNodeTest.cpp @@ -1,295 +1,294 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkDataNode.h" #include #include "mitkVtkPropRenderer.h" #include "mitkTestingMacros.h" #include "mitkGlobalInteraction.h" #include //Basedata Test #include #include #include #include #include #include #include #include //Mapper Test #include #include #include #include #include #include #include #include #include //Interactors -#include -#include +#include //Propertylist Test /** * Simple example for a test for the (non-existent) class "DataNode". * * argc and argv are the command line parameters which were passed to * the ADD_TEST command in the CMakeLists.txt file. For the automatic * tests, argv is either empty for the simple tests or contains the filename * of a test image for the image tests (see CMakeLists.txt). */ class mitkDataNodeTestClass { public: static void TestDataSetting(mitk::DataNode::Pointer dataNode) { mitk::BaseData::Pointer baseData; //NULL pointer Test dataNode->SetData(baseData); MITK_TEST_CONDITION( baseData == dataNode->GetData(), "Testing if a NULL pointer was set correctly" ) baseData = mitk::RenderWindowFrame::New(); dataNode->SetData(baseData); MITK_TEST_CONDITION( baseData == dataNode->GetData(), "Testing if a RenderWindowFrame object was set correctly" ) // MITK_TEST_CONDITION( baseData->GetGeometry(0)->GetVtkTransform() == dataNode->GetVtkTransform(0), "Testing if a NULL pointer was set correctly" ) baseData = mitk::GeometryData::New(); dataNode->SetData(baseData); MITK_TEST_CONDITION( baseData == dataNode->GetData(), "Testing if a GeometryData object was set correctly" ) baseData = mitk::PlaneGeometryData::New(); dataNode->SetData(baseData); MITK_TEST_CONDITION( baseData == dataNode->GetData(), "Testing if a PlaneGeometryData object was set correctly" ) baseData = mitk::GradientBackground::New(); dataNode->SetData(baseData); MITK_TEST_CONDITION( baseData == dataNode->GetData(), "Testing if a GradientBackground object was set correctly" ) baseData = mitk::ManufacturerLogo::New(); dataNode->SetData(baseData); MITK_TEST_CONDITION( baseData == dataNode->GetData(), "Testing if a ManufacturerLogo object was set correctly" ) baseData = mitk::PointSet::New(); dataNode->SetData(baseData); MITK_TEST_CONDITION( baseData == dataNode->GetData(), "Testing if a PointSet object was set correctly" ) baseData = mitk::Image::New(); dataNode->SetData(baseData); MITK_TEST_CONDITION( baseData == dataNode->GetData(), "Testing if a Image object was set correctly" ) baseData = mitk::Surface::New(); dataNode->SetData(baseData); MITK_TEST_CONDITION( baseData == dataNode->GetData(), "Testing if a Surface object was set correctly" ) } static void TestMapperSetting(mitk::DataNode::Pointer dataNode) { //tests the SetMapper() method //in dataNode is a mapper vector which can be accessed by index //in this test method we use only slot 0 (filled with null) and slot 1 //so we also test the destructor of the mapper classes mitk::Mapper::Pointer mapper; dataNode->SetMapper(0,mapper); MITK_TEST_CONDITION( mapper == dataNode->GetMapper(0), "Testing if a NULL pointer was set correctly" ) mapper = mitk::PlaneGeometryDataMapper2D::New(); dataNode->SetMapper(1,mapper); MITK_TEST_CONDITION( mapper == dataNode->GetMapper(1), "Testing if a PlaneGeometryDataMapper2D was set correctly" ) MITK_TEST_CONDITION( dataNode == mapper->GetDataNode(), "Testing if the mapper returns the right DataNode" ) mapper = mitk::ImageVtkMapper2D::New(); dataNode->SetMapper(1,mapper); MITK_TEST_CONDITION( mapper == dataNode->GetMapper(1), "Testing if a ImageVtkMapper2D was set correctly" ) MITK_TEST_CONDITION( dataNode == mapper->GetDataNode(), "Testing if the mapper returns the right DataNode" ) mapper = mitk::PointSetVtkMapper2D::New(); dataNode->SetMapper(1,mapper); MITK_TEST_CONDITION( mapper == dataNode->GetMapper(1), "Testing if a PointSetVtkMapper2D was set correctly" ) MITK_TEST_CONDITION( dataNode == mapper->GetDataNode(), "Testing if the mapper returns the right DataNode" ) mapper = mitk::SurfaceGLMapper2D::New(); dataNode->SetMapper(1,mapper); MITK_TEST_CONDITION( mapper == dataNode->GetMapper(1), "Testing if a SurfaceGLMapper2D was set correctly" ) MITK_TEST_CONDITION( dataNode == mapper->GetDataNode(), "Testing if the mapper returns the right DataNode" ) mapper = mitk::PlaneGeometryDataVtkMapper3D::New(); dataNode->SetMapper(1,mapper); MITK_TEST_CONDITION( mapper == dataNode->GetMapper(1), "Testing if a PlaneGeometryDataVtkMapper3D was set correctly" ) MITK_TEST_CONDITION( dataNode == mapper->GetDataNode(), "Testing if the mapper returns the right DataNode" ) mapper = mitk::PointSetVtkMapper3D::New(); dataNode->SetMapper(1,mapper); MITK_TEST_CONDITION( mapper == dataNode->GetMapper(1), "Testing if a PointSetVtkMapper3D was set correctly" ) MITK_TEST_CONDITION( dataNode == mapper->GetDataNode(), "Testing if the mapper returns the right DataNode" ) mapper = mitk::SurfaceVtkMapper3D::New(); dataNode->SetMapper(1,mapper); MITK_TEST_CONDITION( mapper == dataNode->GetMapper(1), "Testing if a SurfaceVtkMapper3D was set correctly" ) MITK_TEST_CONDITION( dataNode == mapper->GetDataNode(), "Testing if the mapper returns the right DataNode" ) mapper = mitk::VolumeDataVtkMapper3D::New(); dataNode->SetMapper(1,mapper); MITK_TEST_CONDITION( mapper == dataNode->GetMapper(1), "Testing if a VolumeDataVtkMapper3D was set correctly" ) MITK_TEST_CONDITION( dataNode == mapper->GetDataNode(), "Testing if the mapper returns the right DataNode" ) //linker error //mapper = mitk::LineVtkMapper3D::New(); //dataNode->SetMapper(1,mapper); //MITK_TEST_CONDITION( mapper == dataNode->GetMapper(1), "Testing if a LineVtkMapper3D was set correctly" ) //MITK_TEST_CONDITION( dataNode == mapper->GetDataNode(), "Testing if the mapper returns the right DataNode" ) } static void TestInteractorSetting(mitk::DataNode::Pointer dataNode) { //this method tests the SetInteractor() and GetInteractor methods - //the Interactor base class calls the DataNode->SetInteractor method + //the DataInteractor base class calls the DataNode->SetInteractor method - mitk::Interactor::Pointer interactor; + mitk::DataInteractor::Pointer interactor; - MITK_TEST_CONDITION( interactor == dataNode->GetInteractor(), "Testing if a NULL pointer was set correctly (Interactor)" ) + MITK_TEST_CONDITION( interactor == dataNode->GetDataInteractor(), "Testing if a NULL pointer was set correctly (DataInteractor)" ) - interactor = mitk::AffineInteractor::New("AffineInteractions click to select", dataNode); - dataNode->EnableInteractor(); - dataNode->DisableInteractor(); - MITK_TEST_CONDITION( interactor == dataNode->GetInteractor(), "Testing if a AffineInteractor was set correctly" ) + interactor = mitk::PointSetDataInteractor::New(); + interactor->SetDataNode(dataNode); + MITK_TEST_CONDITION( interactor == dataNode->GetDataInteractor(), "Testing if a PointSetDataInteractor was set correctly" ) - interactor = mitk::PointSetInteractor::New("AffineInteractions click to select", dataNode); - MITK_TEST_CONDITION( interactor == dataNode->GetInteractor(), "Testing if a PointSetInteractor was set correctly" ) + interactor = mitk::PointSetDataInteractor::New(); + dataNode->SetDataInteractor(interactor); + MITK_TEST_CONDITION( interactor == dataNode->GetDataInteractor(), "Testing if a PointSetDataInteractor was set correctly" ) } static void TestPropertyList(mitk::DataNode::Pointer dataNode) { mitk::PropertyList::Pointer propertyList = dataNode->GetPropertyList(); MITK_TEST_CONDITION(dataNode->GetPropertyList() != NULL, "Testing if the constructor set the propertylist" ) dataNode->SetIntProperty("int", -31337); int x; dataNode->GetIntProperty("int", x); MITK_TEST_CONDITION(x == -31337, "Testing Set/GetIntProperty"); dataNode->SetBoolProperty("bool", true); bool b; dataNode->GetBoolProperty("bool", b); MITK_TEST_CONDITION(b == true, "Testing Set/GetBoolProperty"); dataNode->SetFloatProperty("float", -31.337); float y; dataNode->GetFloatProperty("float", y); MITK_TEST_CONDITION(y - -31.337 < 0.01, "Testing Set/GetFloatProperty"); dataNode->SetStringProperty("string", "MITK"); std::string s = "GANZVIELPLATZ"; dataNode->GetStringProperty("string", s); MITK_TEST_CONDITION(s == "MITK", "Testing Set/GetStringProperty"); std::string name = "MyTestName"; dataNode->SetName(name.c_str()); MITK_TEST_CONDITION(dataNode->GetName() == name, "Testing Set/GetName"); name = "MySecondTestName"; dataNode->SetName(name); MITK_TEST_CONDITION(dataNode->GetName() == name, "Testing Set/GetName(std::string)"); MITK_TEST_CONDITION(propertyList == dataNode->GetPropertyList(), "Testing if the propertylist has changed during the last tests" ) } static void TestSelected(mitk::DataNode::Pointer dataNode) { vtkRenderWindow *renderWindow = vtkRenderWindow::New(); mitk::VtkPropRenderer::Pointer base = mitk::VtkPropRenderer::New( "the first renderer", renderWindow, mitk::RenderingManager::GetInstance() ); //with BaseRenderer==Null MITK_TEST_CONDITION(!dataNode->IsSelected(), "Testing if this node is not set as selected" ) dataNode->SetSelected(true); MITK_TEST_CONDITION(dataNode->IsSelected(), "Testing if this node is set as selected" ) dataNode->SetSelected(false); dataNode->SetSelected(true,base); MITK_TEST_CONDITION(dataNode->IsSelected(base), "Testing if this node with right base renderer is set as selected" ) //Delete RenderWindow correctly renderWindow->Delete(); } static void TestGetMTime(mitk::DataNode::Pointer dataNode) { unsigned long time; time = dataNode->GetMTime(); mitk::PointSet::Pointer pointSet = mitk::PointSet::New(); dataNode->SetData(pointSet); MITK_TEST_CONDITION( time != dataNode->GetMTime(), "Testing if the node timestamp is updated after adding data to the node" ) mitk::Point3D point; point.Fill(3.0); pointSet->SetPoint(0,point); //less or equal because dataNode timestamp is little later then the basedata timestamp MITK_TEST_CONDITION( pointSet->GetMTime() <= dataNode->GetMTime(), "Testing if the node timestamp is updated after base data was modified" ) // testing if changing anything in the property list also sets the node in a modified state unsigned long lastModified = dataNode->GetMTime(); dataNode->SetIntProperty("testIntProp", 2344); MITK_TEST_CONDITION( lastModified <= dataNode->GetMTime(), "Testing if the node timestamp is updated after property list was modified" ) } }; //mitkDataNodeTestClass int mitkDataNodeTest(int /* argc */, char* /*argv*/[]) { // always start with this! MITK_TEST_BEGIN("DataNode") // Global interaction must(!) be initialized mitk::GlobalInteraction::GetInstance()->Initialize("global"); // let's create an object of our class mitk::DataNode::Pointer myDataNode = mitk::DataNode::New(); // first test: did this work? // using MITK_TEST_CONDITION_REQUIRED makes the test stop after failure, since // it makes no sense to continue without an object. MITK_TEST_CONDITION_REQUIRED(myDataNode.IsNotNull(),"Testing instantiation") //test setData() Method mitkDataNodeTestClass::TestDataSetting(myDataNode); mitkDataNodeTestClass::TestMapperSetting(myDataNode); // //note, that no data is set to the dataNode mitkDataNodeTestClass::TestInteractorSetting(myDataNode); mitkDataNodeTestClass::TestPropertyList(myDataNode); mitkDataNodeTestClass::TestSelected(myDataNode); mitkDataNodeTestClass::TestGetMTime(myDataNode); // write your own tests here and use the macros from mitkTestingMacros.h !!! // do not write to std::cout and do not return from this function yourself! // always end with this! MITK_TEST_END() } diff --git a/Core/Code/files.cmake b/Core/Code/files.cmake index 772bd25bde..0b06fe3d11 100644 --- a/Core/Code/files.cmake +++ b/Core/Code/files.cmake @@ -1,406 +1,407 @@ set(H_FILES Algorithms/itkImportMitkImageContainer.h Algorithms/itkImportMitkImageContainer.txx Algorithms/itkMITKScalarImageToHistogramGenerator.h Algorithms/itkMITKScalarImageToHistogramGenerator.txx Algorithms/mitkInstantiateAccessFunctions.h Algorithms/mitkPixelTypeList.h Algorithms/mitkPPArithmeticDec.h Algorithms/mitkPPArgCount.h Algorithms/mitkPPCat.h Algorithms/mitkPPConfig.h Algorithms/mitkPPControlExprIIf.h Algorithms/mitkPPControlIf.h Algorithms/mitkPPControlIIf.h Algorithms/mitkPPDebugError.h Algorithms/mitkPPDetailAutoRec.h Algorithms/mitkPPDetailDMCAutoRec.h Algorithms/mitkPPExpand.h Algorithms/mitkPPFacilitiesEmpty.h Algorithms/mitkPPFacilitiesExpand.h Algorithms/mitkPPLogicalBool.h Algorithms/mitkPPRepetitionDetailDMCFor.h Algorithms/mitkPPRepetitionDetailEDGFor.h Algorithms/mitkPPRepetitionDetailFor.h Algorithms/mitkPPRepetitionDetailMSVCFor.h Algorithms/mitkPPRepetitionFor.h Algorithms/mitkPPSeqElem.h Algorithms/mitkPPSeqForEach.h Algorithms/mitkPPSeqForEachProduct.h Algorithms/mitkPPSeq.h Algorithms/mitkPPSeqEnum.h Algorithms/mitkPPSeqSize.h Algorithms/mitkPPSeqToTuple.h Algorithms/mitkPPStringize.h Algorithms/mitkPPTupleEat.h Algorithms/mitkPPTupleElem.h Algorithms/mitkPPTupleRem.h Algorithms/mitkClippedSurfaceBoundsCalculator.h Algorithms/mitkExtractSliceFilter.h Algorithms/mitkConvert2Dto3DImageFilter.h Algorithms/mitkPlaneClipping.h Common/mitkCommon.h Common/mitkExceptionMacro.h DataManagement/mitkProportionalTimeGeometry.h DataManagement/mitkTimeGeometry.h DataManagement/mitkImageAccessByItk.h DataManagement/mitkImageCast.h DataManagement/mitkImagePixelAccessor.h DataManagement/mitkImagePixelReadAccessor.h DataManagement/mitkImagePixelWriteAccessor.h DataManagement/mitkImageReadAccessor.h DataManagement/mitkImageWriteAccessor.h DataManagement/mitkITKImageImport.h DataManagement/mitkITKImageImport.txx DataManagement/mitkImageToItk.h DataManagement/mitkShaderProperty.h DataManagement/mitkImageToItk.txx DataManagement/mitkTimeSlicedGeometry.h # Deprecated, empty for compatibility reasons. DataManagement/mitkPropertyListReplacedObserver.cpp Interactions/mitkEventMapperAddOn.h Interfaces/mitkIDataNodeReader.h Rendering/mitkLocalStorageHandler.h Rendering/Colortables/HotIron.h Rendering/Colortables/Jet.h Rendering/Colortables/PET20.h Rendering/Colortables/PETColor.h IO/mitkPixelTypeTraits.h ) set(CPP_FILES Algorithms/mitkBaseDataSource.cpp Algorithms/mitkCompareImageDataFilter.cpp Algorithms/mitkMultiComponentImageDataComparisonFilter.cpp Algorithms/mitkDataNodeSource.cpp Algorithms/mitkPlaneGeometryDataToSurfaceFilter.cpp Algorithms/mitkHistogramGenerator.cpp Algorithms/mitkImageChannelSelector.cpp Algorithms/mitkImageSliceSelector.cpp Algorithms/mitkImageSource.cpp Algorithms/mitkImageTimeSelector.cpp Algorithms/mitkImageToImageFilter.cpp Algorithms/mitkImageToSurfaceFilter.cpp Algorithms/mitkPointSetSource.cpp Algorithms/mitkPointSetToPointSetFilter.cpp Algorithms/mitkRGBToRGBACastImageFilter.cpp Algorithms/mitkSubImageSelector.cpp Algorithms/mitkSurfaceSource.cpp Algorithms/mitkSurfaceToImageFilter.cpp Algorithms/mitkSurfaceToSurfaceFilter.cpp Algorithms/mitkUIDGenerator.cpp Algorithms/mitkVolumeCalculator.cpp Algorithms/mitkClippedSurfaceBoundsCalculator.cpp Algorithms/mitkExtractSliceFilter.cpp Algorithms/mitkConvert2Dto3DImageFilter.cpp Controllers/mitkBaseController.cpp Controllers/mitkCallbackFromGUIThread.cpp Controllers/mitkCameraController.cpp Controllers/mitkCameraRotationController.cpp Controllers/mitkCoreActivator.cpp Controllers/mitkFocusManager.cpp Controllers/mitkLimitedLinearUndo.cpp Controllers/mitkOperationEvent.cpp Controllers/mitkPlanePositionManager.cpp Controllers/mitkProgressBar.cpp Controllers/mitkRenderingManager.cpp Controllers/mitkSliceNavigationController.cpp Controllers/mitkSlicesCoordinator.cpp Controllers/mitkSlicesRotator.cpp Controllers/mitkSlicesSwiveller.cpp Controllers/mitkStatusBar.cpp Controllers/mitkStepper.cpp Controllers/mitkTestManager.cpp Controllers/mitkUndoController.cpp Controllers/mitkVerboseLimitedLinearUndo.cpp Controllers/mitkVtkInteractorCameraController.cpp Controllers/mitkVtkLayerController.cpp DataManagement/mitkProportionalTimeGeometry.cpp DataManagement/mitkTimeGeometry.cpp DataManagement/mitkAbstractTransformGeometry.cpp DataManagement/mitkAnnotationProperty.cpp DataManagement/mitkApplicationCursor.cpp DataManagement/mitkBaseData.cpp DataManagement/mitkBaseGeometry.cpp DataManagement/mitkBaseProperty.cpp DataManagement/mitkClippingProperty.cpp DataManagement/mitkChannelDescriptor.cpp DataManagement/mitkColorProperty.cpp DataManagement/mitkDataStorage.cpp # DataManagement/mitkDataTree.cpp DataManagement/mitkDataNode.cpp DataManagement/mitkDataNodeFactory.cpp # DataManagement/mitkDataTreeStorage.cpp DataManagement/mitkDisplayGeometry.cpp DataManagement/mitkEnumerationProperty.cpp DataManagement/mitkPlaneGeometryData.cpp DataManagement/mitkGeometry3D.cpp DataManagement/mitkGeometryData.cpp DataManagement/mitkGroupTagProperty.cpp DataManagement/mitkImage.cpp DataManagement/mitkImageAccessorBase.cpp DataManagement/mitkImageCaster.cpp DataManagement/mitkImageCastPart1.cpp DataManagement/mitkImageCastPart2.cpp DataManagement/mitkImageCastPart3.cpp DataManagement/mitkImageCastPart4.cpp DataManagement/mitkImageDataItem.cpp DataManagement/mitkImageDescriptor.cpp DataManagement/mitkImageVtkAccessor.cpp DataManagement/mitkImageStatisticsHolder.cpp DataManagement/mitkLandmarkProjectorBasedCurvedGeometry.cpp DataManagement/mitkLandmarkProjector.cpp DataManagement/mitkLevelWindow.cpp DataManagement/mitkLevelWindowManager.cpp DataManagement/mitkLevelWindowPreset.cpp DataManagement/mitkLevelWindowProperty.cpp DataManagement/mitkLookupTable.cpp DataManagement/mitkLookupTables.cpp # specializations of GenericLookupTable DataManagement/mitkMemoryUtilities.cpp DataManagement/mitkModalityProperty.cpp DataManagement/mitkModeOperation.cpp DataManagement/mitkModifiedLock.cpp DataManagement/mitkNodePredicateAnd.cpp DataManagement/mitkNodePredicateBase.cpp DataManagement/mitkNodePredicateCompositeBase.cpp DataManagement/mitkNodePredicateData.cpp DataManagement/mitkNodePredicateDataType.cpp DataManagement/mitkNodePredicateDimension.cpp DataManagement/mitkNodePredicateFirstLevel.cpp DataManagement/mitkNodePredicateNot.cpp DataManagement/mitkNodePredicateOr.cpp DataManagement/mitkNodePredicateProperty.cpp DataManagement/mitkNodePredicateSource.cpp DataManagement/mitkPlaneOrientationProperty.cpp DataManagement/mitkPlaneGeometry.cpp DataManagement/mitkPlaneOperation.cpp DataManagement/mitkPointOperation.cpp DataManagement/mitkPointSet.cpp DataManagement/mitkProperties.cpp DataManagement/mitkPropertyList.cpp DataManagement/mitkPropertyObserver.cpp DataManagement/mitkRestorePlanePositionOperation.cpp DataManagement/mitkApplyTransformMatrixOperation.cpp DataManagement/mitkRotationOperation.cpp DataManagement/mitkSlicedData.cpp DataManagement/mitkSlicedGeometry3D.cpp DataManagement/mitkSmartPointerProperty.cpp DataManagement/mitkStandaloneDataStorage.cpp DataManagement/mitkStateTransitionOperation.cpp DataManagement/mitkStringProperty.cpp DataManagement/mitkSurface.cpp DataManagement/mitkSurfaceOperation.cpp DataManagement/mitkThinPlateSplineCurvedGeometry.cpp DataManagement/mitkTransferFunction.cpp DataManagement/mitkTransferFunctionProperty.cpp DataManagement/mitkTransferFunctionInitializer.cpp DataManagement/mitkVector.cpp DataManagement/mitkVtkInterpolationProperty.cpp DataManagement/mitkVtkRepresentationProperty.cpp DataManagement/mitkVtkResliceInterpolationProperty.cpp DataManagement/mitkVtkScalarModeProperty.cpp DataManagement/mitkVtkVolumeRenderingProperty.cpp DataManagement/mitkWeakPointerProperty.cpp DataManagement/mitkRenderingModeProperty.cpp DataManagement/mitkResliceMethodProperty.cpp DataManagement/mitkMaterial.cpp DataManagement/mitkPointSetShapeProperty.cpp DataManagement/mitkFloatPropertyExtension.cpp DataManagement/mitkIntPropertyExtension.cpp DataManagement/mitkPropertyExtension.cpp DataManagement/mitkPropertyFilter.cpp DataManagement/mitkPropertyAliases.cpp DataManagement/mitkPropertyDescriptions.cpp DataManagement/mitkPropertyExtensions.cpp DataManagement/mitkPropertyFilters.cpp DataManagement/mitkShaderProperty.cpp Interactions/mitkAction.cpp Interactions/mitkAffineInteractor.cpp Interactions/mitkBindDispatcherInteractor.cpp Interactions/mitkCoordinateSupplier.cpp Interactions/mitkDataInteractor.cpp Interactions/mitkDispatcher.cpp Interactions/mitkDisplayCoordinateOperation.cpp Interactions/mitkDisplayInteractor.cpp Interactions/mitkDisplayPositionEvent.cpp # Interactions/mitkDisplayVectorInteractorLevelWindow.cpp # legacy, prob even now unneeded # Interactions/mitkDisplayVectorInteractorScroll.cpp Interactions/mitkEvent.cpp Interactions/mitkEventConfig.cpp Interactions/mitkEventDescription.cpp Interactions/mitkEventFactory.cpp Interactions/mitkInteractionEventHandler.cpp Interactions/mitkEventMapper.cpp Interactions/mitkEventRecorder.cpp Interactions/mitkEventStateMachine.cpp Interactions/mitkGlobalInteraction.cpp Interactions/mitkInteractor.cpp Interactions/mitkInternalEvent.cpp Interactions/mitkInteractionEvent.cpp Interactions/mitkInteractionEventConst.cpp Interactions/mitkInteractionPositionEvent.cpp Interactions/mitkInteractionKeyEvent.cpp Interactions/mitkMousePressEvent.cpp Interactions/mitkMouseMoveEvent.cpp Interactions/mitkMouseReleaseEvent.cpp Interactions/mitkMouseWheelEvent.cpp Interactions/mitkMouseDoubleClickEvent.cpp Interactions/mitkMouseModeSwitcher.cpp Interactions/mitkMouseMovePointSetInteractor.cpp Interactions/mitkMoveBaseDataInteractor.cpp Interactions/mitkNodeDepententPointSetInteractor.cpp Interactions/mitkPointSetDataInteractor.cpp Interactions/mitkPointSetInteractor.cpp Interactions/mitkPositionEvent.cpp Interactions/mitkPositionTracker.cpp + Interactions/mitkSinglePointDataInteractor.cpp Interactions/mitkStateMachineAction.cpp Interactions/mitkStateMachineCondition.cpp Interactions/mitkStateMachineState.cpp Interactions/mitkStateMachineTransition.cpp Interactions/mitkState.cpp Interactions/mitkStateMachineContainer.cpp Interactions/mitkStateEvent.cpp Interactions/mitkStateMachine.cpp Interactions/mitkStateMachineFactory.cpp Interactions/mitkTransition.cpp Interactions/mitkWheelEvent.cpp Interactions/mitkKeyEvent.cpp Interactions/mitkVtkEventAdapter.cpp Interactions/mitkVtkInteractorStyle.cxx Interactions/mitkCrosshairPositionEvent.cpp Interactions/mitkXML2EventParser.cpp Interfaces/mitkInteractionEventObserver.cpp Interfaces/mitkIShaderRepository.cpp Interfaces/mitkIPropertyAliases.cpp Interfaces/mitkIPropertyDescriptions.cpp Interfaces/mitkIPropertyExtensions.cpp Interfaces/mitkIPropertyFilters.cpp Interfaces/mitkIPersistenceService.cpp IO/mitkBaseDataIOFactory.cpp IO/mitkCoreDataNodeReader.cpp IO/mitkDicomSeriesReader.cpp IO/mitkDicomSR_LoadDICOMScalar.cpp IO/mitkDicomSR_LoadDICOMScalar4D.cpp IO/mitkDicomSR_LoadDICOMRGBPixel.cpp IO/mitkDicomSR_LoadDICOMRGBPixel4D.cpp IO/mitkDicomSR_ImageBlockDescriptor.cpp IO/mitkDicomSR_GantryTiltInformation.cpp IO/mitkDicomSR_SliceGroupingResult.cpp IO/mitkFileReader.cpp IO/mitkFileSeriesReader.cpp IO/mitkFileWriter.cpp # IO/mitkIpPicGet.c IO/mitkImageGenerator.cpp IO/mitkImageWriter.cpp IO/mitkImageWriterFactory.cpp IO/mitkItkImageFileIOFactory.cpp IO/mitkItkImageFileReader.cpp IO/mitkItkLoggingAdapter.cpp IO/mitkItkPictureWrite.cpp IO/mitkIOUtil.cpp IO/mitkLookupTableProperty.cpp IO/mitkOperation.cpp # IO/mitkPicFileIOFactory.cpp # IO/mitkPicFileReader.cpp # IO/mitkPicFileWriter.cpp # IO/mitkPicHelper.cpp # IO/mitkPicVolumeTimeSeriesIOFactory.cpp # IO/mitkPicVolumeTimeSeriesReader.cpp IO/mitkPixelType.cpp IO/mitkPointSetIOFactory.cpp IO/mitkPointSetReader.cpp IO/mitkPointSetWriter.cpp IO/mitkPointSetWriterFactory.cpp IO/mitkRawImageFileReader.cpp IO/mitkStandardFileLocations.cpp IO/mitkSTLFileIOFactory.cpp IO/mitkSTLFileReader.cpp IO/mitkSurfaceVtkWriter.cpp IO/mitkSurfaceVtkWriterFactory.cpp IO/mitkVtkLoggingAdapter.cpp IO/mitkVtiFileIOFactory.cpp IO/mitkVtiFileReader.cpp IO/mitkVtkImageIOFactory.cpp IO/mitkVtkImageReader.cpp IO/mitkVtkSurfaceIOFactory.cpp IO/mitkVtkSurfaceReader.cpp IO/vtkPointSetXMLParser.cpp IO/mitkLog.cpp Rendering/mitkBaseRenderer.cpp Rendering/mitkVtkMapper.cpp Rendering/mitkRenderWindowFrame.cpp Rendering/mitkPlaneGeometryDataMapper2D.cpp Rendering/mitkPlaneGeometryDataVtkMapper3D.cpp Rendering/mitkGLMapper.cpp Rendering/mitkGradientBackground.cpp Rendering/mitkManufacturerLogo.cpp Rendering/mitkMapper.cpp Rendering/mitkPointSetGLMapper2D.cpp Rendering/mitkPointSetVtkMapper2D.cpp Rendering/mitkPointSetVtkMapper3D.cpp Rendering/mitkSurfaceGLMapper2D.cpp Rendering/mitkSurfaceVtkMapper3D.cpp Rendering/mitkVolumeDataVtkMapper3D.cpp Rendering/mitkVtkPropRenderer.cpp Rendering/mitkVtkWidgetRendering.cpp Rendering/vtkMitkRectangleProp.cpp Rendering/vtkMitkRenderProp.cpp Rendering/mitkVtkEventProvider.cpp Rendering/mitkRenderWindow.cpp Rendering/mitkRenderWindowBase.cpp Rendering/mitkImageVtkMapper2D.cpp Rendering/vtkMitkThickSlicesFilter.cpp Rendering/vtkMitkLevelWindowFilter.cpp Rendering/vtkNeverTranslucentTexture.cpp Rendering/mitkOverlay.cpp Rendering/mitkVtkOverlay.cpp Rendering/mitkVtkOverlay2D.cpp Rendering/mitkVtkOverlay3D.cpp Rendering/mitkOverlayManager.cpp Rendering/mitkAbstractOverlayLayouter.cpp Rendering/mitkTextOverlay2D.cpp Rendering/mitkTextOverlay3D.cpp Rendering/mitkLabelOverlay3D.cpp Rendering/mitkOverlay2DLayouter.cpp Rendering/mitkScaleLegendOverlay Common/mitkException.cpp Common/mitkCommon.h Common/mitkCoreObjectFactoryBase.cpp Common/mitkCoreObjectFactory.cpp Common/mitkCoreServices.cpp ) set(RESOURCE_FILES Interactions/globalConfig.xml Interactions/DisplayInteraction.xml Interactions/DisplayConfig.xml Interactions/DisplayConfigPACS.xml Interactions/DisplayConfigPACSPan.xml Interactions/DisplayConfigPACSScroll.xml Interactions/DisplayConfigPACSZoom.xml Interactions/DisplayConfigPACSLevelWindow.xml Interactions/DisplayConfigMITK.xml Interactions/PointSet.xml Interactions/Legacy/StateMachine.xml Interactions/Legacy/DisplayConfigMITKTools.xml Interactions/PointSetConfig.xml mitkLevelWindowPresets.xml ) diff --git a/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/simplemeasurement/QmitkSimpleMeasurement.cpp b/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/simplemeasurement/QmitkSimpleMeasurement.cpp index 5816430fd0..b1da2782df 100644 --- a/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/simplemeasurement/QmitkSimpleMeasurement.cpp +++ b/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/simplemeasurement/QmitkSimpleMeasurement.cpp @@ -1,306 +1,307 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "QmitkSimpleMeasurement.h" #include "ui_QmitkSimpleMeasurementControls.h" #include #include -#include #include #include #include #include #include #include QmitkSimpleMeasurement::QmitkSimpleMeasurement() { } QmitkSimpleMeasurement::~QmitkSimpleMeasurement() { //remove all measurements when view is closed for (std::size_t i=0; iGetDataStorage()->Remove(m_CreatedDistances.at(i)); } for (std::size_t i=0; iGetDataStorage()->Remove(m_CreatedAngles.at(i)); } for (std::size_t i=0; iGetDataStorage()->Remove(m_CreatedPaths.at(i)); } if (m_PointSetInteractor.IsNotNull()) { - mitk::GlobalInteraction::GetInstance()->RemoveInteractor(m_PointSetInteractor.GetPointer()); + m_SelectedPointSetNode->SetDataInteractor(NULL); } } void QmitkSimpleMeasurement::Activated() { this->OnSelectionChanged(berry::IWorkbenchPart::Pointer(), this->GetCurrentSelection()); } void QmitkSimpleMeasurement::Deactivated() { } void QmitkSimpleMeasurement::Visible() { } void QmitkSimpleMeasurement::Hidden() { } void QmitkSimpleMeasurement::ActivatedZombieView(berry::SmartPointer /*zombieView*/) { // something else was selected. remove old interactor if (m_PointSetInteractor.IsNotNull()) { - mitk::GlobalInteraction::GetInstance()->RemoveInteractor(m_PointSetInteractor.GetPointer()); + m_SelectedPointSetNode->SetDataInteractor(NULL); } } void QmitkSimpleMeasurement::AddDistanceSimpleMeasurement() { mitk::PointSet::Pointer pointSet = mitk::PointSet::New(); QString name = "Distance " + QString::number(m_CreatedDistances.size()+1); mitk::DataNode::Pointer CurrentPointSetNode = mitk::DataNode::New(); CurrentPointSetNode->SetData(pointSet); CurrentPointSetNode->SetProperty("show contour", mitk::BoolProperty::New(true)); CurrentPointSetNode->SetProperty("name", mitk::StringProperty::New(name.toStdString())); CurrentPointSetNode->SetProperty("show distances", mitk::BoolProperty::New(true)); // add to ds and remember as created m_CreatedDistances.push_back(CurrentPointSetNode); this->GetDataStorage()->Add(CurrentPointSetNode); // make new selection QList selection; selection.push_back( CurrentPointSetNode ); this->FireNodesSelected( selection ); this->OnSelectionChanged(berry::IWorkbenchPart::Pointer(), selection ); } void QmitkSimpleMeasurement::AddAngleSimpleMeasurement() { mitk::PointSet::Pointer pointSet = mitk::PointSet::New(); QString name = "Angle " + QString::number(m_CreatedAngles.size()+1); mitk::DataNode::Pointer _CurrentPointSetNode = mitk::DataNode::New(); _CurrentPointSetNode->SetData(pointSet); _CurrentPointSetNode->SetProperty("show contour", mitk::BoolProperty::New(true)); _CurrentPointSetNode->SetProperty("name", mitk::StringProperty::New(name.toStdString())); _CurrentPointSetNode->SetProperty("show angles", mitk::BoolProperty::New(true)); // add to ds and remember as created this->GetDataStorage()->Add(_CurrentPointSetNode); m_CreatedAngles.push_back( _CurrentPointSetNode ); // make new selection QList selection; selection.push_back( _CurrentPointSetNode ); this->FireNodesSelected( selection ); this->OnSelectionChanged(berry::IWorkbenchPart::Pointer(), selection ); } void QmitkSimpleMeasurement::AddPathSimpleMeasurement() { mitk::PointSet::Pointer pointSet = mitk::PointSet::New(); QString name = "Path " + QString::number(m_CreatedPaths.size()+1); mitk::DataNode::Pointer _CurrentPointSetNode = mitk::DataNode::New(); _CurrentPointSetNode->SetData(pointSet); _CurrentPointSetNode->SetProperty("show contour", mitk::BoolProperty::New(true)); _CurrentPointSetNode->SetProperty("name", mitk::StringProperty::New(name.toStdString())); _CurrentPointSetNode->SetProperty("show distances", mitk::BoolProperty::New(true)); _CurrentPointSetNode->SetProperty("show angles", mitk::BoolProperty::New(true)); // add to ds and remember as created this->GetDataStorage()->Add(_CurrentPointSetNode); m_CreatedPaths.push_back( _CurrentPointSetNode ); // make new selection QList selection; selection.push_back( _CurrentPointSetNode ); this->FireNodesSelected( selection ); this->OnSelectionChanged(berry::IWorkbenchPart::Pointer(), selection ); } void QmitkSimpleMeasurement::CreateQtPartControl( QWidget* parent ) { m_CreatedDistances = std::vector(); m_CreatedAngles = std::vector(); m_CreatedPaths = std::vector(); m_Controls = new Ui::QmitkSimpleMeasurementControls; m_Controls->setupUi(parent); connect( (QObject*)(m_Controls->pbDistance), SIGNAL(clicked()),(QObject*) this, SLOT(AddDistanceSimpleMeasurement()) ); connect( (QObject*)(m_Controls->pbAngle), SIGNAL(clicked()),(QObject*) this, SLOT(AddAngleSimpleMeasurement()) ); connect( (QObject*)(m_Controls->pbPath), SIGNAL(clicked()),(QObject*) this, SLOT(AddPathSimpleMeasurement()) ); connect( (QObject*)(m_Controls->m_Finished), SIGNAL(clicked()),(QObject*) this, SLOT(Finished()) ); EndEditingMeasurement(); } void QmitkSimpleMeasurement::SetFocus() { m_Controls->m_Finished->setFocus(); } void QmitkSimpleMeasurement::Finished() { OnSelectionChanged(berry::IWorkbenchPart::Pointer(), QList()); } void QmitkSimpleMeasurement::OnSelectionChanged(berry::IWorkbenchPart::Pointer /*part*/, const QList &nodes) { mitk::DataNode::Pointer selectedNode ; if(nodes.size() > 0) selectedNode = nodes.front(); mitk::PointSet* pointSet = 0; if(selectedNode.IsNotNull()) pointSet = dynamic_cast ( selectedNode->GetData() ); // something else was selected. remove old interactor if (m_PointSetInteractor.IsNotNull()) { - mitk::GlobalInteraction::GetInstance()->RemoveInteractor(m_PointSetInteractor.GetPointer()); + m_SelectedPointSetNode->SetDataInteractor(NULL); } bool pointsetCreatedByThis = false; // only go further if a pointset was selected if(pointSet) { // see if this pointset was created by us std::vector::iterator it = std::find( m_CreatedDistances.begin() , m_CreatedDistances.end(), selectedNode); if (it != m_CreatedDistances.end()) pointsetCreatedByThis = true; it = std::find( m_CreatedAngles.begin() , m_CreatedAngles.end(), selectedNode); if (it != m_CreatedAngles.end()) pointsetCreatedByThis = true; it = std::find( m_CreatedPaths.begin() , m_CreatedPaths.end(), selectedNode); if (it != m_CreatedPaths.end()) pointsetCreatedByThis = true; } // do nothing if it was not created by us or it is no pointset node or we are not activated if(pointsetCreatedByThis) { // otherwise: set text and add interactor for the pointset m_Controls->selectedPointSet->setText( QString::fromStdString(selectedNode->GetName()) ); - mitk::PointSetInteractor::Pointer newPointSetInteractor - = mitk::PointSetInteractor::New("pointsetinteractor", selectedNode.GetPointer()); - mitk::GlobalInteraction::GetInstance()->AddInteractor(newPointSetInteractor); - m_PointSetInteractor = newPointSetInteractor; + + m_PointSetInteractor = mitk::PointSetDataInteractor::New(); + m_PointSetInteractor->LoadStateMachine("PointSet.xml"); + m_PointSetInteractor->SetEventConfig("PointSetConfig.xml"); + m_PointSetInteractor->SetDataNode(selectedNode); + float green[] = { 0, 255, 0 }; float red[] = { 255, 0, 0 }; selectedNode->SetColor(green); if(m_SelectedPointSetNode.IsNotNull()) m_SelectedPointSetNode->SetColor(red); m_SelectedPointSetNode = selectedNode; StartEditingMeasurement(); } else { EndEditingMeasurement(); } } void QmitkSimpleMeasurement::NodeRemoved( const mitk::DataNode* node ) { // remove a node if it is destroyed from our created array m_CreatedDistances.erase(std::remove(m_CreatedDistances.begin(), m_CreatedDistances.end(), node), m_CreatedDistances.end()); m_CreatedAngles.erase(std::remove(m_CreatedAngles.begin(), m_CreatedAngles.end(), node), m_CreatedAngles.end()); m_CreatedPaths.erase(std::remove(m_CreatedPaths.begin(), m_CreatedPaths.end(), node), m_CreatedPaths.end()); } void QmitkSimpleMeasurement::StartEditingMeasurement() { m_Controls->explain_label->setVisible(true); m_Controls->m_Finished->setVisible(true); m_Controls->pbDistance->setEnabled(false); m_Controls->pbAngle->setEnabled(false); m_Controls->pbPath->setEnabled(false); UpdateMeasurementList(); } void QmitkSimpleMeasurement::EndEditingMeasurement() { m_Controls->pbDistance->setEnabled(true); m_Controls->pbAngle->setEnabled(true); m_Controls->pbPath->setEnabled(true); m_Controls->explain_label->setVisible(false); m_Controls->m_Finished->setVisible(false); m_Controls->selectedPointSet->setText( "None" ); UpdateMeasurementList(); } void QmitkSimpleMeasurement::UpdateMeasurementList() { m_Controls->m_MeasurementList->clear(); for (std::size_t i=0; i(m_CreatedDistances.at(i)->GetData()); if(points->GetSize()<2) { distance = "not available"; } else { distance = QString::number(points->GetPoint(0).EuclideanDistanceTo(points->GetPoint(1))) + " mm"; } QString name = QString(m_CreatedDistances.at(i)->GetName().c_str()) + " (" + distance + ")"; newItem->setText(name); m_Controls->m_MeasurementList->insertItem(m_Controls->m_MeasurementList->count(), newItem); } for (std::size_t i=0; iGetName().c_str(); newItem->setText(name); m_Controls->m_MeasurementList->insertItem(m_Controls->m_MeasurementList->count(), newItem); } for (std::size_t i=0; iGetName().c_str(); newItem->setText(name); m_Controls->m_MeasurementList->insertItem(m_Controls->m_MeasurementList->count(), newItem); } } diff --git a/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/simplemeasurement/QmitkSimpleMeasurement.h b/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/simplemeasurement/QmitkSimpleMeasurement.h index 9313b01104..58c1c5a4a8 100644 --- a/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/simplemeasurement/QmitkSimpleMeasurement.h +++ b/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/simplemeasurement/QmitkSimpleMeasurement.h @@ -1,106 +1,100 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef MITKSIMPELEMEASUREMENT_H #define MITKSIMPELEMEASUREMENT_H #include #include -#include - +#include "mitkDataNode.h" +#include "mitkPointSetDataInteractor.h" #include "ui_QmitkSimpleMeasurementControls.h" namespace Ui { class QmitkSimpleMeasurementControls; } -namespace mitk { -class PointSetInteractor; -} - - /** * \brief SimpleMeasurement * Allows to measure distances, angles, etc. * * \sa QmitkAbstractView */ class QmitkSimpleMeasurement : public QmitkAbstractView, public mitk::IZombieViewPart { Q_OBJECT public: - QmitkSimpleMeasurement(); virtual ~QmitkSimpleMeasurement(); private: virtual void CreateQtPartControl(QWidget* parent); virtual void SetFocus(); virtual void OnSelectionChanged(berry::IWorkbenchPart::Pointer part, const QList &nodes); virtual void NodeRemoved(const mitk::DataNode* node); virtual void Activated(); virtual void Deactivated(); virtual void Visible(); virtual void Hidden(); virtual void ActivatedZombieView(berry::SmartPointer zombieView); private slots: void AddDistanceSimpleMeasurement(); void AddAngleSimpleMeasurement(); void AddPathSimpleMeasurement(); void Finished(); private: /** * controls containing sliders for scrolling through the slices */ Ui::QmitkSimpleMeasurementControls * m_Controls; /* * Interactor for performing the simplemeasurements. */ - mitk::WeakPointer m_PointSetInteractor; + mitk::PointSetDataInteractor::Pointer m_PointSetInteractor; /* * Interactor for performing the simplemeasurements. */ - mitk::WeakPointer m_SelectedPointSetNode; + mitk::DataNode::Pointer m_SelectedPointSetNode; /** @brief * Node representing the PointSets which were created by this application. */ std::vector m_CreatedDistances; std::vector m_CreatedAngles; std::vector m_CreatedPaths; void StartEditingMeasurement(); void EndEditingMeasurement(); void UpdateMeasurementList(); }; #endif // QMITK_MEASUREMENT_H__INCLUDED diff --git a/Modules/QtWidgetsExt/QmitkPointListModel.cpp b/Modules/QtWidgetsExt/QmitkPointListModel.cpp index 94c6b4eea0..f84b221e5e 100644 --- a/Modules/QtWidgetsExt/QmitkPointListModel.cpp +++ b/Modules/QtWidgetsExt/QmitkPointListModel.cpp @@ -1,333 +1,315 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "QmitkPointListModel.h" #include #include "mitkInteractionConst.h" #include "mitkPointOperation.h" #include "mitkRenderingManager.h" -#include +#include #include #include #include +#include QmitkPointListModel::QmitkPointListModel( mitk::DataNode* pointSetNode, int t, QObject* parent ) :QAbstractListModel(parent), m_PointSetNode(NULL), m_PointSetModifiedObserverTag(0), m_PointSetDeletedObserverTag(0), m_TimeStep(t) { ObserveNewPointSet( pointSetNode ); } Qt::ItemFlags QmitkPointListModel::flags(const QModelIndex& /*index*/) const { // no editing so far, return default (enabled, selectable) return Qt::ItemIsSelectable | Qt::ItemIsEnabled; } QmitkPointListModel::~QmitkPointListModel() { this->ObserveNewPointSet( NULL ); } void QmitkPointListModel::SetPointSetNode( mitk::DataNode* pointSetNode ) { this->ObserveNewPointSet( pointSetNode ); QAbstractListModel::reset(); emit SignalUpdateSelection(); } mitk::PointSet* QmitkPointListModel::GetPointSet() const { return this->CheckForPointSetInNode(m_PointSetNode); } void QmitkPointListModel::SetTimeStep(int t) { m_TimeStep = t; QAbstractListModel::reset(); emit SignalUpdateSelection(); } int QmitkPointListModel::GetTimeStep() const { return m_TimeStep; } void QmitkPointListModel::ObserveNewPointSet( mitk::DataNode* pointSetNode ) { //remove old observers if (m_PointSetNode != NULL) { mitk::PointSet::Pointer oldPointSet = dynamic_cast(m_PointSetNode->GetData()); if (oldPointSet.IsNotNull()) { oldPointSet->RemoveObserver(m_PointSetModifiedObserverTag); oldPointSet->RemoveObserver(m_PointSetDeletedObserverTag); } } //get the new pointset mitk::PointSet::Pointer pointSet = this->CheckForPointSetInNode(pointSetNode); m_PointSetNode = pointSetNode; if ( pointSet.IsNotNull()) { // add new observer for modified if necessary itk::ReceptorMemberCommand::Pointer modCommand = itk::ReceptorMemberCommand::New(); modCommand->SetCallbackFunction( this, &QmitkPointListModel::OnPointSetChanged ); m_PointSetModifiedObserverTag = pointSet->AddObserver( itk::ModifiedEvent(), modCommand ); // add new observer for detele if necessary itk::ReceptorMemberCommand::Pointer delCommand = itk::ReceptorMemberCommand::New(); delCommand->SetCallbackFunction( this, &QmitkPointListModel::OnPointSetDeleted ); m_PointSetDeletedObserverTag = pointSet->AddObserver( itk::DeleteEvent(), delCommand ); } else { m_PointSetModifiedObserverTag = 0; m_PointSetDeletedObserverTag = 0; } } void QmitkPointListModel::OnPointSetChanged(const itk::EventObject&) { QAbstractListModel::reset(); emit SignalUpdateSelection(); } void QmitkPointListModel::OnPointSetDeleted(const itk::EventObject&) { mitk::PointSet::Pointer ps = CheckForPointSetInNode(m_PointSetNode); if (ps) { ps->RemoveObserver(m_PointSetModifiedObserverTag); ps->RemoveObserver(m_PointSetDeletedObserverTag); } m_PointSetModifiedObserverTag = 0; m_PointSetDeletedObserverTag = 0; QAbstractListModel::reset(); } int QmitkPointListModel::rowCount(const QModelIndex&) const { mitk::PointSet::Pointer pointSet = this->CheckForPointSetInNode(m_PointSetNode); if ( pointSet.IsNotNull() ) { return pointSet->GetSize(m_TimeStep); } else { return 0; } } QVariant QmitkPointListModel::data(const QModelIndex& index, int role) const { mitk::PointSet::Pointer pointSet = this->CheckForPointSetInNode(m_PointSetNode); if ( pointSet.IsNull() ) { return QVariant(); } if ( !index.isValid() ) { return QVariant(); } if ( index.row() >= pointSet->GetSize(m_TimeStep) ) { return QVariant(); } if (role == Qt::DisplayRole) { mitk::PointSet::PointsContainer::ElementIdentifier id; mitk::PointSet::PointType p; bool pointFound = this->GetPointForModelIndex(index, p, id); if (pointFound == false) return QVariant(); QString s = QString("%0: (%1, %2, %3)") .arg( id, 3) .arg( p[0], 0, 'f', 3 ) .arg( p[1], 0, 'f', 3 ) .arg( p[2], 0, 'f', 3 ); return QVariant(s); } else { return QVariant(); } } QVariant QmitkPointListModel::headerData(int section, Qt::Orientation orientation, int role) const { if (role != Qt::DisplayRole) { return QVariant(); } if (orientation == Qt::Horizontal) { return QString("Coordinates").arg(section); } else { return QString("Row %1").arg(section); } } bool QmitkPointListModel::GetPointForModelIndex( const QModelIndex &index, mitk::PointSet::PointType& p, mitk::PointSet::PointIdentifier& id) const { mitk::PointSet::Pointer pointSet = this->CheckForPointSetInNode(m_PointSetNode); if (pointSet.IsNull()) return false; if ((index.row() < 0) || (index.row() >= (int)pointSet->GetPointSet(m_TimeStep)->GetPoints()->Size())) return false; // get the nth. element, if it exists. // we can not use the index directly, because PointSet uses a map container, // where the index is not necessarily the same as the key. // Therefore we have to count the elements mitk::PointSet::PointsContainer::Iterator it = pointSet->GetPointSet(m_TimeStep)->GetPoints()->Begin(); for (int i = 0; i < index.row(); ++i) { ++it; if (it == pointSet->GetPointSet(m_TimeStep)->GetPoints()->End()) return false; } if (it != pointSet->GetPointSet(m_TimeStep)->GetPoints()->End()) // not at the end, { p = it->Value(); id = it->Index(); return true; } return false; } bool QmitkPointListModel::GetModelIndexForPointID(mitk::PointSet::PointIdentifier id, QModelIndex& index) const { mitk::PointSet::Pointer pointSet = this->CheckForPointSetInNode(m_PointSetNode); if (pointSet.IsNull()) return false; mitk::PointSet::PointsContainer::Pointer points = pointSet->GetPointSet(m_TimeStep)->GetPoints(); if (points->IndexExists(id) == false) return false; unsigned int idx = 0; for (mitk::PointSet::PointsContainer::Iterator it = points->Begin(); it != points->End(); ++it) { if (it->Index() == id) // we found the correct element { index = this->index(idx); return true; } idx++; } return false; // nothing found } void QmitkPointListModel::MoveSelectedPointUp() { mitk::PointSet::Pointer pointSet = this->CheckForPointSetInNode(m_PointSetNode); if (pointSet.IsNull()) return; mitk::PointSet::PointIdentifier selectedID; selectedID = pointSet->SearchSelectedPoint(m_TimeStep); mitk::ScalarType tsInMS = pointSet->GetTimeGeometry()->TimeStepToTimePoint(m_TimeStep); mitk::PointOperation* doOp = new mitk::PointOperation(mitk::OpMOVEPOINTUP,tsInMS, pointSet->GetPoint(selectedID, m_TimeStep), selectedID, true); pointSet->ExecuteOperation(doOp); mitk::RenderingManager::GetInstance()->RequestUpdateAll(); // Workaround for update problem in Pointset/Mapper } void QmitkPointListModel::MoveSelectedPointDown() { mitk::PointSet::Pointer pointSet = this->CheckForPointSetInNode(m_PointSetNode); if (pointSet.IsNull()) return; mitk::PointSet::PointIdentifier selectedID; selectedID = pointSet->SearchSelectedPoint(m_TimeStep); mitk::ScalarType tsInMS = pointSet->GetTimeGeometry()->TimeStepToTimePoint(m_TimeStep); mitk::PointOperation* doOp = new mitk::PointOperation(mitk::OpMOVEPOINTDOWN, tsInMS, pointSet->GetPoint(selectedID, m_TimeStep), selectedID, true); pointSet->ExecuteOperation(doOp); mitk::RenderingManager::GetInstance()->RequestUpdateAll(); // Workaround for update problem in Pointset/Mapper } void QmitkPointListModel::RemoveSelectedPoint() { mitk::PointSet::Pointer pointSet = this->CheckForPointSetInNode(m_PointSetNode); if (pointSet.IsNull()) return; - //get corresponding interactor to PointSet - mitk::PointSetInteractor::Pointer interactor = dynamic_cast(m_PointSetNode->GetInteractor()); - if (interactor.IsNull()) - { - if (m_PointSetNode->GetInteractor()==NULL && m_PointSetNode != NULL) //no Interactor set to node - { - interactor = mitk::PointSetInteractor::New("pointsetinteractor",m_PointSetNode); - m_PointSetNode->SetInteractor(interactor); - } - else - { - MITK_WARN<<"Unexpected interactor found!\n"; - return; - } - } - - - //send a DEL event to pointsetinteractor - const mitk::Event* delEvent = new mitk::Event(NULL, mitk::Type_KeyPress, mitk::BS_NoButton, mitk::BS_NoButton, mitk::Key_Delete); - mitk::StateEvent* delStateEvent = new mitk::StateEvent(mitk::EIDDELETE, delEvent); - interactor->HandleEvent(delStateEvent); - delete delEvent; - delete delStateEvent; - - mitk::RenderingManager::GetInstance()->RequestUpdateAll(); // Workaround for update problem in PointSet/Mapper + mitk::PointSet::PointIdentifier selectedID; + selectedID = pointSet->SearchSelectedPoint(m_TimeStep); + mitk::ScalarType tsInMS = pointSet->GetTimeGeometry()->TimeStepToTimePoint(m_TimeStep); + mitk::PointOperation* doOp = new mitk::PointOperation(mitk::OpREMOVE, tsInMS, pointSet->GetPoint(selectedID, m_TimeStep), selectedID, true); + pointSet->ExecuteOperation(doOp); + mitk::RenderingManager::GetInstance()->RequestUpdateAll(); // Workaround for update problem in Pointset/Mapper } mitk::PointSet* QmitkPointListModel::CheckForPointSetInNode(mitk::DataNode* node) const { if (node != NULL) { mitk::PointSet::Pointer pointSet = dynamic_cast(node->GetData()); if (pointSet.IsNotNull()) return pointSet; } return NULL; } diff --git a/Modules/Segmentation/Interactions/mitkAdaptiveRegionGrowingTool.cpp b/Modules/Segmentation/Interactions/mitkAdaptiveRegionGrowingTool.cpp index 9b84a62671..6ee0dc4633 100644 --- a/Modules/Segmentation/Interactions/mitkAdaptiveRegionGrowingTool.cpp +++ b/Modules/Segmentation/Interactions/mitkAdaptiveRegionGrowingTool.cpp @@ -1,100 +1,93 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkAdaptiveRegionGrowingTool.h" #include "mitkToolManager.h" #include "mitkProperties.h" -#include -#include "mitkGlobalInteraction.h" - // us #include #include #include #include namespace mitk { MITK_TOOL_MACRO(MitkSegmentation_EXPORT, AdaptiveRegionGrowingTool, "AdaptiveRegionGrowingTool"); } mitk::AdaptiveRegionGrowingTool::AdaptiveRegionGrowingTool() { m_PointSetNode = mitk::DataNode::New(); m_PointSetNode->GetPropertyList()->SetProperty("name", mitk::StringProperty::New("3D_Regiongrowing_Seedpoint")); m_PointSetNode->GetPropertyList()->SetProperty("helper object", mitk::BoolProperty::New(true)); m_PointSet = mitk::PointSet::New(); m_PointSetNode->SetData(m_PointSet); - m_SeedPointInteractor = mitk::PointSetInteractor::New("singlepointinteractor", m_PointSetNode); + m_SeedPointInteractor = mitk::SinglePointDataInteractor::New(); + m_SeedPointInteractor->LoadStateMachine("PointSet.xml"); + m_SeedPointInteractor->SetEventConfig("PointSetConfig.xml"); + m_SeedPointInteractor->SetDataNode(m_PointSetNode); } mitk::AdaptiveRegionGrowingTool::~AdaptiveRegionGrowingTool() { } const char** mitk::AdaptiveRegionGrowingTool::GetXPM() const { return NULL; } const char* mitk::AdaptiveRegionGrowingTool::GetName() const { return "Region Growing 3D"; } us::ModuleResource mitk::AdaptiveRegionGrowingTool::GetIconResource() const { us::Module* module = us::GetModuleContext()->GetModule(); us::ModuleResource resource = module->GetResource("RegionGrowing_48x48.png"); return resource; } void mitk::AdaptiveRegionGrowingTool::Activated() { if (!GetDataStorage()->Exists(m_PointSetNode)) GetDataStorage()->Add(m_PointSetNode, GetWorkingData()); - mitk::GlobalInteraction::GetInstance()->AddInteractor(m_SeedPointInteractor); } void mitk::AdaptiveRegionGrowingTool::Deactivated() { - if (m_PointSet->GetPointSet()->GetNumberOfPoints() != 0) - { - mitk::Point3D point = m_PointSet->GetPoint(0); - mitk::PointOperation* doOp = new mitk::PointOperation(mitk::OpREMOVE, point, 0); - m_PointSet->ExecuteOperation(doOp); - } - mitk::GlobalInteraction::GetInstance()->RemoveInteractor(m_SeedPointInteractor); + m_PointSet->Clear(); GetDataStorage()->Remove(m_PointSetNode); } mitk::DataNode* mitk::AdaptiveRegionGrowingTool::GetReferenceData(){ return this->m_ToolManager->GetReferenceData(0); } mitk::DataStorage* mitk::AdaptiveRegionGrowingTool::GetDataStorage(){ return this->m_ToolManager->GetDataStorage(); } mitk::DataNode* mitk::AdaptiveRegionGrowingTool::GetWorkingData(){ return this->m_ToolManager->GetWorkingData(0); } mitk::DataNode::Pointer mitk::AdaptiveRegionGrowingTool::GetPointSetNode() { return m_PointSetNode; } diff --git a/Modules/Segmentation/Interactions/mitkAdaptiveRegionGrowingTool.h b/Modules/Segmentation/Interactions/mitkAdaptiveRegionGrowingTool.h index b7809a4a58..666bc0ffa0 100644 --- a/Modules/Segmentation/Interactions/mitkAdaptiveRegionGrowingTool.h +++ b/Modules/Segmentation/Interactions/mitkAdaptiveRegionGrowingTool.h @@ -1,133 +1,133 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef mitkAdaptiveRegionGrowingTool_h_Included #define mitkAdaptiveRegionGrowingTool_h_Included #include "mitkCommon.h" #include #include "mitkAutoSegmentationTool.h" #include "mitkDataStorage.h" -#include "mitkPointSetInteractor.h" +#include "mitkSinglePointDataInteractor.h" #include "mitkPointSet.h" namespace us { class ModuleResource; } namespace mitk { /** \brief Dummy Tool for AdaptiveRegionGrowingToolGUI to get Tool functionality for AdaptiveRegionGrowing. The actual logic is implemented in QmitkAdaptiveRegionGrowingToolGUI. \ingroup ToolManagerEtAl \sa mitk::Tool \sa QmitkInteractiveSegmentation */ class MitkSegmentation_EXPORT AdaptiveRegionGrowingTool : public AutoSegmentationTool { public: /** * @brief mitkClassMacro */ mitkClassMacro(AdaptiveRegionGrowingTool, AutoSegmentationTool); itkFactorylessNewMacro(Self) itkCloneMacro(Self) /** * @brief Get XPM * @return NULL */ virtual const char** GetXPM() const; /** * @brief Get name * @return name of the Tool */ virtual const char* GetName() const; /** * @brief Get icon resource * @return the resource Object of the Icon */ us::ModuleResource GetIconResource() const; /** * @brief Adds interactor for the seedpoint and creates a seedpoint if neccessary. * * */ virtual void Activated(); /** * @brief Removes all set points and interactors. * * */ virtual void Deactivated(); /** * @brief get pointset node * @return the point set node */ virtual DataNode::Pointer GetPointSetNode(); /** * @brief get reference data * @return the current reference data. */ mitk::DataNode* GetReferenceData(); /** * @brief Get working data * @return a list of all working data. */ mitk::DataNode* GetWorkingData(); /** * @brief Get datastorage * @return the current data storage. */ mitk::DataStorage* GetDataStorage(); protected: /** * @brief constructor */ AdaptiveRegionGrowingTool(); // purposely hidden /** * @brief destructor */ virtual ~AdaptiveRegionGrowingTool(); private: PointSet::Pointer m_PointSet; - PointSetInteractor::Pointer m_SeedPointInteractor; + SinglePointDataInteractor::Pointer m_SeedPointInteractor; DataNode::Pointer m_PointSetNode; }; } // namespace #endif diff --git a/Plugins/org.mitk.gui.qt.registration/files.cmake b/Plugins/org.mitk.gui.qt.registration/files.cmake index c2b2563a16..17c6d8776b 100644 --- a/Plugins/org.mitk.gui.qt.registration/files.cmake +++ b/Plugins/org.mitk.gui.qt.registration/files.cmake @@ -1,77 +1,76 @@ set(SRC_CPP_FILES ) set(INTERNAL_CPP_FILES mitkPluginActivator.cpp #DeformableRegistration QmitkDeformableRegistrationView.cpp # PointBasedRegistration QmitkPointBasedRegistrationView.cpp - QmitkPointBasedRegistrationTesting.cpp mitkLandmarkWarping.cpp # RigidRegistration QmitkRigidRegistrationView.cpp QmitkLoadPresetDialog.cpp QmitkRigidRegistrationSelectorView.cpp ) set(UI_FILES #DeformableRegistration src/internal/QmitkDeformableRegistrationViewControls.ui # PointBasedRegistration src/internal/QmitkPointBasedRegistrationViewControls.ui # RigidRegistration src/internal/QmitkRigidRegistrationViewControls.ui src/internal/QmitkRigidRegistrationSelector.ui ) set(MOC_H_FILES src/internal/mitkPluginActivator.h #DeformableRegistration src/internal/QmitkDeformableRegistrationView.h # PointBasedRegistration src/internal/QmitkPointBasedRegistrationView.h # RigidRegistration src/internal/QmitkRigidRegistrationView.h src/internal/QmitkLoadPresetDialog.h src/internal/QmitkRigidRegistrationSelectorView.h ) set(CACHED_RESOURCE_FILES # list of resource files which can be used by the plug-in # system without loading the plug-ins shared library, # for example the icon used in the menu and tabs for the # plug-in views in the workbench plugin.xml #DeformableRegistration resources/DeformableRegistration.xpm # PointBasedRegistration resources/PointBasedRegistration.xpm # RigidRegistration resources/RigidRegistration.xpm ) set(QRC_FILES #DeformableRegistration resources/QmitkDeformableRegistrationView.qrc # PointBasedRegistration resources/QmitkPointBasedRegistrationView.qrc # RigidRegistration resources/QmitkRigidRegistrationView.qrc ) set(CPP_FILES ) foreach(file ${SRC_CPP_FILES}) set(CPP_FILES ${CPP_FILES} src/${file}) endforeach(file ${SRC_CPP_FILES}) foreach(file ${INTERNAL_CPP_FILES}) set(CPP_FILES ${CPP_FILES} src/internal/${file}) endforeach(file ${INTERNAL_CPP_FILES}) diff --git a/Plugins/org.mitk.gui.qt.registration/src/internal/QmitkPointBasedRegistrationTesting.cpp b/Plugins/org.mitk.gui.qt.registration/src/internal/QmitkPointBasedRegistrationTesting.cpp deleted file mode 100644 index bc3e758a18..0000000000 --- a/Plugins/org.mitk.gui.qt.registration/src/internal/QmitkPointBasedRegistrationTesting.cpp +++ /dev/null @@ -1,813 +0,0 @@ -/*=================================================================== - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center, -Division of Medical and Biological Informatics. -All rights reserved. - -This software is distributed WITHOUT ANY WARRANTY; without -even the implied warranty of MERCHANTABILITY or FITNESS FOR -A PARTICULAR PURPOSE. - -See LICENSE.txt or http://www.mitk.org for details. - -===================================================================*/ - -// #include "QmitkPointBasedRegistrationView.h" // includes mitkConfig, where BUILD_TESTING is defined -// #include "ui_QmitkPointBasedRegistrationViewControls.h" -// -// #ifdef BUILD_TESTING // only if we build a test driver -// -// #include "QmitkStdMultiWidget.h" -// #include "QmitkSelectableGLWidget.h" -// #include "QmitkUserInputSimulation.h" -// #include "QmitkMessageBoxHelper.h" -// #include "QmitkTreeNodeSelector.h" -// #include -// #include "qradiobutton.h" -// #include "qpushbutton.h" -// #include "qslider.h" -// #include "qcheckbox.h" -// #include "qlistbox.h" -// #include -// #include -// #include "QmitkMessageBoxHelper.h" -// #include "QmitkPointListWidget.h" -// -// #include -// #include -// -// #include -// -// -// int QmitkPointBasedRegistration::TestYourself() -// { -// m_MessageBox = false; -// -// std::cout << std::endl; -// time_t randomInit = std::time(0); -// //randomInit = 1200058324; -// std::cout << "Initializing random number generator with " << randomInit << std::endl; -// std::srand(randomInit); -// -// if (m_Controls->m_FixedSelector->GetSelectedNode() == NULL) -// { -// std::cout << "No Fixed Image available! Won't apply test (l. " << __LINE__ << ")" << std::endl; -// return EXIT_SUCCESS; -// } -// mitk::DataNode::Pointer node = NULL; -// if (m_Controls->m_MovingSelector->GetSelectedNode() == NULL) -// { -// node = mitk::DataNode::New(); -// //Create Image out of nowhere -// mitk::Image::Pointer image; -// m_Controls->m_FixedSelector->GetSelectedNode()->GetData(); -// mitk::PixelType pt(typeid(int)); -// unsigned int dim[]={100,100,20}; -// -// std::cout << "Creating image: "; -// image = mitk::Image::New(); -// image->Initialize(mitk::PixelType(typeid(int)), 3, dim); -// int *p = (int*)image->GetData(); -// -// int size = dim[0]*dim[1]*dim[2]; -// int i; -// for(i=0; iSetData(image); -// node->SetProperty("name", mitk::StringProperty::New("new created node for PointBasedRegistrationTest")); -// mitk::LevelWindowProperty::Pointer levWinProp = mitk::LevelWindowProperty::New(); -// mitk::LevelWindow levelWindow; -// levelWindow.SetAuto( image ); -// levWinProp->SetLevelWindow(levelWindow); -// node->GetPropertyList()->SetProperty("levelwindow",levWinProp); -// mitk::DataTreeIteratorClone it; -// it = *m_Controls->m_FixedSelector->GetSelectedIterator(); -// it->GoToParent(); -// it->Add(node); -// std::cout<<"[PASSED]"<m_MovingSelector->GetSelectedNode() == NULL) -// { -// std::cerr << "No Moving Image available! Won't apply test (l. " << __LINE__ << ")" << std::endl; -// return EXIT_FAILURE; -// } -// -// // test Show Images Red/Green -// std::cout << "Test show images red/green:" << std::endl; -// QmitkUserInputSimulation::MouseClick( m_Controls->m_ShowRedGreenValues, Qt::LeftButton ); -// m_Controls->m_ShowRedGreenValues->setChecked(true); -// std::cout << " [PASSED]" << std::endl; -// -// // test for Select model -// QmitkUserInputSimulation::MouseClick( m_Controls->m_FixedPointListWidget->m_SetPoints, Qt::LeftButton ); -// if (!m_Controls->m_FixedPointListWidget->m_SetPoints->isOn()) -// { -// std::cerr << "Select Fixed Image was not toggled (l. " << __LINE__ << ")" << std::endl; -// return EXIT_FAILURE; -// } -// if (m_Controls->m_MovingPointListWidget->m_SetPoints->isOn()) -// { -// std::cerr << "Select Moving Image was toggled (l. " << __LINE__ << ")" << std::endl; -// return EXIT_FAILURE; -// } -// -// QmitkUserInputSimulation::MouseClick( m_Controls->m_MovingPointListWidget->m_SetPoints, Qt::LeftButton ); -// if (!m_Controls->m_MovingPointListWidget->m_SetPoints->isOn()) -// { -// std::cerr << "Select Moving Image was not toggled (l. " << __LINE__ << ")" << std::endl; -// return EXIT_FAILURE; -// } -// if (m_Controls->m_FixedPointListWidget->m_SetPoints->isOn()) -// { -// std::cerr << "Select Fixed Image was toggled (l. " << __LINE__ << ")" << std::endl; -// return EXIT_FAILURE; -// } -// -// QmitkUserInputSimulation::MouseClick( m_Controls->m_MovingPointListWidget->m_SetPoints, Qt::LeftButton ); -// if (m_Controls->m_MovingPointListWidget->m_SetPoints->isOn()) -// { -// std::cerr << "Select Moving Image was toggled (l. " << __LINE__ << ")" << std::endl; -// return EXIT_FAILURE; -// } -// if (m_Controls->m_FixedPointListWidget->m_SetPoints->isOn()) -// { -// std::cerr << "Select Fixed Image was toggled (l. " << __LINE__ << ")" << std::endl; -// return EXIT_FAILURE; -// } -// -// // test for undobutton at start -// if (m_Controls->m_UndoTransformation->isEnabled()) -// { -// std::cerr << "Undo Transformation was enabled but there was no transformation before (l. " << __LINE__ << ")" << std::endl; -// return EXIT_FAILURE; -// } -// -// // test for redobutton at start -// if (m_Controls->m_RedoTransformation->isEnabled()) -// { -// std::cerr << "Redo Transformation was enabled but there was no transformation before (l. " << __LINE__ << ")" << std::endl; -// return EXIT_FAILURE; -// } -// -// // test reinit buttons -// std::cout << "Test reinit buttons:" << std::endl; -// QmitkUserInputSimulation::MouseClick( m_Controls->m_ReinitFixedButton, Qt::LeftButton ); -// QmitkUserInputSimulation::MouseClick( m_Controls->m_ReinitMovingButton, Qt::LeftButton ); -// m_Controls->globalReinitClicked(); -// std::cout << " [PASSED]" << std::endl; -// -// // test opacity slider -// std::cout << "Test opacity slider:" << std::endl; -// m_Controls->m_OpacitySlider->setValue(m_Controls->m_OpacitySlider->minValue()); -// m_Controls->m_OpacitySlider->setValue(m_Controls->m_OpacitySlider->maxValue()); -// std::cout << " [PASSED]" << std::endl; -// -// bool testOK = this->TestAllTools(); -// -// // clean up -// if (m_FixedPointSetNode.IsNotNull()) -// { -// this->GetDefaultDataStorage()->Remove(m_FixedPointSetNode); -// m_FixedPointSetNode = NULL; -// } -// if (m_MovingPointSetNode) -// if (node.IsNotNull()) -// { -// this->GetDefaultDataStorage()->Remove(m_MovingPointSetNode); -// m_MovingPointSetNode = NULL; -// } -// -// // recenter all remaining datatreenodes -// m_Controls->globalReinitClicked(); -// -// if (testOK) -// { -// std::cout << "Whole functionality testing [PASSED]" << std::endl; -// return EXIT_SUCCESS; -// } -// else -// { -// std::cout << "Whole functionality testing [FAILED]" << std::endl; -// return EXIT_FAILURE; -// } -// } -// -// bool QmitkPointBasedRegistration::TestAllTools() -// { -// QWidget* sliceWidget; -// m_MultiWidget->changeLayoutToDefault(); -// -// std::cout << "Creating landmarks:" << std::endl; -// QmitkUserInputSimulation::MouseClick( m_Controls->m_FixedPointListWidget->m_SetPoints, Qt::LeftButton ); -// -// for (unsigned int window = 1; window < 4; ++window) -// { -// switch (window) -// { -// case 1: -// sliceWidget = m_MultiWidget->mitkWidget1; // IMPORTANT to send the events to the renderwindow and not to the multiwidget or one selectableglwidget -// break; -// case 2: -// sliceWidget = m_MultiWidget->mitkWidget2; -// break; -// case 3: -// default: -// sliceWidget = m_MultiWidget->mitkWidget3; -// break; -// } -// float w = (float)sliceWidget->width()-10; -// float h = (float)sliceWidget->height()-10; -// for (unsigned int i = 0; i < 5; ++i ) -// { -// double r; -// r = ( (double)rand() / ((double)(RAND_MAX)+(double)(1)) ); -// float x = r * w; -// -// r = ( (double)rand() / ((double)(RAND_MAX)+(double)(1)) ); -// float y = r * h; -// -// QmitkUserInputSimulation::MouseDown( sliceWidget, (int)x+5, (int)y+5, Qt::LeftButton, Qt::ShiftButton ); -// QmitkUserInputSimulation::MouseRelease( sliceWidget, (int)x+5, (int)y+5, Qt::LeftButton, Qt::ShiftButton ); -// } -// } -// -// QmitkUserInputSimulation::MouseClick( m_Controls->m_MovingPointListWidget->m_SetPoints, Qt::LeftButton ); -// -// for (unsigned int window = 1; window < 4; ++window) -// { -// switch (window) -// { -// case 1: -// sliceWidget = m_MultiWidget->mitkWidget1; // IMPORTANT to send the events to the renderwindow and not to the multiwidget or one selectableglwidget -// break; -// case 2: -// sliceWidget = m_MultiWidget->mitkWidget2; -// break; -// case 3: -// default: -// sliceWidget = m_MultiWidget->mitkWidget3; -// break; -// } -// float w = (float)sliceWidget->width(); -// float h = (float)sliceWidget->height(); -// for (unsigned int i = 0; i < 5; ++i ) -// { -// double r; -// r = ( (double)rand() / ((double)(RAND_MAX)+(double)(1)) ); -// float x = r * w; -// -// r = ( (double)rand() / ((double)(RAND_MAX)+(double)(1)) ); -// float y = r * h; -// QmitkUserInputSimulation::MouseDown( sliceWidget, (int)x, (int)y, Qt::LeftButton, Qt::ShiftButton ); -// QmitkUserInputSimulation::MouseRelease( sliceWidget, (int)x, (int)y, Qt::LeftButton, Qt::ShiftButton ); -// } -// } -// QmitkUserInputSimulation::MouseClick( m_Controls->m_MovingPointListWidget->m_SetPoints, Qt::LeftButton ); -// std::cout << " [PASSED]" << std::endl; -// -// /////// test for deleting points from fixed point list -// std::cout << "Delete Landmarks out of order:" << std::endl; -// m_Controls->m_FixedPointListWidget->InteractivePointList->setSelected(4, true); -// QmitkUserInputSimulation::KeyboardTypeKey( m_Controls->m_FixedPointListWidget->InteractivePointList, Qt::Key_Return ); -// QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); -// m_Controls->m_FixedPointListWidget->InteractivePointList->setSelected(8,true); -// QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); -// m_Controls->m_FixedPointListWidget->InteractivePointList->setSelected(13,true); -// QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); -// m_Controls->m_FixedPointListWidget->InteractivePointList->setSelected(0,true); -// QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); -// m_Controls->m_FixedPointListWidget->InteractivePointList->setSelected(7,true); -// QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); -// m_Controls->m_FixedPointListWidget->InteractivePointList->setSelected(7,true); -// QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); -// m_Controls->m_FixedPointListWidget->InteractivePointList->setSelected(3,true); -// QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); -// m_Controls->m_FixedPointListWidget->InteractivePointList->setSelected(4,true); -// QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); -// for (int i = 0; i < 7; i++) -// { -// m_Controls->m_FixedPointListWidget->InteractivePointList->setSelected(0,true); -// QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); -// } -// /////// test for deleting points from moving point list -// m_Controls->m_MovingPointListWidget->InteractivePointList->setSelected(0,true); -// QmitkUserInputSimulation::KeyboardTypeKey( m_Controls->m_MovingPointListWidget->InteractivePointList, Qt::Key_Return ); -// QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); -// m_Controls->m_MovingPointListWidget->InteractivePointList->setSelected(14,true); -// QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); -// m_Controls->m_MovingPointListWidget->InteractivePointList->setSelected(11,true); -// QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); -// m_Controls->m_MovingPointListWidget->InteractivePointList->setSelected(8,true); -// QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); -// m_Controls->m_MovingPointListWidget->InteractivePointList->setSelected(6,true); -// QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); -// m_Controls->m_MovingPointListWidget->InteractivePointList->setSelected(2,true); -// QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); -// m_Controls->m_MovingPointListWidget->InteractivePointList->setSelected(2,true); -// QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); -// m_Controls->m_MovingPointListWidget->InteractivePointList->setSelected(2,true); -// QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); -// for (int i = 0; i < 7; i++) -// { -// m_Controls->m_MovingPointListWidget->InteractivePointList->setSelected(0,true); -// QmitkUserInputSimulation::KeyboardTypeKey( sliceWidget, Qt::Key_Delete ); -// } -// std::cout << " [PASSED]" << std::endl; -// -// ////// create new points -// std::cout << "Create new landmarks:" << std::endl; -// std::cout << "Creating landmarks:" << std::endl; -// QmitkUserInputSimulation::MouseClick( m_Controls->m_FixedPointListWidget->m_SetPoints, Qt::LeftButton ); -// -// for (unsigned int window = 1; window < 4; ++window) -// { -// switch (window) -// { -// case 1: -// sliceWidget = m_MultiWidget->mitkWidget1; // IMPORTANT to send the events to the renderwindow and not to the multiwidget or one selectableglwidget -// break; -// case 2: -// sliceWidget = m_MultiWidget->mitkWidget2; -// break; -// case 3: -// default: -// sliceWidget = m_MultiWidget->mitkWidget3; -// break; -// } -// float w = (float)sliceWidget->width()-10; -// float h = (float)sliceWidget->height()-10; -// for (unsigned int i = 0; i < 5; ++i ) -// { -// double r; -// r = ( (double)rand() / ((double)(RAND_MAX)+(double)(1)) ); -// float x = r * w; -// -// r = ( (double)rand() / ((double)(RAND_MAX)+(double)(1)) ); -// float y = r * h; -// -// QmitkUserInputSimulation::MouseDown( sliceWidget, (int)x+5, (int)y+5, Qt::LeftButton, Qt::ShiftButton ); -// QmitkUserInputSimulation::MouseRelease( sliceWidget, (int)x+5, (int)y+5, Qt::LeftButton, Qt::ShiftButton ); -// } -// } -// -// QmitkUserInputSimulation::MouseClick( m_Controls->m_MovingPointListWidget->m_SetPoints, Qt::LeftButton ); -// -// for (unsigned int window = 1; window < 4; ++window) -// { -// switch (window) -// { -// case 1: -// sliceWidget = m_MultiWidget->mitkWidget1; // IMPORTANT to send the events to the renderwindow and not to the multiwidget or one selectableglwidget -// break; -// case 2: -// sliceWidget = m_MultiWidget->mitkWidget2; -// break; -// case 3: -// default: -// sliceWidget = m_MultiWidget->mitkWidget3; -// break; -// } -// float w = (float)sliceWidget->width(); -// float h = (float)sliceWidget->height(); -// for (unsigned int i = 0; i < 5; ++i ) -// { -// double r; -// r = ( (double)rand() / ((double)(RAND_MAX)+(double)(1)) ); -// float x = r * w; -// -// r = ( (double)rand() / ((double)(RAND_MAX)+(double)(1)) ); -// float y = r * h; -// QmitkUserInputSimulation::MouseDown( sliceWidget, (int)x, (int)y, Qt::LeftButton, Qt::ShiftButton ); -// QmitkUserInputSimulation::MouseRelease( sliceWidget, (int)x, (int)y, Qt::LeftButton, Qt::ShiftButton ); -// } -// } -// QmitkUserInputSimulation::MouseClick( m_Controls->m_MovingPointListWidget->m_SetPoints, Qt::LeftButton ); -// std::cout << " [PASSED]" << std::endl; -// -// //// Rigid with ICP -// // a helper object to close popping up message boxes -// QmitkMessageBoxHelper* helper1 = new QmitkMessageBoxHelper(m_Controls); -// connect( helper1, SIGNAL(DialogFound(QWidget*)), this, SLOT(RegistrationErrorDialogFound(QWidget*)) ); -// helper1->WaitForDialogAndCallback( "QMessageBox" ); -// if (m_Controls->m_Calculate->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_Calculate, Qt::LeftButton ); -// std::cout << "Rigid with ICP [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Rigid with ICP [FAILED]" << std::endl; -// helper1->StopWaitForDialogAndCallback(); -// return false; -// } -// helper1->StopWaitForDialogAndCallback(); -// if (!m_MessageBox) -// { -// if (m_Controls->m_UndoTransformation->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); -// std::cout << "Undo [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Undo was not enabled [FAILED]" << std::endl; -// return false; -// } -// if (m_Controls->m_UndoTransformation->isEnabled()) -// { -// std::cout << "Undo was enabled [FAILED]" << std::endl; -// return false; -// } -// if (m_Controls->m_RedoTransformation->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_RedoTransformation, Qt::LeftButton ); -// std::cout << "Redo [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Redo was not enabled [FAILED]" << std::endl; -// return false; -// } -// if (m_Controls->m_RedoTransformation->isEnabled()) -// { -// std::cout << "Redo was enabled [FAILED]" << std::endl; -// return false; -// } -// if (m_Controls->m_UndoTransformation->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); -// std::cout << "Undo [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Undo was not enabled [FAILED]" << std::endl; -// return false; -// } -// if (m_Controls->m_UndoTransformation->isEnabled()) -// { -// std::cout << "Undo was enabled [FAILED]" << std::endl; -// return false; -// } -// } -// m_MessageBox = false; -// -// -// //// Similarity with ICP -// QmitkMessageBoxHelper* helper2 = new QmitkMessageBoxHelper(m_Controls); -// connect( helper2, SIGNAL(DialogFound(QWidget*)), this, SLOT(RegistrationErrorDialogFound(QWidget*)) ); -// helper2->WaitForDialogAndCallback( "QMessageBox" ); -// m_Controls->m_SelectedTransformationClass->setFocus(); -// QmitkUserInputSimulation::KeyboardTypeKey( m_Controls->m_SelectedTransformationClass, Qt::Key_Down ); -// if (m_Controls->m_Calculate->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_Calculate, Qt::LeftButton ); -// std::cout << "Similarity with ICP [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Similarity with ICP [FAILED]" << std::endl; -// helper2->StopWaitForDialogAndCallback(); -// return false; -// } -// helper2->StopWaitForDialogAndCallback(); -// if(!m_MessageBox) -// { -// if (m_Controls->m_UndoTransformation->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); -// std::cout << "Undo [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Undo was not enabled [FAILED]" << std::endl; -// return false; -// } -// if (m_Controls->m_RedoTransformation->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_RedoTransformation, Qt::LeftButton ); -// std::cout << "Redo [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Redo was not enabled [FAILED]" << std::endl; -// return false; -// } -// if (m_Controls->m_UndoTransformation->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); -// std::cout << "Undo [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Undo was not enabled [FAILED]" << std::endl; -// return false; -// } -// } -// m_MessageBox = false; -// -// -// //// Affine with ICP -// QmitkMessageBoxHelper* helper3 = new QmitkMessageBoxHelper(m_Controls); -// connect( helper3, SIGNAL(DialogFound(QWidget*)), this, SLOT(RegistrationErrorDialogFound(QWidget*)) ); -// helper3->WaitForDialogAndCallback( "QMessageBox" ); -// m_Controls->m_SelectedTransformationClass->setFocus(); -// QmitkUserInputSimulation::KeyboardTypeKey( m_Controls->m_SelectedTransformationClass, Qt::Key_Down ); -// if (m_Controls->m_Calculate->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_Calculate, Qt::LeftButton ); -// std::cout << "Affine with ICP [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Affine with ICP [FAILED]" << std::endl; -// helper3->StopWaitForDialogAndCallback(); -// return false; -// } -// helper3->StopWaitForDialogAndCallback(); -// if(!m_MessageBox) -// { -// if (m_Controls->m_UndoTransformation->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); -// std::cout << "Undo [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Undo was not enabled [FAILED]" << std::endl; -// return false; -// } -// if (m_Controls->m_RedoTransformation->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_RedoTransformation, Qt::LeftButton ); -// std::cout << "Redo [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Redo was not enabled [FAILED]" << std::endl; -// return false; -// } -// if (m_Controls->m_UndoTransformation->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); -// std::cout << "Undo [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Undo was not enabled [FAILED]" << std::endl; -// return false; -// } -// } -// m_MessageBox = false; -// -// //// Rigid without ICP -// m_Controls->m_SelectedTransformationClass->setFocus(); -// QmitkUserInputSimulation::KeyboardTypeKey( m_Controls->m_SelectedTransformationClass, Qt::Key_Down ); -// // a helper object to close popping up message boxes -// QmitkMessageBoxHelper* helper4 = new QmitkMessageBoxHelper(m_Controls); -// connect( helper4, SIGNAL(DialogFound(QWidget*)), this, SLOT(RegistrationErrorDialogFound(QWidget*)) ); -// helper4->WaitForDialogAndCallback( "QMessageBox" ); -// if (m_Controls->m_Calculate->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_Calculate, Qt::LeftButton ); -// std::cout << "Rigid [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Rigid [FAILED]" << std::endl; -// helper4->StopWaitForDialogAndCallback(); -// return false; -// } -// helper4->StopWaitForDialogAndCallback(); -// if(!m_MessageBox) -// { -// if (m_Controls->m_UndoTransformation->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); -// std::cout << "Undo [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Undo was not enabled [FAILED]" << std::endl; -// return false; -// } -// if (m_Controls->m_RedoTransformation->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_RedoTransformation, Qt::LeftButton ); -// std::cout << "Redo [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Redo was not enabled [FAILED]" << std::endl; -// return false; -// } -// if (m_Controls->m_UndoTransformation->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); -// std::cout << "Undo [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Undo was not enabled [FAILED]" << std::endl; -// return false; -// } -// } -// m_MessageBox = false; -// -// //// Similarity without ICP -// m_Controls->m_SelectedTransformationClass->setFocus(); -// QmitkUserInputSimulation::KeyboardTypeKey( m_Controls->m_SelectedTransformationClass, Qt::Key_Down ); -// // a helper object to close popping up message boxes -// QmitkMessageBoxHelper* helper5 = new QmitkMessageBoxHelper(m_Controls); -// connect( helper5, SIGNAL(DialogFound(QWidget*)), this, SLOT(RegistrationErrorDialogFound(QWidget*)) ); -// helper5->WaitForDialogAndCallback( "QMessageBox" ); -// if (m_Controls->m_Calculate->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_Calculate, Qt::LeftButton ); -// std::cout << "Similarity [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Similarity [FAILED]" << std::endl; -// helper5->StopWaitForDialogAndCallback(); -// return false; -// } -// helper5->StopWaitForDialogAndCallback(); -// if(!m_MessageBox) -// { -// if (m_Controls->m_UndoTransformation->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); -// std::cout << "Undo [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Undo was not enabled [FAILED]" << std::endl; -// return false; -// } -// if (m_Controls->m_RedoTransformation->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_RedoTransformation, Qt::LeftButton ); -// std::cout << "Redo [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Redo was not enabled [FAILED]" << std::endl; -// return false; -// } -// if (m_Controls->m_UndoTransformation->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); -// std::cout << "Undo [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Undo was not enabled [FAILED]" << std::endl; -// return false; -// } -// } -// m_MessageBox = false; -// -// //// Affine without ICP -// m_Controls->m_SelectedTransformationClass->setFocus(); -// QmitkUserInputSimulation::KeyboardTypeKey( m_Controls->m_SelectedTransformationClass, Qt::Key_Down ); -// // a helper object to close popping up message boxes -// QmitkMessageBoxHelper* helper6 = new QmitkMessageBoxHelper(m_Controls); -// connect( helper6, SIGNAL(DialogFound(QWidget*)), this, SLOT(RegistrationErrorDialogFound(QWidget*)) ); -// helper6->WaitForDialogAndCallback( "QMessageBox" ); -// if (m_Controls->m_Calculate->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_Calculate, Qt::LeftButton ); -// std::cout << "Affine [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Affine [FAILED]" << std::endl; -// helper6->StopWaitForDialogAndCallback(); -// return false; -// } -// helper6->StopWaitForDialogAndCallback(); -// if(!m_MessageBox) -// { -// if (m_Controls->m_UndoTransformation->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); -// std::cout << "Undo [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Undo was not enabled [FAILED]" << std::endl; -// return false; -// } -// if (m_Controls->m_RedoTransformation->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_RedoTransformation, Qt::LeftButton ); -// std::cout << "Redo [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Redo was not enabled [FAILED]" << std::endl; -// return false; -// } -// if (m_Controls->m_UndoTransformation->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_UndoTransformation, Qt::LeftButton ); -// std::cout << "Undo [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "Undo was not enabled [FAILED]" << std::endl; -// return false; -// } -// } -// m_MessageBox = false; -// /* -// //// LandmarkWarping -// if (dynamic_cast(m_Controls->m_FixedSelector->GetSelectedNode()->GetData()) != NULL && -// (dynamic_cast(m_Controls->m_FixedSelector->GetSelectedNode()->GetData())->GetDimension() == 2 || -// dynamic_cast(m_Controls->m_FixedSelector->GetSelectedNode()->GetData())->GetDimension() == 3)) -// { -// m_Controls->m_SelectedTransformationClass->setFocus(); -// QmitkUserInputSimulation::KeyboardTypeKey( m_Controls->m_SelectedTransformationClass, Qt::Key_Down ); -// if (m_Controls->m_Calculate->isEnabled()) -// { -// QmitkUserInputSimulation::MouseClick( m_Controls->m_Calculate, Qt::LeftButton ); -// std::cout << "LandmarkWarping [PASSED]" << std::endl; -// } -// else -// { -// std::cout << "LandmarkWarping [FAILED]" << std::endl; -// return false; -// } -// if (m_Controls->m_UndoTransformation->isEnabled()) -// { -// std::cout << "Undo [FAILED]" << std::endl; -// return false; -// } -// else -// { -// std::cout << "Undo [PASSED]" << std::endl; -// } -// if (m_Controls->m_RedoTransformation->isEnabled()) -// { -// std::cout << "Redo [FAILED]" << std::endl; -// return false; -// } -// else -// { -// std::cout << "Redo [PASSED]" << std::endl; -// } -// }*/ -// -// //// end registrationmethods test -// -// QmitkMessageBoxHelper* helper7 = new QmitkMessageBoxHelper(m_Controls); -// connect( helper7, SIGNAL(DialogFound(QWidget*)), this, SLOT(ClearPointSetDialogFound(QWidget*)) ); -// helper7->WaitForDialogAndCallback( "QMessageBox" ); -// QmitkUserInputSimulation::MouseClick( m_Controls->m_FixedPointListWidget->m_ClearPointSet, Qt::LeftButton ); -// -// QmitkMessageBoxHelper* helper8 = new QmitkMessageBoxHelper(m_Controls); -// connect( helper8, SIGNAL(DialogFound(QWidget*)), this, SLOT(ClearPointSetDialogFound(QWidget*)) ); -// helper8->WaitForDialogAndCallback( "QMessageBox" ); -// QmitkUserInputSimulation::MouseClick( m_Controls->m_MovingPointListWidget->m_ClearPointSet, Qt::LeftButton ); -// -// if(this->m_FixedLandmarks->GetSize() > 0) -// { -// std::cout << "Not all fixed points are deleted! [FAILED]" << std::endl; -// return false; -// } -// if(m_MovingLandmarks->GetSize() > 0) -// { -// std::cout << "Not all moving points are deleted! [FAILED]" << std::endl; -// return false; -// } -// -// return true; -// } -// -// void QmitkPointBasedRegistration::RegistrationErrorDialogFound( QWidget* widget ) -// { -// if (!widget) return; -// -// // close message box -// widget->close(); -// std::cout<<"Message box closed!"< -#include -#include #include #include #include //#include "QmitkMessageBoxHelper.h" #include "ui_QmitkPointBasedRegistrationViewControls.h" #include /*! \brief The PointBasedRegistration functionality is used to perform point based registration. This functionality allows you to register 2D as well as 3D images in a rigid and deformable manner via corresponding PointSets. Register means to align two images, so that they become as similar as possible. Therefore you have to set corresponding points in both images, which will be matched. The movement, which has to be performed on the points to align them will be performed on the moving image as well. The result is shown in the multi-widget. For more informations see: \ref QmitkPointBasedRegistrationUserManual \sa QmitkFunctionality \ingroup Functionalities \ingroup PointBasedRegistration */ class REGISTRATION_EXPORT QmitkPointBasedRegistrationView : public QmitkFunctionality { friend struct SelListenerPointBasedRegistration; Q_OBJECT public: static const std::string VIEW_ID; /*! \brief Default constructor */ QmitkPointBasedRegistrationView(QObject *parent=0, const char *name=0); /*! \brief Default destructor */ virtual ~QmitkPointBasedRegistrationView(); /*! \brief method for creating the applications main widget */ virtual void CreateQtPartControl(QWidget *parent); /*! \brief Sets the StdMultiWidget and connects it to the functionality. */ virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget); /*! \brief Removes the StdMultiWidget and disconnects it from the functionality. */ virtual void StdMultiWidgetNotAvailable(); /*! \brief Method for creating the connections of main and control widget */ virtual void CreateConnections(); virtual void Activated(); virtual void Deactivated(); virtual void Visible(); virtual void Hidden(); // // #ifdef BUILD_TESTING // / ** // \brief Testing entry point // * / // virtual int TestYourself(); // // / ** // \brief Helper method for testing // * / // bool TestAllTools(); // // // protected slots: // /** // \brief Helper method for testing // */ // void RegistrationErrorDialogFound( QWidget* widget ); // // /** // \brief Helper method for testing // */ // void ClearPointSetDialogFound( QWidget* widget ); // // private: // bool m_MessageBox; // // // public: // #else // // slot function is needed, because moc ignores our #ifdefs // void RegistrationErrorDialogFound( QWidget* widget ) {} // // slot function is needed, because moc ignores our #ifdefs // void ClearPointSetDialogFound(QWidget* widget){} // #endif void DataNodeHasBeenRemoved(const mitk::DataNode* node); protected slots: /*! \brief Sets the fixed Image according to TreeNodeSelector widget */ void FixedSelected(mitk::DataNode::Pointer fixedImage); /*! \brief Sets the moving Image according to TreeNodeSelector widget */ void MovingSelected(mitk::DataNode::Pointer movingImage); /*! \brief Calculates registration with vtkLandmarkTransform */ void calculateLandmarkbased(); /*! \brief Calculates registration with itkLandmarkWarping */ void calculateLandmarkWarping(); /*! \brief Calculates registration with ICP and vtkLandmarkTransform */ void calculateLandmarkbasedWithICP(); /*! \brief lets the fixed image become invisible and the moving image visible */ void HideMovingImage(bool hide); /*! \brief lets the moving image become invisible and the fixed image visible */ void HideFixedImage(bool hide); /*! \brief Checks if registration is possible */ bool CheckCalculate(); /*! \brief Performs an undo for the last transform. */ void UndoTransformation(); /*! \brief Performs a redo for the last undo transform. */ void RedoTransformation(); /*! \brief Stores whether the image will be shown in grayvalues or in red for fixed image and green for moving image @param show if true, then images will be shown in red and green */ void showRedGreen(bool show); /*! \brief Sets the selected opacity for moving image @param opacity the selected opacity */ void OpacityUpdate(float opacity); /*! \brief Sets the selected opacity for moving image @param opacity the selected opacity */ void OpacityUpdate(int opacity); /*! \brief Updates the moving landmarks */ void updateMovingLandmarksList(); /*! \brief Updates the fixed landmarks */ void updateFixedLandmarksList(); /*! \brief Sets the images to gray values or fixed image to red and moving image to green @param redGreen if true, then images will be shown in red and green */ void setImageColor(bool redGreen); /*! \brief Clears the undo and redo transformation lists. */ void clearTransformationLists(); /*! \brief Calculates the landmark error for the selected transformation. */ void checkLandmarkError(); /*! \brief Changes the transformation type and calls checkLandmarkError(). */ void transformationChanged(int transform); /*! \brief Checks whether the registration can be performed. */ bool checkCalculateEnabled(); /*! \brief Performs the registration. */ void calculate(); void SetImagesVisible(berry::ISelection::ConstPointer /*selection*/); void SwitchImages(); protected: berry::ISelectionListener::Pointer m_SelListener; berry::IStructuredSelection::ConstPointer m_CurrentSelection; /*! * default main widget containing 4 windows showing 3 * orthogonal slices of the volume and a 3d render window */ QmitkStdMultiWidget * m_MultiWidget; /*! * control widget to make all changes for point based registration */ Ui::QmitkPointBasedRegistrationControls m_Controls; mitk::PointSet::Pointer m_FixedLandmarks; mitk::PointSet::Pointer m_MovingLandmarks; mitk::DataNode::Pointer m_MovingPointSetNode; mitk::DataNode::Pointer m_FixedPointSetNode; mitk::DataNode::Pointer m_MovingNode; mitk::DataNode::Pointer m_FixedNode; std::list m_UndoGeometryList; std::list m_UndoPointsGeometryList; std::list m_RedoGeometryList; std::list m_RedoPointsGeometryList; bool m_ShowRedGreen; float m_Opacity; float m_OriginalOpacity; mitk::Color m_FixedColor; mitk::Color m_MovingColor; int m_Transformation; bool m_HideFixedImage; bool m_HideMovingImage; std::string m_OldFixedLabel; std::string m_OldMovingLabel; bool m_Deactivated; int m_CurrentFixedLandmarksObserverID; int m_CurrentMovingLandmarksObserverID; itk::SimpleMemberCommand::Pointer m_FixedLandmarksChangedCommand; itk::SimpleMemberCommand::Pointer m_MovingLandmarksChangedCommand; }; #endif // !defined(QMITK_POINTBASEDREGISTRATION_H__INCLUDED)