[Insight-users] Transformation of an image after registration
Abayiz
abayiz at yahoo.com
Thu Apr 12 07:22:58 EDT 2012
Hello,
I've performed registration using "VersorRigid3DTransform", and now want to perform transformation on original moving image with these registration result parameters. For doing that, I tried taking the inverse of the registration then give it to the affine transform type. Here is my partial code:
**************************************
typedef itk::AffineTransform< double, 3 > AffineType;
AffineType::Pointer affine = AffineType::New();
//finalTransform->SetParameters( finalParameters );
affine->SetMatrix( transform->GetRotationMatrix() );
affine->SetOffset( transform->GetOffset() );
AffineType::Pointer invTransform = affine->GetInverseTransform();
AffineType::MatrixType invmatrix = invTransform->GetMatrix();
AffineType::OffsetType invoffset = invTransform->GetOffset();
ResampleFilterType::Pointer invresampler = ResampleFilterType::New();
invresampler->SetTransform( invTransform );
invresampler->SetInput( movingImageReader->GetOutput() );
FixedImageType::Pointer invImage = movingImageReader->GetOutput();
invresampler->SetSize( movingImageReader->GetLargestPossibleRegion().GetSize() );
invresampler->SetOutputOrigin( movingImageReader->GetOrigin() );
invresampler->SetOutputSpacing( movingImageReader->GetSpacing() );
invresampler->SetOutputDirection( movingImageReader->GetDirection() );
invresampler->SetDefaultPixelValue( 100 );
*********************************************
Then I got this error:
error: conversion from ‘itk::SmartPointer<itk::TransformBase>’ to non-scalar type ‘itk::SmartPointer<itk::AffineTransform<double, 3u> >’ requested
Why the datatype is wrong here? Does affine transform only accept non-scalar type? Besides, is my method correct for what I want to do?
Thank you very much in advance !
Regards,
Abayiz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120412/54975624/attachment.htm>
More information about the Insight-users
mailing list