1 The following comments are intended for core gdcm developpers.
4 * Python related section.
5 Depending on the automake/autoconf/autogen.sh flags you used gdcm could
6 be wrapped in two ways:
7 - the first python wrappers of gdcm uses Swig (http://www.swig.org). These
8 are the one generated when using autogen.sh --enable-python.
9 The entry point here is the file gdcmPython/gdcm.i which uses the
10 Swig syntax. As the last lines of this file (the ones starting
11 with the %include directive) only some classes are wrapped for python.
12 In theory only the library interface (basically the classes gdcmHeader
13 and gdcmFile) should be wrapped, but the time being some additional
14 classes are added (just to make sure those classes are Swig compatible:
15 swig is here used as some link checker!?).
16 Since gdcm is written in C++, Swig will produce two different outputs:
17 -- some C based low level wrapper (see gdcmPython/gdcm_wrap.c)
18 -- some Python based object oriented so called "shadow classes" (see
19 file gdcmPython/gdcm.py)
20 We also added the file gdcmPython/__init__.py which is the one that
21 actually gets loaded when one uses the gdcmPython Python package.
22 The file __init__.py loads the Swig generated shadow classes (gdcm.py)
23 but will only re-export the interface of gdcm which corresponds to
25 gdcmHeader = gdcm.gdcmHeader
26 gdcmDictSet = gdcm.gdcmDictSet
27 gdcmFile = gdcm.gdcmFile
29 Hence this whole Swig wrapping process is quite odd since we shall
30 wrap more classes (%include in swig.i) that eventually get exported to
31 the final user by gdcmPython/__init__.py.
32 - the second python wrappers uses the vtk (http://public.kitware.com/VTK/)
33 native wrappers i.e. the binary vtkWrapPython. But it should be noticed
34 that the purpose is here a bit different than the one of the Swig
35 generated Python wrappers. When using vtkWrapPython the goal is to
36 wrap a single vtk class namely vtkGdcmReader as defined in files
37 vtk/vtkGdcmReader.h and vtk/vtkGdcmReader.cxx (and of course those
38 files are hand made vtk oriented wrappers of gdcm).
39 Those wrappers are the one generated when using
40 autogen.sh --enable-python --enable-vtk
41 - In order to understand the difference between both wrappers you should
42 compare both demo scripts gdcmPython/demo/vtkGdcmDemo.py and
43 gdcmPython/demo/vtkGdcmReader.py. The first one only uses the
44 Swig wrapped classes ("from gdcmPython import gdcmHeader') as opposed
45 to vtkGdcmReader.py which also uses vtkWrapPython wrapped classes
46 ("from gdcmPython.vtkgdcmPython import *").