[Insight-users] Fwd: [ITK4] ITK/Examples/Registration/ImageRegistrationMethodBSpline

Vivien Delmon vivien.delmon at creatis.insa-lyon.fr
Mon Oct 3 03:33:36 EDT 2011


On 09/30/2011 04:57 PM, Nicholas Tustison wrote:
> Hi Vivien,

Hi,

> In an attempt to improve the B-spline transform in itk, we made a couple
> changes
> which you've noticed.
>
> 1) We removed the bulk transform
> 2) We corrected incorrect behavior for even spline orders
> 3) We changed the api to make things easier for the user.
>
> Your inquiry concerns item 3). To make things more clear, we need to
> distinguish
> between the B-spline mesh and the corresponding control point grid. You can
> think of the B-spline mesh in the same way as a FEM mesh---elements, or
> patches,
> linked together in N-dimensions with some continuity constraints joining
> them.

It's what I though but I couldn't find the confirmation in the 
documentation or something.

> The domain of the B-spline mesh is the domain of the B-spline transform.
> However,
> that is not the case with the B-spline control point grid, which,
> depending on the
> order, extends beyond the transform domain. Most users will have some
> idea of
> the transform domain but would require some B-spline familiarity to be
> able to
> translate that to specifying the control point configuration. The new
> API changes
> hides all that complexity from the user.

Which is great but it should definitely be somewhere in the 
documentation for users that are familiar with B-splines.

> As for your specific question---the meshSize (which is *not* the control
> point grid
> size) is the number of elements comprising the transform domain in each
> dimension.
> The relationship between the number of elements in a single dimension
> and the
> number of control points in that dimension is given by
>
> meshSize[d] = controlPointGridSize[d] - SplineOrder.
>
> As for the wiki example, it appears to have a small mistake with the
> following lines.
>
>    unsigned  int  numberOfGridNodesInOneDimension=  5;
>    meshSize.Fill(  numberOfGridNodesInOneDimension-  SplineOrder);
>
>
> In order for it to be analogous to ITKv3, one shouldn't subtract the
> SplineOrder.
> It would probably be more accurate for the first line to be something like
>
> unsigned int numberOfMeshElementsInOneDimension = 5;

To be consistent with the itk3 version of the wiki example I would have 
put something like :

meshSize.Fill( 5 ); // gridBorderSize automatically handled

instead of:

unsigned int numberOfGridNodesInOneDimension = 5;
meshSize.Fill( numberOfGridNodesInOneDimension - SplineOrder );

since in the itk3 part you have:

gridSizeOnImage.Fill( 5 );
gridBorderSize.Fill( 3 );    // Border for spline order = 3 ( 1 lower, 2 
upper )
totalGridSize = gridSizeOnImage + gridBorderSize;

everyone should notice the difference.

The other problem I got with the wiki example is about LBFGS which fail 
with my itk4 version giving a completely wrong output.png

stdout :
Intial Parameters =
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0]

Starting Registration
*************************************************
   N=128   NUMBER OF CORRECTIONS=5       INITIAL VALUES F= 5410.08 
GNORM= 114.898
*************************************************
    I   NFN    FUNC        GNORM       STEPLENGTH
    1    2      5253.912      90.426       0.009
    2    5      3105.967      80.089      10.500
    3    6      2545.817      26.067       0.500
  IFLAG= -1  LINE SEARCH FAILED. SEE DOCUMENTATION OF ROUTINE MCSRCH 
ERROR RETURN OF LINE SEARCH: INFO= 3 POSSIBLE CAUSES: FUNCTION OR GRADI
Optimizer stop condition = LBFGSOptimizer: Failure
Last Transform Parameters
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3.97452e-05, -0.598177, -3.90334, 
-1.91732, -0.0382383, 0, 0, 0, 0.00760074, -15.0278, -67.7895, -17.649, 
0 4.33749, 19.1369, 11.4577, 0.383461, 0, 0, 0, 0.000436145, 0.0193789, 
0.0853397, 0.0409819, 0.00064904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 00, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

Thanks for your detailed answer,
Kind Regards,

> Begin forwarded message:
>
>> *From: *Bill Lorensen
>> <bill.lorensen at gmail.com
>> <mailto:bill.lorensen at gmail.com>>
>> *Subject: **Fwd: [Insight-users] [ITK4]
>> ITK/Examples/Registration/ImageRegistrationMethodBSpline*
>> *Date: *September 30, 2011 10:36:03 AM EDT
>> *To: *Nick Tustison <ntustison at wustl.edu
>> <mailto:ntustison at wustl.edu>>
>>
>> ---------- Forwarded message ----------
>> From: Vivien Delmon <vivien.delmon at creatis.insa-lyon.fr
>> <mailto:vivien.delmon at creatis.insa-lyon.fr>>
>> Date: Thu, Sep 29, 2011 at 12:14 PM
>> Subject: [Insight-users] [ITK4]
>> ITK/Examples/Registration/ImageRegistrationMethodBSpline
>> To: insight-users at itk.org
>> <mailto:insight-users at itk.org>
>>
>>
>> Dear all,
>>
>> I am porting clitk tools to itk4 and I saw that the
>> itkBSplineTransform's API changed. I tried to understand how it works
>> with the example you written here :
>> http://www.itk.org/Wiki/ITK/Examples/Registration/ImageRegistrationMethodBSpline#ImageRegistrationMethodBSpline.cxx
>>
>> But I could not figure out why you subtract the SplineOrder from the
>> meshSize in the itk4 version :
>>
>> unsigned int numberOfGridNodesInOneDimension = 5;
>> meshSize.Fill( numberOfGridNodesInOneDimension - SplineOrder );
>>
>> I compiled the example with itkv3 / itkv4 and the only way I found to
>> get the same number of parameters is by removing this subtraction. Is
>> there something wrong on the wiki page or am I misunderstood something
>> ? Moreover removing this subtract doesn't give the same result as the
>> itkv3 version. What is the right way to have similar result with itkv3
>> and itkv4 ?
>>
>> King Regards,

-- 
Vivien Delmon
PhD student at CREATIS, Lyon
Supported by ANRT and ELEKTA
http://www.creatis.insa-lyon.fr/rio



More information about the Insight-users mailing list