Hi Christian, ParaView/VTK uses a specialized parser tuned for vtk, and this parser has some assumptions , and in particular all class names must start with "vtk", thus your classes starting with ivtk or xtk will not be accepted by the parser. You can try to exclude the offending lines from the parsing using //BTX //ETX , but it would be simpler if you keep the "vtk" prefix.
Other limitations : the parser will complain if you include more than only the superclass header in your header file (and commits to vtk itself will be rejected unless you add comments explaining why you had to add those includes) templated ivars must be between //BTX //ETX Some usefull references : http://www.vtk.org/Wiki/VTK_Coding_Standards http://www.vtk.org/Wiki/VTK_cvs_commit_Guidelines Best, Stephane [email protected] Envoyé par : [email protected] 24/02/2010 09:55 A [email protected] cc Objet [Paraview] Another Syntax Error - ParaView Plugins Hello! I am writng a plugin for my paraview. I already succeeded doing this with another filter but this one drives me crazy. I keep getting these "*** SYNTAX ERROR found in parsing the header file /home/christian/programming/pv-plugins/Transformation/ivtkSampleFilter.h before line 8 *** messages, no matter where I put these //BTX //ETX. This is my header: #ifndef IVTK_SAMPLE_FILTER #define IVTK_SAMPLE_FILTER #include "vtkObjectFactory.h" #include "vtkSimpleImageToImageFilter.h" #include "xtkBox.h" class VTK_IMAGING_EXPORT ivtkSampleImageFilter : public vtkSimpleImageToImageFilter { public: static ivtkSampleImageFilter* New(); vtkTypeMacro( ivtkSampleImageFilter, vtkSimpleImageToImageFilter); protected: ivtkSampleImageFilter(); ivtkSampleImageFilter(const ivtkSampleImageFilter&) {}; void operator=(const ivtkSampleImageFilter&) {}; //override from vtkImageToImageFilter virtual void SimpleExecute(vtkImageData* inp, vtkImageData* out); //BTX vtkImageData* vtkResultImage; //ETX vtkITKFilter_H_Macro; /// custom Filter function /// template <typename ImageType> void ApplyFilter(vtkImageData* vtkInput); }; #endif It also complains if I comment out my #include "xtkBox.h", or put some //BTX//ETX all around other places. It keeps coming with the error message as if I did not even edit the right file. (I do, I checked that... :) I call a macro later in the header which is defined in the xtkBox.h but the compiler does not even care if it is defined or not. Anyway, for completeness I attached this xtkBox.h. Does anyone see what I am missing? Best regards, Chrsitian #ifndef XTK_BOX #define XTK_BOX #include "vtkImageExport.h" #include "vtkImageImport.h" #include "itkVTKImageImport.h" #include "itkVTKImageExport.h" #include "vtkImageData.h" //ETX #include "itkImage.h" //BTX template <typename ImageType> class XTKBox { protected: //BTX typedef itk::VTKImageImport<ImageType> ImageImportType; typedef itk::VTKImageExport<ImageType> ImageExportType; typename ImageImportType::Pointer itkImporter; typename ImageExportType::Pointer itkExporter; vtkImageImport* vtkImporter; vtkImageExport* vtkExporter; ImageType* itkImage; vtkImageData* vtkImage; //ETX public: XTKBox() {}; XTKBox(vtkImageData*); //get/set ITK Image Data void setITKImage(ImageType*); ImageType* getITKFromVTKImage(); //get/set VTK Image Data void setVTKImage(vtkImageData*); vtkImageData* getVTKFromITKImage(); vtkImageData* getVTKImage(); }; ///Two macros that have to be called in all ivkt Filters. ///vtkITKFilter_CXX_Macro(ClassName) and vtkITKFilter_H_Macro ///(they construct the proper ITK ImageType according to the input vtkImageData) #define vtkITKFilter_H_Macro \ virtual void StartTypeGeneration(vtkImageData*); \ template<unsigned int DIM> \ void FinalizeImageType(vtkImageData* vtkInput); \ template<unsigned int DIM, unsigned int COMP> \ void CreateType(vtkImageData* vtkInput); #define vtkITKFilter_CXX_Macro(thisClass) \ /** \ * Step 1) Initialize TypeCreation by getting the dimensionality of the vtkInput. \ */ \ void thisClass:: \ StartTypeGeneration(vtkImageData* vtkInput) \ { \ unsigned int dimensionality = vtkInput->GetDataDimension(); \ switch(dimensionality) { \ case 1: FinalizeImageType<1>(vtkInput); \ break; \ case 2: FinalizeImageType<2>(vtkInput); \ break; \ case 3: FinalizeImageType<3>(vtkInput); \ break; \ default: \ vtkErrorMacro(<<"vtkSimpleImageToImageITKFilter: ApplyITKFilter Error" \ << "\ndimensionality of vtk input image is " << dimensionality); \ } \ } \ /** \ * Step 2) Get the number of scalar components and setup the final image type. \ */ \ template<unsigned int DIM> \ void thisClass:: \ FinalizeImageType(vtkImageData* vtkInput) \ { \ unsigned int components = vtkInput->GetNumberOfScalarComponents(); \ \ switch(components) { \ case 1: return CreateType<DIM, 1>(vtkInput); \ break; \ case 2: return CreateType<DIM, 2>(vtkInput); \ break; \ case 3: return CreateType<DIM, 3>(vtkInput); \ break; \ default: \ vtkErrorMacro(<<"vtkSimpleImageToImageITKFilter: SetupImageType Error" \ << "\nnumber of components of vtk input image is " << components); \ } \ } \ /** \ * Step 3) Setup the appropriate itk::Image data type. \ */ \ template<unsigned int DIM, unsigned int COMP> \ void thisClass:: \ CreateType(vtkImageData* vtkInput) \ { \ const int scalarType = vtkInput->GetScalarType(); \ if (scalarType == VTK_CHAR) { \ typedef itk::Vector< char, COMP > PixelType; \ typedef itk::Image< PixelType, DIM > ImageType; \ ApplyFilter<ImageType>( vtkInput ); \ } else if (scalarType == VTK_UNSIGNED_CHAR) { \ typedef itk::Vector< unsigned char, COMP > PixelType; \ typedef itk::Image< PixelType, DIM > ImageType; \ ApplyFilter<ImageType>( vtkInput ); \ } else if (scalarType == VTK_SHORT) { \ typedef itk::Vector< short, COMP > PixelType; \ typedef itk::Image< PixelType, DIM > ImageType; \ ApplyFilter<ImageType>( vtkInput ); \ } else if (scalarType == VTK_UNSIGNED_SHORT) { \ typedef itk::Vector< unsigned short, COMP > PixelType; \ typedef itk::Image< PixelType, DIM > ImageType; \ ApplyFilter<ImageType>( vtkInput ); \ } else if (scalarType == VTK_INT) { \ typedef itk::Vector< int, COMP > PixelType; \ typedef itk::Image< PixelType, DIM > ImageType; \ ApplyFilter<ImageType>( vtkInput ); \ } else if (scalarType == VTK_UNSIGNED_INT) { \ typedef itk::Vector< unsigned int, COMP > PixelType; \ typedef itk::Image< PixelType, DIM > ImageType; \ ApplyFilter<ImageType>( vtkInput ); \ } else if (scalarType == VTK_LONG) { \ typedef itk::Vector< long, COMP > PixelType; \ typedef itk::Image< PixelType, DIM > ImageType; \ ApplyFilter<ImageType>( vtkInput ); \ } else if (scalarType == VTK_UNSIGNED_LONG) { \ typedef itk::Vector< unsigned long, COMP > PixelType; \ typedef itk::Image< PixelType, DIM > ImageType; \ ApplyFilter<ImageType>( vtkInput ); \ } else if (scalarType == VTK_FLOAT) { \ typedef itk::Vector< float, COMP > PixelType; \ typedef itk::Image< PixelType, DIM > ImageType; \ ApplyFilter<ImageType>( vtkInput ); \ } else if (scalarType == VTK_DOUBLE) { \ typedef itk::Vector< double, COMP > PixelType; \ typedef itk::Image< PixelType, DIM > ImageType; \ ApplyFilter<ImageType>( vtkInput ); \ } else { \ const char* scalarTypeString = vtkInput->GetScalarTypeAsString(); \ vtkErrorMacro(<<"vtkSimpleImageToImageITKFilter: CreateType Error" \ << "\nscalar type of vtk input image is " << scalarTypeString \ << "(" << scalarType << ")"); \ } \ } #endif _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview Ce message et toutes les pièces jointes (ci-après le 'Message') sont établis à l'intention exclusive des destinataires et les informations qui y figurent sont strictement confidentielles. Toute utilisation de ce Message non conforme à sa destination, toute diffusion ou toute publication totale ou partielle, est interdite sauf autorisation expresse. Si vous n'êtes pas le destinataire de ce Message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez reçu ce Message par erreur, merci de le supprimer de votre système, ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support que ce soit. Nous vous remercions également d'en avertir immédiatement l'expéditeur par retour du message. Il est impossible de garantir que les communications par messagerie électronique arrivent en temps utile, sont sécurisées ou dénuées de toute erreur ou virus. ____________________________________________________ This message and any attachments (the 'Message') are intended solely for the addressees. The information contained in this Message is confidential. Any use of information contained in this Message not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return message. E-mail communication cannot be guaranteed to be timely secure, error or virus-free.
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview
