]> Creatis software - gdcm.git/commitdiff
* Fix compilation errors for the Python part
authorregrain <regrain>
Wed, 19 Oct 2005 12:01:47 +0000 (12:01 +0000)
committerregrain <regrain>
Wed, 19 Oct 2005 12:01:47 +0000 (12:01 +0000)
   * Fix errors in the Python tests
   -- BeNours

gdcmPython/demo/PrintDicomDir.py.in
gdcmPython/gdcm.i
src/gdcmCommon.h
src/gdcmDefaultDicts.cxx.in
src/gdcmDicomDirElement.cxx
src/gdcmDicomDirElement.h
src/gdcmDocument.cxx
src/gdcmDocument.h
src/gdcmFile.cxx
src/gdcmSystem.h

index c891650314e1c5122e92665d92808c04c76fa4cb..c988a4e6b0f89c072d849de71b50cb41d1d3e48d 100644 (file)
@@ -67,7 +67,7 @@ while(patient):
          image=serie.GetFirstImage()
          while(image):
             print "         Image"
-            print "         ---",image.GetDataEntry(0x0004,0x1500).GetValue()
+            print "         ---",image.GetDataEntry(0x0004,0x1500).GetString()
             image=serie.GetNextImage()
          serie=study.GetNextSerie()
       study=patient.GetNextStudy()
index 3a6dcfd3c8bd6c415d3d65fc6c88a32e58848da8..84dede0205e73127e1f880904aee55fdc4432778 100644 (file)
@@ -101,10 +101,10 @@ typedef unsigned long long uint64_t;
    {
       if(dynamic_cast<SeqEntry *>($1)) // SeqEntry *
          newEntry = SWIG_NewPointerObj($1,SWIGTYPE_p_gdcm__SeqEntry,0);
-      else if(dynamic_cast<BinEntry *>($1)) // BinEntry *
-         newEntry = SWIG_NewPointerObj($1,SWIGTYPE_p_gdcm__BinEntry,0);
-      else // ValEntry *
-         newEntry = SWIG_NewPointerObj($1,SWIGTYPE_p_gdcm__ValEntry,0);
+      else if(dynamic_cast<DataEntry *>($1)) // DataEntry *
+         newEntry = SWIG_NewPointerObj($1,SWIGTYPE_p_gdcm__DataEntry,0);
+      else
+         newEntry = NULL;
    }
    else
    {
@@ -255,48 +255,3 @@ typedef unsigned long long uint64_t;
 %include "gdcmVR.h"
 %include "gdcmTS.h"
 %include "gdcmDictGroupName.h"
-
-////////////////////////////////////////////////////////////////////////////
-// Notes on swig and this file gdcm.i:
-//
-/////////////////////////////////////
-// Note 1: swig collision of method overloading and %typemap
-// Consider the following junk.i file:
-//     %module junk
-//     %{
-//     #include <string>
-//     #include <iostream>
-//     void Junk(std::string const & bozo) { std::cout << bozo << std::endl; }
-//     void Junk() { std::cout << "Renamed Junk()" << std::endl; }
-//     %}
-//   
-//     %typemap(python, in) std::string const &
-//     {
-//     $1 = new std::string( PyString_AsString( $input ) );
-//     }
-//     void Junk();
-//     void Junk(std::string const & bozo);
-//
-// that we compile on linux with:
-//    swig -c++ -python junk.i
-//    g++ -g -I/usr/include/python2.3/ -o junk_wrap.o -c junk_wrap.cxx
-//    g++ junk_wrap.o -shared -g -o _junk.so -L/usr/lib/python2.3/config \
-//        -lpython2.3
-// and invoque with:
-//    python -c 'from junk import *; Junk("aaa") '
-// then we get the following unexpected (for novice) python TypeError:
-//    TypeError: No matching function for overloaded 'Junk'
-//
-// This happens because the swig generated code (at least for python) does
-// the following two stage process:
-//   1/ first do a dynamic dispatch ON THE NUMBER OF ARGUMENTS of the overloaded
-//      Junk function (the same happens with method of course). [Note that the
-//      dispatch is NOT done on the type of the arguments].
-//   2/ second apply the typemap.
-// When the first dynamic dispatch is executed, the swig generated code
-// has no knowledge of the typemap, and thus expects a pointer to a std::string
-// type i.e. an argument to Junk of the form _p_std__int<address>. But this
-// is not what python handles to Junk ! An invocation of the form 'Junk("aaa")'
-// will make Python pass a PyString to swig (and this is precisely why we
-// wrote the typemap). And this will fail....
-/////////////////////////////////////
index 5d90974289890f27f39f719923ba35694920d48d..85c63a55508c1146d1e04ae68001cc9cfabcbae2 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmCommon.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/19 08:06:45 $
-  Version:   $Revision: 1.97 $
+  Date:      $Date: 2005/10/19 12:01:50 $
+  Version:   $Revision: 1.98 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -24,6 +24,8 @@
 
 #include <string>
 
+//-----------------------------------------------------------------------------
+// TagKey definition
 #define FASTTAGKEY 0
 
 // FIXME: Should rewrite this:
       #include <iostream>
 #endif
 
+//-----------------------------------------------------------------------------
+#if defined(_WIN32) && defined(BUILD_SHARED_LIBS)
+  #ifdef gdcm_EXPORTS
+    #define GDCM_EXPORT __declspec( dllexport )
+  #else
+    #define GDCM_EXPORT __declspec( dllimport )
+  #endif
+#else
+  #define GDCM_EXPORT
+#endif
+
 //-----------------------------------------------------------------------------
 /// \brief namespace for Grass root DiCoM
 namespace gdcm
@@ -158,7 +171,7 @@ enum LodModeType
 /**
  * \brief structure, for internal use only
  */  
-struct Element
+struct DicomElement
 {
    /// DicomGroup number
    unsigned short int Group;
index 2622cc23bae40ba19df21bcd226f67c3a5f53277..6418c31e46dbc2b5116dbdf452de16c9f861e3ab 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDefaultDicts.cxx.in,v $
   Language:  C++
-  Date:      $Date: 2005/04/05 10:56:25 $
-  Version:   $Revision: 1.9 $
+  Date:      $Date: 2005/10/19 12:01:50 $
+  Version:   $Revision: 1.10 $
 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -85,7 +85,7 @@ void FillDefaultDIRDict(DicomDirElement *dde)
 {
    unsigned int i = 0;
    ELEMENT e = dataElement[i];
-   Element elem;
+   DicomElement elem;
    DicomDirType type;
    std::string strType;
 
index 1757284f4494594566d236ee07bb30fd6796f8ff..4af127cd3b5e8b0bc251c6c7adaa22b7c4481c31 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirElement.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/07/11 14:40:40 $
-  Version:   $Revision: 1.39 $
+  Date:      $Date: 2005/10/19 12:01:50 $
+  Version:   $Revision: 1.40 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -51,7 +51,7 @@ DicomDirElement::DicomDirElement()
    {
       char buff[1024];
       std::string strType;
-      Element elem;
+      DicomElement elem;
       DicomDirType type;
 
       while (!from.eof())
@@ -115,7 +115,7 @@ DicomDirElement::~DicomDirElement()
  * @param type Element type (DD_PATIENT, DD_STUDY, DD_SERIE, DD_IMAGE) 
  * @param elem elem
  */
-bool DicomDirElement::AddEntry(DicomDirType type, Element const &elem)
+bool DicomDirElement::AddEntry(DicomDirType type, DicomElement const &elem)
 {
    switch( type )
    {
@@ -150,12 +150,13 @@ bool DicomDirElement::AddEntry(DicomDirType type, Element const &elem)
 void DicomDirElement::AddDicomDirElement(DicomDirType type,
                                          uint16_t group, uint16_t elem)
 {
-   Element el;
+   DicomElement el;
    el.Group = group;
    el.Elem  = elem;
    el.Value = "";
    AddEntry(type, el);
 }
+
 //-----------------------------------------------------------------------------
 // Protected
 
@@ -171,7 +172,7 @@ void DicomDirElement::AddDicomDirElement(DicomDirType type,
 void DicomDirElement::Print(std::ostream &os)
 {
    std::ostringstream s;
-   std::list<Element>::iterator it;
+   std::list<DicomElement>::iterator it;
    //char greltag[10];  //group element tag
    TagKey greltag;
 
index ffb8ba0dc1037f397b8ba3a33ea745ccd34dba11..74b18e0331128a7ea60cfab4388f97d0038b3bdb 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirElement.h,v $
   Language:  C++
-  Date:      $Date: 2005/09/02 07:10:03 $
-  Version:   $Revision: 1.31 $
+  Date:      $Date: 2005/10/19 12:01:50 $
+  Version:   $Revision: 1.32 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -28,36 +28,36 @@ namespace gdcm
 
 //-----------------------------------------------------------------------------
 
-typedef std::list<Element> ListDicomDirElem;
-typedef std::list<Element> ListDicomDirMetaElem;
-typedef std::list<Element> ListDicomDirPatientElem;
-typedef std::list<Element> ListDicomDirStudyElem;
-typedef std::list<Element> ListDicomDirVisitElem;
-typedef std::list<Element> ListDicomDirSerieElem;
-typedef std::list<Element> ListDicomDirImageElem;
+typedef std::list<DicomElement> ListDicomDirElem;
+typedef std::list<DicomElement> ListDicomDirMetaElem;
+typedef std::list<DicomElement> ListDicomDirPatientElem;
+typedef std::list<DicomElement> ListDicomDirStudyElem;
+typedef std::list<DicomElement> ListDicomDirVisitElem;
+typedef std::list<DicomElement> ListDicomDirSerieElem;
+typedef std::list<DicomElement> ListDicomDirImageElem;
 
 // For future use (Full DICOMDIR)
 
 /*
-typedef std::list<Element> ListDicomDirResultElem;
-typedef std::list<Element> ListDicomDirStudyComponentElem;
-
-typedef std::list<Element> ListDicomDirOverlayElem;
-typedef std::list<Element> ListDicomDirModalityLutElem;
-typedef std::list<Element> ListDicomDirModalityLutElem;
-typedef std::list<Element> ListDicomDirCurveElem;
-typedef std::list<Element> ListDicomDirStoredPrintElem;
-typedef std::list<Element> ListDicomDirRtDoseElem;
-typedef std::list<Element> ListDicomDirRtStructureSetElem;
-typedef std::list<Element> ListDicomDirRtPlanElem;
-typedef std::list<Element> ListDicomDirRtTreatRecordElem;
-typedef std::list<Element> ListDicomDirPresentationElem;
-typedef std::list<Element> ListDicomDirSrDocumentElem;
-typedef std::list<Element> ListDicomDirKeyObjectDocElem;
-typedef std::list<Element> ListDicomDirSpectroscopyElem;
-typedef std::list<Element> ListDicomDirRawDataElem;
-typedef std::list<Element> ListDicomDirRegistrationElem;
-typedef std::list<Element> ListDicomDirFiducialElem;
+typedef std::list<DicomElement> ListDicomDirResultElem;
+typedef std::list<DicomElement> ListDicomDirStudyComponentElem;
+
+typedef std::list<DicomElement> ListDicomDirOverlayElem;
+typedef std::list<DicomElement> ListDicomDirModalityLutElem;
+typedef std::list<DicomElement> ListDicomDirModalityLutElem;
+typedef std::list<DicomElement> ListDicomDirCurveElem;
+typedef std::list<DicomElement> ListDicomDirStoredPrintElem;
+typedef std::list<DicomElement> ListDicomDirRtDoseElem;
+typedef std::list<DicomElement> ListDicomDirRtStructureSetElem;
+typedef std::list<DicomElement> ListDicomDirRtPlanElem;
+typedef std::list<DicomElement> ListDicomDirRtTreatRecordElem;
+typedef std::list<DicomElement> ListDicomDirPresentationElem;
+typedef std::list<DicomElement> ListDicomDirSrDocumentElem;
+typedef std::list<DicomElement> ListDicomDirKeyObjectDocElem;
+typedef std::list<DicomElement> ListDicomDirSpectroscopyElem;
+typedef std::list<DicomElement> ListDicomDirRawDataElem;
+typedef std::list<DicomElement> ListDicomDirRegistrationElem;
+typedef std::list<DicomElement> ListDicomDirFiducialElem;
 */
 
 //-----------------------------------------------------------------------------
@@ -118,7 +118,7 @@ public:
       { return DicomDirImageList; }
 
    // Public method to add an element
-   bool AddEntry(DicomDirType type, Element const &elem);
+   bool AddEntry(DicomDirType type, DicomElement const &elem);
 
    // Only one instance of ddElem 
    void AddDicomDirElement(DicomDirType type,
index 82142ef0b87f4be3d5d9ba9e0018de87f055dd1e..15680d25ca17513ffd993479745ef1f7e7ef9972 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 21:19:57 $
-  Version:   $Revision: 1.297 $
+  Date:      $Date: 2005/10/19 12:01:50 $
+  Version:   $Revision: 1.298 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -277,7 +277,7 @@ bool Document::DoTheLoadingDocumentJob(  )
  */
 void Document::AddForceLoadElement (uint16_t group, uint16_t elem) 
 { 
-   Element el;
+   DicomElement el;
    el.Group = group;
    el.Elem  = elem;
    UserForceLoadList.push_back(el); 
index 764160abd78ea4107850652c5ae9cfa84089a28d..1d8ce95c005e05588314684ccd684c975b4d39f9 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/18 12:58:28 $
-  Version:   $Revision: 1.125 $
+  Date:      $Date: 2005/10/19 12:01:51 $
+  Version:   $Revision: 1.126 $
  
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -41,7 +41,7 @@ class GDCM_EXPORT Document : public ElementSet
 {
 public:
 
-typedef std::list<Element> ListElements;
+typedef std::list<DicomElement> ListElements;
 
 // Loading
    //Deprecated : use SetFileName() + Load()
index c53216719ab8aaabb1125a489cce70e14c206404..0a4339b2061939fdcd89d94251ef191107417e0a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmFile.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/10/19 09:43:13 $
-  Version:   $Revision: 1.281 $
+  Date:      $Date: 2005/10/19 12:01:51 $
+  Version:   $Revision: 1.282 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -1570,7 +1570,7 @@ size_t File::GetPixelAreaLength()
 void File::AddAnonymizeElement (uint16_t group, uint16_t elem, 
                                 std::string const &value) 
 { 
-   Element el;
+   DicomElement el;
    el.Group = group;
    el.Elem  = elem;
    el.Value = value;
index c2afd26ceced7a5ba2b010241552e2139f6696e6..5e3920279906c32b28bed5db33879abddaab42dd 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmSystem.h,v $
   Language:  C++
-  Date:      $Date: 2005/10/19 08:16:59 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2005/10/19 12:01:51 $
+  Version:   $Revision: 1.4 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -75,15 +75,5 @@ typedef  unsigned int        uint32_t;
 #define UINT32_MAX    (4294967295U)
 #endif
 
-#if defined(_WIN32) && defined(BUILD_SHARED_LIBS)
-  #ifdef gdcm_EXPORTS
-    #define GDCM_EXPORT __declspec( dllexport )
-  #else
-    #define GDCM_EXPORT __declspec( dllimport )
-  #endif
-#else
-  #define GDCM_EXPORT
-#endif
-
 //-----------------------------------------------------------------------------
 #endif