[Insight-users] Computing the gradient in the Metric?

motes motes mort.motes at gmail.com
Sat Sep 5 14:31:18 EDT 2009


In itkMeanSquaresImageToImageMetric.txx the metric value and the
gradient is computed. I pretty much understand how the metric value is
computed but am a bif confused on how the gradient is computed:




      const RealType movingValue  = this->m_Interpolator->Evaluate(
transformedPoint );
      const TransformJacobianType & jacobian =
this->m_Transform->GetJacobian( inputPoint );
      const RealType fixedValue     = ti.Value();
      this->m_NumberOfPixelsCounted++;
      const RealType diff = movingValue - fixedValue;
      measure += diff * diff;

      for(unsigned int par=0; par<ParametersDimension; par++)
        {
        RealType sum = NumericTraits< RealType >::Zero;
        for(unsigned int dim=0; dim<ImageDimension; dim++)
          {
          sum += 2.0 * diff * jacobian( dim, par ) * gradient[dim];
          }
        derivative[par] += sum;
        }
      }

It basically comes down to this line:



          sum += 2.0 * diff * jacobian( dim, par ) * gradient[dim];

why is the jacobian multiplied with the current gradient?


More information about the Insight-users mailing list