[Insight-users] Compile error: Metric->SetTransform( X )?

IsabelleNg isabelleNg at homeworking.org
Fri Jan 14 15:22:28 EST 2011


Dear Users,

I am stuck with following error for days now and would appreciate any help.
Code is below. Everything compiled/run fine until I added the line
highlighted below.

Compilation error is:

7	error C2664:
'itk::ImageToImageMetric<TFixedImage,TMovingImage>::SetTransform' : cannot
convert parameter 1 from 'itk::SmartPointer<TObjectType>' to
'itk::Transform<TScalarType,NInputDimensions,NOutputDimensions> *'
Processing


Thanks a lot!
Ng

================================= 

#include <iostream>
using namespace std;
 
typedef itk::VersorRigid3DTransform< double >  VTransformType;
typedef double PixelType;

 
template <unsigned int Dim> int CalcMI( int argc, char *argv[] )
{
     
  VTransformType::Pointer transform = VTransformType::New();
  transform->SetIdentity();  

  typedef itk::Image<PixelType, Dim> ImageType;

  typedef itk::ImageFileReader<ImageType> FileReaderType;
  typename FileReaderType::Pointer  imageReader;
  imageReader = FileReaderType::New();

  <do something >

  typename ImageType::Pointer    image1;
  image1 = ImageType::New();
  imageReader->GetOutput();


  typedef itk::MattesMutualInformationImageToImageMetric< ImageType,
ImageType > FilterType;

  typedef typename FilterType::Pointer   MetricPointerType;
  MetricPointerType metric = FilterType::New();
  metric->SetFixedImage( image1 );  
  metric->SetMovingImage( image2 );


  metric->SetFixedImageRegion( region1 );	
  metric->SetTransform(  transform );   //<=============== problematic
line!!
  metric->Initialize();
}

int main( int argc, char *argv[] )
{
	bool status=0;
        int ndim = atoi(argv[1]);

	if ( ndim== 2 )
	    status=CalcMI< 2 >( argc, argv);
	else
	    status=CalcMI< 3 >( argc, argv);
	return status;
}

-- 
View this message in context: http://old.nabble.com/Compile-error%3A-Metric-%3ESetTransform%28-X-%29--tp30669777p30669777.html
Sent from the ITK - Users mailing list archive at Nabble.com.



More information about the Insight-users mailing list