Parameters in BSplineTransform

I’m trying to register images using BSplineTransform. I’m not clear about the total number of parameters in case of BSplineTransform. In the case of AffineTransform, for 3D images, there are 12 parameters and I can count them as the parameters from translation and affine matrix. Can the number of parameters in BSplineTransform be understood in the same way? For a BSplineTransform consisting of cubic spline for the 2D image, the number of parameters is 32. Can someone guide me to some relevant literature regarding the parameters of BSplineTransform or provide some intuition. I have some understanding of BSpline curves, control points and their formation. However, I am not able to get the reasoning behind the total number of parameters while using BSplineTransform in sitk. Thanks in advance :slight_smile:

Hello @prms,

The number of parameters of your BSpline transform depends on your settings, it isn’t a constant as with the 3D Affine. It is defined by the grid mesh size SetTransformDomainMeshSize and the spline order specified in the BSplineTransform constructor.

For example if we set the mesh size for a 2D BSplineTransform to [4,3] and use a cubic spline order then the actual mesh size used becomes [4+3, 3+3], and as we are in 2D the total number of parameters is 7*6*2. The parameters denote the delta/motion of the control points from their original positions. The more complex the deformation you need, the more control points and thus more parameters. For additional details, please take a look at the original ITK documentation, section titled “Detailed Description”.

4 Likes

Thanks @zivy :). You’ve been of great help.

Hey, @prms. You can play with this gist I made some months ago to understand this myself: https://gist.github.com/fepegar/b723d15de620cd2a3a4dbd71e491b59d

3 Likes

Thanks…great resource

The parameters of the B-spline transform are the control points ( B-spline coefficients). ITK implementation is based on Unser paper. EPFL website offers nice presentations like this, and also an open-source for the implementation as well.

2 Likes

Hi @zivy, what is the reason behind adding spline order to mesh size? Can you point me to any reference/paper/maths that is used in SITK implementation of BSplineTransform?

Thanks,

Hi @prms,

This has to do with the treatment of the endpoints of the BSpline knot sequence, so that they have full support. For a brief overview see wikipedia. If you are really interested in the mathematics underlying BSplines I suggest reading the B(asic)-Spline Basics by Carl de Boor.

2 Likes

Hi @zivy. Thank you very much for your help. I have a question regarding the fixed parameters of BSplineTransform. I am able to figure out only the direction information and physical dimensions. What are other values besides them?
(4.0, 4.0, 4.0, -103.73715145372455, -202.6718723955285, -141.98029754218416, 111.20492252847637, 111.20492553856869, 125.05145394429641, 0.7835580706596375, 0.26198989152908325, -0.5633809566497803, 0.03123663179576397, 0.888992965221405, 0.45685410499572754, 0.6205328702926636, -0.3755699396133423, 0.6883939504623413)

For this set of fixed parameters, last 9 are direction cosines, values from position 7 to 9 are physical dimensions. What do the first 6 values denote? This might be a basic question. I looked for this in the doc but couldn’t get the answer.

Hello @prms,

Most people aren’t interested in this as it has to do with the inner workings of the transformation, good to see someone interested in the details:

  1. First three or two parameters, depending on dimensionality, are the number of control points used by the BSpline, this depends on the mesh size you specify and the spline order (number_of_control_points = mesh_size + spline_order). The default spline order is three.
  2. The second three/two parameters are the physical coordinates of the first control point. This is dependent on the user selected mesh_size, origin and spline order. For instance if your spline order is three, there is one control point added before your original specified mesh (two added at the other end). Using the origin as the location of the user specified mesh, the first control point is located at origin-mesh_spacing.

For further details please see the ITK documentation.

2 Likes