[Insight-users] demons deformable filter

Luis Ibanez luis.ibanez at kitware.com
Thu, 15 Jan 2004 19:30:03 -0500


Hi Corinne,


1) Interesting,...

    It looks like the spacing shouldn't be there.

    The fixedGradient is computed by

         itkCentralDiffeerenceImageFunction.txx

    in Insight/Code/Common

    and this class is taking the spacing into
    account as

         Pixel(x+1) - Pixel(x-1)
         -----------------------
              2 * spacing

    It looks like in DemonsRegistrationFunction
    there was an attempt for removing the
    consideration of the spacing.

    I would expect the fixedGradient to be takes
    as it is computed from the CentralDifference
    image function since in this way the updates
    for the deformation fields are in physical
    units, which is what the itkWarpImageFilter
    expects to find when it takes the deformation
    field in order to resample the moving image.
    Let me check with smarter people than
    me, I'm probably missing something here...



2) The pixel that you get from the deformation
    field is the one of the previous iteration.
    You can track this by looking at the files

    Insight/Code/Common/
       itkDenseFiniteDifferenceImageFilter.h
       itkDenseFiniteDifferenceImageFilter.txx

    This class uses a temporary buffer for computing
    the values of the next iteration of the deformation
    field. (m_UpdateBuffer).  The ComputeUpdate()
    method is invoked in lines 249 and 267.

    At the end of the entire iteration, the values
    of m_UpdateBuffer are copied into the output
    (the deformation field). This is done in the
    method ThreadedApplyUpdate() in lines 183-189.



3) The noiser result when you remove the spacing
    may (or may not) be related to the smoothing
    dones in the deformation field but the
    PDEDeformableRegistrationFilter. The current
    smoothing is done independently of the spacing
    in the deformation field.

    The interesting test to perform is to set the
    spacing of your images to a cannonical value,
    run a registration with them, then change the
    spacing (on both images) and run a second
    registration.  The deformation fields of both
    registrations should be related by the ratio
    between the two spacings used.



Regards,



   Luis




------------------------
Corinne Mattmann wrote:

> Hi Luis,
> 
> I have two more questions:
> 
> 1) In itkDemonsRegistrationFunction the fixedGradientSquaredMagnitude
> and update-value are calculated like this:
> 
>     fixedGradientSquaredMagnitude += vnl_math_sqr( fixedGradient[j] ) *
> m_FixedImageSpacing[j];
>     update[j] = speedValue * fixedGradient[j] *
> vnl_math_sqr(m_FixedImageSpacing[j]) / denominator;
> 
> Why do this two formulas contain a multiplication with the ImageSpacing?
> 
> 2) With it.GetCenterPixel() I get the deformation vector at the current
> position - the same as when I go like
> "m_DeformationField->GetPixel(index)". Do this two variables point to
> the same deformation field or does one of them contain the updated
> values (half actual iteration, half previous iteration)?
> 
> Thanks very much for all your answers,
> Corinne
> 
> 
> ps: The itkDemons5RegistrationFunction is working so far and with my
> images I get better results than with the other demons function :) . I
> just would like to make sure that my formula is right (at the moment I
> don't multiply with the ImageSpacing -> see 1). If I delete this
> multiplication in itkDemonsRegistrationFunction as well, the actual
> registration gets better with my images but the reconstruction of the
> image (apply the warp filter to the moving image) gets noisy.
> 
> 
> 
>