<br>Hi Motes<br><br><br>Let&#39;s call<br><br>x = physical point in the fixed image coordinate system<br><br>T = transform<br><br>p = Transform parameters<br><br>x&#39; = T(p,x) = physical point x mapped to moving image <br>
       coordinate system by using the Transform T with<br>       parameters p.<br><br>J = dx&#39; / dp  = Jacobian of mapped point x&#39; with respect<br>       to the Transform parameters p.<br><br><br>Therefore, what Luke meant is that <br>
you can use the chain rule as:<br><br>   dM / dp = ( dM / dx&#39; ) * ( dx&#39; / dp )<br><br>where<br><br>dM / dx&#39;  = Gradient vector of the Moving image<br><br>and<br><br>dx&#39; / dp = Jacobian of the Transform.<br>
<br><br><br>     Regards,<br><br><br>           Luis<br><br><br>------------------------------------------------------------------------------<br><div class="gmail_quote">On Sun, Sep 6, 2009 at 3:38 PM, motes motes <span dir="ltr">&lt;<a href="mailto:mort.motes@gmail.com">mort.motes@gmail.com</a>&gt;</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;">Hm not sure I understand:<br>
<br>
    dM/dx(T(p,x))  * dT/dp:<br>
<br>
<br>
<br>
Don&#39;t you mean:<br>
<br>
    dM/dx&#39;  * dT(p,x)/dp:<br>
<br>
where:<br>
<br>
    x&#39; = T(p,x)<br>
<br>
corresponding to the transformed pixel in the moving image M?<br>
<div><div></div><div class="h5"><br>
<br>
<br>
<br>
<br>
On Sun, Sep 6, 2009 at 5:07 PM, Luke Bloy&lt;<a href="mailto:luke.bloy@gmail.com">luke.bloy@gmail.com</a>&gt; wrote:<br>
&gt; You use the chain rule.<br>
&gt;<br>
&gt; dt/dp = dM(T(p,x))/dp = dM/dx(T(p,x)) * dT/dp<br>
&gt;<br>
&gt; so dM/dx(T(p,x)) is the gradient of the moving image evaluated at T(p,x) and<br>
&gt; dT/dp is the jacobian of the transform.<br>
&gt;<br>
&gt; -luke<br>
&gt;<br>
&gt; motes motes wrote:<br>
&gt;&gt;<br>
&gt;&gt; Ok I am trying to do the metric E differentiation by hand:<br>
&gt;&gt;<br>
&gt;&gt; E = \sum[F(x) - M(T(p,x))]^2<br>
&gt;&gt;   = t^2<br>
&gt;&gt;<br>
&gt;&gt; where:<br>
&gt;&gt;<br>
&gt;&gt; t = F(x) - M(T(p,x))<br>
&gt;&gt;<br>
&gt;&gt; dE/dp = 2t * dt/dp<br>
&gt;&gt;<br>
&gt;&gt; where:<br>
&gt;&gt;<br>
&gt;&gt; dt/dp = dM(T(p,x))/dp<br>
&gt;&gt;<br>
&gt;&gt; since the fixed image is treated as a constant because we are<br>
&gt;&gt; differentiating with respect to the parameters p.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Now I think I understand why its the gradient of the moving image that<br>
&gt;&gt; is used. But how are the Jacobian introduced in:<br>
&gt;&gt;<br>
&gt;&gt; dt/dp = dM(T(p,x))/dp<br>
&gt;&gt;<br>
&gt;&gt; ?<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Sun, Sep 6, 2009 at 3:30 PM, motes motes&lt;<a href="mailto:mort.motes@gmail.com">mort.motes@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Thanks for the hint I have read those pages but I still have two<br>
&gt;&gt;&gt; questions to the below expression:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;         sum += 2.0 * diff * jacobian( dim, par ) * gradient[dim];<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; 1) In the above expression gradient[dim] corresponds to the gradient<br>
&gt;&gt;&gt; for the current pixel in the moving image? On page 249 in the &quot;Insight<br>
&gt;&gt;&gt; Into Images&quot; this is the first term in (10.6). But why are the<br>
&gt;&gt;&gt; gradient of the moving image used to compute the derivative of the<br>
&gt;&gt;&gt; metric? I know this is a very basic question but I still cannot see<br>
&gt;&gt;&gt; the connection.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; 2) When I debug the code the jacobian actually just contains the<br>
&gt;&gt;&gt; weights (computed using the transform kernel) for each node in the<br>
&gt;&gt;&gt; support region. But are the jacobian not supposed to contain the first<br>
&gt;&gt;&gt; order partial derivatives? It seems a bit confusing that the jacobian<br>
&gt;&gt;&gt; is used as a container for the kernel transform weights.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Sun, Sep 6, 2009 at 1:01 PM, Neuner Markus&lt;<a href="mailto:neuner.markus@gmx.net">neuner.markus@gmx.net</a>&gt;<br>
&gt;&gt;&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Hi,<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; To understand why the jacobian is used i would suggest to read pages<br>
&gt;&gt;&gt;&gt; 249-251<br>
&gt;&gt;&gt;&gt; in the Book &quot;Insight Into Images&quot; by Terry S. Yoo. Ther eis described<br>
&gt;&gt;&gt;&gt; how<br>
&gt;&gt;&gt;&gt; and why the jacobian is used.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Greets<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; motes motes wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; In itkMeanSquaresImageToImageMetric.txx the metric value and the<br>
&gt;&gt;&gt;&gt;&gt; gradient is computed. I pretty much understand how the metric value is<br>
&gt;&gt;&gt;&gt;&gt; computed but am a bif confused on how the gradient is computed:<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;     const RealType movingValue  = this-&gt;m_Interpolator-&gt;Evaluate(<br>
&gt;&gt;&gt;&gt;&gt; transformedPoint );<br>
&gt;&gt;&gt;&gt;&gt;     const TransformJacobianType &amp; jacobian =<br>
&gt;&gt;&gt;&gt;&gt; this-&gt;m_Transform-&gt;GetJacobian( inputPoint );<br>
&gt;&gt;&gt;&gt;&gt;     const RealType fixedValue     = ti.Value();<br>
&gt;&gt;&gt;&gt;&gt;     this-&gt;m_NumberOfPixelsCounted++;<br>
&gt;&gt;&gt;&gt;&gt;     const RealType diff = movingValue - fixedValue;<br>
&gt;&gt;&gt;&gt;&gt;     measure += diff * diff;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;     for(unsigned int par=0; par&lt;ParametersDimension; par++)<br>
&gt;&gt;&gt;&gt;&gt;       {<br>
&gt;&gt;&gt;&gt;&gt;       RealType sum = NumericTraits&lt; RealType &gt;::Zero;<br>
&gt;&gt;&gt;&gt;&gt;       for(unsigned int dim=0; dim&lt;ImageDimension; dim++)<br>
&gt;&gt;&gt;&gt;&gt;         {<br>
&gt;&gt;&gt;&gt;&gt;         sum += 2.0 * diff * jacobian( dim, par ) * gradient[dim];<br>
&gt;&gt;&gt;&gt;&gt;         }<br>
&gt;&gt;&gt;&gt;&gt;       derivative[par] += sum;<br>
&gt;&gt;&gt;&gt;&gt;       }<br>
&gt;&gt;&gt;&gt;&gt;     }<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; It basically comes down to this line:<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;         sum += 2.0 * diff * jacobian( dim, par ) * gradient[dim];<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; why is the jacobian multiplied with the current gradient?<br>
&gt;&gt;&gt;&gt;&gt; _____________________________________<br>
&gt;&gt;&gt;&gt;&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; Visit other Kitware open-source projects at<br>
&gt;&gt;&gt;&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; Please keep messages on-topic and check the ITK FAQ at:<br>
&gt;&gt;&gt;&gt;&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt;&gt;&gt;&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; _____________________________________<br>
&gt;&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt;<br>
&gt;&gt; Visit other Kitware open-source projects at<br>
&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt;<br>
&gt;&gt; Please keep messages on-topic and check the ITK FAQ at:<br>
&gt;&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
&gt;&gt;<br>
&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
&gt;&gt;<br>
&gt;<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at: <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</div></div></blockquote></div><br>