Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F556
HandleCrosshairPosition.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
hering
Sep 29 2010, 4:07 PM
2010-09-29 16:07:02 (UTC+2)
Size
9 KB
Referenced Files
None
Subscribers
None
HandleCrosshairPosition.patch
View Options
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 <itkEventObject.h>
#include <itkCommand.h>
#include <mitkIpPicTypeMultiplex.h>
@@ -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 <QMotifStyle>
#include <QList>
#include <QMouseEvent>
+#include <QTimer>
#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<mitk::Image>::Pointer isImageData = mitk::TNodePredicateDataType<mitk::Image>::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<mitk::DataNode::Pointer>(nodes->at(x))->IsVisible( baseRenderer ) )
+ {
+ 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
+ mitk::Index3D p;
+ if(image3D.IsNotNull())
+ {
+ image3D->GetGeometry()->WorldToIndex(crosshairPos, p);
+ stream<<"Position: <"<<crosshairPos[0] << ", " << crosshairPos[1] << ", " << crosshairPos[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());
+
+
+}
+
void QmitkStdMultiWidget::EnableNavigationControllerEventListening()
{
// Let NavigationControllers listen to GlobalInteraction
mitk::GlobalInteraction *gi = mitk::GlobalInteraction::GetInstance();
+
+ // Listen for SliceNavigationController
+ mitkWidget1->GetSliceNavigationController()->crosshairPositionEvent.AddListener( mitk::MessageDelegate<QmitkStdMultiWidget>( this, &QmitkStdMultiWidget::HandleCrosshairPositionEvent ) );
+ mitkWidget2->GetSliceNavigationController()->crosshairPositionEvent.AddListener( mitk::MessageDelegate<QmitkStdMultiWidget>( this, &QmitkStdMultiWidget::HandleCrosshairPositionEvent ) );
+ mitkWidget3->GetSliceNavigationController()->crosshairPositionEvent.AddListener( mitk::MessageDelegate<QmitkStdMultiWidget>( 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_*/
File Metadata
Details
Attached
Mime Type
text/plain
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
534
Default Alt Text
HandleCrosshairPosition.patch (9 KB)
Attached To
Mode
T4660: Slice index and position not updated on mouse wheel change
Attached
Detach File
Event Timeline
•
hering
added a comment.
Sep 29 2010, 4:07 PM
2010-09-29 16:07:02 (UTC+2)
Comment Actions
Patch with the proposed changes
Log In to Comment