I’m using SimpleITK inside my Python scripted module to read metadata from DICOMs. It worked on older Slicer versions (4.6 and 4.8) but I cannot make it work on Slicer 4.10.1. The problem happens on all DICOM files I have tried.
SimpleITK version is 1.1.0dev (ITK 4.12) on Slicer-4.8 and 1.1.0 (ITK 4.13) on Slicer 4-10.1
SimpleITK version 1.1.0 (ITK 4.13). (This SimpleITK works on system Python but not inside Slicer)
# This example worked on old Slicer
i = sitk.ReadImage('image.dcm')
DICOM importing and loading is quite difficult in general, and that’s why Slicer provides advanced tools for this. Please see convenience functions here, with special attention to the importDicom and loadPatient functions:
SimpleITK’s capabilities for accessing DICOM tags are very limited anyway, so I would not bother trying to make that work. You can access some common tags in Slicer database and you can get proper, full access to all fields using pydicom (bundled with Slicer).
Thanks for the answers. I’m not trying to load or import DICOMs on Slicer. My goal is to make a dicom series writer which suits for my work better than the “create a DICOM series” -module. In my module, I am selecting a file from the DicomDatabase and then I want to copy parts of the header to a new DICOM file. I have also tried to access the “create a DICOM series” -module from python script but couldn’t found out how to use it from slicer.modules.createdicomseries.
With Slicer-4.8 GetMetaDataKeys returns a list of tags but with Slicer-4.10.1 GetMetaDataKeys returns an empty list without errors. My module works on Slicer-4.8 as expected and I’m interested to know why it doesn’t work with newer versions since the header reading works with the same SimpleITK version outside Slicer.