[vtkusers] Re: automatic update of objects generating a vtkAbstractTransform

Alexandre Guimond guimond at bwh.harvard.edu
Thu Apr 5 12:43:58 EDT 2001


On Wed, 21 Mar 2001 11:44:00 -0500 (EST)
David Gobbi <dgobbi at irus.rri.on.ca> writes:

> Ah, I understand.  No, a transform does not have a 'source.'  I'll
> have to think about this... it might be worthwhile to make 
> vtkAbstractTransform a subclass of vtkDataObject, but I'm reluctant to
> do this because most of the methods/attributes of vtkDataObject
> are irrelevant to transforms.  On the other hand, the concept of
> 'UpdateExtent' does make sense for nonlinear transformations.  Hmm.
> 
> My suggestion is that, for now, you add GetSource()/SetSource() methods
> to vtkAbstractTransform.h and add this patch to vtkAbstractTransform.cxx:
> 
> //----------------------------------------------------------------------------
> void vtkAbstractTransform::Update()
> {
>   // locking is require to ensure that the class is thread-safe
>   this->UpdateMutex->Lock();
> 
> ! if (this->Source != NULL)
> !   {
> !   this->Source->Update();
> !   } 
> 
> and then ensure that when 'Update' is called on your Registration class,
> the transformation is updated.
> 
> If this sort of thing works for you, I'll add this mechanism to the
> repository.

I've been playing around with it for a couple of weeks.  It works ok,
but it's pretty annoying (considering I'm not at ease with all the vtk
concepts about times and extents).  First the source::Update method
need to do quite a few things (checking pipeline times, setting
extents, types, etc.).  Also, in source::Update you can't call many
functions of the transform (like print) since they call source::update
themselves and you end up in a lock.  It's also weird to call print on
the source itself, since it will call update on the transform and
hence update the source object (which is probably not what one wants
when you calls print).  All in all, I think is ok as a temporary
solution, but I'm hoping you can work out something more convinient in
the future.

If you're interested in what I did to vtkAbstractTransform, I can send
them to you.  I've also come up with a vtkAbstractTransformSource.
Pretty simple, but it might save you a bit of typing if you want
something along those lines.
-- 
Alexandre Guimond, Ph.D. guimond at bwh.harvard.edu Phone:(617) 278-0800 
http://spl.bwh.harvard.edu:8000/~guimond/          Fax:(617) 264-5154
Brigham and Women's Hospital, Harvard Medical School
CNI, RF396, 221 Longwood Av, Boston, MA 02115




More information about the vtkusers mailing list