[Insight-users] itk::BSplineDeformableTransform BulkTransform

Luis Ibanez luis.ibanez at kitware.com
Fri Feb 5 12:41:00 EST 2010


Hi Jef,

Thanks for pointing this out,

You seem to have uncovered a real bug.

The current code in the itkOptImageToImageMetric,
is not taking care of the potential Bulk transform that
the BSplineDeformableTransform can have.


The current code is:


  for( unsigned int ithread=0; ithread < m_NumberOfThreads-1; ++ithread)
    {
    // Create a copy of the main transform to be used in this thread.
    LightObject::Pointer anotherTransform = this->m_Transform->CreateAnother();
    // This static_cast should always work since the pointer was created by
    // CreateAnother() called from the transform itself.
    TransformType * transformCopy = static_cast< TransformType * >(
anotherTransform.GetPointer() );
    /** Set the fixed parameters first. Some transforms have
parameters which depend on
        the values of the fixed parameters. For instance, the
BSplineDeformableTransform
        checks the grid size (part of the fixed parameters) before
setting the parameters. */
    transformCopy->SetFixedParameters(
this->m_Transform->GetFixedParameters() );
    transformCopy->SetParameters( this->m_Transform->GetParameters() );
    this->m_ThreaderTransform[ithread] = transformCopy;
    }


Passing the parameters of the Bulk transform via the FixedParameters,
may not be enough.   We need to clone the bulk transform as well,
and note that the Bulk transform could be any type of transform,
(including another BSplineDeformable transform), although in practice,
most of the time we use an AffineTransform.

It would look like the proper pace to clone the Bulk transform would be
in an overloaded version of the "CreateAnother()" method...

Although, this option may be misleading, given that in principle we expect
to receive a new transform that is plainly initialized just as if it was created
by a New() method.

Maybe we need a specific new function in the Transform hierarchy for
taking care of the Cloning process. Such new function could take care
of doing the same as "CreateInstance()" plus, setting the Fixed and
variable Parameters, plus, in the case of the BSplineDeformableTransform,
it should take care of cloning the BulkTransform as well.


Could you please log a bug in the Bug tracker and assign it to me ?
http://public.kitware.com/Bug/my_view_page.php

    Many Thanks,


          Luis


------------------------------------------------------------------------
On Tue, Feb 2, 2010 at 9:53 AM, jef vdmb <jvdmb at hotmail.com> wrote:
> Hi,
>
> I noticed something during a registration using the
> itk::BSplineDeformableTransform involving a bulk transform.
>
> I am working with the optimized (threaded) framework, available in the
> review section. Since the transform is not threadsafe, copies of the
> transform are made by ImageToImageMetric. As such, the transform should
> provide a function GetFixedParametes() and GetParameters(), both returning
> an array of doubles,  wich allow to synchronize the copies with the original
> transform object.
>
> Unless I missed something it would seem the bulk transform has not been
> included in the FixedParameters array, and is not passed in another way to
> the transform copies. This leads to inconsistent copies of the transform in
> the respective threads: the first has the bulk but the copies don't.
>
> Regards,
> Jef
>
> PS:
>
> One way to pass the bulk is to include in the array of doubles
> m_FixedParameters. A quick workaround I am using for now is to cast the the
> member m_BulkTransform (this time defined as a c++ pointer rather then a
> SmartPointer) to double in GetFixedParameters()
>
>  this->m_FixedParameters[?]= (double)((size_t) m_BulkTransform;
> ...
> And inversely, casting it back to a pointer in SetFixedParameters()....
>
>
>
>
>
>
>
> ________________________________
> Hotmail: Trusted email with Microsoft’s powerful SPAM protection. Sign up
> now.
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list