Hems  
                
               
                 
              
                  
                    July 11, 2020,  2:28pm
                   
                   
              1 
               
             
            
              I find Streamlit impressive. Outstanding work!
I have a 3d mesh file. I am able to plot the 3d mesh file using pyvista library, ITK widgets, and see it in the notebook interactively.
I would like to show this 3D plot in Streamlit interactively. Is it possible to do it? If there is an example, it would be very helpful.
Kind regards, 
Hemanand
             
            
               
               
              1 Like 
            
                
            
           
          
            
            
              Hello @Hems , welcome to the community.
With Components  coming really soon, which will enable you to run arbitrary HTML/JS code in Streamlit, we should be able to replicate part of ITKWidget’s code, which is passing a JS representation or file upload of your mesh read through Pyvista into itk-vtk-viewer  / vtk.js  to visualize it in Streamlit.
I believe that’s an excellent example off custom component where you can have a quick prototype working, if you want to try it out when it’s live 
Fanilo
             
            
               
               
              1 Like 
            
            
           
          
            
              
                Hems  
                
               
              
                  
                    July 14, 2020,  8:32pm
                   
                   
              3 
               
             
            
              Hi, 
Thanks for pointing me towards the right direction. It is very interesting. I’ll try it.
Regards, 
Hems
             
            
               
               
              1 Like 
            
            
           
          
            
            
              Hey @Hems , I am curious if you got the pyvista/vtk component to work! Wouldn’t want to re-invent the wheel 
             
            
               
               
              1 Like 
            
            
           
          
            
              
                Hems  
                
               
              
                  
                    January 10, 2021,  2:12pm
                   
                   
              6 
               
             
            
              Hi @nickvazz  , Unfortunately, I could not find the time to make it. Please let me know if you create it   . Good luck!
             
            
               
               
              1 Like 
            
            
           
          
            
            
              Hello 
a code snippet working for me with itkwidgets.
import vtk
from itkwidgets import view
from ipywidgets import embed
import streamlit.components.v1 as components
nifti_reader = vtk.vtkNIFTIImageReader()
reader.SetFileName(PATH-TO-LOCAL-NIFTI-FILE)
reader.Update()
view_width = 800
view_height = 600
snippet = embed.embed_snippet(views=view(reader.GetOutput()))
html = embed.html_template.format(title="", snippet=snippet)
components.html(html, width=view_width, height=view_height)
 
Hope that could help 
             
            
               
               
              5 Likes 
            
            
           
          
            
              
                py_cad  
                
               
              
                  
                    July 26, 2022,  9:11am
                   
                   
              8 
               
             
            
              Thank you very much! It worked for me
             
            
               
               
               
            
            
           
          
            
              
                system  
                
                  Closed 
               
              
                  
                    July 26, 2023,  9:12am
                   
                   
              9 
               
             
            
              This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
             
            
               
               
               
            
            
           
          
            
              
                edsaac  
                
               
                 
              
                  
                    February 1, 2024,  7:49pm
                   
                   
              10 
               
             
            
              In case someone stumbles upon this post, there is the stpyvista  component to render PyVista plotters in streamlit:
 
  
 
             
            
               
               
              1 Like