Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F250
GetPixelValueByIndex.or.World.diff
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
gergel
Oct 1 2009, 10:29 AM
2009-10-01 10:29:41 (UTC+2)
Size
3 KB
Referenced Files
None
Subscribers
None
GetPixelValueByIndex.or.World.diff
View Options
Index: mitk/Core/Code/Controllers/mitkSliceNavigationController.cpp
===================================================================
--- mitk/Core/Code/Controllers/mitkSliceNavigationController.cpp (revision 19234)
+++ mitk/Core/Code/Controllers/mitkSliceNavigationController.cpp (working copy)
@@ -656,7 +656,7 @@
{
image3D->GetGeometry()->WorldToIndex(posEvent->GetWorldPosition(), p);
stream<<"Position: <"<<floor(p[0] * 100.0 + .5)/100.0<<"; "<<floor(p[1] * 100.0 + .5)/100.0<<"; "<<floor(p[2] * 100.0 + .5)/100.0<<"> mm";
- stream<<"; Time: " << baseRenderer->GetTime() << " ms; Pixelvalue: "<<image3D->GetPixelValue(p, baseRenderer->GetTimeStep())<<" ";
+ stream<<"; Time: " << baseRenderer->GetTime() << " ms; Pixelvalue: "<<image3D->GetPixelValueByIndex(p, baseRenderer->GetTimeStep())<<" ";
}
else
{
Index: mitk/Core/Code/DataManagement/mitkImage.cpp
===================================================================
--- mitk/Core/Code/DataManagement/mitkImage.cpp (revision 19234)
+++ mitk/Core/Code/DataManagement/mitkImage.cpp (working copy)
@@ -99,7 +99,7 @@
return m_CompleteData->GetData();
}
-double mitk::Image::GetPixelValue(const mitk::Point3D &position, unsigned int timestep)
+double mitk::Image::GetPixelValueByIndex(const mitk::Point3D &position, unsigned int timestep)
{
mitkIpPicDescriptor* pic = this->GetPic();
double value = 0;
@@ -111,7 +111,25 @@
return value;
}
+double mitk::Image::GetPixelValueByWorld(const mitk::Point3D &position, unsigned int timestep)
+{
+ mitkIpPicDescriptor* pic = this->GetPic();
+ double value = 0;
+ if (this->GetTimeSteps() < timestep)
+ {
+ timestep = this->GetTimeSteps();
+ }
+ itk::Index<3> itkIndex;
+ this->GetGeometry()->WorldToIndex(position,itkIndex);
+ Point3D mitkPointIndex;
+ mitkPointIndex[0]=itkIndex[0];
+ mitkPointIndex[1]=itkIndex[1];
+ mitkPointIndex[2]=itkIndex[2];
+ mitkIpPicTypeMultiplex3(AccessPixel, pic, mitkPointIndex, value, timestep);
+ return value;
+}
+
vtkImageData* mitk::Image::GetVtkImageData(int t, int n)
{
if(m_Initialized==false)
Index: mitk/Core/Code/DataManagement/mitkImage.h
===================================================================
--- mitk/Core/Code/DataManagement/mitkImage.h (revision 19234)
+++ mitk/Core/Code/DataManagement/mitkImage.h (working copy)
@@ -100,11 +100,16 @@
//## use one of the SubImageSelector classes.
virtual void* GetData();
- //## @brief Get the pixel value at one specific position.
+ //## @brief Get the pixel value at one specific index position.
//##
//## The pixel type is always being converted to double.
- double GetPixelValue(const mitk::Point3D &position, unsigned int timestep = 0);
+ double GetPixelValueByIndex(const mitk::Point3D &position, unsigned int timestep = 0);
+ //## @brief Get the pixel value at one specific world position.
+ //##
+ //## The pixel type is always being converted to double.
+ double GetPixelValueByWorld(const mitk::Point3D &position, unsigned int timestep = 0);
+
//##Documentation
//## @brief Get a volume at a specific time @a t of channel @a n as a vtkImageData.
virtual vtkImageData* GetVtkImageData(int t = 0, int n = 0);
File Metadata
Details
Attached
Mime Type
text/plain
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
241
Default Alt Text
GetPixelValueByIndex.or.World.diff (3 KB)
Attached To
Mode
T2206: Add missing Pixel access Method to mitk::Image
Attached
Detach File
Event Timeline
gergel
added a comment.
Oct 1 2009, 10:29 AM
2009-10-01 10:29:41 (UTC+2)
Comment Actions
patch
Log In to Comment