# DICOM reader

**URL:** <https://discourse.itk.org/t/dicom-reader/1018>\
**Category:** Beginner Questions\
**Created:** [June 19, 2018, 7:51am UTC](https://discourse.itk.org/t/dicom-reader/1018 "2018-06-19T07:51:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Edern\_Haumont](https://discourse.itk.org/letter_avatar_proxy/v4/letter/e/a9adbd/32.png) [@Edern\_Haumont](https://discourse.itk.org/u/Edern_Haumont)\
**Post date:** [June 19, 2018, 7:51am UTC](https://discourse.itk.org/t/dicom-reader/1018/1 "2018-06-19T07:51:59Z")

</div>

Good morning everyone,

I am trying to use the itk GDCM reader in Python. This is what I wrote so far to read from a folder, as a ITK beginner:

```
reader = itk.ImageSeriesReader.New()
dicomIO = itk.GDCMImageIO.New()
reader.SetImageIO(dicomIO)
reader.SetFileNames(folderPath)

name = dicomIO.GetPatientName('')
found, spacing2 = dicomIO.GetValueFromTag("0028|0030", "")

```

Now the thing is, I am sure the DICOM folder I am trying to read is valid. I am also sure that the patient name and the tag (“0028,0030”) I am trying to read (a spacing value) are present in the metadata. However, this code just gives me no result.

Am I supposed to write that another way around ?  
In general it feels like most of the functions of this module have not really been written for Python. I could be missing some part of the documentation though…

Thanks for your help. Bests.  
Edern

---

<div class="post-metadata">

**Author:** ![tim-evain](https://discourse.itk.org/user_avatar/discourse.itk.org/tim-evain/32/220_2.png) [@tim-evain](https://discourse.itk.org/u/tim-evain)\
**Post date:** [June 19, 2018, 11:03am UTC](https://discourse.itk.org/t/dicom-reader/1018/2 "2018-06-19T11:03:45Z")

</div>

Hello @Edern_Haumont,

You need to call Update() on your reader to actually do the reading.

ITK Python is “just” a wrapping from the C++, explaining that it doesn’t look very pythonic. 😉  
You can look at [SimpleITK](http://www.simpleitk.org/) which is more user-friendly and have python binaries. I know efforts have been made to enable a more pythonic logic and syntax in it. @blowekamp should be able to be more precise that me.

HTH,

Tim

---

<div class="post-metadata">

**Author:** ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)\
**Post date:** [June 19, 2018, 1:46pm UTC](https://discourse.itk.org/t/dicom-reader/1018/3 "2018-06-19T13:46:11Z")

</div>

I agree with Tim that a missing `Update()` is likely the cause of the problem. ITK has a pipeline architecture, that must be explicitly updated to be executed. This is a fundamental concept of ITK and is describe in the [ITK Software Guide](https://itk.org/ITKSoftwareGuide/html/).

Regarding SimpleITK, it has been designed with an easier and more pythonic interface. We have a related example for [printing meta-data](https://simpleitk.readthedocs.io/en/master/Examples/DicomImagePrintTags/Documentation.html) (DICOM tags).

There is also a more complex [example](https://simpleitk.readthedocs.io/en/master/Examples/DicomSeriesReadModifyWrite/Documentation.html) which reads a series copies select tags and writes a new series.

---

<div class="post-metadata">

**Author:** ![Edern\_Haumont](https://discourse.itk.org/letter_avatar_proxy/v4/letter/e/a9adbd/32.png) [@Edern\_Haumont](https://discourse.itk.org/u/Edern_Haumont)\
**Post date:** [June 21, 2018, 9:31am UTC](https://discourse.itk.org/t/dicom-reader/1018/4 "2018-06-21T09:31:47Z")

</div>

Thank you @tim-evain and @blowekamp, that was exactly the problem !
