Controls the selection of the slice the associated BaseRenderer will display. More...
#include <mitkSliceNavigationController.h>
Classes | |
class | GeometrySendEvent |
class | GeometrySliceEvent |
class | GeometryTimeEvent |
class | GeometryUpdateEvent |
class | TimeSlicedGeometryEvent |
Public Types | |
enum | ViewDirection { Transversal, Sagittal, Frontal, Original } |
Possible view directions, Original will uses the Geometry2D instances in a SlicedGeometry3D provided as input world geometry (by SetInputWorldGeometry). More... | |
Public Member Functions | |
mitkClassMacro (SliceNavigationController, BaseController) | |
mitkNewMacro1Param (Self, const char *) | |
void | SetInputWorldGeometry (const mitk::Geometry3D *geometry) |
Set the input world geometry out of which the geometries for slicing will be created. | |
virtual const mitk::Geometry3D * | GetInputWorldGeometry () |
virtual const mitk::Geometry3D * | GetCreatedWorldGeometry () |
Access the created geometry. | |
virtual void | SetViewDirection (ViewDirection _arg) |
Set the desired view directions. | |
virtual ViewDirection | GetViewDirection () |
virtual void | SetDefaultViewDirection (ViewDirection _arg) |
Set the default view direction. | |
virtual ViewDirection | GetDefaultViewDirection () |
virtual void | SetViewDirectionToDefault () |
virtual void | Update () |
Do the actual creation and send it to the connected observers (renderers) | |
virtual void | Update (ViewDirection viewDirection, bool top=true, bool frontside=true, bool rotated=false) |
Extended version of Update, additionally allowing to specify the direction/orientation of the created geometry. | |
virtual void | SendCreatedWorldGeometry () |
Send the created geometry to the connected observers (renderers) | |
virtual void | SendCreatedWorldGeometryUpdate () |
Tell observers to re-read the currently selected 2D geometry. | |
virtual void | SendSlice () |
Send the currently selected slice to the connected observers (renderers) | |
virtual void | SendTime () |
Send the currently selected time to the connected observers (renderers) | |
virtual void | SetRenderingManager (RenderingManager *_arg) |
Set the RenderingManager to be used. | |
mitk::RenderingManager * | GetRenderingManager () const |
itkEventMacro (UpdateEvent, itk::AnyEvent) | |
template<typename T > | |
void | ConnectGeometrySendEvent (T *receiver) |
template<typename T > | |
void | ConnectGeometryUpdateEvent (T *receiver) |
template<typename T > | |
void | ConnectGeometrySliceEvent (T *receiver, bool connectSendEvent=true) |
template<typename T > | |
void | ConnectGeometryTimeEvent (T *receiver, bool connectSendEvent=true) |
template<typename T > | |
void | ConnectGeometryEvents (T *receiver) |
virtual void | SetGeometry (const itk::EventObject &geometrySliceEvent) |
To connect multiple SliceNavigationController, we can act as an observer ourselves: implemented interface. | |
virtual void | SetGeometrySlice (const itk::EventObject &geometrySliceEvent) |
To connect multiple SliceNavigationController, we can act as an observer ourselves: implemented interface. | |
virtual void | SetGeometryTime (const itk::EventObject &geometryTimeEvent) |
To connect multiple SliceNavigationController, we can act as an observer ourselves: implemented interface. | |
void | SelectSliceByPoint (const mitk::Point3D &point) |
Positions the SNC according to the specified point. | |
const mitk::TimeSlicedGeometry * | GetCreatedWorldGeometry () |
Returns the TimeSlicedGeometry created by the SNC. | |
const mitk::Geometry3D * | GetCurrentGeometry3D () |
Returns the Geometry3D of the currently selected time step. | |
const mitk::PlaneGeometry * | GetCurrentPlaneGeometry () |
Returns the currently selected Plane in the current Geometry3D (if existent). | |
void | SetRenderer (BaseRenderer *renderer) |
Sets the BaseRenderer associated with this SNC (if any). While the BaseRenderer is not directly used by SNC, this is a convenience method to enable BaseRenderer access via the SNC. | |
BaseRenderer * | GetRenderer () const |
Gets the BaseRenderer associated with this SNC (if any). While the BaseRenderer is not directly used by SNC, this is a convenience method to enable BaseRenderer access via the SNC. Returns NULL if no BaseRenderer has been specified. | |
void | ReorientSlices (const mitk::Point3D &point, const mitk::Vector3D &normal) |
Re-orients the slice stack to include the plane specified by the given point an normal vector. | |
virtual bool | ExecuteAction (Action *action, mitk::StateEvent const *stateEvent) |
Method called in HandleEvent after Statechange. | |
void | ExecuteOperation (Operation *operation) |
A statemachine is also an OperationActor due to the UndoMechanism. | |
virtual void | SetSliceLocked (bool _arg) |
Feature option to lock planes during mouse interaction. This option flag disables the mouse event which causes the center cross to move near by. | |
virtual bool | GetSliceLocked () |
virtual void | SliceLockedOn () |
virtual void | SliceLockedOff () |
virtual void | SetSliceRotationLocked (bool _arg) |
Feature option to lock slice rotation. | |
virtual bool | GetSliceRotationLocked () |
virtual void | SliceRotationLockedOn () |
virtual void | SliceRotationLockedOff () |
void | AdjustSliceStepperRange () |
Adjusts the numerical range of the slice stepper according to the current geometry orientation of this SNC's SlicedGeometry. | |
Static Public Member Functions | |
static Pointer | New () |
Protected Member Functions | |
SliceNavigationController (const char *type=NULL) | |
virtual | ~SliceNavigationController () |
virtual void | SetTop (bool _arg) |
virtual bool | GetTop () |
virtual void | TopOn () |
virtual void | TopOff () |
virtual void | SetFrontSide (bool _arg) |
virtual bool | GetFrontSide () |
virtual void | FrontSideOn () |
virtual void | FrontSideOff () |
virtual void | SetRotated (bool _arg) |
virtual bool | GetRotated () |
virtual void | RotatedOn () |
virtual void | RotatedOff () |
Static Protected Member Functions | |
template<class T > | |
static void | buildstring (mitkIpPicDescriptor *pic, itk::Point< int, 3 > p, std::string &s, T=0) |
Protected Attributes | |
mitk::Geometry3D::ConstPointer | m_InputWorldGeometry |
mitk::Geometry3D::Pointer | m_ExtendedInputWorldGeometry |
mitk::TimeSlicedGeometry::Pointer | m_CreatedWorldGeometry |
ViewDirection | m_ViewDirection |
ViewDirection | m_DefaultViewDirection |
mitk::RenderingManager::Pointer | m_RenderingManager |
mitk::BaseRenderer * | m_Renderer |
bool | m_Top |
bool | m_FrontSide |
bool | m_Rotated |
bool | m_BlockUpdate |
bool | m_SliceLocked |
bool | m_SliceRotationLocked |
unsigned int | m_OldPos |
Controls the selection of the slice the associated BaseRenderer will display.
A SliceNavigationController takes a Geometry3D as input world geometry (TODO what are the exact requirements?) and generates a TimeSlicedGeometry as output. The TimeSlicedGeometry holds a number of SlicedGeometry3Ds and these in turn hold a series of Geometry2Ds. One of these Geometry2Ds is selected as world geometry for the BaseRenderers associated to 2D views.
The SliceNavigationController holds has Steppers (one for the slice, a second for the time step), which control the selection of a single Geometry2D from the TimeSlicedGeometry. SliceNavigationController generates ITK events to tell observers, like a BaseRenderer, when the selected slice or timestep changes.
SliceNavigationControllers are registered as listeners to GlobalInteraction by the QmitkStdMultiWidget. In ExecuteAction, the controllers react to PositionEvents by setting the steppers to the slice which is nearest to the point of the PositionEvent.
Example:
// Initialization sliceCtrl = mitk::SliceNavigationController::New(); // Tell the navigator the geometry to be sliced (with geometry a // Geometry3D::ConstPointer) sliceCtrl->SetInputWorldGeometry(geometry.GetPointer()); // Tell the navigator in which direction it shall slice the data sliceCtrl->SetViewDirection(mitk::SliceNavigationController::Transversal); // Connect one or more BaseRenderer to this navigator, i.e.: events sent // by the navigator when stepping through the slices (e.g. by // sliceCtrl->GetSlice()->Next()) will be received by the BaseRenderer // (in this example only slice-changes, see also ConnectGeometryTimeEvent // and ConnectGeometryEvents.) sliceCtrl->ConnectGeometrySliceEvent(renderer.GetPointer()); //create a world geometry and send the information to the connected renderer(s) sliceCtrl->Update();
You can connect visible navigators to a SliceNavigationController, e.g., a QmitkSliderNavigator (for Qt):
// Create the visible navigator (a slider with a spin-box) QmitkSliderNavigator* navigator = new QmitkSliderNavigator(parent, "slidernavigator"); // Connect the navigator to the slice-stepper of the // SliceNavigationController. For initialization (position, mininal and // maximal values) the values of the SliceNavigationController are used. // Thus, accessing methods of a navigator is normally not necessary, since // everything can be set via the (Qt-independent) SliceNavigationController. // The QmitkStepperAdapter converts the Qt-signals to Qt-independent // itk-events. new QmitkStepperAdapter(navigator, sliceCtrl->GetSlice(), "navigatoradaptor");
If you do not want that all renderwindows are updated when a new slice is selected, you can use a specific RenderingManager, which updates only those renderwindows that should be updated. This is sometimes useful when a 3D view does not need to be updated when the slices in some 2D views are changed. QmitkSliderNavigator (for Qt):
// create a specific RenderingManager mitk::RenderingManager::Pointer myManager = mitk::RenderingManager::New(); // tell the RenderingManager to update only renderwindow1 and renderwindow2 myManager->AddRenderWindow(renderwindow1); myManager->AddRenderWindow(renderwindow2); // tell the SliceNavigationController of renderwindow1 and renderwindow2 // to use the specific RenderingManager instead of the global one renderwindow1->GetSliceNavigationController()->SetRenderingManager(myManager); renderwindow2->GetSliceNavigationController()->SetRenderingManager(myManager);
Definition at line 141 of file mitkSliceNavigationController.h.
Possible view directions, Original will uses the Geometry2D instances in a SlicedGeometry3D provided as input world geometry (by SetInputWorldGeometry).
Definition at line 153 of file mitkSliceNavigationController.h.
{Transversal, Sagittal, Frontal, Original};
mitk::SliceNavigationController::SliceNavigationController | ( | const char * | type = NULL ) |
[protected] |
Definition at line 44 of file mitkSliceNavigationController.cpp.
References SendSlice(), and SendTime().
{ SliceNavigationController::SliceNavigationController( const char *type ) : BaseController( type ), m_InputWorldGeometry( NULL ), m_CreatedWorldGeometry( NULL ), m_ViewDirection( Transversal ), m_DefaultViewDirection( Transversal ), m_RenderingManager( NULL ), m_Renderer( NULL ), m_Top( false ), m_FrontSide( false ), m_Rotated( false ), m_BlockUpdate( false ), m_SliceLocked( false ), m_SliceRotationLocked( false ), m_OldPos(0) { typedef itk::SimpleMemberCommand< SliceNavigationController > SNCCommandType; SNCCommandType::Pointer sliceStepperChangedCommand, timeStepperChangedCommand; sliceStepperChangedCommand = SNCCommandType::New(); timeStepperChangedCommand = SNCCommandType::New(); sliceStepperChangedCommand->SetCallbackFunction( this, &SliceNavigationController::SendSlice ); timeStepperChangedCommand->SetCallbackFunction( this, &SliceNavigationController::SendTime ); m_Slice->AddObserver( itk::ModifiedEvent(), sliceStepperChangedCommand ); m_Time->AddObserver( itk::ModifiedEvent(), timeStepperChangedCommand );
mitk::SliceNavigationController::~SliceNavigationController | ( | ) | [protected, virtual] |
Definition at line 84 of file mitkSliceNavigationController.cpp.
void mitk::SliceNavigationController::AdjustSliceStepperRange | ( | ) |
Adjusts the numerical range of the slice stepper according to the current geometry orientation of this SNC's SlicedGeometry.
Definition at line 518 of file mitkSliceNavigationController.cpp.
References m_Renderer.
{ return m_Renderer; } void SliceNavigationController::AdjustSliceStepperRange() { const mitk::SlicedGeometry3D *slicedGeometry = dynamic_cast< const mitk::SlicedGeometry3D * > ( this->GetCurrentGeometry3D() ); const Vector3D &direction = slicedGeometry->GetDirectionVector(); int c = 0; int i, k = 0; for ( i = 0; i < 3; ++i ) { if ( fabs( (float) direction[i] ) < 0.000000001 ) { ++c; } else { k = i; } } if ( c == 2 ) { ScalarType min = m_InputWorldGeometry->GetOrigin()[k]; ScalarType max = min + m_InputWorldGeometry->GetExtentInMM( k ); m_Slice->SetRange( min, max );
static void mitk::SliceNavigationController::buildstring | ( | mitkIpPicDescriptor * | pic, |
itk::Point< int, 3 > | p, | ||
std::string & | s, | ||
T | = 0 |
||
) | [inline, static, protected] |
Definition at line 440 of file mitkSliceNavigationController.h.
{ std::string value; std::stringstream stream; stream<<s<<"; Pixelvalue: "; if ( (p[0]>=0 && p[1] >=0 && p[2]>=0) && (unsigned int)p[0] < pic->n[0] && (unsigned int)p[1] < pic->n[1] && (unsigned int)p[2] < pic->n[2] ) { if(pic->bpe!=24) { stream<<(((T*) pic->data)[ p[0] + p[1]*pic->n[0] + p[2]*pic->n[0]*pic->n[1] ]); } else { stream<<(((T*) pic->data)[p[0]*3 + 0 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 ]); stream<<(((T*) pic->data)[p[0]*3 + 1 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 ]); stream<<(((T*) pic->data)[p[0]*3 + 2 + p[1]*pic->n[0]*3 + p[2]*pic->n[0]*pic->n[1]*3 ]); } s = stream.str(); } else { s+= "point out of data"; } };
void mitk::SliceNavigationController::ConnectGeometryEvents | ( | T * | receiver ) | [inline] |
Definition at line 342 of file mitkSliceNavigationController.h.
{ //connect sendEvent only once ConnectGeometrySliceEvent(receiver, false); ConnectGeometryTimeEvent(receiver); }
void mitk::SliceNavigationController::ConnectGeometrySendEvent | ( | T * | receiver ) | [inline] |
Definition at line 294 of file mitkSliceNavigationController.h.
Referenced by QmitkStdMultiWidget::InitializeWidget(), and mitk::SlicesRotator::OnSliceControllerAdded().
{ typedef typename itk::ReceptorMemberCommand<T>::Pointer ReceptorMemberCommandPointer; ReceptorMemberCommandPointer eventReceptorCommand = itk::ReceptorMemberCommand<T>::New(); eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometry); AddObserver(GeometrySendEvent(NULL,0), eventReceptorCommand); }
void mitk::SliceNavigationController::ConnectGeometrySliceEvent | ( | T * | receiver, |
bool | connectSendEvent = true |
||
) | [inline] |
Definition at line 316 of file mitkSliceNavigationController.h.
{ typedef typename itk::ReceptorMemberCommand<T>::Pointer ReceptorMemberCommandPointer; ReceptorMemberCommandPointer eventReceptorCommand = itk::ReceptorMemberCommand<T>::New(); eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometrySlice); AddObserver(GeometrySliceEvent(NULL,0), eventReceptorCommand); if(connectSendEvent) ConnectGeometrySendEvent(receiver); }
void mitk::SliceNavigationController::ConnectGeometryTimeEvent | ( | T * | receiver, |
bool | connectSendEvent = true |
||
) | [inline] |
Definition at line 329 of file mitkSliceNavigationController.h.
Referenced by QmitkStdMultiWidget::InitializeWidget().
{ typedef typename itk::ReceptorMemberCommand<T>::Pointer ReceptorMemberCommandPointer; ReceptorMemberCommandPointer eventReceptorCommand = itk::ReceptorMemberCommand<T>::New(); eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometryTime); AddObserver(GeometryTimeEvent(NULL,0), eventReceptorCommand); if(connectSendEvent) ConnectGeometrySendEvent(receiver); }
void mitk::SliceNavigationController::ConnectGeometryUpdateEvent | ( | T * | receiver ) | [inline] |
Definition at line 305 of file mitkSliceNavigationController.h.
{ typedef typename itk::ReceptorMemberCommand<T>::Pointer ReceptorMemberCommandPointer; ReceptorMemberCommandPointer eventReceptorCommand = itk::ReceptorMemberCommand<T>::New(); eventReceptorCommand->SetCallbackFunction(receiver, &T::UpdateGeometry); AddObserver(GeometryUpdateEvent(NULL,0), eventReceptorCommand); }
bool mitk::SliceNavigationController::ExecuteAction | ( | Action * | action, |
mitk::StateEvent const * | stateEvent | ||
) | [virtual] |
Method called in HandleEvent after Statechange.
look up which object method is associated to the given action and call the method
Each statechange has actions, which can be assigned by it's number. If you are developing a new statemachine, declare all your operations here and send them to Undo-Controller and to the Data. Object- and group-EventId can also be accessed through static methods from OperationEvent
Reimplemented from mitk::StateMachine.
Definition at line 592 of file mitkSliceNavigationController.cpp.
{ bool ok = false; const PositionEvent* posEvent = dynamic_cast< const PositionEvent * >( stateEvent->GetEvent() ); if ( posEvent != NULL ) { if ( m_CreatedWorldGeometry.IsNull() ) { return true; } switch (action->GetActionId()) { case AcMOVE: { BaseRenderer *baseRenderer = posEvent->GetSender(); if ( !baseRenderer ) { baseRenderer = const_cast<BaseRenderer *>( GlobalInteraction::GetInstance()->GetFocus() ); } if ( baseRenderer ) if ( baseRenderer->GetMapperID() == 1 ) { PointOperation* doOp = new mitk::PointOperation(OpMOVE, posEvent->GetWorldPosition()); if (m_UndoEnabled) { m_OldPos = this->GetSlice()->GetPos(); // m_OldPos holds the old slice position. For the undo controller this old position will be stored as index in mitk::PointOperation PointOperation* undoOp = new mitk::PointOperation(OpMOVE, posEvent->GetWorldPosition(), m_OldPos); OperationEvent *operationEvent = new mitk::OperationEvent(this, doOp, undoOp, "Move slices"); m_UndoController->SetOperationEvent(operationEvent); } this->ExecuteOperation( doOp ); // If click was performed in this render window than we have to update the status bar information about position and pixel value. if(baseRenderer == m_Renderer) { { std::string statusText; TNodePredicateDataType<mitk::Image>::Pointer isImageData = TNodePredicateDataType<mitk::Image>::New(); mitk::DataStorage::SetOfObjects::ConstPointer nodes = baseRenderer->GetDataStorage()->GetSubset(isImageData).GetPointer(); mitk::Point3D worldposition = posEvent->GetWorldPosition(); int maxlayer = -32768; mitk::Image::Pointer image3D; // find image with largest layer, that is the image shown on top in the render window for (unsigned int x = 0; x < nodes->size(); x++) { if(nodes->at(x)->GetData()->GetGeometry()->IsInside(worldposition)) { int layer = 0; if(!(nodes->at(x)->GetIntProperty("layer", layer))) continue; if(layer > maxlayer) { if(static_cast<mitk::DataNode::Pointer>(nodes->at(x))->IsVisible(m_Renderer)) { image3D = dynamic_cast<mitk::Image*>(nodes->at(x)->GetData()); maxlayer = layer; } } } } std::stringstream stream; // get the position and gray value from the image and build up status bar text if(image3D.IsNotNull()) { Index3D p; image3D->GetGeometry()->WorldToIndex(worldposition, p); stream.precision(2); stream<<"Position: <" << std::fixed <<worldposition[0] << ", " << std::fixed << worldposition[1] << ", " << std::fixed << worldposition[2] << "> mm"; stream<<"; Index: <"<<p[0] << ", " << p[1] << ", " << p[2] << "> "; stream<<"; Time: " << baseRenderer->GetTime() << " ms; Pixelvalue: "<<image3D->GetPixelValueByIndex(p, baseRenderer->GetTimeStep())<<" "; } else { stream << "No image information at this position!"; } statusText = stream.str(); mitk::StatusBar::GetInstance()->DisplayGreyValueText(statusText.c_str()); } } ok = true; break; } } default: ok = true; break; } return ok; } const DisplayPositionEvent *displPosEvent = dynamic_cast< const DisplayPositionEvent * >( stateEvent->GetEvent() );
void mitk::SliceNavigationController::ExecuteOperation | ( | Operation * | operation ) | [virtual] |
A statemachine is also an OperationActor due to the UndoMechanism.
The statechange is done in ExecuteOperation, so that the statechange can be undone by UndoMechanism. Is set private here and in superclass it is set public, so UndoController can reach ist, but it can't be overwritten by a subclass
Reimplemented from mitk::StateMachine.
Definition at line 550 of file mitkSliceNavigationController.cpp.
{ // switch on type // - select best slice for a given point // - rotate created world geometry according to Operation->SomeInfo() if ( !operation ) { return; } switch ( operation->GetOperationType() ) { case OpMOVE: // should be a point operation { if ( !m_SliceLocked ) //do not move the cross position { // select a slice PointOperation *po = dynamic_cast< PointOperation * >( operation ); if ( po && po->GetIndex() == -1 ) { this->SelectSliceByPoint( po->GetPoint() ); } else if ( po && po->GetIndex() != -1 ) // undo case because index != -1, index holds the old position of this slice { this->GetSlice()->SetPos( po->GetIndex() ); } } break; }
virtual void mitk::SliceNavigationController::FrontSideOff | ( | ) | [protected, virtual] |
virtual void mitk::SliceNavigationController::FrontSideOn | ( | ) | [protected, virtual] |
const mitk::TimeSlicedGeometry * mitk::SliceNavigationController::GetCreatedWorldGeometry | ( | ) | [virtual] |
Access the created geometry.
Definition at line 462 of file mitkSliceNavigationController.cpp.
Referenced by mitk::SlicesRotator::RotateToPoint(), and mitk::BaseRenderer::SetSliceNavigationController().
const mitk::TimeSlicedGeometry* mitk::SliceNavigationController::GetCreatedWorldGeometry | ( | ) |
Returns the TimeSlicedGeometry created by the SNC.
const mitk::Geometry3D * mitk::SliceNavigationController::GetCurrentGeometry3D | ( | ) |
Returns the Geometry3D of the currently selected time step.
Definition at line 469 of file mitkSliceNavigationController.cpp.
References m_CreatedWorldGeometry.
{ return m_CreatedWorldGeometry; } const mitk::Geometry3D * SliceNavigationController::GetCurrentGeometry3D() { if ( m_CreatedWorldGeometry.IsNotNull() ) {
const mitk::PlaneGeometry * mitk::SliceNavigationController::GetCurrentPlaneGeometry | ( | ) |
Returns the currently selected Plane in the current Geometry3D (if existent).
Definition at line 483 of file mitkSliceNavigationController.cpp.
Referenced by mitk::PlanarFigureInteractor::ExecuteAction(), QmitkStdMultiWidget::GetCrossPosition(), and mitk::SlicesRotator::RotateToPoint().
{ return NULL; } } const mitk::PlaneGeometry * SliceNavigationController::GetCurrentPlaneGeometry() { const mitk::SlicedGeometry3D *slicedGeometry = dynamic_cast< const mitk::SlicedGeometry3D * > ( this->GetCurrentGeometry3D() ); if ( slicedGeometry ) { const mitk::PlaneGeometry *planeGeometry = dynamic_cast< mitk::PlaneGeometry * > ( slicedGeometry->GetGeometry2D(this->GetSlice()->GetPos()) );
virtual ViewDirection mitk::SliceNavigationController::GetDefaultViewDirection | ( | ) | [virtual] |
virtual bool mitk::SliceNavigationController::GetFrontSide | ( | ) | [protected, virtual] |
virtual const mitk::Geometry3D* mitk::SliceNavigationController::GetInputWorldGeometry | ( | ) | [virtual] |
BaseRenderer * mitk::SliceNavigationController::GetRenderer | ( | ) | const |
Gets the BaseRenderer associated with this SNC (if any). While the BaseRenderer is not directly used by SNC, this is a convenience method to enable BaseRenderer access via the SNC. Returns NULL if no BaseRenderer has been specified.
Definition at line 510 of file mitkSliceNavigationController.cpp.
References m_Renderer.
Referenced by mitk::SlicesRotator::RotateToPoint().
{ m_Renderer = renderer;
RenderingManager * mitk::SliceNavigationController::GetRenderingManager | ( | ) | const |
Definition at line 109 of file mitkSliceNavigationController.cpp.
References m_InputWorldGeometry.
{ m_InputWorldGeometry = geometry; this->Modified(); } } RenderingManager * SliceNavigationController::GetRenderingManager() const { mitk::RenderingManager* renderingManager = m_RenderingManager.GetPointer(); if (renderingManager != NULL) return renderingManager; if ( m_Renderer != NULL ) { renderingManager = m_Renderer->GetRenderingManager();
virtual bool mitk::SliceNavigationController::GetRotated | ( | ) | [protected, virtual] |
virtual bool mitk::SliceNavigationController::GetSliceLocked | ( | ) | [virtual] |
Referenced by QmitkSelectableGLWidget::wheelEvent().
virtual bool mitk::SliceNavigationController::GetSliceRotationLocked | ( | ) | [virtual] |
virtual bool mitk::SliceNavigationController::GetTop | ( | ) | [protected, virtual] |
virtual ViewDirection mitk::SliceNavigationController::GetViewDirection | ( | ) | [virtual] |
mitk::SliceNavigationController::itkEventMacro | ( | UpdateEvent | , |
itk::AnyEvent | |||
) |
mitk::SliceNavigationController::mitkClassMacro | ( | SliceNavigationController | , |
BaseController | |||
) |
mitk::SliceNavigationController::mitkNewMacro1Param | ( | Self | , |
const char * | |||
) |
Method for creation through New
Reimplemented from mitk::BaseController.
static Pointer mitk::SliceNavigationController::New | ( | ) | [static] |
Reimplemented from mitk::BaseController.
Referenced by mitk::BaseRenderer::BaseRenderer(), QmitkStdMultiWidget::InitializeWidget(), main(), and testGeometry().
void mitk::SliceNavigationController::ReorientSlices | ( | const mitk::Point3D & | point, |
const mitk::Vector3D & | normal | ||
) |
Re-orients the slice stack to include the plane specified by the given point an normal vector.
virtual void mitk::SliceNavigationController::RotatedOff | ( | ) | [protected, virtual] |
virtual void mitk::SliceNavigationController::RotatedOn | ( | ) | [protected, virtual] |
void mitk::SliceNavigationController::SelectSliceByPoint | ( | const mitk::Point3D & | point ) |
Positions the SNC according to the specified point.
Referenced by QmitkMeasurement::PlanarFigureSelectionChanged().
void mitk::SliceNavigationController::SendCreatedWorldGeometry | ( | ) | [virtual] |
Send the created geometry to the connected observers (renderers)
Called by Update().
Definition at line 295 of file mitkSliceNavigationController.cpp.
{
void mitk::SliceNavigationController::SendCreatedWorldGeometryUpdate | ( | ) | [virtual] |
Tell observers to re-read the currently selected 2D geometry.
Called by mitk::SlicesRotator during rotation.
Definition at line 306 of file mitkSliceNavigationController.cpp.
References m_CreatedWorldGeometry.
Referenced by mitk::SlicesRotator::RotateToPoint().
{ this->InvokeEvent( GeometrySendEvent(m_CreatedWorldGeometry, 0) ); } } void SliceNavigationController::SendCreatedWorldGeometryUpdate()
void mitk::SliceNavigationController::SendSlice | ( | ) | [virtual] |
Send the currently selected slice to the connected observers (renderers)
Called by Update().
Definition at line 316 of file mitkSliceNavigationController.cpp.
References m_CreatedWorldGeometry, and mitk::BaseController::m_Slice.
Referenced by QmitkSlicesInterpolator::OnFrontalTimeChanged(), QmitkSlicesInterpolator::OnSagittalTimeChanged(), QmitkSlicesInterpolator::OnTransversalTimeChanged(), and SliceNavigationController().
{ this->InvokeEvent( GeometryUpdateEvent(m_CreatedWorldGeometry, m_Slice->GetPos()) ); } } void SliceNavigationController::SendSlice() { if ( !m_BlockUpdate ) { if ( m_CreatedWorldGeometry.IsNotNull() ) { this->InvokeEvent(
void mitk::SliceNavigationController::SendTime | ( | ) | [virtual] |
Send the currently selected time to the connected observers (renderers)
Called by Update().
Definition at line 332 of file mitkSliceNavigationController.cpp.
Referenced by SliceNavigationController().
{ if ( !m_BlockUpdate ) { if ( m_CreatedWorldGeometry.IsNotNull() ) { this->InvokeEvent(
virtual void mitk::SliceNavigationController::SetDefaultViewDirection | ( | ViewDirection | _arg ) | [virtual] |
Set the default view direction.
This is used to re-initialize the view direction of the SNC to the default value with SetViewDirectionToDefault()
Referenced by QmitkStdMultiWidget::InitializeWidget().
virtual void mitk::SliceNavigationController::SetFrontSide | ( | bool | _arg ) | [protected, virtual] |
void mitk::SliceNavigationController::SetGeometry | ( | const itk::EventObject & | geometrySliceEvent ) | [virtual] |
To connect multiple SliceNavigationController, we can act as an observer ourselves: implemented interface.
Definition at line 348 of file mitkSliceNavigationController.cpp.
void mitk::SliceNavigationController::SetGeometrySlice | ( | const itk::EventObject & | geometrySliceEvent ) | [virtual] |
To connect multiple SliceNavigationController, we can act as an observer ourselves: implemented interface.
Definition at line 377 of file mitkSliceNavigationController.cpp.
{
void mitk::SliceNavigationController::SetGeometryTime | ( | const itk::EventObject & | geometryTimeEvent ) | [virtual] |
To connect multiple SliceNavigationController, we can act as an observer ourselves: implemented interface.
Definition at line 354 of file mitkSliceNavigationController.cpp.
{ } void SliceNavigationController ::SetGeometryTime( const itk::EventObject &geometryTimeEvent ) { const SliceNavigationController::GeometryTimeEvent *timeEvent = dynamic_cast< const SliceNavigationController::GeometryTimeEvent * >( &geometryTimeEvent); assert( timeEvent != NULL ); TimeSlicedGeometry *timeSlicedGeometry = timeEvent->GetTimeSlicedGeometry(); assert( timeSlicedGeometry != NULL ); if ( m_CreatedWorldGeometry.IsNotNull() ) {
void mitk::SliceNavigationController::SetInputWorldGeometry | ( | const mitk::Geometry3D * | geometry ) |
Set the input world geometry out of which the geometries for slicing will be created.
Definition at line 90 of file mitkSliceNavigationController.cpp.
Referenced by QmitkSliceWidget::InitWidget(), and mitk::BaseRenderer::SetSliceNavigationController().
{ } void SliceNavigationController::SetInputWorldGeometry( const Geometry3D *geometry ) { if ( geometry != NULL ) { if ( const_cast< BoundingBox * >( geometry->GetBoundingBox()) ->GetDiagonalLength2() < eps ) { itkWarningMacro( "setting an empty bounding-box" ); geometry = NULL; }
void mitk::SliceNavigationController::SetRenderer | ( | BaseRenderer * | renderer ) |
Sets the BaseRenderer associated with this SNC (if any). While the BaseRenderer is not directly used by SNC, this is a convenience method to enable BaseRenderer access via the SNC.
Definition at line 504 of file mitkSliceNavigationController.cpp.
Referenced by mitk::BaseRenderer::SetSliceNavigationController().
{
return NULL;
}
}
virtual void mitk::SliceNavigationController::SetRenderingManager | ( | RenderingManager * | _arg ) | [virtual] |
Set the RenderingManager to be used.
If NULL, the default RenderingManager will be used.
virtual void mitk::SliceNavigationController::SetRotated | ( | bool | _arg ) | [protected, virtual] |
virtual void mitk::SliceNavigationController::SetSliceLocked | ( | bool | _arg ) | [virtual] |
Feature option to lock planes during mouse interaction. This option flag disables the mouse event which causes the center cross to move near by.
Referenced by QmitkStdMultiWidget::SetWidgetPlanesLocked().
virtual void mitk::SliceNavigationController::SetSliceRotationLocked | ( | bool | _arg ) | [virtual] |
Feature option to lock slice rotation.
This option flag disables separately the rotation of a slice which is implemented in mitkSliceRotator.
Referenced by QmitkStdMultiWidget::SetWidgetPlanesRotationLocked().
virtual void mitk::SliceNavigationController::SetTop | ( | bool | _arg ) | [protected, virtual] |
virtual void mitk::SliceNavigationController::SetViewDirection | ( | ViewDirection | _arg ) | [virtual] |
Set the desired view directions.
Referenced by QmitkSliceWidget::InitWidget().
void mitk::SliceNavigationController::SetViewDirectionToDefault | ( | ) | [virtual] |
Definition at line 128 of file mitkSliceNavigationController.cpp.
virtual void mitk::SliceNavigationController::SliceLockedOff | ( | ) | [virtual] |
virtual void mitk::SliceNavigationController::SliceLockedOn | ( | ) | [virtual] |
virtual void mitk::SliceNavigationController::SliceRotationLockedOff | ( | ) | [virtual] |
virtual void mitk::SliceNavigationController::SliceRotationLockedOn | ( | ) | [virtual] |
virtual void mitk::SliceNavigationController::TopOff | ( | ) | [protected, virtual] |
virtual void mitk::SliceNavigationController::TopOn | ( | ) | [protected, virtual] |
void mitk::SliceNavigationController::Update | ( | SliceNavigationController::ViewDirection | viewDirection, |
bool | top = true , |
||
bool | frontside = true , |
||
bool | rotated = false |
||
) | [virtual] |
Extended version of Update, additionally allowing to specify the direction/orientation of the created geometry.
Definition at line 149 of file mitkSliceNavigationController.cpp.
References m_ViewDirection, and Update().
{ this->Update( m_ViewDirection ); } } } void SliceNavigationController::Update( SliceNavigationController::ViewDirection viewDirection, bool top, bool frontside, bool rotated ) { const TimeSlicedGeometry* worldTimeSlicedGeometry = dynamic_cast< const TimeSlicedGeometry * >( m_InputWorldGeometry.GetPointer() ); if( m_BlockUpdate || m_InputWorldGeometry.IsNull() || ( (worldTimeSlicedGeometry != NULL) && (worldTimeSlicedGeometry->GetTimeSteps() == 0) ) ) { return; } m_BlockUpdate = true; if ( m_LastUpdateTime < m_InputWorldGeometry->GetMTime() ) { Modified(); } this->SetViewDirection( viewDirection ); this->SetTop( top ); this->SetFrontSide( frontside ); this->SetRotated( rotated ); if ( m_LastUpdateTime < GetMTime() ) { m_LastUpdateTime = GetMTime(); // initialize the viewplane SlicedGeometry3D::Pointer slicedWorldGeometry = NULL; m_CreatedWorldGeometry = NULL; switch ( viewDirection ) { case Original: if ( worldTimeSlicedGeometry != NULL ) { m_CreatedWorldGeometry = static_cast< TimeSlicedGeometry * >( m_InputWorldGeometry->Clone().GetPointer() ); worldTimeSlicedGeometry = m_CreatedWorldGeometry.GetPointer(); slicedWorldGeometry = dynamic_cast< SlicedGeometry3D * >( m_CreatedWorldGeometry->GetGeometry3D( this->GetTime()->GetPos() ) ); if ( slicedWorldGeometry.IsNotNull() ) { break; } } else { const SlicedGeometry3D *worldSlicedGeometry = dynamic_cast< const SlicedGeometry3D * >( m_InputWorldGeometry.GetPointer()); if ( worldSlicedGeometry != NULL ) { slicedWorldGeometry = static_cast< SlicedGeometry3D * >( m_InputWorldGeometry->Clone().GetPointer()); break; } } //else: use Transversal: no "break" here!! case Transversal: slicedWorldGeometry = SlicedGeometry3D::New(); slicedWorldGeometry->InitializePlanes( m_InputWorldGeometry, PlaneGeometry::Transversal, top, frontside, rotated ); slicedWorldGeometry->SetSliceNavigationController( this ); break; case Frontal: slicedWorldGeometry = SlicedGeometry3D::New(); slicedWorldGeometry->InitializePlanes( m_InputWorldGeometry, PlaneGeometry::Frontal, top, frontside, rotated ); slicedWorldGeometry->SetSliceNavigationController( this ); break; case Sagittal: slicedWorldGeometry = SlicedGeometry3D::New(); slicedWorldGeometry->InitializePlanes( m_InputWorldGeometry, PlaneGeometry::Sagittal, top, frontside, rotated ); slicedWorldGeometry->SetSliceNavigationController( this ); break; default: itkExceptionMacro("unknown ViewDirection"); } m_Slice->SetPos( 0 ); m_Slice->SetSteps( (int)slicedWorldGeometry->GetSlices() ); if ( m_CreatedWorldGeometry.IsNull() ) { // initialize TimeSlicedGeometry m_CreatedWorldGeometry = TimeSlicedGeometry::New(); } if ( worldTimeSlicedGeometry == NULL ) { m_CreatedWorldGeometry->InitializeEvenlyTimed( slicedWorldGeometry, 1 ); m_Time->SetSteps( 0 ); m_Time->SetPos( 0 ); m_Time->InvalidateRange(); } else { m_BlockUpdate = true; m_Time->SetSteps( worldTimeSlicedGeometry->GetTimeSteps() ); m_Time->SetPos( 0 ); const TimeBounds &timeBounds = worldTimeSlicedGeometry->GetTimeBounds(); m_Time->SetRange( timeBounds[0], timeBounds[1] ); m_BlockUpdate = false; assert( worldTimeSlicedGeometry->GetGeometry3D( this->GetTime()->GetPos() ) != NULL ); slicedWorldGeometry->SetTimeBounds( worldTimeSlicedGeometry->GetGeometry3D( this->GetTime()->GetPos() )->GetTimeBounds() ); //@todo implement for non-evenly-timed geometry! m_CreatedWorldGeometry->InitializeEvenlyTimed( slicedWorldGeometry, worldTimeSlicedGeometry->GetTimeSteps() ); } } // unblock update; we may do this now, because if m_BlockUpdate was already // true before this method was entered, then we will never come here. m_BlockUpdate = false; // Send the geometry. Do this even if nothing was changed, because maybe // Update() was only called to re-send the old geometry and time/slice data.
void mitk::SliceNavigationController::Update | ( | ) | [virtual] |
Do the actual creation and send it to the connected observers (renderers)
Definition at line 133 of file mitkSliceNavigationController.cpp.
References m_DefaultViewDirection, and m_ViewDirection.
Referenced by mitk::RenderingManager::GetTimeNavigationController(), QmitkSliceWidget::InitWidget(), mitk::BaseRenderer::SetSliceNavigationController(), and Update().
{ m_ViewDirection = m_DefaultViewDirection; } void SliceNavigationController::Update() { if ( !m_BlockUpdate ) { if ( m_ViewDirection == Transversal ) { this->Update( Transversal, false, false, true );
bool mitk::SliceNavigationController::m_BlockUpdate [protected] |
Definition at line 495 of file mitkSliceNavigationController.h.
mitk::TimeSlicedGeometry::Pointer mitk::SliceNavigationController::m_CreatedWorldGeometry [protected] |
Definition at line 470 of file mitkSliceNavigationController.h.
Referenced by GetCurrentGeometry3D(), SendCreatedWorldGeometryUpdate(), and SendSlice().
Definition at line 473 of file mitkSliceNavigationController.h.
Referenced by Update().
Definition at line 468 of file mitkSliceNavigationController.h.
bool mitk::SliceNavigationController::m_FrontSide [protected] |
Definition at line 492 of file mitkSliceNavigationController.h.
Definition at line 465 of file mitkSliceNavigationController.h.
Referenced by GetRenderingManager().
unsigned int mitk::SliceNavigationController::m_OldPos [protected] |
Definition at line 499 of file mitkSliceNavigationController.h.
Definition at line 477 of file mitkSliceNavigationController.h.
Referenced by AdjustSliceStepperRange(), and GetRenderer().
mitk::RenderingManager::Pointer mitk::SliceNavigationController::m_RenderingManager [protected] |
Definition at line 475 of file mitkSliceNavigationController.h.
bool mitk::SliceNavigationController::m_Rotated [protected] |
Definition at line 493 of file mitkSliceNavigationController.h.
bool mitk::SliceNavigationController::m_SliceLocked [protected] |
Definition at line 497 of file mitkSliceNavigationController.h.
bool mitk::SliceNavigationController::m_SliceRotationLocked [protected] |
Definition at line 498 of file mitkSliceNavigationController.h.
bool mitk::SliceNavigationController::m_Top [protected] |
Definition at line 489 of file mitkSliceNavigationController.h.
Definition at line 472 of file mitkSliceNavigationController.h.
Referenced by Update().