[Insight-users] Newbie question: change transform in multi-resolution registration

M.Staring at lumc.nl M.Staring at lumc.nl
Fri Jun 5 10:06:33 EDT 2009


Hi Patrik, 

Instead of 

FixedImageType  fixedImage  = registration->GetFixedImage();
MovingImageType movingImage = registration->GetMovingImage();

use

FixedImageType::Pointer  fixedImage  = registration->GetFixedImage();
MovingImageType::Pointer movingImage = registration->GetMovingImage();

Cheers,

Marius

> -----Original Message-----
> From: insight-users-bounces at itk.org 
> [mailto:insight-users-bounces at itk.org] On Behalf Of Patrik.Br.
> Sent: Friday, June 05, 2009 3:54 PM
> To: insight-users at itk.org
> Subject: [Insight-users] Newbie question: change transform in 
> multi-resolution registration
> 
> 
> Hello, 
> 
> I just started using ITK so bare with me. I would like to change the
> transform in multi-resolution registration using an Observer. 
> I started from
> the example "MultiResImageRegistration1" included in ITK, and 
> an observer is
> already used to change some parameters in the optimizer so I 
> thought this
> would be easy. 
> 
> I wanted to change from the TranslationTransform to the
> CenteredRigid2DTransform, and added this to the last 
> registration level:
> 
> const   unsigned int    Dimension = 2;
> 	  typedef  float  PixelType;
> 	  typedef itk::Image< PixelType, Dimension >  FixedImageType;
> 	  typedef itk::Image< PixelType, Dimension >  MovingImageType;
> 
> 	  typedef itk::CenteredRigid2DTransform< float > TransformType;
> 	  TransformType::Pointer transform = TransformType::New();
> 
> 	  typedef 
> itk::CenteredTransformInitializer<TransformType,	FixedImageType,
> MovingImageType > TransformInitializerType;
> 
> 	  TransformInitializerType::Pointer initializer =
> TransformInitializerType::New();
> 
> 	  FixedImageType  fixedImage  = 
> registration->GetFixedImage(); // <--- This
> is apparently not ok!
> 	  MovingImageType movingImage = registration->GetMovingImage();
> 	  initializer->SetTransform(    transform );
> 	  initializer->SetFixedImage(	fixedImage );
> 	  initializer->SetMovingImage(	movingImage);
> 	  initializer->MomentsOn();
> 	  initializer->InitializeTransform();
> 	  transform->SetAngle( 0.0 );
> 
> 	  
> registration->SetInitialTransformParameters(transform->GetPara
> meters() );
> 
> I get the error: error C2440: 'initializing' : cannot convert 
> from 'const
> itk::Image<TPixel,VImageDimension> *' to
> 'itk::Image<TPixel,VImageDimension>'
> 
> What am I not doing right? I've been using matlab for a long 
> time, but C++
> is kind of new to me. Any help appreciated!
> 
> //Patrik
> -- 
> View this message in context: 
> http://n2.nabble.com/Newbie-question%3A-change-transform-in-mu
> lti-resolution-registration-tp3030421p3030421.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
> 
> 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
> 
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 8.5.339 / Virus Database: 270.12.53/2156 - Release 
> Date: 06/05/09 06:24:00
> 


More information about the Insight-users mailing list