Index: Core/Code/Controllers/mitkSliceNavigationController.cpp =================================================================== --- Core/Code/Controllers/mitkSliceNavigationController.cpp (revision 26412) +++ Core/Code/Controllers/mitkSliceNavigationController.cpp (working copy) @@ -23,6 +23,7 @@ #include "mitkOperation.h" #include "mitkOperationActor.h" #include "mitkStateEvent.h" +#include "mitkCrosshairPositionEvent.h" #include "mitkPositionEvent.h" #include "mitkInteractionConst.h" #include "mitkAction.h" @@ -331,6 +332,11 @@ // Request rendering update for all views this->GetRenderingManager()->RequestUpdateAll(); + + // send event + crosshairPositionEvent.Send(); + + } } } @@ -632,7 +638,7 @@ } 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) { @@ -685,7 +691,7 @@ } } - ok = true; + */ ok = true; break; } } Index: Core/Code/Controllers/mitkSliceNavigationController.h =================================================================== --- Core/Code/Controllers/mitkSliceNavigationController.h (revision 26412) +++ Core/Code/Controllers/mitkSliceNavigationController.h (working copy) @@ -23,6 +23,7 @@ #include "mitkBaseController.h" #include "mitkRenderingManager.h" #include "mitkTimeSlicedGeometry.h" +#include "mitkMessage.h" #include #include #include @@ -345,6 +346,8 @@ ConnectGeometrySliceEvent(receiver, false); ConnectGeometryTimeEvent(receiver); } + + Message<> crosshairPositionEvent; /** * \brief To connect multiple SliceNavigationController, we can Index: Core/Code/files.cmake =================================================================== --- Core/Code/files.cmake (revision 26412) +++ Core/Code/files.cmake (working copy) @@ -149,6 +149,7 @@ Interactions/mitkWheelEvent.cpp Interactions/mitkKeyEvent.cpp Interactions/mitkVtkEventAdapter.cpp + Interactions/mitkCrosshairPositionEvent.cpp IO/mitkBaseDataIOFactory.cpp IO/mitkDicomSeriesReader.cpp IO/mitkFileReader.cpp Index: Core/Code/Interactions/mitkCrosshairPositionEvent.cpp =================================================================== --- Core/Code/Interactions/mitkCrosshairPositionEvent.cpp (revision 0) +++ Core/Code/Interactions/mitkCrosshairPositionEvent.cpp (revision 0) @@ -0,0 +1,8 @@ +#include "mitkCrosshairPositionEvent.h" + + +mitk::CrosshairPositionEvent::CrosshairPositionEvent( BaseRenderer* sender) +: Event( sender, 0, 0, 0, 0) +{ + +} Property changes on: Core\Code\Interactions\mitkCrosshairPositionEvent.cpp ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision" Added: svn:eol-style + native Index: Core/Code/Interactions/mitkCrosshairPositionEvent.h =================================================================== --- Core/Code/Interactions/mitkCrosshairPositionEvent.h (revision 0) +++ Core/Code/Interactions/mitkCrosshairPositionEvent.h (revision 0) @@ -0,0 +1,17 @@ +#ifndef mitkCrosshairPositionEvent_h +#define mitkCrosshairPositionEvent_h + +#include "mitkCommon.h" +#include "mitkEvent.h" + +namespace mitk { + + class MITK_CORE_EXPORT CrosshairPositionEvent : public Event + { + public: + CrosshairPositionEvent(BaseRenderer* sender); + }; + +} + +#endif \ No newline at end of file Property changes on: Core\Code\Interactions\mitkCrosshairPositionEvent.h ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision" Added: svn:eol-style + native Index: CoreUI/Bundles/org.mitk.gui.qt.common/src/QmitkStatusBar.cpp =================================================================== --- CoreUI/Bundles/org.mitk.gui.qt.common/src/QmitkStatusBar.cpp (revision 26412) +++ CoreUI/Bundles/org.mitk.gui.qt.common/src/QmitkStatusBar.cpp (working copy) @@ -28,7 +28,7 @@ /** - * Display the text in the statusbar of the applikation + * Display the text in the statusbar of the application */ void QmitkStatusBar::DisplayText(const char* t) { @@ -38,7 +38,7 @@ } /** - * Display the text in the statusbar of the applikation for ms seconds + * Display the text in the statusbar of the application for ms seconds */ void QmitkStatusBar::DisplayText(const char* t, int ms) { Index: CoreUI/Qmitk/QmitkStdMultiWidget.cpp =================================================================== --- CoreUI/Qmitk/QmitkStdMultiWidget.cpp (revision 26412) +++ CoreUI/Qmitk/QmitkStdMultiWidget.cpp (working copy) @@ -26,6 +26,7 @@ #include #include #include +#include #include "mitkProperties.h" #include "mitkGeometry2DDataMapper2D.h" @@ -38,6 +39,12 @@ #include "mitkInteractionConst.h" #include "mitkDataStorage.h" + +#include "mitkNodePredicateBase.h" +#include "mitkNodePredicateDataType.h" +#include "mitkStatusBar.h" +#include "mitkImage.h" + //#include "QmitkNavigationToolBar.h" #include "mitkVtkLayerController.h" @@ -51,7 +58,8 @@ m_PlaneNode1(NULL), m_PlaneNode2(NULL), m_PlaneNode3(NULL), -m_Node(NULL) +m_Node(NULL), +PendingCrosshairPositionEvent(false) { /*******************************/ //Create Widget manually @@ -372,7 +380,7 @@ m_GradientBackground4 = mitk::GradientBackground::New(); m_GradientBackground4->SetRenderWindow( mitkWidget4->GetRenderWindow() ); - m_GradientBackground4->SetGradientColors(0.1,0.1,0.1,0.5,0.5,0.5); + m_GradientBackground4->SetGradientColors(0.0,0.1,0.3,0.7,0.7,0.8); m_GradientBackground4->Enable(); // setup the department logo rendering @@ -1573,11 +1581,81 @@ mitk::RenderingManager::GetInstance()->RequestUpdateAll(); } +void QmitkStdMultiWidget::HandleCrosshairPositionEvent() +{ + if(!PendingCrosshairPositionEvent) + { + PendingCrosshairPositionEvent=true; + QTimer::singleShot(0,this,SLOT( HandleCrosshairPositionEventDelayed() ) ); + } +} +void QmitkStdMultiWidget::HandleCrosshairPositionEventDelayed() +{ + PendingCrosshairPositionEvent = false; + + // find image with highest layer + mitk::Point3D crosshairPos = this->GetCrossPosition(); + + mitk::TNodePredicateDataType::Pointer isImageData = mitk::TNodePredicateDataType::New(); + + mitk::DataStorage::SetOfObjects::ConstPointer nodes = this->m_DataStorage->GetSubset(isImageData).GetPointer(); + std::string statusText; + mitk::Image::Pointer image3D; + int maxlayer = -32768; + + mitk::BaseRenderer* baseRenderer = this->mitkWidget1->GetSliceNavigationController()->GetRenderer(); + // 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(crosshairPos)) + { + int layer = 0; + if(!(nodes->at(x)->GetIntProperty("layer", layer))) continue; + if(layer > maxlayer) + { + if( static_cast(nodes->at(x))->IsVisible( baseRenderer ) ) + { + image3D = dynamic_cast(nodes->at(x)->GetData()); + maxlayer = layer; + } + } + } + } + + std::stringstream stream; + + // get the position and gray value from the image and build up status bar text + mitk::Index3D p; + if(image3D.IsNotNull()) + { + image3D->GetGeometry()->WorldToIndex(crosshairPos, p); + stream<<"Position: <"< mm"; + stream<<"; Index: <"< "; + stream<<"; Time: " << baseRenderer->GetTime() << " ms; Pixelvalue: "<GetPixelValueByIndex(p, baseRenderer->GetTimeStep())<<" "; + } + else + { + stream << "No image information at this position!"; + } + + statusText = stream.str(); + mitk::StatusBar::GetInstance()->DisplayGreyValueText(statusText.c_str()); + + +} + void QmitkStdMultiWidget::EnableNavigationControllerEventListening() { // Let NavigationControllers listen to GlobalInteraction mitk::GlobalInteraction *gi = mitk::GlobalInteraction::GetInstance(); + + // Listen for SliceNavigationController + mitkWidget1->GetSliceNavigationController()->crosshairPositionEvent.AddListener( mitk::MessageDelegate( this, &QmitkStdMultiWidget::HandleCrosshairPositionEvent ) ); + mitkWidget2->GetSliceNavigationController()->crosshairPositionEvent.AddListener( mitk::MessageDelegate( this, &QmitkStdMultiWidget::HandleCrosshairPositionEvent ) ); + mitkWidget3->GetSliceNavigationController()->crosshairPositionEvent.AddListener( mitk::MessageDelegate( this, &QmitkStdMultiWidget::HandleCrosshairPositionEvent ) ); + + switch ( m_PlaneMode ) { Index: CoreUI/Qmitk/QmitkStdMultiWidget.h =================================================================== --- CoreUI/Qmitk/QmitkStdMultiWidget.h (revision 26412) +++ CoreUI/Qmitk/QmitkStdMultiWidget.h (working copy) @@ -99,6 +99,10 @@ /// activate Menu Widget. true: activated, false: deactivated void ActivateMenuWidget( bool state ); + void HandleCrosshairPositionEvent(); + + + protected: void UpdateAllWidgets(); @@ -107,6 +111,8 @@ public slots: + void HandleCrosshairPositionEventDelayed(); + void changeLayoutTo2DImagesUp(); void changeLayoutTo2DImagesLeft(); @@ -296,7 +302,7 @@ vtkRenderer *ren; } m_CornerAnnotaions[3]; - + bool PendingCrosshairPositionEvent; }; #endif /*QMITKSTDMULTIWIDGET_H_*/