[Insight-users] SpatialObject and MTimes

Miller, James V (Research) millerjv at crd.ge.com
Mon May 23 08:28:26 EDT 2005


Gavin,

It looks like the SetObjectTo*Transform() methods are not calling
Modified().  So this is one fix that can be done.

Would this fix your use case?  Or do you need the modified time
to reflect a modification of the transform as opposed to simply
a swap of transforms?

Jim


-----Original Message-----
From: insight-users-bounces+millerjv=crd.ge.com at itk.org
[mailto:insight-users-bounces+millerjv=crd.ge.com at itk.org]On Behalf Of
Gavin Baker
Sent: Monday, May 23, 2005 2:35 AM
To: Insight Users
Subject: [Insight-users] SpatialObject and MTimes



Greetings,

I have been working on some modelling with the SpatialObject classes,
and came across some unexpected behaviour.

Basically, the MTime of the SpatialObject is determined only by its
bounds and the MTime of its children.  But it also has MTimes
associated with its transforms, which are not taken into account.

So, an example of a potential problem is:

1. Create a SpatialObject
2. Initialise its parent transform
3. Connect it to a SpatialObjectToImageFilter
4. Update the filter, saving its output
5. Do some processing (eg. model-image registration)
6. Change the object's transform
7. Call Update() on the writer to render the object and save the output

What I would expect to happen is to see the newly transformed object
in the output.  But the MTime, which is set in step #2 does not change
at step #6, so the output of the rendering filter is unchanged.

(I have some code to demonstrate this if it helps, it's just a hacked
up version of the ModelImageRegistration1.cxx example.)

The obvious thing seems to be to include the MTime of the transforms
in the MTime of the object itself.  Especially since changing the
transform will potentially change the bounding box (upon which the
object's MTime depends).

[Later]

I've made a patch to the SpatialObject code, it seems to work with my
program, and fix the problem described above.  Please find it attached
below.  It includes the MTime of the two transforms, and also adds
const qualifiers to the two Get* methods (which would be good to
include, regardless of the other changes).

[Later again]

I have re-run the SpatialObject test suite against this, and they all
pass, so it hasn't caused major breakage (yet!).

Can someone familiar with the SpatialObjects framework please comment?

Thanks,

  :: Gavin

-- 
Gavin Baker                                      Complex Systems Group
http://www.cs.mu.oz.au/~gavinb             The University of Melbourne


More information about the Insight-users mailing list