[Insight-users] Bugfix Spatial Object Rotation

Dr. Uwe Köhler U.Koehler at gmx.de
Wed Feb 23 04:33:35 EST 2005


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

-- 
 |                                                                 |
-+-----------------------------------------------------------------+-
 |  Dr. Uwe Köhler              MR - Physics                       | 
 |                              German Heart Institute Berlin      |
 |                              Augustenburger Platz 1             |
 |                              D - 13353 Berlin                   |
 |          ////                Germany                            |
 |         (@ @)                Phone: +49 172 98 11 598           |
-+-----oOO--(_)--OOo-----------------------------------------------+-
 | <URL:http://www.ed.ac.uk/~ukoehler>   <mailto:UKoehler at dhzb.de> |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/insight-users/attachments/20050223/dcd3b707/attachment.pgp


More information about the Insight-users mailing list