]> Creatis software - gdcm.git/commitdiff
* FIX : wrapping python for ListPatient, ListStudy, ListSerie, ListImage
authorregrain <regrain>
Thu, 5 Feb 2004 14:34:38 +0000 (14:34 +0000)
committerregrain <regrain>
Thu, 5 Feb 2004 14:34:38 +0000 (14:34 +0000)
     -- BeNours

ChangeLog
gdcmPython/gdcm.i

index cfad4d3..a72d3a2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2004-02-05 Benoit Regrain
      * ENH : add methods in gdcmObject to get the hash table or the list of
        header entries
+     * FIX : wrapping python for ListPatient, ListStudy, ListSerie, ListImage
 
 2004-02-04 Benoit Regrain
      * FIX : even length for some strings when writting the dicom dir
index 998702e..82436e9 100644 (file)
@@ -104,6 +104,53 @@ extern gdcmGlobal gdcmGlob;
        $result = NewDict;
 }
 
+////////////////////////////////////////////////////////////////////////////
+%typemap(out) ListPatient & {
+       PyObject* NewItem = (PyObject*)0;
+       $result = PyList_New(0); // The result of this typemap
+
+       for (list<gdcmPatient *>::iterator New = ($1)->begin();
+           New != ($1)->end(); ++New) {
+               NewItem = SWIG_NewPointerObj(*New,SWIGTYPE_p_gdcmPatient,1);
+               PyList_Append($result, NewItem);
+       }
+}
+
+%typemap(out) ListStudy & {
+       PyObject* NewItem = (PyObject*)0;
+       $result = PyList_New(0); // The result of this typemap
+
+       for (list<gdcmStudy *>::iterator New = ($1)->begin();
+           New != ($1)->end(); ++New) {
+               NewItem = SWIG_NewPointerObj(*New,SWIGTYPE_p_gdcmStudy,1);
+               PyList_Append($result, NewItem);
+       }
+}
+
+%typemap(out) ListSerie & {
+       PyObject* NewItem = (PyObject*)0;
+       $result = PyList_New(0); // The result of this typemap
+
+       for (list<gdcmSerie *>::iterator New = ($1)->begin();
+           New != ($1)->end(); ++New) {
+               NewItem = SWIG_NewPointerObj(*New,SWIGTYPE_p_gdcmSerie,1);
+               PyList_Append($result, NewItem);
+       }
+}
+
+%typemap(out) ListImage & {
+       PyObject* NewItem = (PyObject*)0;
+       $result = PyList_New(0); // The result of this typemap
+
+       for (list<gdcmImage *>::iterator New = ($1)->begin();
+           New != ($1)->end(); ++New) {
+               NewItem = SWIG_NewPointerObj(*New,SWIGTYPE_p_gdcmImage,1);
+               PyList_Append($result, NewItem);
+       }
+}
+
+////////////////////////////////////////////////////////////////////////////
+
 ////////////////////////////////////////////////////////////////////////////
 // Deals with function returning a C++ string.
 %typemap(out) string, std::string  {