[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 15:37:36 EDT 2005
Karthik,
Thank you very much for your reply. It was my mistake, sorry. I did not
double check the way in which the bounds were organized :-(
Thanks again,
Lino
> Lino:
>
> Isn't the result what you'd expect ?
> The bounds are organized as
> [dim_0_min, dim_0_max, dim_1_min, dim_1_max, dim2_min, dim2_max]
> and not as
> [dim0_min, dim1_min, dim2_min, dim0_max, dim1_max, dim2_max]
>
> karthik
>
> Lino Ramirez wrote:
>
>>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;
>>
>>
>>
>>_______________________________________________
>>Insight-users mailing list
>>Insight-users at itk.org
>>http://www.itk.org/mailman/listinfo/insight-users
>>
>>
>>
>
More information about the Insight-users
mailing list