[Insight-users] Pixel difference between two images

soheilghafurian soheilghafurian at yahoo.com
Tue Oct 4 20:24:25 EDT 2011


Hi Cory

Thanks a lot for your time and consideration. In order to test it, I wrote a
one page code, and it has the same problem. Here is my code. I think there
is a part that should be added, but I don't know what it is.

#include "itkImage.h"
#include "itkImageFileReader.h"
#include <itkMeanSquaresImageToImageMetric.h>
#include <itkIdentityTransform.h>
 
#include "QuickView.h"

using namespace std ;
 
int main()
{
  typedef itk::Image< double, 2 >         ImageType;
  typedef itk::ImageFileReader<ImageType> ReaderType;
 
  ReaderType::Pointer reader = ReaderType::New();
  reader->SetFileName("Image.png");
 
  QuickView viewer;
  viewer.AddImage<ImageType>(reader->GetOutput());
  

  ImageType::Pointer FixedImage = reader->GetOutput() ;
  ImageType::Pointer MovingImage = reader->GetOutput() ;

  typedef itk::MeanSquaresImageToImageMetric < ImageType , ImageType >
MetricType ;
  typedef itk::IdentityTransform < double , 2 > TransformType ;

  MetricType::Pointer metric = MetricType::New() ;
  TransformType::Pointer transform = TransformType::New() ;

  metric->SetFixedImage( FixedImage ) ;
  metric->SetMovingImage( MovingImage ) ;
  metric->SetTransform( transform ) ;

  TransformType::ParametersType params ;

  cout<&lt;endl&lt;&lt; metric-&gt;GetValue( params ) << endl ;

  viewer.Visualize();
 
  return EXIT_SUCCESS;
}

--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Pixel-difference-between-two-images-tp6832343p6860559.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.


More information about the Insight-users mailing list