]> 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 cfad4d3f231a44112cf09a8944b9e131db0a5535..a72d3a2825067fb7b71882f1af2e1e7d30aaa965 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 998702e8a04ee0174df7134b23a8a33d4a1d36a3..82436e9ebe96e57f791b44e3094b75c23c0d24c1 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  {