]> Creatis software - gdcm.git/commitdiff
* gdcmPython/gdcm.i:
authorfrog <frog>
Tue, 27 May 2003 15:16:13 +0000 (15:16 +0000)
committerfrog <frog>
Tue, 27 May 2003 15:16:13 +0000 (15:16 +0000)
        - typemaps correction to take into account the systematic replacement
          of "using namespace std" with std:: prefix e.g. std::list,
          std::string... (cf changes of 2003-05-21).
        - gdcmGlob global variable of type gdcmGlobal (defined in
          src/gdcmUtil.cxx and declared in gdcmPython/gdcm.i) is now
          exported to Python a as cvar.
      * gdcmPython/__init__.py now defines two functions GetPubDictTagNames()
        and GetPubDictTagNamesByCategory() as a replacement for deprecated
        gdcmDictSet.GetPubDictTagNames() and
        gdcmDictSet.GetPubDictTagNamesByCategory() class functions (i.e.
        C++ static methods).
      * gdcmPython/demo/printGroupedPublicDict.py is operational again,
        with the above changes.                    ---- Frog

ChangeLog
gdcmPython/__init__.py
gdcmPython/demo/printGroupedPublicDict.py
gdcmPython/gdcm.i

index 33eb0877d371097309d41b2d63bf73af1249cc67..1f4c8132f0bdfe1e62077ded47adba113c4f26d0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2003-05-27  Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
+      * gdcmPython/gdcm.i:
+        - typemaps correction to take into account the systematic replacement
+          of "using namespace std" with std:: prefix e.g. std::list,
+          std::string... (cf changes of 2003-05-21).
+        - gdcmGlob global variable of type gdcmGlobal (defined in
+          src/gdcmUtil.cxx and declared in gdcmPython/gdcm.i) is now
+          exported to Python a as cvar.
+      * gdcmPython/__init__.py now defines two functions GetPubDictTagNames()
+        and GetPubDictTagNamesByCategory() as a replacement for deprecated
+        gdcmDictSet.GetPubDictTagNames() and
+        gdcmDictSet.GetPubDictTagNamesByCategory() class functions (i.e.
+        C++ static methods).
+      * gdcmPython/demo/printGroupedPublicDict.py is operational again,
+        with the above changes.
+
 2003-05-22  Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
       * setup.py, manifest.in : bug fix under linux
 
index e1b32c2a36194f0879246753b734a79c86414a0e..a4c36f33062ebd1fdd2d24a85fa9cc286001f6b5 100644 (file)
@@ -57,3 +57,9 @@ except ImportError,e:
 gdcmHeader = gdcm.gdcmHeader
 gdcmDictSet = gdcm.gdcmDictSet
 gdcmFile = gdcm.gdcmFile
+
+def GetPubDictTagNames():
+   return gdcm.cvar.gdcmGlob.GetDicts().GetPubDictTagNames()
+
+def GetPubDictTagNamesByCategory():
+   return gdcm.cvar.gdcmGlob.GetDicts().GetPubDictTagNamesByCategory()
index 153e173b5f97d822a3eed425849f208998f5e469..7a5aca6d5c69ac7afad301a0a4e8a584d3f31c80 100644 (file)
@@ -4,7 +4,7 @@ print "##############################################################"
 print "### Display all the possible tags of the current public"
 print "### dictionary"
 print "##############################################################"
-PubList = gdcmDictSet.GetPubDictTagNames()
+PubList = GetPubDictTagNames()
 for i in range(0, len(PubList)):
    print "   ", PubList[i]
 
@@ -12,7 +12,7 @@ print "##############################################################"
 print "### Display all the possible tags of the current public"
 print "### dictionary, but grouped by using the Fourth field"
 print "##############################################################"
-PubDict = gdcmDictSet.GetPubDictTagNamesByCategory()
+PubDict = GetPubDictTagNamesByCategory()
 for fourth in PubDict:
    print "   ############ Fourth group = ", fourth, " ##############"
    for key in PubDict[fourth]:
index 15c6ff385856456bb484cb600eb9450acdd28020..69e8a82f14ec51c0ebe174b5025fe4cc18bca6e3 100644 (file)
@@ -6,12 +6,11 @@
 #include "gdcmDictSet.h"
 #include "gdcmElValue.h"
 #include "gdcmElValSet.h"
+#include "gdcmUtil.h"
 #include "gdcmHeader.h"
 #include "gdcmFile.h"
 using namespace std;
 
-using namespace std;
-
 // Utility functions on strings for removing leading and trailing spaces
 void EatLeadingAndTrailingSpaces(string & s) {
        while ( s.length() && (s[0] == ' ') )
@@ -24,7 +23,13 @@ typedef  unsigned short guint16;
 typedef  unsigned int guint32;
 
 ////////////////////////////////////////////////////////////////////////////
-%typemap(out) list<string> * {
+// Global variables get exported to cvar in Python
+%immutable;
+extern gdcmGlobal gdcmGlob;
+%mutable;
+
+////////////////////////////////////////////////////////////////////////////
+%typemap(out) std::list<std::string> * {
        PyObject* NewItem = (PyObject*)0;
        PyObject* NewList = PyList_New(0); // The result of this typemap
        for (list<string>::iterator NewString = ($1)->begin();
@@ -37,7 +42,7 @@ typedef  unsigned int guint32;
 
 ////////////////////////////////////////////////////////////////////////////
 // Convert a c++ hash table in a python native dictionary
-%typemap(out) map<string, list<string> > * {
+%typemap(out) std::map<std::string, std::list<std::string> > * {
        PyObject* NewDict = PyDict_New(); // The result of this typemap
        PyObject* NewKey = (PyObject*)0;
        PyObject* NewVal = (PyObject*)0;
@@ -98,7 +103,6 @@ typedef  unsigned int guint32;
 %typemap(out) std::string  {
     $result = PyString_FromString(($1).c_str());
 }
-//////%apply int { std::int };    
 
 ////////////////////////////////////////////////////////////////////////////
 %include "gdcmCommon.h"
@@ -107,6 +111,7 @@ typedef  unsigned int guint32;
 %include "gdcmDictSet.h"
 %include "gdcmElValue.h"
 %include "gdcmElValSet.h"
+%include "gdcmUtil.h"
 %include "gdcmHeader.h"
 %include "gdcmFile.h"