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:
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
does not match
Perhaps that is your problem? (The difference is the code is missing “Instance” in the tag name)
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?
The error message is from Slicer/CreateDICOMSeries.cxx at 54884b5c11e9834c3a784bcfbadffdeeaa19ce7e · Slicer/Slicer · GitHub
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.
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.setTag('MyCustomTestTag', 'tag_value') I cannot find this tag anywhere in the DICOM header when I load it for example with pydicom