[Insight-users] 'itk::ImageRegistrationMethod<TFixedImage, TMovingImage>::SetTransform' : cannot convert parameter 1 from 'itk::SmartPointer<TObjectType>' to 'itk::Transform<TScalarType, NInputDimensions, NOutputDimensions> *'

Siddharth Srivastava siddys at gmail.com
Fri Nov 4 12:54:07 EDT 2011


Hi Cagatay,
      I sort of realised my error late last night! Thanks for the response.
sid.

On Fri, Nov 4, 2011 at 12:58 AM, cagatay bilgin <bilgincc at gmail.com> wrote:

> Hi Siddharth,
>
> Try changing unsigned char to double here
>
> typedef itk::AffineTransform<unsigned char, 2> TransformType;
>
> From http://www.itk.org/Doxygen/html/classitk_1_1AffineTransform.html
> "There are two template parameters for this class:
>
> ScalarT The type to be used for scalar numeric values. Either float or
> double."
> Regards,
> Cagatay
>
> On Thu, Nov 3, 2011 at 1:58 PM, Siddharth Srivastava <siddys at gmail.com>wrote:
>
>> Hi ITK users,
>>
>>       I am trying to implement, following the example given in the ITK
>> guide, an affine registration
>> routine. Somewhere at the top of the code, I set
>>
>>     typedef itk::AffineTransform<unsigned char, 2> TransformType;
>>     typedef itk::RegularStepGradientDescentOptimizer OptimizerType;
>>     typedef itk::LinearInterpolateImageFunction< BFrameType, double >
>> InterpolatorType;
>>     typedef itk::MeanSquaresImageToImageMetric< BFrameType, BFrameType >
>> MetricType;
>>     typedef itk::ImageRegistrationMethod<BFrameType, BFrameType>
>> RegistrationType;
>>
>> // then I create the necessary smart pointers to objects
>>
>>     TransformType::Pointer transform = TransformType::New();
>>     OptimizerType::Pointer optimizer = OptimizerType::New();
>>     InterpolatorType::Pointer interpolator = InterpolatorType::New();
>>     RegistrationType::Pointer registration = RegistrationType::New();
>>     MetricType::Pointer metric = MetricType::New();
>>
>> // and then I associate them to the registration filter:
>>      registration->SetOptimizer( optimizer );
>>     registration->SetTransform( transform ); // *error on this line*
>>     registration->SetInterpolator (interpolator );
>>     registration->SetMetric( metric );
>>
>> // including the reference and floating images
>>
>>     registration->SetFixedImage(  ref ) ;
>>     registration->SetMovingImage( flt );
>>
>> during the build (on MS Visual studio 2010) I get the following error:
>>
>> Error    12    error C2664:
>> 'itk::ImageRegistrationMethod<TFixedImage,TMovingImage>::SetTransform' :
>> cannot convert parameter 1 from 'itk::SmartPointer<TObjectType>' to
>> 'itk::Transform<TScalarType,NInputDimensions,NOutputDimensions> *'
>>
>> Can anyone help with useful insights?
>>
>> Thanks,
>> Sid.
>>
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.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
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20111104/936d6b48/attachment.htm>


More information about the Insight-users mailing list