[Insight-developers] accessing metrics

Brian B Avants avants@grasp.cis.upenn.edu
Wed, 30 Jan 2002 20:41:57 -0500 (EST)


Hello,

I would like to access the existing img to img metrics (MI, XCOR, MSQ,
etc)  by using, for example, a function like this --

MeanSquaresImageToImageMetric<TTarget,TMapper>
::GetValueAtPointInRegion( const ParametersType & parameters ,
  				Point, RegionSize)
{

  TargetConstPointer target = Superclass::GetTarget();

  TTarget::SizeType targetSize = {{RegionSize,RegionSize}};
  TTarget::IndexType targetIndex = {{Point[0],Point[1]}};
  TTarget::RegionType targetRegion;

  targetRegion.SetSize( targetSize );
  targetRegion.SetIndex( targetIndex );

  .... etc ....

  return MetricValue;

}


and similarly for the derivative of the metric.

This would be nice to have for all metrics, if possible.

it would also be nice if the metrics could act as filters too. that is,
they can output a scalar image of metric magnitudes and a vector image of
metric derivatives, given some RegionSize.

The reason is, given a non-linear vector field, we could evaluate these
metrics over local regions by varying the parameters to a translation
mapper.  For example,


RegionSize=3;
for( pt = startpt, pt = endpoint, pt++) // all pts in Reference Image
    {
    TranslationParameters[] = VectorField at pt;
    TargetPt = pt + (VectorField at pt);
    metric->GetValueAndDerivativeAtPointInRegion( TranslationParameters,
          TargetPt, RegionSize, MetricValue,  MetricDerivative );
   }
   ...

then apply some deformation based on these values.

I could inherit from the metric classes and define these functions therein
but they seem natural to have in the original classes.
It would be relatively easy to write the meansquares filter using
neighborhood iterators, but it's not as obvious for MI.

Maybe i am missing something and this capability exists in some
combination of things i don't know about ...

let me know what you think,

Brian