]> Creatis software - gdcm.git/commitdiff
* gdcmPython/ : change GDCM_DATA_PATH to GDCM_DATA_ROOT to be complient with
authorregrain <regrain>
Wed, 19 Jan 2005 14:56:09 +0000 (14:56 +0000)
committerregrain <regrain>
Wed, 19 Jan 2005 14:56:09 +0000 (14:56 +0000)
     all in gdcm
   * Remove some useless files in the Python part. Files now generated by CMake
   -- BeNours

ChangeLog
gdcmPython/CMakeLists.txt
gdcmPython/README
gdcmPython/__init__.py [deleted file]
gdcmPython/demo/PrintDicomDir.py.in
gdcmPython/demo/PrintHeader.py.in
gdcmPython/demo/vtkGdcmReader.py.in
gdcmPython/demo/vtkGdcmWriter.py.in
gdcmPython/gdcmVersion.py [deleted file]
gdcmPython/setup.py.in [deleted file]

index c14b7b48d9cdb381088a215223b740f7c8fe3144..449a85a2729bc4c28448e353e3d168dd59215b4d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-01-19 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
+   * gdcmPython/ : change GDCM_DATA_PATH to GDCM_DATA_ROOT to be complient with
+     all in gdcm
+
 2005-01-19 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
    * Test/ : rename VTK tests to have a best name for the tests
    * gdcmPython/demo/*.py.in : Change the InitTraversal/GetNextEntry use to
index 9e85703cd34402fdd914f2cf95106e2c75b92cc2..21315eddc4189c41fb7260c888ccbe5427bf27a5 100644 (file)
@@ -176,12 +176,12 @@ ENDIF(GDCM_VTK)
 
 # generate a setup.py according to VTK installation
 # put it in subdir in order to not override old one
-
-GET_FILENAME_COMPONENT(VTKPATH ${VTK_DIR}/../../ ABSOLUTE)
-CONFIGURE_FILE(
-    ${GDCM_SOURCE_DIR}/gdcmPython/setup.py.in
-    ${GDCM_BINARY_DIR}/setup.py
-)
+#
+#GET_FILENAME_COMPONENT(VTKPATH ${VTK_DIR}/../../ ABSOLUTE)
+#CONFIGURE_FILE(
+#    ${GDCM_SOURCE_DIR}/gdcmPython/setup.py.in
+#    ${GDCM_BINARY_DIR}/setup.py
+#)
 
 #-----------------------------------------------------------------------------
 # Install stuff:
@@ -208,8 +208,7 @@ FILE(WRITE ${GDCM_BINARY_DIR}/gdcmPython/__init__.py
 
 FILE(WRITE ${GDCM_BINARY_DIR}/gdcmPython/core.py
     "import gdcm\n"
-    "GDCM_DATA_PATH     =\"${GDCM_DATA_ROOT}\"\n"
-    "GDCM_TEST_DATA_PATH=\"${GDCM_DATA_ROOT}\"\n"
+    "GDCM_DATA_ROOT     =\"${GDCM_DATA_ROOT}\"\n"
     )
 
 IF(GDCM_VTK)
@@ -219,8 +218,7 @@ IF(GDCM_VTK)
     "  from libvtkgdcmPython import *\n"
     "else:\n"
     "  from vtkgdcmPython import *\n"
-    "GDCM_DATA_PATH     =\"${GDCM_DATA_ROOT}\"\n"
-    "GDCM_TEST_DATA_PATH=\"${GDCM_DATA_ROOT}\"\n"
+    "GDCM_DATA_ROOT     =\"${GDCM_DATA_ROOT}\"\n"
     )
 ENDIF(GDCM_VTK)
 
index 8cecd8e4ef6b0c9cccd1e07bc8095480f1a4a2aa..3cab0fa8a66f4d1b9128544145f09c231244fa0e 100644 (file)
@@ -1,10 +1,12 @@
 Variables that should be set in order to work with gdcmPython:
-GDCM_DICT_PATH path to the dictionary GDCM_SOURCE/Dicts/
-GDCM_DATA_PATH path to gdcmData
-PYTHONPATH path to both GDCM_BIN and GDCM_BIN/bin
+GDCM_DATA_ROOT path to gdcmData
+PYTHONPATH path to both 
+ - GDCM_BIN
+ - GDCM_BIN/bin (for linux) or GDCM_BIN/bin/Release (for Windows)
 
 e.g.
 
 export GDCM_DICT_PATH=~/cvs/gdcm/Dicts/
 export GDCM_DATA_PATH=~/cvs/gdcmData/
 export PYTHONPATH=~/cvs/gdcmbin/bin:~/cvs/gdcmbin/
+
diff --git a/gdcmPython/__init__.py b/gdcmPython/__init__.py
deleted file mode 100644 (file)
index 4b2b8cc..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-import os, sys
-
-try:
-       from gdcmVersion import *
-except:
-       print "gdcmVersion not imported"
-
-def BuildInstallOrPreinstallPath(DirName, FileName = None):
-   # Builds a path to the DirName directory. This should work both when:
-   # - the package is properly installed in which case DirName is a subdir
-   #   of the package,
-   # - when in pre-installation mode (basically inside a CVS hierarchy)
-   #   in which case DirName and the package itself lie at the same
-   #   filesystem level.
-   # In both cases we need to express the full path to DirName relatively
-   # to the path to this __init__.py. For this we rely on __path__ variable.
-   # In order to make sure we got the correct Path, we check for the
-   # existence of FileName if it is setted otherwise for the existence of the
-   # DirName.
-   InstallModePath = os.path.join(__path__[0], DirName + "/")
-   if(FileName):
-      if os.path.isfile(os.path.join(InstallModePath, FileName)):
-         return InstallModePath
-   else:
-      if os.path.isdir(InstallModePath):
-         return InstallModePath
-
-   PreInstallModePath = os.path.join(__path__[0], "..", DirName + "/")
-   if(FileName):
-      if os.path.isfile(os.path.join(PreInstallModePath, FileName)):
-         return PreInstallModePath
-   else:
-      if os.path.isdir(PreInstallModePath):
-         return PreInstallModePath
-   return None
-
-### Setup the path to the dictionaries. WARNING: this needs to be done
-#   BEFORE importation of the shadow classes generated by swig as found
-#   in gdcm, since the dynamic library loads the standard dictionary
-#   when dynamically loaded.
-#   We consider we succefully found the dictionaries path when we encounter
-#   the standard dictionary i.e. the file dicomV3.dic.
-
-try:
-   ### First consider the environnement variable.
-   os.environ["GDCM_DICT_PATH"]
-   if not os.path.isfile(os.path.join(os.environ["GDCM_DICT_PATH"],
-                                      "dicomV3.dic")):
-      raise KeyError
-except KeyError:
-   Path = BuildInstallOrPreinstallPath("Dicts", "dicomV3.dic")
-   if not Path:
-      print "Path to dictionaries is mandatory. Exiting"
-      sys.exit(1)
-   os.environ["GDCM_DICT_PATH"] = Path
-GDCM_DICT_PATH = os.environ["GDCM_DICT_PATH"]
-
-### Set up the path to the data images for the demos.
-if os.environ["GDCM_DATA_PATH"]:
-   GDCM_DATA_PATH = BuildInstallOrPreinstallPath(os.environ["GDCM_DATA_PATH"],
-                                                 "test.acr")
-else:
-   GDCM_DATA_PATH = BuildInstallOrPreinstallPath("Test", "test.acr")
-if not GDCM_DATA_PATH:
-   print "GDCM_DATA_PATH is not setup properly: unfound Test directory"
-
-### Set up the path to the data images of the test suite.
-GDCM_TEST_DATA_PATH = BuildInstallOrPreinstallPath("gdcmData")
-
-### Import the swig generated shadow classes.
-try:
-   import gdcm
-except ImportError,e:
-   print e
-   raise ImportError, "gdcm extension not imported."
-
-### Expose only the necessary stuff
-gdcmGlobal          = gdcm.gdcmGlobal
-gdcmDictSet         = gdcm.gdcmDictSet
-gdcmDicomDir        = gdcm.gdcmDicomDir
-gdcmHeader          = gdcm.gdcmHeader
-gdcmHeaderHelper    = gdcm.gdcmHeaderHelper
-gdcmFile            = gdcm.gdcmFile
-
-gdcmDicomDirMeta    = gdcm.gdcmDicomDirMeta
-gdcmDicomDirPatient = gdcm.gdcmDicomDirPatient
-gdcmDicomDirStudy   = gdcm.gdcmDicomDirStudy
-gdcmDicomDirSerie   = gdcm.gdcmDicomDirSerie
-gdcmDicomDirImage   = gdcm.gdcmDicomDirImage
-
-def GetPubDictEntryNames():
-   return gdcmGlobal.GetDicts().GetPubDictEntryNames()
-
-def GetPubDictEntryNamesByCategory():
-   return gdcmGlobal.GetDicts().GetPubDictEntryNamesByCategory()
index 1f74e5435d6b2172c3b7aabab6b17ac82e9dfe70..1e97623edaa06da4a01f8809ba6a718ec132f9eb 100644 (file)
@@ -14,7 +14,7 @@ from gdcmPython.core import *
 try:
    fileName = sys.argv[1]
 except IndexError:
-   fileName = os.path.join(GDCM_DATA_PATH, "DICOMDIR")
+   fileName = os.path.join(GDCM_DATA_ROOT, "DICOMDIR")
 
 try:
    printLevel = int(sys.argv[2])
index 6b7ca53052ac251f83907d3753a0d43a36d8750c..74d4b4eed7258350df2080a60c6d5d2c4bf4dce8 100644 (file)
@@ -14,7 +14,7 @@ from gdcmPython.core import *
 try:
    fileName = sys.argv[1]
 except IndexError:
-   fileName = os.path.join(GDCM_DATA_PATH, "test.acr")
+   fileName = os.path.join(GDCM_DATA_ROOT, "test.acr")
 
 try:
    printLevel = int(sys.argv[2])
index 70670b2b9907c60a7452897b841b5d9330f71537..587165c06849ef6973bf3251f7fddcb695edc1de 100644 (file)
@@ -16,7 +16,7 @@ from vtkpython import *
 try:
    fileName = sys.argv[1]
 except IndexError:
-   fileName = os.path.join(GDCM_DATA_PATH, "test.acr")
+   fileName = os.path.join(GDCM_DATA_ROOT, "test.acr")
 
 # read the image
 reader = vtkGdcmReader()
index 845243f75529996ae07e4a8995bd0dc5762cb762..5a9249ce5e7eb9ec5f9b3eb0f0cea00c3e87c5e1 100644 (file)
@@ -15,7 +15,7 @@ from vtkpython import *
 try:
    fileName = sys.argv[1]
 except IndexError:
-   fileName = os.path.join(GDCM_DATA_PATH, "test.acr")
+   fileName = os.path.join(GDCM_DATA_ROOT, "test.acr")
 
 # read the image
 reader = vtkGdcmReader()
diff --git a/gdcmPython/gdcmVersion.py b/gdcmPython/gdcmVersion.py
deleted file mode 100644 (file)
index c99e46d..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-gdcmVERSION="0.4.1"
-
diff --git a/gdcmPython/setup.py.in b/gdcmPython/setup.py.in
deleted file mode 100644 (file)
index 50ee836..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-#!/usr/bin/env python
-
-"""
-setup.py for installing the gdcm-Python bindings using distutils.
-
-Created by Mathieu Malaterre, May 2004.
-Heavily based on setup.py.in from VTK, Prabhu Ramachandran, June 2002.
-
-"""
-
-import glob, sys, os
-from types import StringType
-from distutils.core import setup
-from distutils.util import change_root, convert_path
-from distutils.command.install_data import install_data
-from distutils.sysconfig import get_config_var
-
-version = "${GDCM_VERSION}",
-
-build_lib_dir = "${LIBRARY_OUTPUT_PATH}"
-
-build_bin_dir = "${EXECUTABLE_OUTPUT_PATH}"
-
-gdcmDictsDir = "${GDCM_SOURCE_DIR}"
-gdcmDictsDir = os.path.join( gdcmDictsDir, "Dicts" )
-
-def get_libs():
-    """Returns a list of libraries to be installed.  """
-    libs = []
-    if os.name == 'posix':
-        libs = glob.glob(os.path.abspath(os.path.join(
-            build_lib_dir, '_gdcm' + get_config_var('SO'))))
-        libs = libs + glob.glob(os.path.abspath(os.path.join(
-            build_lib_dir, 'libvtkgdcmPython' + get_config_var('SO'))))
-    else:
-        d = os.path.normpath(build_lib_dir)
-        if not os.path.isfile(os.path.join(d, 'libvtkgdcmPython.dll')):
-            d = os.path.normpath(os.path.join(build_lib_dir, 'release'))
-            
-        libs = glob.glob(os.path.join(d, 'vtk*Python.dll'))
-
-    return libs
-
-class my_install_data (install_data):
-    def finalize_options (self):
-        """Needed to make this thing work properly."""
-        self.set_undefined_options ('install',
-                                    ('install_lib', 'install_dir'),
-                                    ('root', 'root'),
-                                    ('force', 'force'),
-                                    )
-    def run (self):
-        """Taken shamlessly from VTK source"""
-        self.mkpath(self.install_dir)
-        for f in self.data_files:
-            if type(f) == StringType:
-                # it's a simple file, so copy it
-                f = convert_path(f)
-                if self.warn_dir:
-                    self.warn("setup script did not provide a directory for "
-                              "'%s' -- installing right in '%s'" %
-                              (f, self.install_dir))
-                (out, _) = self.copy_file(f, self.install_dir)
-                self.outfiles.append(out)
-            else:
-                # it's a tuple with path to install to and a list of files
-                dir = convert_path(f[0])
-                if not os.path.isabs(dir):
-                    dir = os.path.join(self.install_dir, dir)
-                elif self.root:
-                    dir = change_root(self.root, dir)
-                self.mkpath(dir)
-                for data in f[1]:
-                    data = convert_path(data)
-                    (out, _) = self.copy_file(data, dir)
-                    self.outfiles.append(out)
-      
-# I should not hardcode 'bin' since user could build in none default path...
-# Well keep finger cross it won't happen :P
-
-setup(name             = "gdcmPython",
-      version          = "${GDCM_VERSION}",
-      description      = "Grass Root DiCoM",
-      author           = "frog",
-      author_email     = "frog@creatis.insa-lyon.fr",
-      maintainer       = "GDCM Developers",
-      maintainer_email = "dcmlib@creatis.insa-lyon.fr",
-      license          = "BSD",
-      long_description = "Library dedicated to reading/parsing and writing Dicom files",
-      url              = "http://www.creatis.insa-lyon.fr/Public/Gdcm/",
-      platforms        = ['Any'],
-      cmdclass          = {'install_data': my_install_data},
-      packages         = ['gdcmPython'],
-      package_dir      = {'gdcmPython' : 'bin'},
-      data_files       = [ ('gdcmPython', get_libs() ), ('.', ['gdcmPython/gdcm.pth']) ],
-     )
-