Dear Luis,<br><br> Thank you so much for your quick and detailed response. But I still have a doubt. I appreciate that you pointed out, " there is a difference between computing the gradient of the moving image in the coordinate system of the moving image, and then mapping that back to the coordinate system of the fixed image, and mapping the<br>
moving image to the coordinate system of the fixed image and then computing the gradient with respect to the coordinate system of the fixed image". I believe the code I came cross with belongs to the latter case. But, when the gradient with respect to the coordinate system of the fixed image is obtained and an increment (update) of the deformation field calculated accordingly, how is the increment (update) combined to the original deformation? This is what perplexed me a lot. Simply adding it back to the original deformation field sounds not quite right to me. Please give me some guidance. Thank you.<br>
<br>Sincerely,<br><br>Hua-mei Chen <br>
<br><br><div class="gmail_quote">On Wed, Jun 3, 2009 at 10:15 PM, Luis Ibanez <span dir="ltr"><<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Hi Hua,<br>
<br>
<br>
1) In the case of the MeanSquaresImageMetric,<br>
the Gradient of the moving image is interpolated using<br>
NearestNeighborhood interpolation.<br>
<br>
See lines: 210-217 of<br>
<br>
Insight/Code/Algorithms/itkMeanSquaresImageToImageMetric.txx<br>
<br>
<br>
2) In the case of the SymmetricForcesDemonsRegistration<br>
the gradient of the moving image is computed *after*<br>
mapping the moving image to the coordinate system of<br>
the fixed image.<br>
<br>
See lines: 188-220 of<br>
<br>
Insight/Code/Algorithms/<br>
itkSymmetricForcesDemonsRegistrationFunction.txx<br>
<br>
Note that in this case, this is done "on-demand",<br>
that is, on a pixel-by-pixel basis.<br>
<br>
<br>
<br>
3) In the case of the<br>
itkFastSymmetricForcesDemonsRegistrationFunction<br>
<br>
The gradient is also computed by finite differences<br>
*after* mapping the moving image to the coordinate<br>
system of the fixed image, but this time is not done<br>
on-demand, but the entire moving image is warped<br>
first, and the resulting warped image is used for<br>
computing the gradient.<br>
<br>
See lines: 196 and 151-157 of<br>
<br>
<br>
Insight/Code/Algorithms/<br>
itkFastSymmetricForcesDemonsRegistrationFunction.txx<br>
<br>
Note that there is a difference between computing the<br>
gradient of the moving image in the coordinate system<br>
of the moving image, and then mapping that back to the<br>
coordinate system of the fixed image, and mapping the<br>
moving image to the coordinate system of the fixed image<br>
and then computing the gradient with respect to the<br>
coordinate system of the fixed image.<br>
<br>
<br>
<br>
<br>
Regards,<br>
<br>
<br>
Luis<br>
<br>
<br>
<br>
---------------------<div><div></div><div class="h5"><br>
Hua-mei Chen wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Sorry. I forgot to change the subject of my previous email. Here I re-send it again.<br>
<br>
====================================================================<br>
<br>
Dear ITK Users and Developers,<br>
<br>
In deformable image registration, it is very common to find the image gradient at non-grid positions. For example, to obtain the driving force by taking the derivative of SSD similarity measure. I am wondering how this procedure is implemented in ITK. I used to construct a continuous image based on Bspline model and then find the derivitive at non-grid positions. However, I recently found a MATLAB code which resamples the image based on the current deformation field and then find the gradient at the resampled image. In this way, there is no need to find the gradient at non-grid positions. Afterwards, the gradient information is used to construct the update of the deformation field and the new deformation field is obtained by ADDING the update to the original deformation field. Is this a common practice to implement deformable image registration algorithms like demons, fluid, and FFD in ITK? Any response is appreciated.<br>
<br>
Chen <br>
</blockquote>
</div></div></blockquote></div><br>