[Insight-users] Problem in running MyProject.cxx in getting started II?

Cemal Cagatay Bilgin bilgic at cs.rpi.edu
Tue Dec 30 17:20:16 EST 2008


Nora,

there are 3 bugs in your code:
> >         typedef itk::ImageFileReader<Imagetype> ReaderType;
should be
typedef itk::ImageFileReader<ImageType> ReaderType;
Node the  ImageType  with the capital letters.

the others are
ReaderType::Pointer reader = ReaderType::New(); //
and reader->SetFileName.

Your code should compile after you take care of these.

Cagatay Bilgin



On Dec 30, 2008, at 8:58 AM, Nora Nora wrote:

>
> Dear Andinet,
>
> I got the error message posted in the last email when trying to run  
> a new build. I have just repeated the building processus after  
> deleting the first binary directory and copying the four files in  
> source directory. Here is the error message wich  is the same :
> I can't advance in my registration project without resolving this  
> problem. May be the problem is in visual C++ version?As  
> itkImageToVTKImageFilter.h is a part of itk applications and most  
> applications are done in old vs versions??I'm using visual express  
> 2008!!
>  Are threre any other way or other examples to connect ITK to VTK??
>
> Thanks,
> Nora
> --- En date de : Mar 30.12.08, Andinet Enquobahrie <andinet.enqu at kitware.com 
> > a écrit :
> De: Andinet Enquobahrie <andinet.enqu at kitware.com>
> Objet: Re: [Insight-users] Problem in running MyProject.cxx in  
> getting started II?
> À: nora_droit at yahoo.fr
> Date: Mardi 30 Décembre 2008, 13h01
>
> Nora-
>
> Start from a clean  build tree and try again...
> > Thanks Andinet for response,
> > I copied these four files in the source directory with  
> MyProject.cxx, here
> is the new error message I got :
> >   2>..\Myproject-source\myProject.cxx(10) : error C2065:
> 'Imagetype' : identificateur non déclaré
> > 2>..\Myproject-source\myProject.cxx(13) : error C2955:
> 'itk::ImageFileReader' : l'utilisation d'une classe modèle
> requiert une liste d'arguments modèle
> > 2> c:\program
> files\insighttoolkit-3.10.0\code\io\itkImageFileReader.h(93) :
> voir la déclaration de 'itk::ImageFileReader'
> > 2>..\Myproject-source\myProject.cxx(13) : error C2653:
> 'readertype' : n'est pas un nom de classe ni d'espace de noms
> > 2>..\Myproject-source\myProject.cxx(13) : error C3861:
> 'New' : identificateur introuvable
> > 2>..\Myproject-source\myProject.cxx(13) : error C2514:
> 'itk 
> ::SmartPointer<itk::ImageFileReader<TOutputImage,ConvertPixelTraits>>'
> : la classe n'a aucun constructeur
> > 2>..\Myproject-source\myProject.cxx(16) : error C2678:
> '->' binaire : aucun opérateur trouvé qui accepte un opérande de
> partie gauche de type
> 'itk 
> ::SmartPointer<itk::ImageFileReader<TOutputImage,ConvertPixelTraits>>'
> (ou il n'existe pas de conversion acceptable)
> > 2> c:\program
> files\insighttoolkit-3.10.0\code\common\itkSmartPointer.h(69):
> peut être 'TObjectType *itk::SmartPointer<TObjectType>::operator
> ->(void) const'
> > 2> lors de la tentative de mise en correspondance de la liste des
> arguments
> '(itk 
> ::SmartPointer 
> <itk::ImageFileReader<TOutputImage,ConvertPixelTraits>>)'
> > 2>..\Myproject-source\myProject.cxx(16) : error C2039:
> 'setFilename' : n'est pas membre de
> 'itk 
> ::SmartPointer<itk::ImageFileReader<TOutputImage,ConvertPixelTraits>>'
> > 2>..\Myproject-source\myProject.cxx(17) : error C2678:
> '->' binaire : aucun opérateur trouvé qui accepte un opérande de
> partie gauche de type
> 'itk 
> ::SmartPointer<itk::ImageFileReader<TOutputImage,ConvertPixelTraits>>'
> (ou il n'existe pas de conversion acceptable)
> > 2> c:\program
> files\insighttoolkit-3.10.0\code\common\itkSmartPointer.h(69):
> peut être 'TObjectType *itk::SmartPointer<TObjectType>::operator
> ->(void) const'
> > 2> lors de la tentative de mise en correspondance de la liste des
> arguments
> '(itk 
> ::SmartPointer 
> <itk::ImageFileReader<TOutputImage,ConvertPixelTraits>>)'
> > 2>..\Myproject-source\myProject.cxx(17) : error C2039:
> 'GetOutput' : n'est pas membre de
> 'itk 
> ::SmartPointer<itk::ImageFileReader<TOutputImage,ConvertPixelTraits>>'
> > 2>Le journal de génération a été enregistré à l'emplacement
> "file://c:\Documents and
> Settings\PC.WORK-PC\Bureau\ITK-VTK\MyProject\MyProject-Bin 
> \myProject.dir\Debug\BuildLog.htm"
> > 2>myProject - 9 erreur(s), 0 avertissement(s)
> >
> > Is the problem in including Lib or in adding namespace?
> >  I will appreciate you help,
> >  Nora
> >
> > --- En date de : *Lun 29.12.08, Andinet Enquobahrie
> /<andinet.enqu at kitware.com>/* a écrit :
> >
> >     De: Andinet Enquobahrie <andinet.enqu at kitware.com>
> >     Objet: Re: [Insight-users] Problem in running MyProject.cxx in
> >     getting started II?
> >     À: nora_droit at yahoo.fr
> >     Date: Lundi 29 Décembre 2008, 22h14
> >
> >     Nora-
> >
> >     Copy those files into your Project source directory ( where you
> >     have MyProject.cxx ) NOT to your binary directory.
> >
> >
> >     On Mon, Dec 29, 2008 at 5:04 PM, Nora Nora <nora_droit at yahoo.fr
> >     <mailto:nora_droit at yahoo.fr>> wrote:
> >
> >                  Hi all ITK users,
> >                  I tried to run MyProject.cxx  following  
> instructions in
> >         getting started II. Here are MyProjct.cxx and CmakeLists.txt
> >         files :
> >                  PROJECT( myProject )
> >          FIND_PACKAGE ( ITK )
> >           IF ( ITK_FOUND )
> >              INCLUDE( ${USE_ITK_FILE} )
> >         ENDIF( ITK_FOUND )
> >          FIND_PACKAGE ( VTK )
> >           IF ( VTK_FOUND )
> >             INCLUDE( ${USE_VTK_FILE} )
> >          ENDIF( VTK_FOUND )
> >          INCLUDE_DIRECTORIES( ${myProject_SOURCE_DIR})
> >          ADD_EXECUTABLE( myProject myProject.cxx )
> >          TARGET_LINK_LIBRARIES ( myProject
> >          ITKBasicFilters ITKCommon ITKIO
> >          vtkRendering vtkGraphics vtkHybrid
> >          vtkImaging vtkIO vtkFiltering vtkCommon
> >         )
> >         #include "itkImage.h"
> >         #include "itkImageFileReader.h"
> >         #include "itkImageToVTKImageFilter.h"
> >
> >         #include "vtkImageViewer.h"
> >         #include "vtkRenderWindowInteractor.h"
> >
> >         int main( int argc, char **argv) {
> >
> >         typedef itk::Image<unsigned short,2> ImageType;
> >         typedef itk::ImageFileReader<Imagetype> ReaderType;
> >         typedef itk::ImageToVTKImageFilter<ImageType> ConnectorType;
> >
> >         ReaderType::Pointer reader = readertype::New();
> >         ConnectorType::Pointer connector = ConnectorType::New();
> >
> >         reader->setFilename( argv[1] );
> >         connector->SetInput( reader->GetOutput() );
> >
> >         vtkImageViewer * viewer = vtkImageViewer::New();
> >         vtkRenderWindowInteractor * renderWindowInteractor =
> >         vtkRenderWindowInteractor::New();
> >
> >         viewer->SetupInteractor( renderWindowInteractor );
> >         viewer->SetInput( connector->GetOutput() );
> >
> >         viewer->Render();
> >         viewer->SetColorWindow( 255 );
> >         viewer->SetColorLevel( 128 );
> >         renderWindowInteractor->Start();
> >
> >         return 0;
> >         }
> >
> >         I have successively built it, but in running this error
> >         message is chown :
> >                  Myproject-source\myProject.cxx(3) : fatal error
> C1083:
> >         Impossible d'ouvrir le fichier include :
> >         'itkImageToVTKImageFilter.h' : No such file or directory
> >          I have red the response of Luis in OSdir forum to such
> >         problem that is as followed :
> >                  The files that you need are in
> InsightApplications/Auxiliary/vtk :
> >
> >         itkImageToVTKImageFilter.h
> >         itkImageToVTKImageFilter.txx
> >         itkVTKImageToImageFilter.h
> >         itkVTKImageToImageFilter.txx
> >
> >         Copy these files into the directory where you are putting  
> the
> >         code of your example.
> >                  So I copied these files in the generated binary  
> directory
> with
> >         myProject.dsw.
> >                  But I stiil have the same error message??
> >                  Can someone help me??
> >                  Are there other examples on how connect ITK to VTK?
> >                  Thanks,
> >         Nora
> >
> >
> >         _______________________________________________
> >         Insight-users mailing list
> >         Insight-users at itk.org <mailto:Insight-users at itk..org>
> >         http://www.itk.org/mailman/listinfo/insight-users
> >
> >
> >
>
>
> -- ==========================================================
> Andinet A. Enquobahrie, PhD
> R&D Engineer
> Kitware Inc.
>
> 28 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-371-3971 x124
> www.kitware.com
>
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20081230/cd47ae9a/attachment-0001.htm>


More information about the Insight-users mailing list