[Insight-users] Pixel difference between two images
robert tamburo
robert.tamburo at gmail.com
Wed Oct 5 09:37:35 EDT 2011
I lost track of your exact problem, but it looks like you need to 1) update
the reader, i.e.,
reader->SetFileName("Image.png");
reader->Update();
and 2) initialize the metric, i.e.,
metric->Initialize();
cout<<endl<< metric->GetValue( params ) << endl ;
On Tue, Oct 4, 2011 at 8:24 PM, soheilghafurian
<soheilghafurian at yahoo.com>wrote:
> 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<<endl<< metric->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.
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20111005/469153c7/attachment.htm>
More information about the Insight-users
mailing list