# DICOM export failed - UID tags

**URL:** <https://discourse.slicer.org/t/dicom-export-failed-uid-tags/22317>\
**Category:** Support\
**Created:** [March 4, 2022, 5:43pm UTC](https://discourse.slicer.org/t/dicom-export-failed-uid-tags/22317 "2022-03-04T17:43:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![koeglfryderyk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/koeglfryderyk/32/14638_2.png) [@koeglfryderyk](https://discourse.slicer.org/u/koeglfryderyk)\
**Post date:** [March 4, 2022, 5:43pm UTC](https://discourse.slicer.org/t/dicom-export-failed-uid-tags/22317/1 "2022-03-04T17:43:43Z")

</div>

I tried exporting a volume to a DICOM series with only the ‘StudyInstanceUID’ tag specified.

This threw the following error:

> If any of UIDs (studyInstanceUID, seriesInstanceUID, and frameOfReferenceInstanceUID) are specified then all of them must be specified.

So I specified all three tags in the following way:

```auto
exp.setTag('StudyInstanceUID', study_instance_uid)
exp.setTag('SeriesInstanceUID', series_instance_uid)
exp.setTag('FrameOfReferenceUID', frame_of_reference_uid)

```

But the export still failed and it gave the same error.

I tried it with several different volumes and the error didn’t change.

Slicer version 4.11.20210226, revision 29738, built 2021-02-28, macOS

---

<div class="post-metadata">

**Author:** ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)\
**Post date:** [March 4, 2022, 7:09pm UTC](https://discourse.slicer.org/t/dicom-export-failed-uid-tags/22317/2 "2022-03-04T19:09:33Z")

</div>

> [@koeglfryderyk](#):
>
> frameOfReferenceInstanceUID

does not match

> [@koeglfryderyk](#):
>
> `exp.setTag('FrameOfReferenceUID', frame_of_reference_uid)`

Perhaps that is your problem? (The difference is the code is missing “Instance” in the tag name)

---

<div class="post-metadata">

**Author:** ![koeglfryderyk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/koeglfryderyk/32/14638_2.png) [@koeglfryderyk](https://discourse.slicer.org/u/koeglfryderyk)\
**Post date:** [March 4, 2022, 7:41pm UTC](https://discourse.slicer.org/t/dicom-export-failed-uid-tags/22317/3 "2022-03-04T19:41:57Z")

</div>

That worked…!

However, I had another problem with this error message:  
the first letter of each of the keywords is lower-case, however, the first letter has to be upper-case. (e.g. in the error message it says ‘studyInstanceUID’ and it should be ‘StudyInstanceUID’

Would it be possible to change the content of this error message? I would make a pull request, however I couldn’t find this anywhere on GitHub.

Also, why doesn’t setTag() throw an error when a wrong tag is used?

---

<div class="post-metadata">

**Author:** ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)\
**Post date:** [March 4, 2022, 9:21pm UTC](https://discourse.slicer.org/t/dicom-export-failed-uid-tags/22317/4 "2022-03-04T21:21:11Z")

</div>

The error message is from [Slicer/CreateDICOMSeries.cxx at 54884b5c11e9834c3a784bcfbadffdeeaa19ce7e · Slicer/Slicer · GitHub](https://github.com/Slicer/Slicer/blob/54884b5c11e9834c3a784bcfbadffdeeaa19ce7e/Modules/CLI/CreateDICOMSeries/CreateDICOMSeries.cxx#L358)

It looks like the underlying export machinery is likely ITK. Perhaps both cases for the first character of a tag name are accepted? You could test that to see if it is the case. If not, then the error message should definitely be corrected.

I suspect (but don’t know) that `setTag()` does not throw an error for a new tag because you could use it to create a new custom tag.

---

<div class="post-metadata">

**Author:** ![koeglfryderyk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/koeglfryderyk/32/14638_2.png) [@koeglfryderyk](https://discourse.slicer.org/u/koeglfryderyk)\
**Post date:** [March 4, 2022, 11:43pm UTC](https://discourse.slicer.org/t/dicom-export-failed-uid-tags/22317/5 "2022-03-04T23:43:56Z")

</div>

that was the problem - it was case sensitive, so the keywords mentioned in the error didn’t work. Now that you showed me where the error is, I’ll make a pull request

I’m not sure about the custom tag - at least when I set a custom tag like this `exportable[0].setTag('MyCustomTestTag', 'tag_value')` I cannot find this tag anywhere in the DICOM header when I load it for example with pydicom
