# SlicerRT Batch Conversation Memory issue

**URL:** <https://discourse.slicer.org/t/slicerrt-batch-conversation-memory-issue/13026>\
**Category:** Support\
**Tags:** extensions-manager, slicerrt\
**Created:** [August 16, 2020, 5:26pm UTC](https://discourse.slicer.org/t/slicerrt-batch-conversation-memory-issue/13026 "2020-08-16T17:26:21Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![kleingeo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/kleingeo/32/6772_2.png) [@kleingeo](https://discourse.slicer.org/u/kleingeo)\
**Post date:** [August 16, 2020, 5:26pm UTC](https://discourse.slicer.org/t/slicerrt-batch-conversation-memory-issue/13026/1 "2020-08-16T17:26:21Z")

</div>

I am trying to use the batch conversion tool with SlicerRT and I’ve been getting memory issues. I am trying to use it to convert label maps from a Struct file and an accompanying CT scan. Is there any reason why I would be getting this type of issue and how much computation memory is required? I am running it on a PC with 32 GB of RAM, so not an insignificant amount.

---

<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:** [August 16, 2020, 5:31pm UTC](https://discourse.slicer.org/t/slicerrt-batch-conversation-memory-issue/13026/2 "2020-08-16T17:31:49Z")

</div>

If you set a large oversampling value, extents are large, or you have many segments then memory usage can be excessive.

Try latest Slicer Preview Release, as it contains many memory optimizations.

If you still have issues then attach the application log (menu: Help / Report a bug) obtained with latest Slicer Preview Release.

---

<div class="post-metadata">

**Author:** ![kleingeo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/kleingeo/32/6772_2.png) [@kleingeo](https://discourse.slicer.org/u/kleingeo)\
**Post date:** [August 16, 2020, 5:42pm UTC](https://discourse.slicer.org/t/slicerrt-batch-conversation-memory-issue/13026/3 "2020-08-16T17:42:46Z")

</div>

I’m using one of the lastest nightly previews to do it (maybe just a week ago). I’m not sure what the issue is, or if it is a slicer bug, a bug with the extension, or if this behaviour is expected.

---

<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:** [August 16, 2020, 6:20pm UTC](https://discourse.slicer.org/t/slicerrt-batch-conversation-memory-issue/13026/4 "2020-08-16T18:20:01Z")

</div>

Attach the application log (menu: Help / Report a bug) of a session where you run out of memory. It may help us to answer what causing the issue and how to resolve it.

---

<div class="post-metadata">

**Author:** ![kleingeo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/kleingeo/32/6772_2.png) [@kleingeo](https://discourse.slicer.org/u/kleingeo)\
**Post date:** [August 16, 2020, 6:26pm UTC](https://discourse.slicer.org/t/slicerrt-batch-conversation-memory-issue/13026/5 "2020-08-16T18:26:15Z")

</div>

I have the log, what is the best way to share it (its too large to copy-and-paste)?

---

<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:** [August 16, 2020, 6:30pm UTC](https://discourse.slicer.org/t/slicerrt-batch-conversation-memory-issue/13026/6 "2020-08-16T18:30:34Z")

</div>

You can use [https://gist.github.com/](https://gist.github.com/) or any cloud storage provider (Dropbox, OneDrive, Google drive, etc) and post the link here.

---

<div class="post-metadata">

**Author:** ![kleingeo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/kleingeo/32/6772_2.png) [@kleingeo](https://discourse.slicer.org/u/kleingeo)\
**Post date:** [August 16, 2020, 6:31pm UTC](https://discourse.slicer.org/t/slicerrt-batch-conversation-memory-issue/13026/7 "2020-08-16T18:31:52Z")

</div>

> <https://gist.github.com/kleingeo/eaa06ae63d525c00be7f7e2e0841fcd2>

---

<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:** [August 16, 2020, 7:07pm UTC](https://discourse.slicer.org/t/slicerrt-batch-conversation-memory-issue/13026/8 "2020-08-16T19:07:32Z")

</div>

Thank you, these logs are already useful, but it is hard to tell for sure what’s wrong. Can you share the structure set files (of anonymized or phantom data sets)?

@Sunderlandkyl do any of the errors shown in the log look familiar to you?

---

<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:** [August 16, 2020, 9:15pm UTC](https://discourse.slicer.org/t/slicerrt-batch-conversation-memory-issue/13026/9 "2020-08-16T21:15:52Z")

</div>

No, it’s not an error that I’ve seen before.

---

<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:** [August 17, 2020, 12:14pm UTC](https://discourse.slicer.org/t/slicerrt-batch-conversation-memory-issue/13026/10 "2020-08-17T12:14:12Z")

</div>

Is this something that occurs with any data you want to convert or one specific dataset?

---

<div class="post-metadata">

**Author:** ![kleingeo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/kleingeo/32/6772_2.png) [@kleingeo](https://discourse.slicer.org/u/kleingeo)\
**Post date:** [August 17, 2020, 2:39pm UTC](https://discourse.slicer.org/t/slicerrt-batch-conversation-memory-issue/13026/11 "2020-08-17T14:39:19Z")

</div>

Here is a link to the file. Sorry for the delay, I just had to make sure the file was properly deidentified.

[https://utoronto-my.sharepoint.com/:u:/g/personal/geoff\_klein\_mail\_utoronto\_ca/Eeb1--vk2S1GpMu4sOfO-ekBL94v\_pzPEkTaft12\_W2p-w?e=Qj41Ob](https://utoronto-my.sharepoint.com/:u:/g/personal/geoff_klein_mail_utoronto_ca/Eeb1--vk2S1GpMu4sOfO-ekBL94v_pzPEkTaft12_W2p-w?e=Qj41Ob)

---

<div class="post-metadata">

**Author:** ![kleingeo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/kleingeo/32/6772_2.png) [@kleingeo](https://discourse.slicer.org/u/kleingeo)\
**Post date:** [August 17, 2020, 2:47pm UTC](https://discourse.slicer.org/t/slicerrt-batch-conversation-memory-issue/13026/12 "2020-08-17T14:47:08Z")

</div>

> [@cpinter](#):
>
> his something that occurs with any data you

I’ve only been trying right now with a specific dataset, I haven’t tried with others. That being said, there shouldn’t be anything specifically different with this dataset compared to others I have.

---

<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:** [August 17, 2020, 3:20pm UTC](https://discourse.slicer.org/t/slicerrt-batch-conversation-memory-issue/13026/13 "2020-08-17T15:20:23Z")

</div>

What is the resolution of the accompanying CT scan?

---

<div class="post-metadata">

**Author:** ![kleingeo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/kleingeo/32/6772_2.png) [@kleingeo](https://discourse.slicer.org/u/kleingeo)\
**Post date:** [August 17, 2020, 3:48pm UTC](https://discourse.slicer.org/t/slicerrt-batch-conversation-memory-issue/13026/14 "2020-08-17T15:48:12Z")

</div>

The CT scan is a 512 x 512 x 296 volume with voxel spacing 1.171 x 1.171 x 1 mm^3

---

<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:** [August 17, 2020, 3:59pm UTC](https://discourse.slicer.org/t/slicerrt-batch-conversation-memory-issue/13026/15 "2020-08-17T15:59:35Z")

</div>

> [@kleingeo](#):
>
> 512 x 512 x 296

That is quite standard, it shouldn’t be a problem.

> [@kleingeo](#):
>
> there shouldn’t be anything specifically different with this dataset compared to others I have

I wouldn’t be so sure. Maybe there is somethig going on with one of the contours that confuses our conversion algorithm and makes it allocate way too much memory.

Thanks for the data! I think the only way to see it is to try it ourselves. @Sunderlandkyl do you have some time checking it out? You know way more about the contour conversion algorithm specifically, so if my hunch is right then you’re in a better position to find out the root of the problem. Please let me know if you don’t, and then I’ll give it a go when I can.

---

<div class="post-metadata">

**Author:** ![kleingeo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/kleingeo/32/6772_2.png) [@kleingeo](https://discourse.slicer.org/u/kleingeo)\
**Post date:** [August 17, 2020, 4:01pm UTC](https://discourse.slicer.org/t/slicerrt-batch-conversation-memory-issue/13026/16 "2020-08-17T16:01:38Z")

</div>

I know in the Struct file there are a lot of contours. However, there are only a few that I am actually interested in. Is there a way in the batch conversion tool to specify which labels I am actually interested in?

---

<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:** [August 17, 2020, 4:05pm UTC](https://discourse.slicer.org/t/slicerrt-batch-conversation-memory-issue/13026/17 "2020-08-17T16:05:09Z")

</div>

Yes, I can take a look at it.

I’ve already looked at the contour to surface conversion in Slicer, and some of the structures were not converted correctly.  
I think this is causing some additional issues in the closed surface to binary labelmap conversion, but I’ll debug and find 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:** [August 18, 2020, 3:06pm UTC](https://discourse.slicer.org/t/slicerrt-batch-conversation-memory-issue/13026/18 "2020-08-18T15:06:05Z")

</div>

The following structures: TS+2mmring, TS+4mmring, outer tissue ring, and bowel max20 are all not triangulated correctly from the contours, however that doesn’t seem to be the issue.

2 things seem to be happening:

- The memory usage when collapsing the binary labelmaps to a single layer is very high
- After collapsing the labelmaps, the closed surface to binary labelmap conversion is run again.

I’m working on a fix.

---

<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:** [August 18, 2020, 7:00pm UTC](https://discourse.slicer.org/t/slicerrt-batch-conversation-memory-issue/13026/19 "2020-08-18T19:00:53Z")

</div>

This should be fixed in tomorrows preview release ([c4fe6c5](https://github.com/SlicerRt/SlicerRT/commit/c4fe6c54c0b3269ba24a46f7d72967d5d132c976)).  
The reference geometry wasn’t being applied to the segmentation.
