Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F561
geometry3d.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
ritter
Sep 1 2010, 2:38 PM
2010-09-01 14:38:06 (UTC+2)
Size
1 KB
Referenced Files
None
Subscribers
None
geometry3d.patch
View Options
Index: mitk/Core/Code/DataManagement/mitkGeometry3D.h
===================================================================
--- mitk/Core/Code/DataManagement/mitkGeometry3D.h (revision 25851)
+++ mitk/Core/Code/DataManagement/mitkGeometry3D.h (working copy)
@@ -434,19 +434,35 @@
}
//##Documentation
- //## @brief Test whether the point \a p (index coordinates in units) is
+ //## @brief Test whether the point \a p ((continous!)index coordinates in units) is
//## inside the bounding box
bool IsIndexInside(const mitk::Point3D& index) const
{
- bool inside = m_BoundingBox->IsInside(index);
- if((m_ImageGeometry) && (inside))
+ bool inside = false;
+ //if it is an image geometry, we need to convert the index to discrete values
+ //this is done by applying the rounding function also used in WorldToIndex (see line 323)
+ if (m_ImageGeometry)
{
- const BoundingBox::BoundsArrayType& bounds = m_BoundingBox->GetBounds();
- if((index[0] == bounds[1]) ||
- (index[1] == bounds[3]) ||
- (index[2] == bounds[5]))
- inside = false;
+ mitk::Point3D discretIndex;
+ discretIndex[0]=itk::Math::RoundHalfIntegerUp( index[0] );
+ discretIndex[1]=itk::Math::RoundHalfIntegerUp( index[1] );
+ discretIndex[2]=itk::Math::RoundHalfIntegerUp( index[2] );
+
+ inside = m_BoundingBox->IsInside(discretIndex);
+ //we have to check if the index is at the upper border of each dimension,
+ // because the boundingbox is not centerbased
+ if (inside)
+ {
+ const BoundingBox::BoundsArrayType& bounds = m_BoundingBox->GetBounds();
+ if((discretIndex[0] == bounds[1]) ||
+ (discretIndex[1] == bounds[3]) ||
+ (discretIndex[2] == bounds[5]))
+ inside = false;
+ }
}
+ else
+ inside = m_BoundingBox->IsInside(index);
+
return inside;
}
File Metadata
Details
Attached
Mime Type
text/plain
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
539
Default Alt Text
geometry3d.patch (1 KB)
Attached To
Mode
T4692: Inconsistent handling of pixel and voxel centers
Attached
Detach File
Event Timeline
•
ritter
added a comment.
Sep 1 2010, 2:38 PM
2010-09-01 14:38:06 (UTC+2)
Comment Actions
patch for correcting the IsIndexInside function
Log In to Comment