[Insight-users] how to calculate displacement from B-Spline parameters

M.Staring at lumc.nl M.Staring at lumc.nl
Wed Oct 29 04:35:15 EDT 2008


Hi Pinpress,

you can compute the displacement of a point x by calling the
TransformPoint() function from the B-spline transform:

PointType x, y, displacement;
// you fill it with whatever point you are interested in
y = bSplineTransform->TransformPoint( x );
displacement = y - x;

In case you want to compute these things afterwards, you will have to
store all information that defines a BSplineDeformableTransform. That is
not only the parameters, but also information about the grid:
GridRegion, GridSpacing, GridOrigin, GridDirection. And of course the
BulkTransform, the dimension of your data, and the spline order. Then
the simplest thing to do is create a new BSplineDeformableTransform and
feed all this data to it, then call the TransformPoint() again.

Hope this helps,

Marius Staring

> -----Original Message-----
> From: insight-users-bounces at itk.org 
> [mailto:insight-users-bounces at itk.org] On Behalf Of pinpress
> Sent: Wednesday, October 29, 2008 4:01 AM
> To: insight-users at itk.org
> Subject: [Insight-users] how to calculate displacement from 
> B-Spline parameters
> 
> 
> Hi,
> 
> I can run Registration example code: 
> DeformableRegistration15.cxx to perform
> rigid, affine and then BSPline registration to two 3D image sets
> artificially created by scaling the fixed image radially at 
> the center to
> generate the moving image. To make my life a little easier, I 
> disabled the
> rigid, affine and coarse BSpline registrations by setting their
> corresponding # of iterations to 0. So I am only dealing with 
> the result of
> the fine BSpline registration with the simple phantom image sets.
> 
> The resampled output image does indeed match with the fixed 
> image. However,
> I am having trouble to calculate the displacement field. For 
> illustration
> purposes, let me denote that both fixed and moving images are of size:
> im(10,10,5). The deformation field file was written to a VTK 
> file, and I was
> able to read in the binary data, "def", of size:
> 
> def(10,10,5,3);
> 
> It is clear that the 4D matrix represents displacement 
> vectors in x, y, and
> z directions at each 10-by-10-by-5 voxel. So, let me denote 
> displacement
> vector along x as dx, which is of size dx(10,10,5). The 
> problem is that only
> the first column of each frame in dx is non-zero, while zero 
> everywhere
> else. This does not make sense to me, because I would expect 
> displacement in
> x and y to be about symmetrical with respect to the center, 
> based on how I
> generated the images in the first place. 
> 
> Then I tried to write the BSPline parameters:  finalParameters =
> registration->GetLastTransformParameters();  to an ascii 
> file. I was able to
> find out that the number of parameters is: (N+2)^3*3, where N 
> is the number
> of grid I choose. From here, I can get the parametric matrix 
> corresponding
> to x, y, and z, such that "tx" would be of size 
> (N+2)-by-(N+2)-by(N+2). My
> problem is that I do not know how to proceed from here to 
> calculate the
> displacement vectors at each voxel. Specifically,
> 
> 1). Where are these BSpline grids located with respect to the 
> image voxels?
> 
> 2). What formula to use to do interpolation?
> 
> 3). If I do not use these parameters, how do I get the 
> explicit displacement
> vectors? From the deformation VTK file? How then?
> 
> Thanks. I appreciate if you can point me to the right direction. 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/how-to-calculate-displacement-from-B-Spl
> ine-parameters-tp20220125p20220125.html
> Sent from the ITK - Users mailing list archive at Nabble.com.
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com 
> Version: 8.0.175 / Virus Database: 270.8.4/1753 - Release 
> Date: 10/28/2008 9:20 PM
> 


More information about the Insight-users mailing list