[Insight-users] Bugfix Spatial Object Rotation

Julien Jomier jjomier at cs.unc.edu
Thu Feb 24 12:33:40 EST 2005


Hi Uwe,

I put a fix in the cvs repository yesterday. Now Ellipse and 
TubeSpatialObjects should work fine. I've added a GetCorners() function 
in itkBoundingBox and using it to compute the bounding box of the 
objects in world coordinates. Thanks for providing a fix.

Let me know if you have any further problems,

Julien

Dr. Uwe Köhler wrote:
> Hi folks,
> 
> I think I do have a fix for the bug I reported about rotating SpatialObjects.
> 
> When calculating the bounding box of a rotated spatail object (certainly for 
> ellipse and tube) only the opposite corners (-radius1,-radius2) and 
> (radius1,radius2) are considered. This does lead to bounding boxes that are 
> to small. I have this code suggestion for Ellipse (other should work 
> accordingly)
> ...
>     std::vector<EllipseType::PointType> pntVector;
>     for( unsigned int j=0; j<pow(2,Dimension); j++ )
>     {   
> 	EllipseType::PointType point;
> 	for(unsigned int i=0; i<Dimension;i++) 
> 	{
> 	    point[i]=pow(-1,j/(int(pow(2,i))))*ellipse->GetRadius()[i];
> 	}
> 	pntVector.push_back( point );
>     } 
>     for( unsigned int j=0; j<pntVector.size(); j++ )
>     {
> 	pntVector[j] = 
> ellipse2->GetIndexToWorldTransform()->TransformPoint(pntVector[j]);
>     const_cast<BoundingBoxType 
> *>(this->GetBounds())->ConsiderPoint(pntVector[j]);
>     }
> ...
> This does consider all corners of the unrotated bounding box in n-dimensions. 
> Would be very happy if somebody could check this and insert it to the CVS.
> 
> Many thanks in advance.
> 
> Uwe
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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