[Insight-users] Fwd: wrapping itk with python
Curzio Basso
curzio.basso at disi.unige.it
Fri Nov 7 03:34:20 EST 2008
Dear all,
I got a problem trying to use wrapITK/Python and the GetSeriesUIDs()
method of itk.GDCMSeriesFileNames, since I get
a string rather than a vector of strings. It looks like the mangled
C++ name of the std::vector<string> object.
The python code looks like the following:
--- BEGIN ---
import itk
def readDcmSeries(path):
readerDcm = itk.ImageSeriesReader.IF3.New()
dicomIO = itk.GDCMImageIO.New()
readerDcm.SetImageIO(dicomIO.GetPointer())
nameGenerator = itk.GDCMSeriesFileNames.New()
nameGenerator.SetDirectory(path)
seriesUID = nameGenerator.GetSeriesUIDs()
print seriesUID
seriesItr = seriesUID.begin() # here fails because seriesIUD is a string
seriesEnd = seriesUID.end()
p = '/some/path/to/a/dcm/dir'
seriesUID = readDcmSeries(p)
---- END ----
and this is the error I get instead:
--- BEGIN ---
_9c58380a_p_std__vectorTstd__basic_stringTchar_std__char_traitsTchar_t_std__allocatorTchar_t_t_std__allocatorTstd__basic_stringTchar_std__char_traitsTchar_t_std__allocatorTchar_t_t_t_t
Traceback (most recent call last):
File "main_intra.py", line 20, in <module>
seriesUID = readDcmSeries(p)
File "main_intra.py", line 15, in readDcmSeries
seriesItr = seriesUID.begin()
AttributeError: 'str' object has no attribute 'begin'
--- END ----
I thought it might be something I missed in the configuration of
WrapITK, but I can't find it. I also did not find
anything on the mailing list. Does anyone know where the problem might be?
cheers,
curzio
--
http://www.disi.unige.it/person/BassoC/
--
http://www.disi.unige.it/person/BassoC/
More information about the Insight-users
mailing list