[Insight-users] Visual studio error ... cannot convert parameter 1 from 'itk::SmartPointer<TObjectType>' to 'itk::PDEDeformableRegistrationFilter
Neil.Burdett at csiro.au
Neil.Burdett at csiro.au
Sun Feb 7 23:11:14 EST 2010
Hi Luis,
A) SetRegistrationFilter() is not declared in itkRegistrationBasedInterpolatorFilter.h.
RegistrationPointer m_RegistrationFilter is declared in itkMultiResolutionPDEDeformableRegistration2.h which uses the macro:
itkSetObjectMacro( RegistrationFilter, RegistrationType ); in the same file this declares the SetRegistrationFilter method (copied directly from eclipse) to be;
virtual void SetRegistrationFilter(RegistrationType* _arg)
{
{ if (this->GetDebug() && ::itk::Object::GetGlobalWarningDisplay())
{ ::itk::OStringStream itkmsg;
itkmsg << "Debug: In " "/home/bur448/Dev/milx-view/lib/include/itk-aux/demons/itkMultiResolutionPDEDeformableRegistration2.h" ", line " << 162 << "\n"
<< this->GetNameOfClass() << " (" << this << "): " "setting " << "RegistrationFilter" " to " << _arg
<< "\n\n";
::itk::OutputWindowDisplayDebugText(itkmsg.str().c_str());}
};
if (this->m_RegistrationFilter!= _arg)
{
this->m_RegistrationFilter= _arg;
this->Modified();
}
}
B) The default constructor fot itkRegistrationBasedInterpolatorFilter is;
/**
* Default Constructor
*/
template <class TInputImage, class TOutputImage>
RegistrationBasedInterpolatorFilter<TInputImage, TOutputImage>
::RegistrationBasedInterpolatorFilter(){
direction = 0;
m_InterpolationType = LINEAR_LINEAR;
m_Interslice = 0;
m_Verbose = true;
m_Finalise = true;
}//end of constructor
Where
typedef itk::Image<float, 3> InputImageType;
typedef itk::Image<float, 3> OutputImageType;
C) typedef typename itk::PDEDeformableRegistrationFilter < SliceInputImageType, SliceInputImageType, DemonsDeformationFieldType> BaseRegistrationFilterType;
Where
typedef typename TInputImage::PixelType InputPixelType;
typedef itk::Image<InputPixelType, 2> SliceInputImageType;
typedef itk::Vector< float, 2 > VectorPixelType;
typedef itk::Image< VectorPixelType, 2 > DemonsDeformationFieldType;
D) windows is 32 bits
E) Works fine under both 32bit and 64 bit Ubuntu
Thanks for looking into this
Neil
-----Original Message-----
From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
Sent: Saturday, 6 February 2010 4:45 AM
To: Burdett, Neil (ICT Centre, Herston - RBWH)
Cc: mike.jackson at bluequartz.net; insight-users at itk.org
Subject: Re: [Insight-users] Visual studio error ... cannot convert parameter 1 from 'itk::SmartPointer<TObjectType>' to 'itk::PDEDeformableRegistrationFilter
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