]> Creatis software - gdcm.git/commitdiff
* Straightforward temporary fixes for swig to build the python wrappers.
authorfrog <frog>
Thu, 31 Oct 2002 15:15:49 +0000 (15:15 +0000)
committerfrog <frog>
Thu, 31 Oct 2002 15:15:49 +0000 (15:15 +0000)
     src/Makefile now has a python working entry [by working we mean
     that we can import de shadow classes without errors]. --- Frog

12 files changed:
ChangeLog
src/Makefile
src/gdcm.h
src/gdcm.i
src/gdcmDict.cxx
src/gdcmDictEntry.cxx
src/gdcmDictSet.cxx
src/gdcmElValSet.cxx
src/gdcmElValue.cxx
src/gdcmFile.cxx
src/gdcmHeader.cxx
src/gdcmIdo.h

index 9820dfc8c136cd973e401c0d76154f54ac57f74f..4aea47dda993e9b0f2acbf855d4301ac4c4db77b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2002-10-31 Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
+      * Straightforward temporary fixes for swig to build the python wrappers.
+        src/Makefile now has a python working entry [by working we mean
+        that we can import de shadow classes without errors].
+
 2002-10-29 Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
       * hashtest.cxx removed (since allready in Test)
       * src/gdcmlib.h renamed to src/gdcm.h
index f929fc2d7fbcbf0ad2b5efb56213ffaaa747a002..e28a8765518c7a858eedbaaf119a6a6c9bfd12cf 100644 (file)
@@ -1,7 +1,7 @@
 
 ###CC   = gcc
 ###LINK = gcc -shared -o ptinpoly.so
-SWIG = ~/Local/bin/swig
+SWIG = swig
 SWIGFLAGS= -python -c++
 
 PYTHON=python
@@ -13,10 +13,12 @@ CXXFLAGS=`glib-config --cflags`
 CPPFLAGS=-g -Wall -Wunused-variable
 LDFLAGS=`glib-config --libs` -g
 
-%.o : %.cxx
-       $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
+%_wrap.o : %_wrap.cxx
+       $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(PYTHON_INCLUDES) $< -o $@
 %_wrap.cxx : %.i
        $(SWIG) $(SWIGFLAGS) $(PYTHON_INCLUDES) -o $@ $<
+%.o : %.cxx
+       $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
 
 all: gdcmlib.so
 
@@ -27,13 +29,14 @@ gdcmlib.so: gdcmUtil.o    \
        gdcmDict.o      \
        gdcmDictSet.o   \
        gdcmElValSet.o  \
-       gdcmHeaderIdo.o
+       gdcmHeaderIdo.o \
+       gdcmFile.o
        g++ -shared -o gdcmlib.so $^ $(LDFLAGS)
 
-python: gdcmlib.so dcm_wrap.o
-       g++ -shared $^ -o gdcmc.so
+python: gdcmlib.so gdcm_wrap.o
+       g++ -shared $^ -o _gdcm.so
 
 clean:
-       rm -f *_wrap* *.so *.o *.pyc
+       rm -f *_wrap* *.so *.o *.pyc gdcm.py
 
 .SECONDARY: dcm_wrap.cxx
index 512c86e4f39e78ccd524c81196d307bdf36c5565..80e98048f99f9e3bf15df81cc47e82bf99f14eae 100644 (file)
@@ -7,6 +7,13 @@
 // * Formats: this lib should be able to read ACR-NEMA v1 and v2, Dicom v3 (as
 //   stated in part10). [cf dcmtk/dcmdata/docs/datadict.txt]
 // * Targeted plateforms: Un*xes and Win32/VC++6.0
+//
+//
+// TODO
+// The declarations commented out and starting with "TODO Swig" needed
+// to be temporarily removed for swig to proceed correctly (in fact
+// problems appears at loading of _gdcm.[so/dll]). So, simply uncomment
+// the declaration once you provided the definition of the method...
 
 #include <string>
 #include <stddef.h>    // For size_t
@@ -85,9 +92,8 @@ class gdcmDict {
        string filename;
        TagHT entries;
 public:
-       gdcmDict();
        gdcmDict(char *FileName);   // Read Dict from disk
-       int AppendEntry(gdcmDictEntry* NewEntry);
+       // TODO Swig int AppendEntry(gdcmDictEntry* NewEntry);
        gdcmDictEntry * GetTag(guint32 group, guint32 element);
        void Print(ostream&);
 };
@@ -104,17 +110,17 @@ class gdcmDictSet {
 private:
        DictSetHT dicts;
        int AppendDict(gdcmDict* NewDict);
+       int LoadDictFromFile(char* filename, DictKey);
 public:
        gdcmDictSet(void);    // loads THE DICOM v3 dictionary
-       int LoadDictFromFile(string filename);
+       // TODO Swig int LoadDictFromFile(string filename);
 ///// QUESTION: the following function might not be thread safe !? Maybe
 /////           we need some mutex here, to avoid concurent creation of
 /////           the same dictionary !?!?!
-       int LoadDictFromName(string filename);
-       int LoadDictFromFile(char*, DictKey);
-       int LoadAllDictFromDirectory(string DirectoryName);
+       // TODO Swig int LoadDictFromName(string filename);
+       // TODO Swig int LoadAllDictFromDirectory(string DirectoryName);
+       // TODO Swig string* GetAllDictNames();
        int LoadDicomV3Dict(void);
-       string* GetAllDictNames();
        void Print(ostream&);
        gdcmDict* GetDict(DictKey DictName);
        gdcmDict* GetDefaultPublicDict(void);
@@ -235,50 +241,50 @@ protected:
 public:
        void LoadElements(void);
        virtual void ParseHeader(void);
-       gdcmHeader(char* filename);
+       gdcmHeader(const char* filename);
        virtual ~gdcmHeader();
 
-       int SetPubDict(string filename);
+       // TODO Swig int SetPubDict(string filename);
        // When some proprietary shadow groups are disclosed, whe can set
        // up an additional specific dictionary to access extra information.
-       int SetShaDict(string filename);
+       // TODO Swig int SetShaDict(string filename);
 
        // Retrieve all potentially available tag [tag = (group, element)] names
        // from the standard (or public) dictionary (hence static). Typical usage:
        // enable the user of a GUI based interface to select his favorite fields
        // for sorting or selection.
-       string* GetPubTagNames();
+       // TODO Swig string* GetPubTagNames();
        // Get the element values themselves:
        string GetPubElValByName(string TagName);
        string GetPubElValByNumber(guint16 group, guint16 element);
        // Get the element value representation: (VR) might be needed by caller
        // to convert the string typed content to caller's native type (think
        // of C/C++ vs Python).
-       string GetPubElValRepByName(string TagName);
-       string GetPubElValRepByNumber(guint16 group, guint16 element);
+       // TODO Swig string GetPubElValRepByName(string TagName);
+       // TODO Swig string GetPubElValRepByNumber(guint16 group, guint16 element);
        void   PrintPubElVal(ostream &);
        void   PrintPubDict(ostream &);
          
        // Same thing with the shadow :
-       string* GetShaTagNames(); 
-       string GetShaElValByName(string TagName);
-       string GetShaElValByNumber(guint16 group, guint16 element);
-       string GetShaElValRepByName(string TagName);
-       string GetShaElValRepByNumber(guint16 group, guint16 element);
+       // TODO Swig string* GetShaTagNames(); 
+       // TODO Swig string GetShaElValByName(string TagName);
+       // TODO Swig string GetShaElValByNumber(guint16 group, guint16 element);
+       // TODO Swig string GetShaElValRepByName(string TagName);
+       // TODO Swig string GetShaElValRepByNumber(guint16 group, guint16 element);
 
        // Wrappers of the above (both public and shadow) to avoid bugging the
        // caller with knowing if ElVal is from the public or shadow dictionary.
-       string GetElValByName(string TagName);
-       string GetElValByNumber(guint16 group, guint16 element);
-       string GetElValRepByName(string TagName);
-       string GetElValRepByNumber(guint16 group, guint16 element);
+       // TODO Swig string GetElValByName(string TagName);
+       // TODO Swig string GetElValByNumber(guint16 group, guint16 element);
+       // TODO Swig string GetElValRepByName(string TagName);
+       // TODO Swig string GetElValRepByNumber(guint16 group, guint16 element);
 
-       int SetPubElValByName(string content, string TagName);
-       int SetPubElValByNumber(string content, guint16 group, guint16 element);
-       int SetShaElValByName(string content, string ShadowTagName);
-       int SetShaElValByNumber(string content, guint16 group, guint16 element);
+       // TODO Swig int SetPubElValByName(string content, string TagName);
+       // TODO Swig int SetPubElValByNumber(string content, guint16 group, guint16 element);
+       // TODO Swig int SetShaElValByName(string content, string ShadowTagName);
+       // TODO Swig int SetShaElValByNumber(string content, guint16 group, guint16 element);
 
-       int GetSwapCode();
+       // TODO Swig int GetSwapCode();
 };
 
 // In addition to Dicom header exploration, this class is designed
@@ -296,7 +302,7 @@ private:
 public:
        // Constructor dedicated to writing a new DICOMV3 part10 compliant
        // file (see SetFileName, SetDcmTag and Write)
-       gdcmFile();
+       // TODO Swig gdcmFile();
        // Opens (in read only and when possible) an existing file and checks
        // for DICOM compliance. Returns NULL on failure.
        // Note: the in-memory representation of all available tags found in
@@ -306,28 +312,28 @@ public:
        //    seen a a side effect).
        gdcmFile(string & filename);
        // For promotion (performs a deepcopy of pointed header object)
-       gdcmFile(gdcmHeader* header);
-       ~gdcmFile();
+       // TODO Swig gdcmFile(gdcmHeader* header);
+       // TODO Swig ~gdcmFile();
 
        // On writing purposes. When instance was created through
        // gdcmFile(string filename) then the filename argument MUST be different
        // from the constructor's one (no overwriting aloud).
-       int SetFileName(string filename);
+       // TODO Swig int SetFileName(string filename);
 
        // Allocates necessary memory, copies the data (image[s]/volume[s]) to
        // newly allocated zone and return a pointer to it:
-       void * GetImageData();
+       // TODO Swig void * GetImageData();
        // Returns size (in bytes) of required memory to contain data
        // represented in this file.
-       size_t GetImageDataSize();
+       // TODO Swig size_t GetImageDataSize();
        // Copies (at most MaxSize bytes) of data to caller's memory space.
        // Returns an error code on failure (if MaxSize is not big enough)
-       int PutImageDataHere(void* destination, size_t MaxSize );
+       // TODO Swig int PutImageDataHere(void* destination, size_t MaxSize );
        // Allocates ExpectedSize bytes of memory at this->Data and copies the
        // pointed data to it.
-       int SetImageData(void * Data, size_t ExpectedSize);
+       // TODO Swig int SetImageData(void * Data, size_t ExpectedSize);
        // Push to disk.
-       int Write();
+       // TODO Swig int Write();
 };
 
 //class gdcmSerie : gdcmFile;
index c2b404a4eb06e544008008274424c68a5ff166b3..4ec4600147e2a39238f104ba88179dd4c8ecb0c8 100644 (file)
@@ -1,7 +1,7 @@
-%module dcm
+%module gdcm
 %{
-#include "dcmlib.h"
+#include "gdcm.h"
 %}
 %rename(new_dcmHeader_c) dcmHeader::dcmHeader(char*);
 
-%include dcmlib.h
+%include gdcm.h
index 8b42624d8924da9e841ddcf64e8d2b393c451ded..271a2346640b96f1ed8233d6a9d30fd3423f334f 100644 (file)
@@ -1,5 +1,5 @@
 #include <fstream>
-#include "gdcmlib.h"
+#include "gdcm.h"
 #include "gdcmUtil.h"
 
 gdcmDict::gdcmDict(char * FileName) {
index 5bcacb34fbe1960b1d907bdef4eec08229a56372..ddfd3e00ec7d45d626835bcab614bbde805558fe 100644 (file)
@@ -1,4 +1,4 @@
-#include "gdcmlib.h"
+#include "gdcm.h"
 
 gdcmDictEntry::gdcmDictEntry(guint16 InGroup, guint16 InElement,
                              string  InVr, string InFourth, string InName) 
index 5352bcae9007f2652ed037411165fa4284533ef4..ed4bdf9be3a8aecc3d371380fe7c0bf3887b35a9 100644 (file)
@@ -1,5 +1,5 @@
 #include <fstream>
-#include "gdcmlib.h"
+#include "gdcm.h"
 #include "gdcmUtil.h"
 
 
index 85ea5fc5aa024e3c0441197ba0d9d3792af6d7aa..2b5656fe225a6c900cdb5e42cfce8404dde8d7da 100644 (file)
@@ -1,4 +1,4 @@
-#include "gdcmlib.h"
+#include "gdcm.h"
 #include "gdcmUtil.h"
 
 TagElValueHT & ElValSet::GetTagHt(void) {
index 3a353cf8b1d197f0367d8bbdc93fbe5bb45d2b29..5194a799fb9c13d0576fe9c906d32dc0bdd71db7 100644 (file)
@@ -1,4 +1,4 @@
-#include "gdcmlib.h"
+#include "gdcm.h"
 
 void   ElValue::SetVR(string ValRep) { entry->SetVR(ValRep); }
 string ElValue::GetVR(void)   { return entry->GetVR(); }
index 37672ec09b56b3dc5e0654d3ec442e8a980bab12..cb69387531a50ab4b7529af62f59cc5c4ecbdb94 100644 (file)
@@ -1,5 +1,7 @@
-#include "gdcmlib.h"
+#include "gdcm.h"
 
-gdcmFile::gdcmFile(string & filename) {
+gdcmFile::gdcmFile(string & filename)
+       :gdcmHeader(filename.c_str())
+{
        
 }
index 49a4945f5391f102fff3df818606d308435bfc5e..cd5785b1985683f6f2ba118bca6ccb133f12c9ba 100644 (file)
@@ -1,4 +1,4 @@
-#include "gdcmlib.h"
+#include "gdcm.h"
 extern "C" {
 #include "glib.h"
 }
@@ -39,7 +39,7 @@ void gdcmHeader::Initialise(void) {
        RefShaDict = (gdcmDict*)0;
 }
 
-gdcmHeader::gdcmHeader (char* InFilename) {
+gdcmHeader::gdcmHeader (const char* InFilename) {
        filename = InFilename;
        Initialise();
        fp=fopen(InFilename,"rw");
index d22cf3552aef0eb338c892b5a90dbf22abb3eb9a..af006f764dc57406927646d39ad68b2348a38730 100644 (file)
@@ -1,4 +1,4 @@
-#include "gdcmlib.h"
+#include "gdcm.h"
 
 class gdcmHeaderIdo: protected gdcmHeader {
 private: