[Insight-users] Computing the Metric?
motes motes
mort.motes at gmail.com
Mon Aug 17 18:53:25 EDT 2009
As I understand the metric is calculated using the fixedImage, movingImage
and the current transform parameters based on the following approach:
1) Apply transform parameters to the movingImage (transform moving image
into the fixed image space, itkSoftwareGuide Figure 8.43 page 410 [*] ).
2) Run through the fixed and moving image indicies and sum the intensity
difference.
But when I look into the code of:
itkMeanSquaresImageToImageMetric.txx
it seems that its not how its done.
The function:
GetValueAndDerivative(const TransformParametersType & parameters,
MeasureType & value, DerivativeType & derivative)
const
computes the metric value and the gradient. Its basically done by running
through the fixed image and summing the difference between the fixed image
values and the transformed fixed image values:
const RealType diff = movingValue - fixedValue;
measure += diff * diff;
where:
OutputPointType transformedPoint = this->m_Transform->TransformPoint(
inputPoint ); // Using the current fixed image inputPoint
const RealType movingValue = this->m_Interpolator->Evaluate(
transformedPoint );
const RealType fixedValue = ti.Value(); // The current value of the
pixel in the fixed image.
As I understand the current transform parameters are applied to the fixed
image and the corresponding transformed pixel value is computed. So the
'measure' is actually the difference between the fixed and the transformed
fixed image:
1) measure = fixed - T(fixed)
But should the metric not be computed between the fixed and the transformed
Moving image as described in the itkSoftwawreGuide:
2) measure = fixed - T(moving)
?
* Caption Figure 8.43:
"The moving image is mapped into the fixed image space under some spatial
transformation.
An iterator walks through the fixed image and its coordinates are mapped
onto the moving image."
Later on the same page:
"Figure 8.43 (left) illustrates the mapping of the fixed image space onto
the moving image space.
The transform maps points from the fixed image coordinate system onto the
moving image coordinate system"
I assume that the second quote is similar to the implementation, but I still
don't see how that is correct.
while(!ti.IsAtEnd())
{
index = ti.GetIndex();
InputPointType inputPoint;
fixedImage->TransformIndexToPhysicalPoint( index, inputPoint );
if( this->m_FixedImageMask && !this->m_FixedImageMask->IsInside(
inputPoint ) )
{
++ti;
continue;
}
OutputPointType transformedPoint = this->m_Transform->TransformPoint(
inputPoint );
if( this->m_MovingImageMask && !this->m_MovingImageMask->IsInside(
transformedPoint ) )
{
++ti;
continue;
}
if( this->m_Interpolator->IsInsideBuffer( transformedPoint ) )
{
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;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090818/6d4ea1f3/attachment-0001.htm>
More information about the Insight-users
mailing list