]> Creatis software - gdcm.git/blob - DEVELOPPER
gdcmHeader::gdcmHeader(const char *InFilename, bool exception_on_error)
[gdcm.git] / DEVELOPPER
1 The following comments are intended for core gdcm developpers.
2
3
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
24     the lines :
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) that eventually get exported to
30     the final user by gdcmPython/__init__.py.
31   - the second python wrappers uses the vtk (http://public.kitware.com/VTK/)
32     native wrappers i.e. the binary vtkWrapPython. But it should be noticed
33     that the purpose 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     vtk/vtkGdcmReader.h and 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 wrapped classes ("from gdcmPython import gdcmHeader') as opposed
44     to vtkGdcmReader.py which also uses vtkWrapPython wrapped classes
45     ("from gdcmPython.vtkgdcmPython import *").
46