[Insight-users] Visual studio error ... cannot convert parameter 1 from 'itk::SmartPointer<TObjectType>' to 'itk::PDEDeformableRegistrationFilter

Luis Ibanez luis.ibanez at kitware.com
Fri Feb 5 13:45:07 EST 2010


Hi Neil,

We need to know:

A) The *exact* declaration of the method

             SetRegistrationFilter()

     from the file:

        itkRegistrationBasedInterpolatorFilter.h


and

B) The Template parameters that you used
     in order to instantiate the

        tkRegistrationBasedInterpolatorFilter


and

C)  The exact template parameters that you
      used for instantiating:

            BaseRegistrationFilterType


D)  Is your Windows build, a 64 bits one ?

E)  Is your Ubuntu build, a 64bits one ?



----


FYI: Smart Pointers will not do polymorphism.




---------------------------------------------------------------------
On Tue, Feb 2, 2010 at 8:11 PM,  <Neil.Burdett at csiro.au> wrote:
> Visual studio 2008 but the same error also occurs on visual studio 2005, but is okay using gcc under linux
>
> Neil
>
> -----Original Message-----
> From: Mike Jackson [mailto:mike.jackson at bluequartz.net]
> Sent: Tuesday, 2 February 2010 11:20 PM
> To: Burdett, Neil (ICT Centre, Herston - RBWH)
> Cc: insight-users at itk.org
> Subject: Re: [Insight-users] Visual studio error ... cannot convert parameter 1 from 'itk::SmartPointer<TObjectType>' to 'itk::PDEDeformableRegistrationFilter
>
> It seems that you are passing in a smart pointer when the argument
> wants an actual pointer. You may also need to dynamic_cast<> to get it
> to work with Visual Studio. Also, what version of Visual Studio is
> this?
> _________________________________________________________
> Mike Jackson                  mike.jackson at bluequartz.net
>
> On Mon, Feb 1, 2010 at 10:41 PM,  <Neil.Burdett at csiro.au> wrote:
>> Hi,
>>
>>      The following code compiles on Ubuntu but  on Visual Studio the
>> highlighted line fails with;
>>
>>
>>
>> 2>c:\milx-view\lib\include\itk-ext\modules\basicfilters\itkRegistrationBasedInterpolatorFilter.txx(336)
>> : error C2664:
>> 'itk::MultiResolutionPDEDeformableRegistration2<TFixedImage,TMovingImage,TDeformationField,TRealType>::SetRegistrationFilter'
>> : cannot convert parameter 1 from 'itk::SmartPointer<TObjectType>' to
>> 'itk::PDEDeformableRegistrationFilter<TFixedImage,TMovingImage,TDeformationField>
>> *'
>>
>>
>>
>>
>>
>>         typename BaseRegistrationFilterType::Pointer filter_2to1;
>>
>>     typename ActualRegistrationFilterType::Pointer actualfilter_2to1;
>>
>>
>>
>>         ....
>>
>>
>>
>>
>>
>>     // Perform registration of slice N-1 onto slice N
>>
>>
>>
>>     actualfilter_2to1 = ActualRegistrationFilterType::New();
>>
>>     actualfilter_2to1->SetMaximumUpdateStepLength( 2.0 );
>>
>>     actualfilter_2to1->SetUseGradientType( static_cast<GradientType>(0) );
>>
>>     filter_2to1 = actualfilter_2to1;
>>
>>     filter_2to1->SmoothDeformationFieldOn();
>>
>>     filter_2to1->SetStandardDeviations( 3.0 );
>>
>>     filter_2to1->SmoothUpdateFieldOff();
>>
>>
>>
>>     multires_2to1 = MultiResRegistrationFilterType::New();
>>
>>     multires_2to1->SetRegistrationFilter( filter_2to1 );                  //
>> This line fails with the above error...
>>
>>     multires_2to1->SetNumberOfLevels( numLevels );
>>
>>     multires_2to1->SetNumberOfIterations( &numIterations[0] );
>>
>>     // We register Slice N onto slice N, so we can robustly work out
>> correpondances between these 2 slices,
>>
>>     // whe we start from slice N-1
>>
>>     multires_2to1->SetFixedImage( filter1->GetOutput() );
>>
>>     multires_2to1->SetMovingImage( filter2->GetOutput() );
>>
>>
>>
>>
>>
>> The code looks okay to me and works fine under Ubuntu.
>>
>>
>>
>> Any help will be much appreciated...
>>
>>
>>
>>
>>
>> Thanks
>>
>>
>>
>> Neil
>>
>> _____________________________________
>> 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
>>
>>
> _____________________________________
> 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
>


More information about the Insight-users mailing list