[Insight-users] Python-wrapped ITK and vector<string> problem

Mike K. kolorotur at gmail.com
Sun Nov 25 11:47:13 EST 2007


Hi fellas!

I'm using Windows XP SP2 (and vista ultimate on another machine), Python 2.5
and python/tcl/java-enabled ITK, kindly provided by Gaëtan
(http://www.nabble.com/ITK-package-for-windows-with-python,-java-and-tcl-support-available-t4652875.html)

Everything seems to work fine, except there is this nasty problem I couldn't
solve.
Here is a short example of what I'm doing:

import itk

filenamesReader = itk.DICOMSeriesFileNames.New()
filenamesReader.SetDirectory("C:/images")

filenames = filenamesReader.GetFileNames(True)

GetFileNames() method returns a vector of strings, but it is not interpreted
by Python as any kind of collection; except it is stored in filenames as a
single string, containing a pointer address, or something like that. Same
applies to GetSeriesUIDs method (and any other C++ function that returns
vector<string>)

I've done some searching on the forums, and found that there were similar
problems in accessing vector<string> objects in Python.
The last posting regarding this matter was made more than a year ago, and it
seems there were no solution to this problem by that time.
However, a year has passed, so maybe things have changed :)
So, is there ANY way to get the actual list of elements from a function that
returns vector<string>?

P.S. I'm totally new to ITK, so please exuse me if I'm asking a dumb
question. It's just I wasn't able to find any up-to-date answer to it.

Best Regards,
Mike.
-- 
View this message in context: http://www.nabble.com/Python-wrapped-ITK-and-vector%3Cstring%3E-problem-tf4870774.html#a13937275
Sent from the ITK - Users mailing list archive at Nabble.com.



More information about the Insight-users mailing list