[ITK] [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/community/attachments/20160422/606a3f16/attachment.html>
-------------- next part --------------
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list