# Enabling volume rendering for a large volume makes the application crash

**URL:** <https://discourse.slicer.org/t/enabling-volume-rendering-for-a-large-volume-makes-the-application-crash/17032>\
**Category:** Support\
**Tags:** volume-rendering\
**Created:** [April 12, 2021, 1:13am UTC](https://discourse.slicer.org/t/enabling-volume-rendering-for-a-large-volume-makes-the-application-crash/17032 "2021-04-12T01:13:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![evodevo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/evodevo/32/10623_2.png) [@evodevo](https://discourse.slicer.org/u/evodevo)\
**Post date:** [April 12, 2021, 1:13am UTC](https://discourse.slicer.org/t/enabling-volume-rendering-for-a-large-volume-makes-the-application-crash/17032/1 "2021-04-12T01:13:38Z")

</div>

Operating system: windows  
Slicer version:4.11.20200930  
Expected behavior: volume rendering  
Actual behavior: volume rendering freezes

I have datasets that are small (in dimensions) and whenever I ask slicer to do volume rendering, it produces a tiny volume in the middle of the 3d field. When I zoom in on the volume to move it, the program freezes.

---

<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 12, 2021, 1:27am UTC](https://discourse.slicer.org/t/enabling-volume-rendering-for-a-large-volume-makes-the-application-crash/17032/2 "2021-04-12T01:27:17Z")

</div>

Can you take a screenshot of the Volume information section of Volumes module (to see dimensions, spacing, and scalar type of your volume)?

---

<div class="post-metadata">

**Author:** ![evodevo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/evodevo/32/10623_2.png) [@evodevo](https://discourse.slicer.org/u/evodevo)\
**Post date:** [April 12, 2021, 1:54am UTC](https://discourse.slicer.org/t/enabling-volume-rendering-for-a-large-volume-makes-the-application-crash/17032/3 "2021-04-12T01:54:10Z")

</div>

![screenshot](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/e/de9989353960e6a21d553fbeabf388cefb99b27f.png)

---

<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 12, 2021, 2:04am UTC](https://discourse.slicer.org/t/enabling-volume-rendering-for-a-large-volume-makes-the-application-crash/17032/4 "2021-04-12T02:04:45Z")

</div>

Thank you. The volume rendering looks good. The image spacing is a bit too small (2 magnitudes smaller than usual), but should not cause application hang.

Do you use CPU or GPU volume rendering?  
Does the hang occur when you zoom in? Does the application crash after the hang?  
What graphics card do you have?

Please try if rendering the volume in multiple partitions (to ease the load on the GPU) solves the issue, by copy-pasting these lines to the Python console:

```python
threeDViewWidget = slicer.app.layoutManager().threeDWidget(0)
vrDisplayableManager = threeDViewWidget.threeDView().displayableManagerByClassName('vtkMRMLVolumeRenderingDisplayableManager')
vrMapper = vrDisplayableManager.GetVolumeMapper(getNode('skull'))
vrMapper.SetPartitions(1,1,2)

```

---

<div class="post-metadata">

**Author:** ![evodevo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/evodevo/32/10623_2.png) [@evodevo](https://discourse.slicer.org/u/evodevo)\
**Post date:** [April 12, 2021, 2:35am UTC](https://discourse.slicer.org/t/enabling-volume-rendering-for-a-large-volume-makes-the-application-crash/17032/5 "2021-04-12T02:35:28Z")

</div>

Thank you lasson, for all your help.  
I use the gpu volume rendering. the hand occur right after i zoom in. yes it crashes after the hang  
my graphics card is amd radeon™ vega 3 400mhz, vram of 1009 mb and total memory of 3542 mb  
I tried inserting the code you sent, but i got an error message and the problem did not go away.

 ![screenshot](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/7/7/77e2cca78c3348035a91132dacd76d0941a78c72.png)

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [April 12, 2021, 2:59am UTC](https://discourse.slicer.org/t/enabling-volume-rendering-for-a-large-volume-makes-the-application-crash/17032/6 "2021-04-12T02:59:39Z")

</div>

Try what @lassoan suggested with the latest stable it might work better. Also you have a very low end gpu. Even when works, performance is unlikely to be good.

---

<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 12, 2021, 3:57am UTC](https://discourse.slicer.org/t/enabling-volume-rendering-for-a-large-volume-makes-the-application-crash/17032/7 "2021-04-12T03:57:12Z")

</div>

> [@evodevo](#):
>
> I use the gpu volume rendering. the hand occur right after i zoom in. yes it crashes after the hang

This indicates that you get a TDR error: the operating system shuts down applications that keep the graphics card busy for too long. This happens because the size of the volume is too large for your GPU to comfortably handle. There are several ways to work around this:

- Option A: Run the code snippet above to split the volume to smaller chunks (that way you have a better chance that the graphics card will not be unresponsive for too long) or increase TDR delay in the registry.
- Option B: Crop and downsample your volume using Crop volume and volume render this smaller volume.
- Option C: Increase TDR delay value in registry (see details [here](https://docs.microsoft.com/en-us/windows-hardware/drivers/display/tdr-registry-keys))
- Option D: Use CPU volume rendering.
- Option E: Upgrade your computer with a stronger graphics card.

> [@evodevo](#):
>
> I tried inserting the code you sent, but i got an error message and the problem did not go away.

You need to run the code after you enabled volume rendering.
