[Insight-users] VTKImageImport

Luis Ibanez luis.ibanez at kitware.com
Fri Feb 26 16:32:30 EST 2010


Hi Juan,


The problem is that you are missing the keyword:

                              "typename"

This is a common mistake.

You need this keyword when you access a "Trait"
from a type that depends on one of the template
arguments of your class.



Instead of

   ImageImportType::Pointer movingpointer = ImageImportType::New();

You should do:

   typename  ImageImportType::Pointer movingpointer =
                             ImageImportType::New();


or even better, (because it is more readable),
you should do:

      typedef typename  ImageImportType::Pointer ImageImportPointer;
      ImageImportPointer movingpointer = ImageImportType::New();


  Regards,


         Luis


--------------------------------------------------------------------------
On Fri, Feb 26, 2010 at 1:44 PM, Juan Carlos Prieto
<juanprietob at gmail.com> wrote:
> Hello
>
> I'm trying to make a VTKImageImport
>
> I have a method define as a template like the following:
>
> template<typename TypeImage>
> void SegmentationMethod<TypeImage>::executeMethod() throw (char*){
>
>     vtkImageExport * vtk_export = vtkImageExport::New();
>     vtk_export->SetInput( _img );
>
>     typedef itk::VTKImageImport<TypeImage> ImageImportType;
>     ImageImportType::Pointer movingpointer = ImageImportType::New();
> }
>
> the variable _img is a vtkImageData*, what I'm trying to do is to connect
> the vtkImageData to the filter and then get the itkImageData, I saw an
> example were the procedure was like that but it is not working or I don't
> know what I'm doing wrong. If I comment the line " ImageImportType::Pointer
> movingpointer = ImageImportType::New();" it will compile with out problems.
>
> I get the following errors
>
>
> Error    54    error C2825:
> 'itk::ImageSource<TOutputImage>::OutputImageType': must be a class or
> namespace when followed by '::'    c:\program
> files\creatools\crea_thirdparty_libraries_d-3.0.0\library\itk-3.16.0\include\insighttoolkit\common\itkImageSource.h
> 69
> Error    55    error C2039: 'Pointer' : is not a member of '`global
> namespace''    c:\program
> files\creatools\crea_thirdparty_libraries_d-3.0.0\library\itk-3.16.0\include\insighttoolkit\common\itkImageSource.h
> 69
>


More information about the Insight-users mailing list