# RTstruct not showing contour

**URL:** <https://discourse.slicer.org/t/rtstruct-not-showing-contour/1926>\
**Category:** Support\
**Tags:** segmentation\
**Created:** [January 24, 2018, 9:12pm UTC](https://discourse.slicer.org/t/rtstruct-not-showing-contour/1926 "2018-01-24T21:12:38Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmtg](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@mmtg](https://discourse.slicer.org/u/mmtg)\
**Post date:** [January 24, 2018, 9:12pm UTC](https://discourse.slicer.org/t/rtstruct-not-showing-contour/1926/1 "2018-01-24T21:12:39Z")

</div>

Hi everyone,

I am using the segmentations module in 3DSlicer v 4.8.0. I have contours that were made in MIM and I am exporting the RTStruct to 3DSlicer. One of the contours is rather small and when I load it into 3DSlicer, it doesn’t show the contour that I can see in MIM. I don’t know why this is and am confident it’s not in exporting the file from MIM as I have other contours that work just fine.

Let me know what I need figure this out, thanks!

---

<div class="post-metadata">

**Author:** ![gcsharp](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/gcsharp/32/863_2.png) [@gcsharp](https://discourse.slicer.org/u/gcsharp)\
**Post date:** [January 24, 2018, 10:16pm UTC](https://discourse.slicer.org/t/rtstruct-not-showing-contour/1926/2 "2018-01-24T22:16:07Z")

</div>

Hi mmtg,

I can’t think of any obvious reason.

Is there any error in the error log?

Is an (apparently empty) segment created?

Would you be able to anonymize and share the data?

Greg

---

<div class="post-metadata">

**Author:** ![mmtg](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@mmtg](https://discourse.slicer.org/u/mmtg)\
**Post date:** [January 25, 2018, 6:53pm UTC](https://discourse.slicer.org/t/rtstruct-not-showing-contour/1926/3 "2018-01-25T18:53:33Z")

</div>

Hi, sorry I am not ignoring your response. I am making sure I have the ethics to send anonymized data. If I were to supply just the RTstruct, would that be helpful (if I can’t send the CT it was generated on)?

---

<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:** [January 25, 2018, 7:06pm UTC](https://discourse.slicer.org/t/rtstruct-not-showing-contour/1926/4 "2018-01-25T19:06:26Z")

</div>

Yes, absolutely. Getting the RT struct should be enough.

---

<div class="post-metadata">

**Author:** ![mmtg](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@mmtg](https://discourse.slicer.org/u/mmtg)\
**Post date:** [January 25, 2018, 9:01pm UTC](https://discourse.slicer.org/t/rtstruct-not-showing-contour/1926/5 "2018-01-25T21:01:21Z")

</div>

I can send the anonymized RTStruct at this point (still waiting for lead PI on ethics of anonymized CT). Who should I send it to? I’d rather not post a link here.

---

<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:** [January 25, 2018, 9:16pm UTC](https://discourse.slicer.org/t/rtstruct-not-showing-contour/1926/6 "2018-01-25T21:16:02Z")

</div>

You can send it to me: [csaba.pinter@queensu.ca](mailto:csaba.pinter@queensu.ca). I’m a SlicerRT developer, just as Andras and Greg who answered before. Please make sure that the anonymized dataset produces the samme issue as the original. Thanks!

---

<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:** [January 27, 2018, 2:57pm UTC](https://discourse.slicer.org/t/rtstruct-not-showing-contour/1926/7 "2018-01-27T14:57:36Z")

</div>

@mmtg Thanks for the data! However I don’t think it is suitable for debugging your issue.

- The only ROI in the dataset you sent me seems to contain less information than what is enough to calculate the spacing between the contours in itself (see error message “Input polydata has less than two cells! Unable to calculate spacing” - in general it is good practice to look at the log when anything unexpected happens and try to figure out the issue from there, but at least send it to us)
- Usually the RTSTRUCT comes with a CT, which SlicerRT uses as additional information to determine the spacing. However you only sent the RTSTRUCT, so reading it in happens in a different way than if the CT is also available

Can you please give us more information?

- What does “rather small” mean for your contours? How many slices do they span?
- Do you segment a CT? If so, do you export it as well?
- Please send us a dataset that you actually segmented in MIM (and exported ideally along with the CT), and also send us a screenshot what it supposed to look like

Thanks!

---

<div class="post-metadata">

**Author:** ![mmtg](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@mmtg](https://discourse.slicer.org/u/mmtg)\
**Post date:** [January 27, 2018, 4:53pm UTC](https://discourse.slicer.org/t/rtstruct-not-showing-contour/1926/8 "2018-01-27T16:53:52Z")

</div>

Hi thanks for taking a look.

In this case the contour only spanned 1 slice and, on the original CT is probably about 30 voxels or so… Just from memory. One problem is that I think MIM tends to interpolate the volumes heavily and so I am wondering if the coordinates specified don’t actually correspond to any physical space in the original CT… But again that’s just a guess and I am naive in how this works.

The CT is segmented and exported with the RT struct. Both are loaded at the same time.

I will attempt to use one of the sample data sets in Slicer, export to MIM, contour a small volume, and then re-import to slicer to see if I can recreate it. Unfortunately the main PI on this case is away from email and I haven’t got a response about sending the anonymized CT data.

I will hopefully be able to do this monday morning. Thanks for your time so far.

---

<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:** [January 27, 2018, 7:01pm UTC](https://discourse.slicer.org/t/rtstruct-not-showing-contour/1926/9 "2018-01-27T19:01:44Z")

</div>

> [@mmtg](#):
>
> Both are loaded at the same time

In that case please send the anatomical volume too, because loading the RTSTRUCT alone yields a different result.

It’s a good idea to start from a sample dataset to work around patient confidentiality issues. Thanks!

---

<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:** [January 29, 2018, 8:29pm UTC](https://discourse.slicer.org/t/rtstruct-not-showing-contour/1926/11 "2018-01-29T20:29:10Z")

</div>

Thanks for the new data! I was able to determine the problem. It’s that due to the single-sliceness of the segmentation the contours-\>surface conversion algorithm is unable to do the “end-capping” step properly, because when it fails to calculate the contour thickness, it defaults to 0mm. So end-capping is done with 0mm thickness, and so while it is done, the surface will remain completely flat (see screenshot; the wireframe shows the end-capping).

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/8/38c5ff2d337d14f3fa23c476a13f3a08e40be62d.png)

@Sunderlandkyl will do a fix that sets a default slice thickness to the conversion algorithm for cases like this.

In the meantime you can probably fall back to the “ribbon” method, I’ll provide you a script shortly if I manage to make it work.

---

<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:** [January 29, 2018, 9:19pm UTC](https://discourse.slicer.org/t/rtstruct-not-showing-contour/1926/12 "2018-01-29T21:19:49Z")

</div>

The ribbon method yields a segment that looks nicer and that allows labelmaps to be created. The segment’s volume was calculated to be 0.209cc, which is about half of what you said it is in MIM. This makes complete sense if we consider interpolation (i.e. the aforementioned end-capping, which is performed in this scenario as well), instead of the raw ribbon method.

I had to do one fix in the ribbon converter as well. It required at least two cells in the polydata, but I don’t know why so I decreased it to one (@lassoan any ideas?) and now it works well. You’ll be able to try it with tomorrow’s nightly. Also you’ll need to disable the direct conversion that @Sunderlandkyl is fixing now. You can do it by entering this in the python interactor before loading the data, or adding this to .slicerrc.py. However this is a temporary workaround in case you’re in a rush.

```
f=slicer.vtkSegmentationConverterFactory()
f.DisableConverterRule('Planar contour', 'Closed surface')

```

It will look like this:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/9/b9886070986932b1d2364e4f6c6d0033c5e13957.jpeg)

---

<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:** [January 29, 2018, 9:23pm UTC](https://discourse.slicer.org/t/rtstruct-not-showing-contour/1926/13 "2018-01-29T21:23:23Z")

</div>

> [@cpinter](#):
>
> It required at least two cells in the polydata, but I don’t know why

I guess 2 contours were required so that we can compute slice thickness, but it is better to compute thickness from the CT image anyway.

---

<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:** [January 29, 2018, 9:26pm UTC](https://discourse.slicer.org/t/rtstruct-not-showing-contour/1926/14 "2018-01-29T21:26:39Z")

</div>

Makes sense. Also the slice thickness calculator function has been significantly improved, so it can calculate it multiple ways. The 2 cell restriction shouldn’t be needed I think. Thanks!

---

<div class="post-metadata">

**Author:** ![mmtg](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@mmtg](https://discourse.slicer.org/u/mmtg)\
**Post date:** [January 29, 2018, 9:38pm UTC](https://discourse.slicer.org/t/rtstruct-not-showing-contour/1926/15 "2018-01-29T21:38:36Z")

</div>

Thanks very much for this! I will install the nightly - hopefully my script to batch convert these RTStructs into binaries still works. Glad this worked out!

---

<div class="post-metadata">

**Author:** ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)\
**Post date:** [January 29, 2018, 9:58pm UTC](https://discourse.slicer.org/t/rtstruct-not-showing-contour/1926/16 "2018-01-29T21:58:44Z")

</div>

The underlying issue has been fixed (Slice thickness now defaults to image slice spacing instead of 0.0).

You should be able to use the default conversions tomorrow in the next nightly, without needing the workaround that Csaba posted.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/e/fe4f2359c6783e99b417b3fd3e5b256a48c86a2c.jpeg)
