Page MenuHomePhabricator

StatusBar.patch

Authored By
kast
Jul 1 2009, 11:01 AM
Size
7 KB
Subscribers
None

StatusBar.patch

Index: mitk/Core/Code/Controllers/mitkSliceNavigationController.cpp
===================================================================
--- mitk/Core/Code/Controllers/mitkSliceNavigationController.cpp (revision 17827)
+++ mitk/Core/Code/Controllers/mitkSliceNavigationController.cpp (working copy)
@@ -614,8 +614,114 @@
m_UndoController->SetOperationEvent(operationEvent);
}
- this->ExecuteOperation( doOp );
+ this->ExecuteOperation( doOp );
+ if(baseRenderer == m_BaseRenderer)
+ {
+
+ {
+ mitk::Image* image = NULL;
+ TNodePredicateDataType<mitk::Image>::Pointer isImageData = TNodePredicateDataType<mitk::Image>::New();
+
+ mitk::DataStorage::SetOfObjects nodes = baseRenderer->GetDataStorage()->GetSubset(isImageData);
+ mitk::Point3D worldposition = posEvent->GetWorldPosition();
+ int maxlayer = 0;
+ int grvalue = 0;
+ 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)
+ {
+ grvalue = nodes.at(x)->GetData()
+
+ }
+ }
+
+ image = GetImageFromDataTree();
+ QString s;
+ mitk::Point3D p = pointoperation->GetPoint();
+ mitk::ScalarType time = pointoperation->GetTimeInMS();
+
+ s.sprintf("<%.2f,%.2f,%.2f> mm", p[0], p[1], p[2]);
+ if(time>mitk::ScalarTypeNumericTraits::min())
+ {
+ QString tmp;
+ tmp.sprintf("; %.2f ms", time);
+ s+=tmp;
}
+
+
+ if (image==NULL)
+ {
+ m_TimeSelector->SetInput(NULL);
+ }
+ else if ( image->IsInitialized() )
+ {
+ m_TimeSelector->SetInput(image);
+ mitk::Image* image3D = m_TimeSelector->GetOutput();
+
+ const mitk::TimeSlicedGeometry* inputTimeGeometry = image->GetUpdatedTimeSlicedGeometry();
+
+ int timestep=0;
+ if(time>mitk::ScalarTypeNumericTraits::min())
+ timestep = inputTimeGeometry->MSToTimeStep( time );
+ if ( ( inputTimeGeometry->IsValidTime( timestep ) == false ) || ( image->IsVolumeSet(timestep) == false ) )
+ {
+ if(image3D!=NULL)
+ {
+
+ image3D->ReleaseData();
+ }
+ //m_TimeSelector->SetInput(NULL);
+ return;
+ }
+
+ m_TimeSelector->SetTimeNr(timestep);
+ m_TimeSelector->UpdateLargestPossibleRegion();
+
+ image3D->GetGeometry()->WorldToIndex(pointoperation->GetPoint(), p);
+
+ QString pixel;
+ if(time>mitk::ScalarTypeNumericTraits::min())
+ pixel.sprintf("; <%.2f,%.2f,%.2f,%u> pixel ", p[0], p[1], p[2],timestep);
+ else
+ pixel.sprintf("; <%.2f,%.2f,%.2f> pixel ", p[0], p[1], p[2]);
+ s+=pixel;
+
+ ipPicDescriptor* pic = image3D->GetPic();
+ if ( pic )
+ {
+
+ mitk::FillVector3D(p, (int)(p[0]+0.5), (int)(p[1]+0.5), (int)(p[2]+0.5));
+ if ( image3D->GetGeometry()->IsIndexInside(p) )
+ {
+ itk::Point<int, 3> pi;
+ mitk::itk2vtk(p, pi);
+ if(pic->bpe!=24)
+ {
+ mitkIpPicTypeMultiplex2(__buildstring, pic, pi, s);
+ }
+ else
+ __buildstring(pic, pi, s, (unsigned char) 1);
+ }
+ }
+
+ if(image3D!=NULL)
+ {
+ image3D->ReleaseData();
+ }
+ //m_TimeSelector->SetInput(NULL);
+ }
+
+
+ mitk::StatusBar::GetInstance();
+
+
+
+ }
+ }
ok = true;
break;
}
Index: mitk/Core/Code/Controllers/mitkStatusBar.cpp
===================================================================
--- mitk/Core/Code/Controllers/mitkStatusBar.cpp (revision 17827)
+++ mitk/Core/Code/Controllers/mitkStatusBar.cpp (working copy)
@@ -69,7 +69,11 @@
if (m_Implementation != NULL)
m_Implementation->DisplayDebugText(t);
}
-
+void StatusBar::DisplayGreyValueText(const char *t)
+{
+ if (m_Implementation != NULL)
+ m_Implementation->DisplayGreyValueText(t);
+}
void StatusBar::Clear()
{
if ( m_Implementation != NULL)
Index: mitk/Core/Code/Controllers/mitkStatusBar.h
===================================================================
--- mitk/Core/Code/Controllers/mitkStatusBar.h (revision 17827)
+++ mitk/Core/Code/Controllers/mitkStatusBar.h (working copy)
@@ -62,6 +62,7 @@
void DisplayWarningText(const char *t, int ms);
void DisplayGenericOutputText(const char *t);
void DisplayDebugText(const char *t);
+ void DisplayGreyValueText(const char *t);
//##Documentation
//## @brief removes any temporary message being shown.
Index: mitk/Core/Code/Controllers/mitkStatusBarImplementation.h
===================================================================
--- mitk/Core/Code/Controllers/mitkStatusBarImplementation.h (revision 17827)
+++ mitk/Core/Code/Controllers/mitkStatusBarImplementation.h (working copy)
@@ -45,7 +45,9 @@
virtual void DisplayWarningText(const char *t, int ms) = 0;
virtual void DisplayGenericOutputText(const char *t) = 0;
virtual void DisplayDebugText(const char *t) = 0;
+ virtual void DisplayGreyValueText(const char *t) = 0;
+
//##Documentation
//## @brief removes any temporary message being shown.
virtual void Clear() = 0;
Index: mitk/CoreUI/Bundles/org.mitk.gui.qt.application/src/QmitkStatusBar.cpp
===================================================================
--- mitk/CoreUI/Bundles/org.mitk.gui.qt.application/src/QmitkStatusBar.cpp (revision 17827)
+++ mitk/CoreUI/Bundles/org.mitk.gui.qt.application/src/QmitkStatusBar.cpp (working copy)
@@ -27,7 +27,6 @@
#include <itkObjectFactory.h>
-
/**
* Display the text in the statusbar of the applikation
*/
@@ -47,8 +46,15 @@
// TODO bug #1357
//qApp->processEvents(); // produces crashes!
}
-
/**
+ * Show the grey value text in the statusbar
+ */
+void DisplayGreyValueText(const char* t)
+{
+ QString text(t);
+ m_GreyValueLabel->setText(text);
+}
+/**
* Clear the text in the StatusBar
*/
void QmitkStatusBar::Clear()
@@ -73,6 +79,8 @@
:StatusBarImplementation()
{
m_StatusBar = instance;
+ m_GreyValueLabel = new QLabel(m_StatusBar,"0");
+ m_StatusBar->addPermanentWidget(m_GreyValueLabel);
mitk::StatusBar::SetImplementation(this);
}
Index: mitk/CoreUI/Bundles/org.mitk.gui.qt.application/src/QmitkStatusBar.h
===================================================================
--- mitk/CoreUI/Bundles/org.mitk.gui.qt.application/src/QmitkStatusBar.h (revision 17827)
+++ mitk/CoreUI/Bundles/org.mitk.gui.qt.application/src/QmitkStatusBar.h (working copy)
@@ -22,6 +22,7 @@
#include <mitkCommon.h>
#include <qstatusbar.h>
#include "mitkQtAppDll.h"
+#include <QLabel>
//##Documentation
//## @brief QT-Toolkit/GUI dependent class that provides to send a Message to the QT's StatusBar
@@ -59,6 +60,7 @@
virtual void DisplayWarningText(const char *t, int ms) { this->DisplayText(t, ms); };
virtual void DisplayGenericOutputText(const char *t) {this->DisplayText(t);}
virtual void DisplayDebugText(const char *t) { this->DisplayText(t); };
+ virtual void DisplayGreyValueText(const char *t);
//##Documentation
//## @brief removes any temporary message being shown.
@@ -73,6 +75,7 @@
private:
//static Pointer m_Instance;
QStatusBar* m_StatusBar;
+ QLabel* m_GreyValueLabel;
};

File Metadata

Mime Type
application/octet-stream
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
224
Default Alt Text
StatusBar.patch (7 KB)

Event Timeline

First progress from the bug squashing party for BUG 2132