<div dir="ltr"><pre style="word-wrap:break-word">Hi all,</pre><pre style="word-wrap:break-word">I am looking at the code for computing the bending energy of a deformation/displacement field in itk.</pre><pre style="word-wrap:break-word">
The part which computes the bending energy one has the following line:</pre><pre style="word-wrap:break-word">bending += pqc.GetSquaredNorm() *<br>      vcl_pow( this->m_HalfDerivativeWeights[i], static_cast<int>(4) );</pre>
<pre style="word-wrap:break-word">This computes the squared bending energy term using the second order derivative of the transformation. One bit I do not understand is the use of the <span style="font-family:arial">this->m_HalfDerivativeWeights[i] term. When I look into the parent class source file, it is defined as:</span></pre>
<pre style="word-wrap:break-word"><div class="" style="font-family:monospace,fixed;font-size:13px;color:rgb(0,0,0);white-space:normal">m_DerivativeWeights[i] =</div><div class="" style="font-family:monospace,fixed;font-size:13px;color:rgb(0,0,0);white-space:normal">
<a name="l00160" style="color:rgb(61,87,140)"></a><span class="" style="color:rgb(0,128,0)">static_cast<</span> TRealType <span class="" style="color:rgb(0,128,0)">></span>( 1.0</div><div class="" style="font-family:monospace,fixed;font-size:13px;color:rgb(0,0,0);white-space:normal">
/ <span class="" style="color:rgb(0,128,0)">static_cast<</span> TRealType <span class="" style="color:rgb(0,128,0)">></span>( this->GetInput()->GetSpacing()[i] ));</div><div class="" style="font-family:monospace,fixed;font-size:13px;color:rgb(0,0,0);white-space:normal">
<a name="l00162" style="color:rgb(61,87,140)"></a>m_HalfDerivativeWeights[i] = 0.5 * m_DerivativeWeights[i];</div><div class="" style="font-family:monospace,fixed;font-size:13px;color:rgb(0,0,0);white-space:normal"><br></div>
<div class="" style="font-family:monospace,fixed;font-size:13px;color:rgb(0,0,0);white-space:normal">Now why is the weight set to 0.5 * spacing. Should we not use the m_DerivativeWeights instead? I am assuming that the second order derivative is calculated as:</div>
<div class="" style="font-family:monospace,fixed;font-size:13px;color:rgb(0,0,0);white-space:normal"><br></div><div class="" style="font-family:monospace,fixed;font-size:13px;color:rgb(0,0,0);white-space:normal">(f(x - h) + f(x + h) - 2 * f(x)) / h^2</div>
<div class="" style="font-family:monospace,fixed;font-size:13px;color:rgb(0,0,0);white-space:normal"><br></div><div class="" style="font-family:monospace,fixed;font-size:13px;color:rgb(0,0,0);white-space:normal">Thanks a lot for any help you can give me.</div>
<div class="" style="font-family:monospace,fixed;font-size:13px;color:rgb(0,0,0);white-space:normal"><br></div><div class="" style="font-family:monospace,fixed;font-size:13px;color:rgb(0,0,0);white-space:normal">Anja</div>
<div class="" style="font-family:monospace,fixed;font-size:13px;color:rgb(0,0,0);white-space:normal"><br></div></pre><pre style="word-wrap:break-word"><span style="font-family:arial;white-space:pre-wrap">-- </span><br></pre>
<div>Cheers,<br><br>Anja
</div></div>