# Export Segmentation in DICOM-RT format

**URL:** https://discourse.slicer.org/t/export-segmentation-in-dicom-rt-format/16805
**Category:** Support
**Created:** [March 28, 2021, 7:00pm UTC](https://discourse.slicer.org/t/export-segmentation-in-dicom-rt-format/16805 "2021-03-28T19:00:49Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Cody\_Xie](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cody_xie/32/10261_2.png) [@Cody\_Xie](https://discourse.slicer.org/u/Cody_Xie)
#### Post date: [March 28, 2021, 7:00pm UTC](https://discourse.slicer.org/t/export-segmentation-in-dicom-rt-format/16805/1 "2021-03-28T19:00:49Z")

</div>

Dear all,

What I would like to do is to export a **clipped region** (from Dynamic Modeler) into a **DICOM-RT** file. I have searched throughout the Forum with no answer. It has bothered me for a long time. Any help from your side will be much appreciated.

Operating system: Windows 10  
Slicer version: 4.11.20210226  
Expected behavior: Export a **Segmentation** in **DICOM-RT** format  
Actual behavior:

My workflow is as follows:

1. Imput a CT data set with some heart Segmentations (in RTSTRUCT format);
2. “Export visible segments to models”;
3. Generate a Segmentation (ClippedRegion) by Dynamic Modeler (using curve cut);
4. “Convert model to segmentation node”;
5. Right click this segmentation, then click “Export to DICOM…”;
6. Get the **error message** “Must export the primar anatomical (CT/MR) image” (see the screenshot below).

 ![2](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/b/dbca539ab71316b7e8ccd1db6b7f96bb27676bfa.png)

Could you give me some support?

Thank you so much!

---

<div class="post-metadata">

### Author: ![Cody\_Xie](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cody_xie/32/10261_2.png) [@Cody\_Xie](https://discourse.slicer.org/u/Cody_Xie)
#### Post date: [March 28, 2021, 10:02pm UTC](https://discourse.slicer.org/t/export-segmentation-in-dicom-rt-format/16805/2 "2021-03-28T22:02:27Z")

</div>

And it seems that the new Segmentation is not “linked” to the primary CT data set? When I click the CT data set in this Export window, the label of the original segmentation with the CT will turn green. I guess this means the original segmentation is “linked” with the CT. This is maby another problem.

 ![1](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/6/a638895c5e7f62b610cdfd3bea18d53aecec0a1a.png)

---

<div class="post-metadata">

### Author: ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)
#### Post date: [March 29, 2021, 9:18am UTC](https://discourse.slicer.org/t/export-segmentation-in-dicom-rt-format/16805/3 "2021-03-29T09:18:47Z")

</div>

If I remember correctly, the segmentation needs to be a sibling of the CT under the study, and not under the CT. Please try that and let us know.

---

<div class="post-metadata">

### Author: ![Cody\_Xie](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cody_xie/32/10261_2.png) [@Cody\_Xie](https://discourse.slicer.org/u/Cody_Xie)
#### Post date: [April 6, 2021, 8:24am UTC](https://discourse.slicer.org/t/export-segmentation-in-dicom-rt-format/16805/4 "2021-04-06T08:24:34Z")

</div>

Hi Csaba, I have tried and it works now. Thanks for your support!

---

<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: [April 6, 2021, 1:12pm UTC](https://discourse.slicer.org/t/export-segmentation-in-dicom-rt-format/16805/5 "2021-04-06T13:12:22Z")

</div>

It is great that it works now. @cpinter is there a specific reason why the segmentation must be a directly under the study item? Should we make the export mechanism more robust (e.g., do a recursive search from the study level)? If we don’t implement a fix right now then we should at least add an issue to the tracker to remember to work on this later.

---

<div class="post-metadata">

### Author: ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)
#### Post date: [April 7, 2021, 12:37pm UTC](https://discourse.slicer.org/t/export-segmentation-in-dicom-rt-format/16805/6 "2021-04-07T12:37:24Z")

</div>

Accepting more valid scenarios would be nice indeed. I added an issue [More robust item discovery for export · Issue #185 · SlicerRt/SlicerRT · GitHub](https://github.com/SlicerRt/SlicerRT/issues/185)
