Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F423
bug3209.diff
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
xplanes
Jan 20 2010, 2:11 PM
2010-01-20 14:11:07 (UTC+1)
Size
5 KB
Referenced Files
None
Subscribers
None
bug3209.diff
View Options
Index: mitkPointSet.cpp
===================================================================
--- mitkPointSet.cpp (revision 21081)
+++ mitkPointSet.cpp (working copy)
@@ -652,6 +652,8 @@
// Iterate over the PointSets and update the Geometry
// information of each of the items.
//
+ mitk::ScalarType nullpoint[]={0,0,0,0,0,0};
+ BoundingBox::BoundsArrayType itkBoundsNull(nullpoint);
if (m_CalculateBoundingBox)
{
for ( unsigned int i = 0 ; i < m_PointSetSeries.size() ; ++i )
@@ -659,17 +661,23 @@
const DataType::BoundingBoxType *bb = m_PointSetSeries[i]->GetBoundingBox();
BoundingBox::BoundsArrayType itkBounds = bb->GetBounds();
- // Ensure minimal bounds of 1.0 in each dimension
- for ( unsigned int j = 0; j < 3; ++j )
- {
- if ( itkBounds[j*2+1] - itkBounds[j*2] < 1.0 )
+ // If there are no points, the bounding box cannot be (-0.5, 0.5) because
+ // this will affect all the TimePoints
+ if ( m_PointSetSeries[i]->GetNumberOfPoints() &&
+ itkBounds != itkBoundsNull )
+ {
+ // Ensure minimal bounds of 1.0 in each dimension
+ for ( unsigned int j = 0; j < 3; ++j )
{
- BoundingBox::CoordRepType center =
- (itkBounds[j*2] + itkBounds[j*2+1]) / 2.0;
- itkBounds[j*2] = center - 0.5;
- itkBounds[j*2+1] = center + 0.5;
+ if ( itkBounds[j*2+1] - itkBounds[j*2] < 1.0 )
+ {
+ BoundingBox::CoordRepType center =
+ (itkBounds[j*2] + itkBounds[j*2+1]) / 2.0;
+ itkBounds[j*2] = center - 0.5;
+ itkBounds[j*2+1] = center + 0.5;
+ }
}
- }
+ }
this->GetGeometry(i)->SetBounds(itkBounds);
}
m_CalculateBoundingBox = false;
Index: mitkDataTree.cpp
===================================================================
--- mitkDataTree.cpp (revision 21081)
+++ mitkDataTree.cpp (working copy)
@@ -108,18 +108,27 @@
const Geometry3D* geometry = node->GetData()->GetUpdatedTimeSlicedGeometry();
if (geometry != NULL )
{
- // bounding box
- unsigned char i;
- for(i=0; i<8; ++i)
- {
- point = geometry->GetCornerPoint(i);
- if(point[0]*point[0]+point[1]*point[1]+point[2]*point[2] < large)
- pointscontainer->InsertElement( pointid++, point);
- else
+ // Check if the bounding box is null
+ mitk::ScalarType nullpoint[]={0,0,0,0,0,0};
+ BoundingBox::BoundsArrayType itkBoundsNull(nullpoint);
+ const Geometry3D::BoundingBoxType *bb = geometry->GetBoundingBox();
+ BoundingBox::BoundsArrayType itkBounds = bb->GetBounds();
+
+ // bounding box
+ if ( itkBounds != itkBoundsNull )
+ {
+ unsigned char i;
+ for(i=0; i<8; ++i)
{
- itkGenericOutputMacro( << "Unrealistically distant corner point encountered. Ignored. Node: " << node );
+ point = geometry->GetCornerPoint(i);
+ if(point[0]*point[0]+point[1]*point[1]+point[2]*point[2] < large)
+ pointscontainer->InsertElement( pointid++, point);
+ else
+ {
+ itkGenericOutputMacro( << "Unrealistically distant corner point encountered. Ignored. Node: " << node );
+ }
}
- }
+ }
// spacing
try
{
Index: mitkTimeSlicedGeometry.cpp
===================================================================
--- mitkTimeSlicedGeometry.cpp (revision 21081)
+++ mitkTimeSlicedGeometry.cpp (working copy)
@@ -63,13 +63,24 @@
const mitk::BoundingBox::PointsContainer * nextPoints = nextBoundingBox->GetPoints();
if(nextPoints!=NULL)
{
+ // Check if all points of bounding box are == 0
+ bool bValid = false;
mitk::BoundingBox::PointsContainer::ConstIterator pointsIt = nextPoints->Begin();
-
while (pointsIt != nextPoints->End() )
{
- pointscontainer->InsertElement( pointid++, pointsIt->Value());
+ bValid |= pointsIt->Value() != p;
++pointsIt;
}
+
+ if ( bValid )
+ {
+ mitk::BoundingBox::PointsContainer::ConstIterator pointsIt = nextPoints->Begin();
+ while (pointsIt != nextPoints->End() )
+ {
+ pointscontainer->InsertElement( pointid++, pointsIt->Value());
+ ++pointsIt;
+ }
+ }
}
}
Index: mitkDataStorage.cpp
===================================================================
--- mitkDataStorage.cpp (revision 21081)
+++ mitkDataStorage.cpp (working copy)
@@ -275,18 +275,28 @@
const TimeSlicedGeometry* geometry = node->GetData()->GetUpdatedTimeSlicedGeometry();
if (geometry != NULL )
{
+ // Check if the bounding box is null
+ mitk::ScalarType nullpoint[]={0,0,0,0,0,0};
+ BoundingBox::BoundsArrayType itkBoundsNull(nullpoint);
+ const Geometry3D::BoundingBoxType *bb = geometry->GetBoundingBox();
+ BoundingBox::BoundsArrayType itkBounds = bb->GetBounds();
+
// bounding box
- unsigned char i;
- for(i=0; i<8; ++i)
+ if ( itkBounds != itkBoundsNull )
{
- point = geometry->GetCornerPoint(i);
- if(point[0]*point[0]+point[1]*point[1]+point[2]*point[2] < large)
- pointscontainer->InsertElement( pointid++, point);
- else
+ unsigned char i;
+ for(i=0; i<8; ++i)
{
- itkGenericOutputMacro( << "Unrealistically distant corner point encountered. Ignored. Node: " << node );
+ point = geometry->GetCornerPoint(i);
+ if(point[0]*point[0]+point[1]*point[1]+point[2]*point[2] < large)
+ pointscontainer->InsertElement( pointid++, point);
+ else
+ {
+ itkGenericOutputMacro( << "Unrealistically distant corner point encountered. Ignored. Node: " << node );
+ }
}
- }
+ }
+
// spacing
try
{
File Metadata
Details
Attached
Mime Type
text/plain
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
407
Default Alt Text
bug3209.diff (5 KB)
Attached To
Mode
T3209: BugFix: When the input mitk::PointSet has no points, the computation of the bounding box is taking the 0,0,0 point
Attached
Detach File
Event Timeline
xplanes
added a comment.
Jan 20 2010, 2:11 PM
2010-01-20 14:11:07 (UTC+1)
Comment Actions
Unified patch
Log In to Comment