[Insight-users] Problems using image smart pointer

IsabelleNg isabelleNg at homeworking.org
Tue Apr 10 14:49:54 EDT 2007



IsabelleNg wrote:
> 
> Hi everyone, 
> 
> I have having problems with the following code: 
> 
> typedef itk::ImageFileWriter< ImageType > WriterType; 
> WriterType::Pointer writer = WriterType::New(); 
> writer->SetFileName("test.mhd"); 
> writer->SetInput( this->GetImage()->GetPointer()); 
> 
> This code is inside a function of a derived class.  GetImage() should
> return a smartpointer obj returned by its supercass, using the macro: 
> 
> itkGetConstObjectMacro( Image, ImageType ); 
> 
> And m_Image is defined in this superclass as: 
> 
> typedef SmartPointer< ImageType >     ImagePointer; 
> ImagePointer m_Image; 
> 
> 
> The error that I got is 
>         
> error C2664: 'itk::ImageFileWriter<TInputImage>::SetInput' : cannot
> convert parameter 1 from 'const itk::Image<TPixel,VImageDimension> *' to
> 'const itk::Image<TPixel,VImageDimension> *' 
> 
> 
> Thanks for any of your help, 
> Isabelle
> 

Hi,

Neither of the following worked...

writer->SetInput( this->GetImage()->GetPointer()); 
// writer->SetInput( this->GetImage().GetPointer() );   <-- doesn't work
either

For the latter, I would get the following:
error C2228: left of '.GetPointer' must have class/struct/union


David Cole wrote:
> 
> On 4/10/07, IsabelleNg <isabelleNg at homeworking.org> wrote:
>> writer->SetInput( this->GetImage()->GetPointer());
> 
> Try
> " ...... GetImage().GetPointer() ......... "
> 
> "." instead of "->" on the smart pointer object...
> 
> HTH,
> David
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 
> 



-- 
View this message in context: http://www.nabble.com/Problems-using-image-smart-pointer-tf3551006.html#a9925984
Sent from the ITK - Users mailing list archive at Nabble.com.



More information about the Insight-users mailing list