# How to display volume rendering of large volume Images

**URL:** <https://discourse.vtk.org/t/how-to-display-volume-rendering-of-large-volume-images/10375>\
**Category:** Development\
**Created:** [January 4, 2023, 2:12am UTC](https://discourse.vtk.org/t/how-to-display-volume-rendering-of-large-volume-images/10375 "2023-01-04T02:12:01Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![tong\_yang](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tong_yang/32/6355_2.png) [@tong\_yang](https://discourse.vtk.org/u/tong_yang)\
**Post date:** [January 4, 2023, 2:12am UTC](https://discourse.vtk.org/t/how-to-display-volume-rendering-of-large-volume-images/10375/1 "2023-01-04T02:12:01Z")

</div>

Hello, I have been learning VTK for one year. This is my first question. I met some questions about the visualization of large capacity images, about 50GB，100GB，500GB，1TB. These are some TIFF microscopic images, so the images is very large. Now i tried to display these images in volume rendering. but it seems that the performance of the GPU card is insufficient, causing the driver to report an error, as shown in the following figure.  
system: win 10 x64  
CPU：Intel Xeon E5-2680 v4 @ 2.40GHz (X2)  
Memory: 256GB  
GPU: NVIDIA RTX A4000

 ![image](https://discourse.vtk.org/uploads/default/original/2X/4/44c1f3ca479044f49d3772873b20c8f39be31254.png)

So how can I solve this problem? Thanks a lot.

---

<div class="post-metadata">

**Author:** ![jfausty](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jfausty/32/5372_2.png) [@jfausty](https://discourse.vtk.org/u/jfausty)\
**Post date:** [January 4, 2023, 9:18am UTC](https://discourse.vtk.org/t/how-to-display-volume-rendering-of-large-volume-images/10375/2 "2023-01-04T09:18:42Z")

</div>

@Timothee_Chabat

---

<div class="post-metadata">

**Author:** ![Timothee\_Chabat](https://discourse.vtk.org/user_avatar/discourse.vtk.org/timothee_chabat/32/3234_2.png) [@Timothee\_Chabat](https://discourse.vtk.org/u/Timothee_Chabat)\
**Post date:** [January 4, 2023, 9:56am UTC](https://discourse.vtk.org/t/how-to-display-volume-rendering-of-large-volume-images/10375/3 "2023-01-04T09:56:33Z")

</div>

Hello @tong_yang ,

Most likely the image is given entirely to the GPU , causing it to crash because it cannot fit the too big image. What are the mappers / actors / render view classes that you are using ? Some mappers allows for image streaming and this feature may solve your issue.

---

<div class="post-metadata">

**Author:** ![tong\_yang](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tong_yang/32/6355_2.png) [@tong\_yang](https://discourse.vtk.org/u/tong_yang)\
**Post date:** [January 5, 2023, 2:04am UTC](https://discourse.vtk.org/t/how-to-display-volume-rendering-of-large-volume-images/10375/4 "2023-01-05T02:04:40Z")

</div>

Thank you for your reply. I use these classes, such as vtkSmartVolumeMapper，vtkVolume，vtkVolumeProperty，vtkRenderer。And i found suggestions on NVIDIA’s official website, [https://nvidia.custhelp.com/app/answers/detail/a\_id/3633](https://nvidia.custhelp.com/app/answers/detail/a_id/3633)。I know that this is really caused by the insufficient performance of the GPU, but I still want to know whether there are other ways to optimize and improve this situation, such as using VTK in other ways.

---

<div class="post-metadata">

**Author:** ![Timothee\_Chabat](https://discourse.vtk.org/user_avatar/discourse.vtk.org/timothee_chabat/32/3234_2.png) [@Timothee\_Chabat](https://discourse.vtk.org/u/Timothee_Chabat)\
**Post date:** [January 5, 2023, 9:36am UTC](https://discourse.vtk.org/t/how-to-display-volume-rendering-of-large-volume-images/10375/5 "2023-01-05T09:36:36Z")

</div>

There are a few things that come to my mind for improving peformance without changing the size of the image :

- disable the `Shade` option → `vtkVolumeProperty::SetShade(bool)`, if it was enabled
- check [https://vtk.org/doc/nightly/html/classvtkOpenGLGPUVolumeRayCastMapper.html#ab3fe2913f0a5282d3aa7550f22acbd98](https://vtk.org/doc/nightly/html/classvtkOpenGLGPUVolumeRayCastMapper.html#ab3fe2913f0a5282d3aa7550f22acbd98) for partitioning the volume into smaller volume
- Disable the option `AutoAdjustSampleDistances` on the mapper and set the sample distance by hand with `SetSampleDistance(float)` : greater is faster (but rendering might look bad)
- If you already know what part of the image you want to render, you can use the `Cropping` options of the mapper.
- Use directly `vtkOpenGLGPUVolumeRayCastMapper` instead of `vtkSmartMapper` to avoid some overhead and to have more control over the rendering

---

<div class="post-metadata">

**Author:** ![tong\_yang](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tong_yang/32/6355_2.png) [@tong\_yang](https://discourse.vtk.org/u/tong_yang)\
**Post date:** [January 11, 2023, 4:05am UTC](https://discourse.vtk.org/t/how-to-display-volume-rendering-of-large-volume-images/10375/6 "2023-01-11T04:05:06Z")

</div>

Hello @Timothee_Chabat ,

Thank you again for your reply, I tried these methods according to your suggestions, which helped a little, but it was not big. There was no error when the mouse interacted, but the jamming was very serious. So I want to ask：

1. Whether vtk supports volume rendering of such large images during design, development and testing
2. Have you tried to display such a large image? How about the situation and the software and hardware configuration
3. Are there any open source software specially designed to display such large images

---

<div class="post-metadata">

**Author:** ![Timothee\_Chabat](https://discourse.vtk.org/user_avatar/discourse.vtk.org/timothee_chabat/32/3234_2.png) [@Timothee\_Chabat](https://discourse.vtk.org/u/Timothee_Chabat)\
**Post date:** [January 11, 2023, 8:30am UTC](https://discourse.vtk.org/t/how-to-display-volume-rendering-of-large-volume-images/10375/7 "2023-01-11T08:30:20Z")

</div>

Hello @tong_yang ,

VTK per se is not the kind of software you’re looking for because your problem basically boils down to : image is very big but you want to visualize the whole image anyway. What you may want to try instead :

- use OSPRay in VTK : for datasets this big it can sometimes help to use the CPU instead of the GPU (that is if you have lots of RAM and a good CPU)
- use ParaView : this is a software that uses VTK under the hood but that has a client / server architecture and allows multiple server. So for example if you have multiple computers with a good graphic card available, run a `pvserver` on each of them and use `paraview` to visualize the image. ParaView will split evenly the image so each GPU has to do less works, and compose the image afterwards.

[EDIT]

ParaView can also work if you have multiple GPUs on a single computer, just spawn as many `pvserver` as GPU available and assign a single GPU per server.  
You may want to read [https://docs.paraview.org/en/latest/ReferenceManual/parallelDataVisualization.html](https://docs.paraview.org/en/latest/ReferenceManual/parallelDataVisualization.html)

---

<div class="post-metadata">

**Author:** ![tong\_yang](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tong_yang/32/6355_2.png) [@tong\_yang](https://discourse.vtk.org/u/tong_yang)\
**Post date:** [February 15, 2023, 5:50am UTC](https://discourse.vtk.org/t/how-to-display-volume-rendering-of-large-volume-images/10375/8 "2023-02-15T05:50:32Z")

</div>

Hello @Timothee_Chabat ,  
In these months, i tested OSPRay, I found that if the CPU power is sufficient, it can meet the image rendering below 500GB. Although the interactive speed is only 1-2 FPS, it can at least run normally, which has met my needs·. But I found several problems about OSPRay：

1. Setting vtkOSPRayVolumeMapper:: SetBlendModeToMaximumIntensity has no effect
2. Multiple instances cannot be displayed in one window, or I use them incorrectly
3. The transform function is not normal and has no effect, such as translation, rotation and scaling

Finally, thank you for your reply, which gave me a lot of help.

---

<div class="post-metadata">

**Author:** ![Timothee\_Chabat](https://discourse.vtk.org/user_avatar/discourse.vtk.org/timothee_chabat/32/3234_2.png) [@Timothee\_Chabat](https://discourse.vtk.org/u/Timothee_Chabat)\
**Post date:** [February 15, 2023, 7:59am UTC](https://discourse.vtk.org/t/how-to-display-volume-rendering-of-large-volume-images/10375/9 "2023-02-15T07:59:49Z")

</div>

Hello @tong_yang ,

I’m glad that you’re happy with the OSPray solution ! 🙂

> [@tong\_yang](#):
>
> Setting vtkOSPRayVolumeMapper:: SetBlendModeToMaximumIntensity has no effect

According to OSPray documentation there is no such API for volume so I believe it is not supported by OSPRay itself. [Intel OSPRay Documentation](https://www.ospray.org/documentation.html#volumetricmodels)

> [@tong\_yang](#):
>
> Multiple instances cannot be displayed in one window, or I use them incorrectly

I can confirm that when displaying multiple volumes in ParaView there is some issues. It displays but rendering is incorrect and crash in some situation.

> [@tong\_yang](#):
>
> The transform function is not normal and has no effect, such as translation, rotation and scaling

I can confirm that it doesn’t work either with ParaView for volumes (it works for surfaces). I’m not sure whether this is a limit of VTK or OSPRay.

For point 1 and 3 maybe @Dave_DeMarle may have more infos ?

Also, do not hesitate to open issues on VTK gitlab [https://gitlab.kitware.com/vtk/vtk/-/issues/](https://gitlab.kitware.com/vtk/vtk/-/issues/) if your compfortable with it 🙂

FYI @sankhesh

---

<div class="post-metadata">

**Author:** ![tong\_yang](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tong_yang/32/6355_2.png) [@tong\_yang](https://discourse.vtk.org/u/tong_yang)\
**Post date:** [March 7, 2023, 3:00am UTC](https://discourse.vtk.org/t/how-to-display-volume-rendering-of-large-volume-images/10375/10 "2023-03-07T03:00:04Z")

</div>

Hello @Timothee_Chabat,  
Thank you for your reply. Now I already know that the performance of a single machine can’t do this work well, i want to try VTK MPI Distributed randering, can it use the resources of multiple machines to complete the rendering work?

If so, this is also a good method to solve my problem. I known that the ParaView can do this, but ParaView is too complex and huge for me. I hope to find a simplified example to test and realize the visualization of large-capacity images by VTK distributed rendering.

Finally, thank you for your reply, which gave me a lot of help.

---

<div class="post-metadata">

**Author:** ![jfausty](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jfausty/32/5372_2.png) [@jfausty](https://discourse.vtk.org/u/jfausty)\
**Post date:** [March 7, 2023, 7:50am UTC](https://discourse.vtk.org/t/how-to-display-volume-rendering-of-large-volume-images/10375/11 "2023-03-07T07:50:04Z")

</div>

Hi @tong_yang,

Glad that the answers @Timothee_Chabat gave you were helpful!

The OSPRay solution should work in a distributed context (multiple communicating MPI nodes each holding part of the data set in memory).

Be forewarned however, when using ray tracing in parallel some artifacts may pop up in the rendering: [https://gitlab.kitware.com/paraview/paraview/-/issues/21353](https://gitlab.kitware.com/paraview/paraview/-/issues/21353). This mostly seems to be related to the fact that each MPI node renders the data it has on hand without consideration for the data on other nodes I believe. To my knowledge, this kind of issue has not yet been tackled and can be relatively difficult to solve. I could be wrong on this point.

Best of luck!
