Modify additional DICOM tags in export

Hello, I use the “DICOM Export” feature from right clicking on a volume in the Data module frequently to output modified volumes in a format readable by other medical devices. It is very helpful that several fields are filled in with correct values (patient name, id, date) and that I can modify others (modality, descriptions). However, for one use case, the device is rejecting my exported volumes because they do not specify a “WindowCenter” and “WindowWidth”. I would like to add a value for these tags (preferably just drawn automatically from the Slicer display settings for the volume).

What is the easiest way to do this?

I see that I can use the “Create a DICOM series” module, but this requires specifying every single field I want filled in, which is unwieldy and potentially error prone (and actually I don’t see that WindowCenter and WindowWidth are options there anyway). I also see the example in the Script Repository of exporting a DICOM volume via python script, but aside from customizing the output directory, I don’t see how to change any of the DICOM tags in that process (i.e. change the series description, window settings, etc while keeping the automatically extracted patient info).

1 Like

That’s an interesting question; someone would need to change the code to expose more fields (maybe in general all the fields).

As a workaround you could easily write a pydicom script (it is bundled with Slicer’s python) or maybe use a shell script and a command like [dcmodify].(

1 Like

OK, I agree, it probably won’t be too hard to write a pydicom script that does what I want. Thanks for your help.

It would be great if you could add the missing fields to CreateDICOMSeries module (it is a very simple CLI module) and update and to set these fields. This should not be harder than adding a pydicom post-processing step just for your project, and all Slicer users would benefit from it.

OK, I’ll give this a try. I haven’t done any CLI programming yet, only scripted modules, so this will be a good chance to try.

If you have not built Slicer yet then and don’t want to do it just for this then we can help you with that.

I had a closer look at CreateDICOMSeries.cxx and it actually saves window center and width fields (although it sets is to the cover the full intensity range of the image, which is not ideal):

Could you check why that particular device may reject the image? Maybe the field is there but the data type or value is incorrect?

@lassoan, I have returned to this problem and, despite the code you link to, the exported volumes seem to be missing the WindowCenter and WindowWidth fields. Can you test on a sample volume and see if you get the same behavior (i.e. no “0028|1050” field in exported DICOM volume)?

A tricky bug prevented writing of the window center&width fields. I’ve fixed the bug and also improved the exporter so that the current display window center&width values are used for export. The fix will be available in the Slicer Preview Release on Friday.

1 Like