[Insight-users] Marching Cubes itkReadITKImage3DSegmentShowVTK
zhang xiaohui
comet1986 at gmail.com
Fri Apr 25 10:54:04 EDT 2008
Hi Luis,
I read about your lectures about registration and want to plot the metric.
There is an error :( What's wrong?
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 at CostFunction@itk@@MBEXAAV?$basic_ostream at DU?$char_traits at D@std@
@@std@@VIndent at 2@@Z)
I add ITKCommon and ITKIO in the library
TARGET_LINK_LIBRARIES(HelloWorld ITKCommon ITKIO)
--program--
#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkMeanSquaresImageToImageMetric.h"
#include "itkMattesMutualInformationImageToImageMetric.h"
#include "itkLinearInterpolateImageFunction.h"
#include "itkTranslationTransform.h"
#include <iostream>
int main()
{
const unsigned int ImageDimension = 2;
typedef unsigned char PixelType;
typedef itk::Image< PixelType, ImageDimension > ImageType;
typedef itk::ImageFileReader< ImageType > ReaderType;
ReaderType::Pointer ImageReader = ReaderType::New();
ImageReader->SetFileName( "leber1.TIF");
ImageReader->Update();
ImageType::Pointer input = ImageReader->GetOutput();
typedef itk::LinearInterpolateImageFunction< ImageType, double >
InterpolatorType;
InterpolatorType::Pointer interpolator = InterpolatorType::New();
typedef itk::TranslationTransform< double, ImageDimension >
TransformType;
TransformType::Pointer transform = TransformType::New();
typedef itk::MeanSquaresImageToImageMetric< ImageType, ImageType >
MetricType;
MetricType::Pointer metric = MetricType::New();
metric->SetInterpolator( interpolator );
metric->SetTransform( transform );
metric->SetFixedImage( input );
metric->SetMovingImage( input );
MetricType::TransformParametersType translation( ImageDimension );
double value[21][21];
for( int dx = 0; dx <= 20; dx++)
{
for( int dy = 0; dy <= 20; dy++)
{
translation[0] = dx;
translation[1] = dy;
value[dx][dy] = metric->GetValue( translation );
}
}
}
Thanks and have nice weekend!
Sophie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20080425/6971f51f/attachment.htm>
More information about the Insight-users
mailing list