<br><font size=2 face="sans-serif">Hi Christian,</font>
<br>
<br><font size=2 face="sans-serif">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.</font>
<br>
<br><font size=2 face="sans-serif">Other limitations : </font>
<br><font size=2 face="sans-serif">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)</font>
<br><font size=2 face="sans-serif">templated ivars must be between //BTX
//ETX </font>
<br>
<br><font size=2 face="sans-serif">Some usefull references : </font>
<br><font size=2 face="sans-serif">http://www.vtk.org/Wiki/VTK_Coding_Standards</font>
<br><font size=2 face="sans-serif">http://www.vtk.org/Wiki/VTK_cvs_commit_Guidelines</font>
<br>
<br><font size=2 face="sans-serif">Best,</font>
<br><font size=2 face="sans-serif">Stephane<br>
</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>christian.werner@rwth-aachen.de</b>
</font>
<br><font size=1 face="sans-serif">Envoyé par : paraview-bounces@paraview.org</font>
<p><font size=1 face="sans-serif">24/02/2010 09:55</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">A</font></div>
<td><font size=1 face="sans-serif">paraview@paraview.org</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Objet</font></div>
<td><font size=1 face="sans-serif">[Paraview] Another Syntax Error - ParaView
Plugins</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><tt><font size=2>Hello!<br>
<br>
I am writng a plugin for my paraview. I already succeeded doing this <br>
with another filter but this one drives me crazy. I keep getting these<br>
<br>
"*** SYNTAX ERROR found in parsing the header file <br>
/home/christian/programming/pv-plugins/Transformation/ivtkSampleFilter.h
<br>
before line 8 ***<br>
<br>
messages, no matter where I put these //BTX //ETX. This is my header:<br>
<br>
<br>
#ifndef IVTK_SAMPLE_FILTER<br>
#define IVTK_SAMPLE_FILTER<br>
<br>
#include "vtkObjectFactory.h"<br>
#include "vtkSimpleImageToImageFilter.h"<br>
#include "xtkBox.h"<br>
<br>
class VTK_IMAGING_EXPORT ivtkSampleImageFilter : public <br>
vtkSimpleImageToImageFilter {<br>
public:<br>
static ivtkSampleImageFilter* New();<br>
<br>
vtkTypeMacro( ivtkSampleImageFilter, vtkSimpleImageToImageFilter);<br>
protected:<br>
ivtkSampleImageFilter();<br>
ivtkSampleImageFilter(const ivtkSampleImageFilter&) {};<br>
void operator=(const ivtkSampleImageFilter&) {};<br>
<br>
//override from vtkImageToImageFilter<br>
virtual void SimpleExecute(vtkImageData* inp, vtkImageData*
out);<br>
<br>
//BTX<br>
vtkImageData* vtkResultImage;<br>
//ETX<br>
vtkITKFilter_H_Macro;<br>
/// custom Filter function ///<br>
template <typename ImageType><br>
void ApplyFilter(vtkImageData* vtkInput);<br>
};<br>
#endif<br>
<br>
It also complains if I comment out my #include "xtkBox.h", or
put some <br>
//BTX//ETX all around other places. It keeps coming with the error <br>
message as if I did not even edit the right file. (I do, I checked <br>
that... :)<br>
<br>
I call a macro later in the header which is defined in the xtkBox.h but
<br>
the compiler does not even care if it is defined or not. Anyway, for <br>
completeness I attached this xtkBox.h.<br>
<br>
Does anyone see what I am missing?<br>
<br>
<br>
Best regards,<br>
Chrsitian<br>
#ifndef XTK_BOX<br>
#define XTK_BOX<br>
<br>
#include "vtkImageExport.h"<br>
#include "vtkImageImport.h"<br>
#include "itkVTKImageImport.h"<br>
#include "itkVTKImageExport.h"<br>
<br>
#include "vtkImageData.h"<br>
//ETX<br>
#include "itkImage.h"<br>
//BTX<br>
template <typename ImageType><br>
class XTKBox {<br>
protected:<br>
//BTX<br>
typedef itk::VTKImageImport<ImageType> ImageImportType;<br>
typedef itk::VTKImageExport<ImageType> ImageExportType;<br>
typename ImageImportType::Pointer
itkImporter;<br>
typename ImageExportType::Pointer
itkExporter;<br>
<br>
vtkImageImport*
vtkImporter;<br>
vtkImageExport*
vtkExporter;<br>
<br>
ImageType*
itkImage;<br>
vtkImageData*
vtkImage;<br>
//ETX<br>
public:<br>
XTKBox() {};<br>
XTKBox(vtkImageData*);<br>
<br>
//get/set ITK Image Data<br>
void setITKImage(ImageType*);<br>
ImageType* getITKFromVTKImage();<br>
//get/set VTK Image Data<br>
void setVTKImage(vtkImageData*);<br>
vtkImageData* getVTKFromITKImage();<br>
vtkImageData* getVTKImage();<br>
};<br>
<br>
///Two macros that have to be called in all ivkt Filters.<br>
///vtkITKFilter_CXX_Macro(ClassName) and vtkITKFilter_H_Macro<br>
///(they construct the proper ITK ImageType according to the input vtkImageData)<br>
#define vtkITKFilter_H_Macro \<br>
virtual void StartTypeGeneration(vtkImageData*); \<br>
template<unsigned int DIM> \<br>
void FinalizeImageType(vtkImageData* vtkInput); \<br>
template<unsigned int DIM, unsigned int COMP> \<br>
void CreateType(vtkImageData* vtkInput);<br>
<br>
#define vtkITKFilter_CXX_Macro(thisClass) \<br>
/** \<br>
* Step 1) Initialize TypeCreation by getting the dimensionality of the
vtkInput. \<br>
*/ \<br>
void thisClass:: \<br>
StartTypeGeneration(vtkImageData* vtkInput) \<br>
{ \<br>
unsigned int dimensionality = vtkInput->GetDataDimension();
\<br>
switch(dimensionality) { \<br>
case 1: FinalizeImageType<1>(vtkInput); \<br>
break; \<br>
case 2: FinalizeImageType<2>(vtkInput); \<br>
break; \<br>
case 3: FinalizeImageType<3>(vtkInput); \<br>
break; \<br>
default: \<br>
vtkErrorMacro(<<"vtkSimpleImageToImageITKFilter:
ApplyITKFilter Error" \<br>
<< "\ndimensionality of vtk input image is "
<< dimensionality); \<br>
} \<br>
} \<br>
/** \<br>
* Step 2) Get the number of scalar components and setup the final image
type. \<br>
*/ \<br>
template<unsigned int DIM> \<br>
void thisClass:: \<br>
FinalizeImageType(vtkImageData* vtkInput) \<br>
{ \<br>
unsigned int components = vtkInput->GetNumberOfScalarComponents();
\<br>
\<br>
switch(components) { \<br>
case 1: return CreateType<DIM, 1>(vtkInput); \<br>
break;
\<br>
case 2: return CreateType<DIM, 2>(vtkInput); \<br>
break;
\<br>
case 3: return CreateType<DIM, 3>(vtkInput); \<br>
break;
\<br>
default: \<br>
vtkErrorMacro(<<"vtkSimpleImageToImageITKFilter:
SetupImageType Error" \<br>
<< "\nnumber of components of vtk input image
is " << components); \<br>
} \<br>
} \<br>
/** \<br>
* Step 3) Setup the appropriate itk::Image data type. \<br>
*/ \<br>
template<unsigned int DIM, unsigned int COMP> \<br>
void thisClass:: \<br>
CreateType(vtkImageData* vtkInput) \<br>
{ \<br>
const int scalarType = vtkInput->GetScalarType(); \<br>
if (scalarType == VTK_CHAR) { \<br>
typedef itk::Vector< char, COMP >
PixelType; \<br>
typedef itk::Image< PixelType, DIM >
ImageType; \<br>
ApplyFilter<ImageType>( vtkInput ); \<br>
} else if (scalarType == VTK_UNSIGNED_CHAR) { \<br>
typedef itk::Vector< unsigned char, COMP >
PixelType; \<br>
typedef itk::Image< PixelType, DIM >
ImageType; \<br>
ApplyFilter<ImageType>( vtkInput ); \<br>
} else if (scalarType == VTK_SHORT) { \<br>
typedef itk::Vector< short, COMP >
PixelType; \<br>
typedef itk::Image< PixelType, DIM >
ImageType; \<br>
ApplyFilter<ImageType>( vtkInput ); \<br>
} else if (scalarType == VTK_UNSIGNED_SHORT) { \<br>
typedef itk::Vector< unsigned short, COMP >
PixelType; \<br>
typedef itk::Image< PixelType, DIM >
ImageType; \<br>
ApplyFilter<ImageType>( vtkInput ); \<br>
} else if (scalarType == VTK_INT) { \<br>
typedef itk::Vector< int, COMP >
PixelType; \<br>
typedef itk::Image< PixelType, DIM >
ImageType; \<br>
ApplyFilter<ImageType>( vtkInput ); \<br>
} else if (scalarType == VTK_UNSIGNED_INT) { \<br>
typedef itk::Vector< unsigned int, COMP >
PixelType; \<br>
typedef itk::Image< PixelType, DIM >
ImageType; \<br>
ApplyFilter<ImageType>( vtkInput ); \<br>
} else if (scalarType == VTK_LONG) { \<br>
typedef itk::Vector< long, COMP >
PixelType; \<br>
typedef itk::Image< PixelType, DIM >
ImageType; \<br>
ApplyFilter<ImageType>( vtkInput ); \<br>
} else if (scalarType == VTK_UNSIGNED_LONG) { \<br>
typedef itk::Vector< unsigned long, COMP >
PixelType; \<br>
typedef itk::Image< PixelType, DIM >
ImageType; \<br>
ApplyFilter<ImageType>( vtkInput ); \<br>
} else if (scalarType == VTK_FLOAT) { \<br>
typedef itk::Vector< float, COMP >
PixelType; \<br>
typedef itk::Image< PixelType, DIM >
ImageType; \<br>
ApplyFilter<ImageType>( vtkInput ); \<br>
} else if (scalarType == VTK_DOUBLE) { \<br>
typedef itk::Vector< double, COMP >
PixelType; \<br>
typedef itk::Image< PixelType, DIM >
ImageType; \<br>
ApplyFilter<ImageType>( vtkInput ); \<br>
} else { \<br>
const char* scalarTypeString = vtkInput->GetScalarTypeAsString(); \<br>
vtkErrorMacro(<<"vtkSimpleImageToImageITKFilter: CreateType
Error" \<br>
<< "\nscalar type of vtk input image is "
<< scalarTypeString \<br>
<< "(" << scalarType << ")");
\<br>
} \<br>
}<br>
#endif<br>
_______________________________________________<br>
Powered by www.kitware.com<br>
<br>
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView<br>
<br>
Follow this link to subscribe/unsubscribe:<br>
http://www.paraview.org/mailman/listinfo/paraview<br>
</font></tt>
<br><pre>
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.
</pre>