[Insight-users] Computing the Bounding Box of a Ellipse Spatial
Object after applying an offset
Lino Ramirez
ramirez at ece.ualberta.ca
Sun Jun 12 14:57:31 EDT 2005
Hello All,
I am trying to compute the bounding box of a couple of ellipses in 3-D.
The radius in each dimension is set to 10. When the ellipses are centered
in the origin, the bounds are what I expect (from -10 to 10). If I apply
an offset only in the z axis to both ellipses (20 for the first one and 50
for the second one), the results are not what I expect ([-10, 10, 10, 10,
-10, 30] for the first ellipse and [-1, 10, 40, 10, -10, 60] for the
second one). The results I get are:
Ellipse 1 After Transform Bounding Box: [-10, 10, -10, 10, 10, 30]
Ellipse 2 After Transform Bounding Box: [-10, 10, -10, 10, 40, 60]
I am using a CVS version dated April 29, 2005. My compiler is Visual
Studio .Net. The portion of the code I used for the computation is located
at the end of this message.
I am not sure if this is a bug or if I am forgetting something in my code
Any help would be really appreciated
Regards,
Lino
//-----------
//Portion of the code
typedef itk::EllipseSpatialObject< 3 > EllipseType;
EllipseType::Pointer ellipse1 = EllipseType::New();
EllipseType::Pointer ellipse2 = EllipseType::New();
ellipse1->SetRadius( 10.0 );
ellipse2->SetRadius( 10.0 );
ellipse1->ComputeBoundingBox();
EllipseType::BoundingBoxType * ellipse1BoundingBox =
ellipse1->GetBoundingBox();
std::cout << "Ellipse 1 Initial Bounding Box: " <<
ellipse1BoundingBox->GetBounds() << std::endl;
ellipse2->ComputeBoundingBox();
EllipseType::BoundingBoxType * ellipse2BoundingBox =
ellipse2->GetBoundingBox();
std::cout << "Ellipse 2 Initial Bounding Box: " <<
ellipse2BoundingBox->GetBounds() << std::endl;
EllipseType::TransformType::OffsetType soOffset;
soOffset[ 0 ] = 0.0;
soOffset[ 1 ] = 0.0;
soOffset[ 2 ] = 20.0;
ellipse1->GetObjectToParentTransform()->SetOffset(soOffset);
ellipse1->ComputeObjectToWorldTransform();
soOffset[ 0 ] = 0.0;
soOffset[ 1 ] = 0.0;
soOffset[ 2 ] = 50.0;
ellipse2->GetObjectToParentTransform()->SetOffset(soOffset);
ellipse2->ComputeObjectToWorldTransform();
ellipse1->ComputeBoundingBox();
std::cout << "Ellipse 1 After Transform Bounding Box: " <<
ellipse1BoundingBox->GetBounds() << std::endl;
ellipse2->ComputeBoundingBox();
std::cout << "Ellipse 2 After Transform Bounding Box: " <<
ellipse2BoundingBox->GetBounds() << std::endl;
More information about the Insight-users
mailing list