# How to overlay a DICOM volume on a nii.gz segmentation image for editing in segment editor?

**URL:** <https://discourse.slicer.org/t/how-to-overlay-a-dicom-volume-on-a-nii-gz-segmentation-image-for-editing-in-segment-editor/2802>\
**Category:** Support\
**Created:** [May 11, 2018, 11:22am UTC](https://discourse.slicer.org/t/how-to-overlay-a-dicom-volume-on-a-nii-gz-segmentation-image-for-editing-in-segment-editor/2802 "2018-05-11T11:22:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fuessinger](https://avatars.discourse-cdn.com/v4/letter/f/ee59a6/32.png) [@Fuessinger](https://discourse.slicer.org/u/Fuessinger)\
**Post date:** [May 11, 2018, 11:22am UTC](https://discourse.slicer.org/t/how-to-overlay-a-dicom-volume-on-a-nii-gz-segmentation-image-for-editing-in-segment-editor/2802/1 "2018-05-11T11:22:16Z")

</div>

Operating system: MAC  
Slicer version: 4.81.  
Hallo,

I want to edit my segmentation which is saved as nii.gz on basis of a dicom file.  
How I can modify the dicim and the nii.gz to edit the segmentation?  
Thanks for your help.

---

<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 11, 2018, 4:22pm UTC](https://discourse.slicer.org/t/how-to-overlay-a-dicom-volume-on-a-nii-gz-segmentation-image-for-editing-in-segment-editor/2802/2 "2018-05-11T16:22:54Z")

</div>

Load the DICOM volume using Slicer’s DICOM module. Load the nii.gz file using Add data function - and in the Add data dialog, click Show Options, scroll to the right, and make sure that LabelMap checkbox is selected.

---

<div class="post-metadata">

**Author:** ![Stweie](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/stweie/32/4374_2.png) [@Stweie](https://discourse.slicer.org/u/Stweie)\
**Post date:** [November 18, 2018, 11:09am UTC](https://discourse.slicer.org/t/how-to-overlay-a-dicom-volume-on-a-nii-gz-segmentation-image-for-editing-in-segment-editor/2802/3 "2018-11-18T11:09:26Z")

</div>

Hi @lassoan. I want to achieve the same result but using python script. Can you please give me idea or example code to achieve that. I used pydicom to load dcm series and nibabel module to read nii.gz file.

Thank you in advance 🙂

---

<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:** [November 18, 2018, 3:21pm UTC](https://discourse.slicer.org/t/how-to-overlay-a-dicom-volume-on-a-nii-gz-segmentation-image-for-editing-in-segment-editor/2802/4 "2018-11-18T15:21:58Z")

</div>

See examples in the script repository:

- [Load volume from file](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Load_volume_from_file)
- [Select what is shown in slice viewers](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Iterate_over_current_visible_slice_views.2C_and_set_foreground_and_background_images)

---

<div class="post-metadata">

**Author:** ![Stweie](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/stweie/32/4374_2.png) [@Stweie](https://discourse.slicer.org/u/Stweie)\
**Post date:** [November 19, 2018, 8:57am UTC](https://discourse.slicer.org/t/how-to-overlay-a-dicom-volume-on-a-nii-gz-segmentation-image-for-editing-in-segment-editor/2802/5 "2018-11-19T08:57:33Z")

</div>

Thank you @lassoan. But When 3D slicer overlay nifti file over .dcm files, does it convert dicom series to nifti ? Otherwise how does the overlay transformation happens? can you please explain the principal/way this nifti on dicom series overlay ?

---

<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:** [November 19, 2018, 1:07pm UTC](https://discourse.slicer.org/t/how-to-overlay-a-dicom-volume-on-a-nii-gz-segmentation-image-for-editing-in-segment-editor/2802/6 "2018-11-19T13:07:04Z")

</div>

Slicer can load images from a wide variety of file formats, including DICOM, nifti, nrrd, metaimage. Once an image is loaded, it can be displayed in slice viewer layers. Images can be saved in any file format, regardless of what format they were loaded from.
