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 use Swig (http://www.swig.org). They
8 are the ones generated when using autogen.sh --enable-python.
9 The entry point is here the file gdcmPython/gdcm.i which uses the
10 Swig synthax. 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 lint checker!?).
16 Since gdcm is written in C++, Swig will produce two different outups:
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 ones 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 correponds to
25 gdcmHeader = gdcm.gdcmHeader
26 gdcmDictSet = gdcm.gdcmDictSet
27 gdcmFile = gdcm.gdcmFile
28 Hence this whole Swig wrapping process is quite odd since we shall
29 wrap more classes (%include in swig.i) than eventually exported to
30 the final user by gdcmPython/__init__.py.
31 - the second python wrappers use the vtk (http://public.kitware.com/VTK/)
32 native wrappers i.e. the binary vtkWrapPython. But it should be noticed
33 that the purpous is here a bit different than the one of the Swig
34 generated Python wrappers. When using vtkWrapPython the goal is to
35 wrap a single vtk class namely vtkGdcmReader as defined in files
36 in vtk/vtkGdcmReader.h vtk/vtkGdcmReader.cxx (and of course those
37 files are hand made vtk oriented wrappers of gdcm).
38 Those wrappers are the one generated when using
39 autogen.sh --enable-python --enable-vtk
40 - In order to understand the difference between both wrappers you should
41 compare both demo scripts gdcmPython/demo/vtkGdcmDemo.py and
42 gdcmPython/demo/vtkGdcmReader.py. The first one only uses the
43 Swig wraped classes ("from gdcmPython import gdcmHeader') as opposed
44 to vtkGdcmReader.py which also uses vtkWrapPython wraped classes
45 ("from gdcmPython.vtkgdcmPython import *").