<span class="gmail_quote"><br></span>Hi Luis,<br><br>I read about your lectures about registration and want to plot the metric. There is an error :( What's wrong?<br><br>error LNK2001: Nichtaufgeloestes externes Symbol "protected: virtual void __thiscall itk::CostFunction::PrintSelf(class std::basic_ostream<char,struct std::char_traits<char> > &,class itk::Indent)const " (?PrintSelf@CostFunction@itk@@MBEXAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@VIndent@2@@Z)<br>
<br><br>I add ITKCommon and ITKIO in the library<br>TARGET_LINK_LIBRARIES(HelloWorld ITKCommon ITKIO)<br><br>--program--<br><br>#include "itkImage.h"<br>#include "itkImageFileReader.h"<br>#include "itkMeanSquaresImageToImageMetric.h"<br>
#include "itkMattesMutualInformationImageToImageMetric.h"<br>#include "itkLinearInterpolateImageFunction.h"<br>#include "itkTranslationTransform.h"<br>#include <iostream><br><br>int main()<br>
{<br> const unsigned int ImageDimension = 2;<br> typedef unsigned char PixelType;<br> typedef itk::Image< PixelType, ImageDimension > ImageType;<br> typedef itk::ImageFileReader< ImageType > ReaderType;<br>
<br> ReaderType::Pointer ImageReader = ReaderType::New();<br> ImageReader->SetFileName( "leber1.TIF");<br> ImageReader->Update();<br> ImageType::Pointer input = ImageReader->GetOutput();<br>
<br> typedef itk::LinearInterpolateImageFunction< ImageType, double > InterpolatorType;<br> InterpolatorType::Pointer interpolator = InterpolatorType::New();<br><br><br> typedef itk::TranslationTransform< double, ImageDimension > TransformType;<br>
TransformType::Pointer transform = TransformType::New();<br><br> typedef itk::MeanSquaresImageToImageMetric< ImageType, ImageType > MetricType;<br> MetricType::Pointer metric = MetricType::New();<br><br>
metric->SetInterpolator( interpolator );<br>
metric->SetTransform( transform );<br><br> metric->SetFixedImage( input );<br> metric->SetMovingImage( input );<br><br> MetricType::TransformParametersType translation( ImageDimension );<br><br> double value[21][21];<br>
<br> for( int dx = 0; dx <= 20; dx++) <br> {<br> for( int dy = 0; dy <= 20; dy++)<br> {<br> translation[0] = dx;<br> translation[1] = dy;<br><br> value[dx][dy] = metric->GetValue( translation );<br>
}<br> }<br><br>}<br><br><br>Thanks and have nice weekend!<br><br>Sophie<br>