Discussion:
[ITK-users] ITK GDCM python wrapping
Kris Vorren
2017-08-18 17:55:11 UTC
Permalink
Hello,

I am trying to load DICOMRT structure data into a tbd ITK class via a python script. I found some useful C++ code<http://www.insight-journal.org/browse/publication/887> by Jason Dowling that extracts contours from DICOMRT and draws them on the corresponding image data. I’ve managed to get this code to work on my own DICOM data. While trying to port sections of this code to python, I realized that Jason was directly instantiating GDCM classes to access the structure data. This is where I got stuck.

My install of ITK used the built-in GDCM library, and it does’t appear that Python wrappings for GDCM were built. Is there a way to build GDCM python wrappers in ITK? I couldn’t find a CMAKE flag for it. Would it be simpler to just build GDCM separately, rebuild ITK setting the system GDCM flag, and then import GDCM into Python?

Thanks,
-Kris
Francois Budin
2017-08-18 19:48:10 UTC
Permalink
Hello Kris,

ITK does not expose the third party libraries it uses in its Python
wrapping. If you are trying to reimplement this nice insight journal paper
in Python, you may want to install GDCMPython and use both ITK and gdcm,
however you may have to duplicate the memory (load your DICOM once with
each library). If you are trying to write some Python code that uses this
C++ implementation, you could convert this filter into an ITK remote module
[1][2] and wrap that module in Python.
Hope this helps,

François

[1]
https://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch9.html#x48-1460009
[2] https://github.com/InsightSoftwareConsortium/ITKModuleTemplate
Post by Kris Vorren
Hello,
I am trying to load DICOMRT structure data into a tbd ITK class via a
python script. I found some useful C++ code
<http://www.insight-journal.org/browse/publication/887> by Jason Dowling
that extracts contours from DICOMRT and draws them on the corresponding
image data. I’ve managed to get this code to work on my own DICOM data.
While trying to port sections of this code to python, I realized that Jason
was directly instantiating GDCM classes to access the structure data. This
is where I got stuck.
My install of ITK used the built-in GDCM library, and it does’t appear
that Python wrappings for GDCM were built. Is there a way to build GDCM
python wrappers in ITK? I couldn’t find a CMAKE flag for it. Would it be
simpler to just build GDCM separately, rebuild ITK setting the system GDCM
flag, and then import GDCM into Python?
Thanks,
-Kris
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
http://public.kitware.com/mailman/listinfo/insight-users
Loading...