[ITK-users] Exporting DICOM via SimpleITK in Python

G glebber at gmail.com
Fri Apr 22 13:09:55 EDT 2016


Good afternoon,

I am a fairly new SimpleITK user and had a question about modifying and
exporting DICOMs using Python.

If, for example we start off with a 512x512x100 image, I would like to add
a buffer zone around it with voxel values of -1000 making it a 600x600x100
image.

So for example, I can import the DICOM files:

import SimpleITK
def importDICOM(inputLocation):
    reader = SimpleITK.ImageSeriesReader()
    filenamesDICOM = reader.GetGDCMSeriesFileNames(inputLocation)
    reader.SetFileNames(filenamesDICOM)
    image = reader.Execute()
    return image

And I know that SimpleITK.GetArrayFromImage(image) will return a numpy
array that I can manipulate to get said 600x600x100 image.

After I have my 600x600x100 image I would need to update the Meta Data
gotten from SimpleITK.GetMetaData() and save it back as DICOMs.

I know there is a SimpleITK.WriteImage() function, however, there is no
SimpleITK.SetMetaData() function so I was wondering what the best procedure
would be.

Grateful for your help,
Gleb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20160422/606a3f16/attachment.html>


More information about the Insight-users mailing list