# How to save the 3D medical image reconstructed by the volume drawing algorithm as a PLY file to the local computer

**URL:** https://discourse.vtk.org/t/how-to-save-the-3d-medical-image-reconstructed-by-the-volume-drawing-algorithm-as-a-ply-file-to-the-local-computer/9982
**Category:** Support
**Created:** [November 28, 2022, 1:49pm UTC](https://discourse.vtk.org/t/how-to-save-the-3d-medical-image-reconstructed-by-the-volume-drawing-algorithm-as-a-ply-file-to-the-local-computer/9982 "2022-11-28T13:49:37Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![mmXIO](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mmxio/32/6128_2.png) [@mmXIO](https://discourse.vtk.org/u/mmXIO)
#### Post date: [November 28, 2022, 1:49pm UTC](https://discourse.vtk.org/t/how-to-save-the-3d-medical-image-reconstructed-by-the-volume-drawing-algorithm-as-a-ply-file-to-the-local-computer/9982/1 "2022-11-28T13:49:37Z")

</div>

How to save the 3D medical image reconstructed by the volume drawing algorithm as a PLY file to the local computer

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [November 29, 2022, 2:05am UTC](https://discourse.vtk.org/t/how-to-save-the-3d-medical-image-reconstructed-by-the-volume-drawing-algorithm-as-a-ply-file-to-the-local-computer/9982/2 "2022-11-29T02:05:08Z")

</div>

Direct volume rendering using raycasting is a display technique and you cannot store its result in a surface mesh (.ply file). See more detailed discussion of this topic on the Slicer forum:

> **[Save volume rendering as STL file](https://discourse.slicer.org/t/save-volume-rendering-as-stl-file/524)**
>
> Hello, I am a new user on 3D slicer. I was using the display preset feature under volume rendering, and I was wondering if there is a way to save what I was viewing as an .stl or 3D printable file. For example, I was viewing a sample MRI using the...

---

<div class="post-metadata">

### Author: ![mmXIO](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mmxio/32/6128_2.png) [@mmXIO](https://discourse.vtk.org/u/mmXIO)
#### Post date: [November 30, 2022, 7:37am UTC](https://discourse.vtk.org/t/how-to-save-the-3d-medical-image-reconstructed-by-the-volume-drawing-algorithm-as-a-ply-file-to-the-local-computer/9982/3 "2022-11-30T07:37:02Z")

</div>

Thank you very much for your answer. Can I ask one more question? If I want the rendering results to be displayed on a web page, is there a suitable way?

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [November 30, 2022, 1:30pm UTC](https://discourse.vtk.org/t/how-to-save-the-3d-medical-image-reconstructed-by-the-volume-drawing-algorithm-as-a-ply-file-to-the-local-computer/9982/4 "2022-11-30T13:30:43Z")

</div>

Yes, there are many ways to use VTK’s volume renderer in a web browser:

- [trame](https://kitware.github.io/trame/docs/module-vtk.html)
- [vtk.js](https://kitware.github.io/vtk-js/index.html)
- run your current desktop VTK code in a docker container; view it in the web browser using novnc (for example, run this command to run the VTK-based 3D Slicer application in your web browser at the URL [http://127.0.0.1:8080/:](http://127.0.0.1:8080/:) `docker run -d -p 8080:8080 --name slicer stevepieper/slicer:5.0.3`)

---

<div class="post-metadata">

### Author: ![mmXIO](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mmxio/32/6128_2.png) [@mmXIO](https://discourse.vtk.org/u/mmXIO)
#### Post date: [November 30, 2022, 2:02pm UTC](https://discourse.vtk.org/t/how-to-save-the-3d-medical-image-reconstructed-by-the-volume-drawing-algorithm-as-a-ply-file-to-the-local-computer/9982/5 "2022-11-30T14:02:36Z")

</div>

I’m a noob and thank you very much for your answer. My Volume Rendering is programmed in C++, the web system is written in Java and Js. I want to display the Volume Rendering results on the web page, can it be implemented through network transmission? If not, which way is appropriate?

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [November 30, 2022, 6:40pm UTC](https://discourse.vtk.org/t/how-to-save-the-3d-medical-image-reconstructed-by-the-volume-drawing-algorithm-as-a-ply-file-to-the-local-computer/9982/6 "2022-11-30T18:40:58Z")

</div>

If you don’t want to touch the C++ code then the first and third option (trame and docker+novnc) should work. The only non-trivial part is that you need to set up a reverse proxy server that launches a new server (docker container or trame server) for each client and makes each client communicate with its own server.

---

<div class="post-metadata">

### Author: ![mmXIO](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mmxio/32/6128_2.png) [@mmXIO](https://discourse.vtk.org/u/mmXIO)
#### Post date: [December 1, 2022, 1:57am UTC](https://discourse.vtk.org/t/how-to-save-the-3d-medical-image-reconstructed-by-the-volume-drawing-algorithm-as-a-ply-file-to-the-local-computer/9982/7 "2022-12-01T01:57:53Z")

</div>

Thanks, I’ll give it a try.

---

<div class="post-metadata">

### Author: ![mmXIO](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mmxio/32/6128_2.png) [@mmXIO](https://discourse.vtk.org/u/mmXIO)
#### Post date: [December 3, 2022, 3:49am UTC](https://discourse.vtk.org/t/how-to-save-the-3d-medical-image-reconstructed-by-the-volume-drawing-algorithm-as-a-ply-file-to-the-local-computer/9982/8 "2022-12-03T03:49:54Z")

</div>

Hello, Can I use vtkWindowToImageFilter to get a series of volume drawing rendered images and Transfer these pictures to the front-end to generate a 3D model?

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [December 3, 2022, 4:17am UTC](https://discourse.vtk.org/t/how-to-save-the-3d-medical-image-reconstructed-by-the-volume-drawing-algorithm-as-a-ply-file-to-the-local-computer/9982/9 "2022-12-03T04:17:43Z")

</div>

Yes, absolutely, this works. Fortunately, you don’t even need to implement this, because this is exactly what [Trame](https://kitware.github.io/trame/index.html) does when you use it in remote rendering mode.

---

<div class="post-metadata">

### Author: ![mmXIO](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mmxio/32/6128_2.png) [@mmXIO](https://discourse.vtk.org/u/mmXIO)
#### Post date: [December 3, 2022, 4:19am UTC](https://discourse.vtk.org/t/how-to-save-the-3d-medical-image-reconstructed-by-the-volume-drawing-algorithm-as-a-ply-file-to-the-local-computer/9982/10 "2022-12-03T04:19:55Z")

</div>

But my code is written in C++, and I learned a bit about trame, which uses python. Does trame support C++?

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [December 3, 2022, 4:44am UTC](https://discourse.vtk.org/t/how-to-save-the-3d-medical-image-reconstructed-by-the-volume-drawing-algorithm-as-a-ply-file-to-the-local-computer/9982/11 "2022-12-03T04:44:20Z")

</div>

Yes, it works for C++ classes, too. You can expose any vtkRenderWindow in the web browser using [vtkRemoteView](https://github.com/Kitware/trame-vtk/blob/214e1bfb4419a83c6390f1b8bf3cafa75fb3d1c7/README.rst#vtkremoteview). This is how ParaView (implemented in C++) is made available via Trame using remote rendering. You only need a few small Python files to describe your view layout and if you want to use any web widgets.

---

<div class="post-metadata">

### Author: ![mmXIO](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mmxio/32/6128_2.png) [@mmXIO](https://discourse.vtk.org/u/mmXIO)
#### Post date: [December 3, 2022, 4:56am UTC](https://discourse.vtk.org/t/how-to-save-the-3d-medical-image-reconstructed-by-the-volume-drawing-algorithm-as-a-ply-file-to-the-local-computer/9982/12 "2022-12-03T04:56:54Z")

</div>

Thank you very much for your answer! I will try it.

---

<div class="post-metadata">

### Author: ![mmXIO](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mmxio/32/6128_2.png) [@mmXIO](https://discourse.vtk.org/u/mmXIO)
#### Post date: [January 14, 2023, 5:00am UTC](https://discourse.vtk.org/t/how-to-save-the-3d-medical-image-reconstructed-by-the-volume-drawing-algorithm-as-a-ply-file-to-the-local-computer/9982/13 "2023-01-14T05:00:58Z")

</div>

Hello, long time no see.  
I now use the vtk server, using the remoteview method to display the volume drawing results on the web page, but I found that the only pictures presented on the web page are pictures. I now have a question: I want to achieve cutting through interaction with the web page, how should I do it? On the back end, I used boxwidget2 to implement cutting,

 ![BWXT6N}MWT%1VSTI6}U)2](https://discourse.vtk.org/uploads/default/original/2X/3/3e41f4a8c2e145564b6465c0c52d8f107201b204.jpeg)  
but when I rendered the web page with remote rendering, there was no box surrounding the image, which confused me.
