[Insight-users] TubeSpatialObject in groups

Luis Ibanez luis.ibanez at kitware.com
Fri, 02 Jan 2004 14:19:34 -0500


Hi Gavin,

The computation of the BoundingBox is closely
related to the "Modified" time of each one of
the SpatialObjects in the group.

I wonder if the effect that you are observing
is a consecuence of the order of operations in
the creation and assignement of spatial objects
to the group.

Could you please post a simplified version of your
code where you find this undesirable behavior ?

It will be interesting to print out the modified
types (GetMTime()) of the group and its children....


Thanks


    Luis


-----------------------------
Gavin Baker wrote:

> Hi all,
> 
> Happy New Year...!
> 
> I have been using the spatial objects classes to generate test data (with
> great success), and came across some unexpected behaviour.
> 
> I create a TubeSpatialObject, and if I plug it straight into the
> SpatialObjectToImageFilter it is rendered into the volume just fine.
> 
> If I create a group and add the tubes to the group, it doesn't work
> (ie. nothing comes out in the volume) until I explicitly call
> ComputeBoundingBox() on the tubes.  
> 
> If I create a group and add some ellipses in the same manner, it works fine
> _without_ calling ComputeBoundingBox().  (I haven't changed the child depth
> for the BB calculation.)
> 
> I'm not sure if this is an actual bug or not, but I would expect them to
> behave the same.  There doesn't appear to be much difference in the
> implementation of the ellipse and tube.  Is it necessary to call
> ComputeBoundingBox() manually for each object?  If so, I would suggest a
> small addition to the manual to this effect:
> 
> --- /debian/build/ITK/insighttoolkit-1.4.0/Examples/SpatialObjects/EllipseSpatialObject.cxx     2003-09-11 00:30:00.000000000 +1000
> +++ /tmp/EllipseSpatialObject.cxx       2004-01-01 16:35:31.000000000 +1100
>  at  at  -141,7 +141,10  at  at 
>  // 
>  // Like other spatial objects, we can also query the bounding box of the
>  // object by using \code{GetBoundingBox()}. The resulting bounding box is
> -// expressed in the local frame.
> +// expressed in the local frame.  Before adding a spatial object to a group,
> +// the bounding box should be recalculated by calling
> +// \code{ComputeBoundingBox()} to ensure the parent object has the correctly
> +// sized bounding box.
>  //
>  // Software Guide : EndLatex 
> 
> 
> Thanks - best regards to all,
> 
>   :: Gavin
>