# How to save nrrd as a dicom file?

**URL:** <https://discourse.slicer.org/t/how-to-save-nrrd-as-a-dicom-file/2952>\
**Category:** Support\
**Tags:** dicom, nrrd\
**Created:** [May 28, 2018, 5:46pm UTC](https://discourse.slicer.org/t/how-to-save-nrrd-as-a-dicom-file/2952 "2018-05-28T17:46:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ElonKou](https://avatars.discourse-cdn.com/v4/letter/e/e19b73/32.png) [@ElonKou](https://discourse.slicer.org/u/ElonKou)\
**Post date:** [May 28, 2018, 5:46pm UTC](https://discourse.slicer.org/t/how-to-save-nrrd-as-a-dicom-file/2952/1 "2018-05-28T17:46:53Z")

</div>

After I used the brainsFit plug-in for slicer to register two dicoms, I got a node object. I plan to export this node to show it to others, but I didn’t find how to use code to convert node object to dicom series file. Somebody helped. Me?  
I know that DICOMScalarVolumePlugin and DicomRtImportExported can do this, but I don’t know where to find their calling function.  
So my question is as follows (using scripting):  
1.How to add a patient’s(and study) node to a node object?  
2. Which commands and function can be used to add patient’s tag information and set the output folder?  
If anyone knows these questions, can you help me? Thank you very much!

 ![35](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/4/64081b4eee127f2cdb30e102a603f9be01d0888b.png)

Or there are other ways to export the registered image into dicom

---

<div class="post-metadata">

**Author:** ![brhoom](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/brhoom/32/1228_2.png) [@brhoom](https://discourse.slicer.org/u/brhoom)\
**Post date:** [May 28, 2018, 6:51pm UTC](https://discourse.slicer.org/t/how-to-save-nrrd-as-a-dicom-file/2952/2 "2018-05-28T18:51:56Z")

</div>

I convert nrrd to dicom using slicer’s [Create a DICOM Series module](https://www.slicer.org/wiki/Documentation/4.0/Modules/CreateDICOMSeries). You can input the important metadata as well. It is also available as CLI so you can call it with some arguments in your python [script](https://www.slicer.org/wiki/Documentation/4.2/Developers/Python_scripting#Running_a_CLI_from_Python).

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [May 28, 2018, 8:15pm UTC](https://discourse.slicer.org/t/how-to-save-nrrd-as-a-dicom-file/2952/3 "2018-05-28T20:15:08Z")

</div>

> [@ElonKou](#):
>
> 1.How to add a patient’s(and study) node to a node object?

In Data module / Subject hierarchy tab, drag-and-drop the series under the study.

> [@ElonKou](#):
>
> Which commands and function can be used to add patient’s tag information and set the output folder?

Do you mean using Python scripting? Have you exported successfully using the graphical user interface?

---

<div class="post-metadata">

**Author:** ![ElonKou](https://avatars.discourse-cdn.com/v4/letter/e/e19b73/32.png) [@ElonKou](https://discourse.slicer.org/u/ElonKou)\
**Post date:** [May 29, 2018, 4:38am UTC](https://discourse.slicer.org/t/how-to-save-nrrd-as-a-dicom-file/2952/4 "2018-05-29T04:38:47Z")

</div>

Thank you very much. I used your method and succeed.

---

<div class="post-metadata">

**Author:** ![ElonKou](https://avatars.discourse-cdn.com/v4/letter/e/e19b73/32.png) [@ElonKou](https://discourse.slicer.org/u/ElonKou)\
**Post date:** [May 29, 2018, 4:44am UTC](https://discourse.slicer.org/t/how-to-save-nrrd-as-a-dicom-file/2952/5 "2018-05-29T04:44:12Z")

</div>

Yes, thanks for your help, I want to use python script to convert volume to dicom series. I use the method provided by @brhoom and succeed. Thank you, the people in the Slicer community are very enthusiastic。

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [May 29, 2018, 4:53am UTC](https://discourse.slicer.org/t/how-to-save-nrrd-as-a-dicom-file/2952/6 "2018-05-29T04:53:16Z")

</div>

For reference, [ProstateMRIUSContourPropagation](https://github.com/SlicerRt/SegmentRegistration/tree/master/ProstateMRIUSContourPropagation) module implements a complete clinical workflow for registering prostate MRI to ultrasound images. All inputs are imported from DICOM and registered images are written to DICOM. See a short demo of the module:

If you need a similar tool that can register clinical images that you retrieve from PACS and you can push back to a PACS then you can use this module as a starting point. It is implemented in Python, so it should be very easy to adapt it to your specific use case.

---

<div class="post-metadata">

**Author:** ![ElonKou](https://avatars.discourse-cdn.com/v4/letter/e/e19b73/32.png) [@ElonKou](https://discourse.slicer.org/u/ElonKou)\
**Post date:** [May 29, 2018, 9:35am UTC](https://discourse.slicer.org/t/how-to-save-nrrd-as-a-dicom-file/2952/7 "2018-05-29T09:35:40Z")

</div>

In fact, I am looking for a way to register MR images on CT images，and export it to dicom-series for display. Thank you very much for your suggestion. This plugin may solve my problem.
