[vtkusers] Moving a class from 4.0 to 3.2

Eric Boix frog at creatis.insa-lyon.fr
Thu Oct 25 03:53:41 EDT 2001


        Dear vtk[3-4].X + Python[1-2].Y users,

        I would like to use the new vtkPNGWriter (thanks dear developpers)
vtkClass as taken from vtk version4.0. Alas I failed in using vtk4.0.
I simply couldn't get VTK4.0 + Python2.1 + wxPython2.3 + MyApplication to
run as smoothly as vtk3.2Nightly + python1.5 +...+ MyApplication. For
sure MyApplication and my low milage are to blame ! [flame me here]

        By despair, I extracted vtkPNGWriter from vkt4.0 (both unmodified files
vtkPNGWriter.cxx and vtkPNGWriter.h), recompiled it, wraped it against
Python1.5 by using the vtk3.2Nightly proper tools. BUT (there is a but)
at run time vtkPNGWriter::WriteSlice crashes on invocation of an accessor
(GetNumberOfScalarComponents which is inherited from vtkImageData
and generated through the proper vtkGetMacro declaration in vktImageData.h).

        Un-interstingly enough, I could fix this unexpected behavior
by simply removing the "virtual" keyword in the declaration of
GetNumberOfScalarComponents (I run g++ -E vtkPNGWriter.cxx, edit the
preprocessed result in order to remove the "virtual" keyword and
proceed with compilation of the result and wrapping...).

        Anyhow, here are my questions : is there any reason for this
"porting" strategy to fail (like a deep incompatiblity in the data structures
implied by the different versions of vtkObjectFactory::CreateInstance,
or something even more obscure to me) ?
Is there a simple work-around or should my approach be definitively
discouraged ? [flame me here again]

        I know that "porting" from 4.0 to 3.2 can NOT be considered as
a sexy subject but a non-intrusive and portable (Win32+Un*x) solution
would be greatly appreciated.

        Yours,
        Eric Boix.

----
Eric.Boix at creatis.insa-lyon.fr
http://www.creatis.insa-lyon.fr/~frog




More information about the vtkusers mailing list