[Insight-users] Similarity measure

Josiane Yankam Njiwa--DEA Clarysse--Fin 11/04 njiwa@creatis.insa-lyon.fr
Fri May 14 11:39:56 EDT 2004


Hello


I have two images and i want to calculate the square difference métric
beetween the two images. I have the code below which is not work and
return zero when i run the programm. Can you help me to solve my problem?
Thanks for your help

Josiane


--------------------------------------------------------------------------
typedef itk::MeanSquaresImageToImageMetric<
                                    FixedImageType,
                                    MovingImageType >    MetricType;
typedef itk::AffineTransform< PixelType, Dimension >  TransformType;
TransformType::Pointer transform = TransformType::New();
MetricType::Pointer         metric        = MetricType::New();
TransformType::OutputVectorType translation;
  translation[0] = 0;  // X translation in millimeters
  translation[1] = 1;  // Y translation in millimeters
  transform->Translate( translation );
  transform->Rotate2D(0,false);
metric->SetFixedImage(    fixedImageReader->GetOutput()    );
metric->SetMovingImage(   caster->GetOutput()   );
metric->SetFixedImageRegion(
fixedImageReader->GetOutput()->GetBufferedRegion() );
const double bestValue = metric->GetValue(transform);
std::cout << " Metric value  = " << bestValue          << std::endl;
---------------------------------------------------------------------------



More information about the Insight-users mailing list