I got myself confused with the ordering of the parameters of the BSplineTransform. At some point I wrote it down but cannot find that anymore, and now I’m looking at some code that I have written some years ago and don’t know how that worked
I know for sure that the flattened array of the parameters is [x0 x1 .. xn y0 y1 .. yn z0 z1 .. zn]
but what is the order of the coordinates of the control points? I.e., is the x coordinate the fast coordinate or the z coordinate?
The user specifies the parameters as one flat array: each N-D grid is represented by an array in the same way an N-D image is represented in the buffer; the N arrays are then concatenated together to form a single array.
and from C order or F order? - #2 by dzenanz I read, that the order of N-D images is C - thus the z-coordinate is the fastest, correct?
Thus, if I use this code:
import numpy as np
import SimpleITK as sitk
s = sitk.BSplineTransform(3, 3)
# np.array(s.GetParameters()).reshape(-1, 3, order='C') # edit: no, not like that!
np.vstack(np.split(np.array(tx.GetParameters()), tx.GetDimension())).T
I would get the control point displacements in the following order of control points indices of the grid:
x, y, z
-------
0, 0, 0
0, 0, 1
0, 0, 2
0, 0, 3
0, 1, 0
0, 1, 1
...
0, 3, 3
1, 0, 0
1, 0, 1
...
3, 3, 3
Is that correct?