<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Thanks for your answers,</div><div><br></div><div>I try to fight my way through vtkFastSplatter, but there is only one example and I do not understand everything. (The documentation is a little sparse)</div><div>The example in the docs use a <span style="color: rgb(0, 0, 0); font-family: monospace; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); display: inline !important; float: none; ">vtkImageViewer2,</span>and I want to have a vtkactor to put it in my 3d scenery.</div><div>So I mapped the splatter on a vtkplane through a vtktexture (to be able to have a vtkactor). Hope this will not lead to performance problems once I try to display millions of vtkactors ...</div><div>It's also not really working, the colors are messed up, and I don't understand the vtkpoints usage for the vtkFastSplatter.</div><div><br></div><div>5 points are used in the example, which display 5 splats, but I was not able to have only one splat centered in the middle (even using only 1 point, at 0,0,0).</div><div><br></div><div><div><br></div><div>For vtkPointSpriteMapper, is not in vtk, so I have to find the way to take it from paraview, add it to vtk, and make the python bindings for it. Any idea how to achieve this ?</div></div><div><br></div><div><br></div><div>Regards</div><div><br></div><div>Michka</div><div><br></div><div><br></div><div>Le 19 juin 2013 à 23:29, Biddiscombe, John A. a écrit :</div><div><br></div><div><blockquote type="cite">Try googling vtkPointSpriteMapper<br>A modified version using painters is in paraview, but the original was designed for straight vtk use.<br><br>JB <br>(apologies if you get multiple copies of this, email misfired)</blockquote></div><div><br></div><br><div><div>Le 19 juin 2013 à 19:57, Markus Neuner a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi,<br><br>oh vtkGaussianSplatter is the wrong class. It generates a volume, but you could visualize it with volume rendering.<br><br>The first version is basically what FastSplatter does (<a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/FastSplatter">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/FastSplatter</a>).<br><br>For the second version i can't find a class in vtk that can actually does this (compute the Gaussian directly in the fragment shader).<br><br>You can derive from vtkGLSLShaderProgram and implement the procedures described in this example <a href="http://prideout.net/blog/p60/Splat.zip">http://prideout.net/blog/p60/Splat.zip</a> written by Philip Rideout.<br><br>Regards,<br>Markus<br><br><br>On 06/16/2013 06:31 PM, Michka Popoff wrote:<br><blockquote type="cite">Hi<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">thank you for your help.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">1) For the first solution, what would be the class to use to create the texture from the gaussian equation ? Once I have the textures, I could map them to planes. I did wrote some OpenGL code a while ago where I did this with a shader, billboarding the textures so that the gaussians would always face the camera. This was very fast.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">2) I saw vtkGaussianSplatter, but I don't know if I can set a different radius and exponent factor for each point ? In the class these values can only be set globally. I wrote some code (in python), inspired from the FinancialField example from vtkGaussianSplatter, but the splats are passed through vtkContourFilter to make a surface. I think this is messing with my gaussians, and I don't know how to do this without vtkContourFilter. I found no other example for vtkGaussianSplatter. Here is the code I wrote, displaying 10x10 points :<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">#!/usr/bin/env python<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">import vtk<br></blockquote><blockquote type="cite">from numpy import random<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"># Create points<br></blockquote><blockquote type="cite">points = vtk.vtkPoints()<br></blockquote><blockquote type="cite">for i in range(10):<br></blockquote><blockquote type="cite"> for j in range(10):<br></blockquote><blockquote type="cite"> points.InsertNextPoint(i, j, 0.0)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">polydata = vtk.vtkPolyData()<br></blockquote><blockquote type="cite">polydata.SetPoints(points)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">popSplatter = vtk.vtkGaussianSplatter()<br></blockquote><blockquote type="cite">popSplatter.SetInput(polydata)<br></blockquote><blockquote type="cite">popSplatter.SetSampleDimensions(50, 50, 50)<br></blockquote><blockquote type="cite">popSplatter.SetRadius(0.05)<br></blockquote><blockquote type="cite">popSplatter.ScalarWarpingOff()<br></blockquote><blockquote type="cite">popSplatter.Update()<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">popSurface = vtk.vtkContourFilter()<br></blockquote><blockquote type="cite">popSurface.SetInputConnection(popSplatter.GetOutputPort())<br></blockquote><blockquote type="cite">popSurface.SetValue(0, 0.01)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">popMapper = vtk.vtkPolyDataMapper()<br></blockquote><blockquote type="cite">popMapper.SetInputConnection(popSurface.GetOutputPort())<br></blockquote><blockquote type="cite">popMapper.ImmediateModeRenderingOn()<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">popActor = vtk.vtkActor()<br></blockquote><blockquote type="cite">popActor.SetMapper(popMapper)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"># Renderer<br></blockquote><blockquote type="cite">renderer = vtk.vtkRenderer()<br></blockquote><blockquote type="cite">renderer.AddActor(popActor)<br></blockquote><blockquote type="cite">renderer.ResetCamera()<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"># Render Window<br></blockquote><blockquote type="cite">renderWindow = vtk.vtkRenderWindow()<br></blockquote><blockquote type="cite">renderWindow.AddRenderer(renderer)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"># Interactor<br></blockquote><blockquote type="cite">renderWindowInteractor = vtk.vtkRenderWindowInteractor()<br></blockquote><blockquote type="cite">renderWindowInteractor.SetRenderWindow(renderWindow)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"># Begin Interaction<br></blockquote><blockquote type="cite">renderWindow.Render()<br></blockquote><blockquote type="cite">renderWindowInteractor.Start()<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">On 16 juin 2013, at 11:14, Markus Neuner <<a href="mailto:neuner.markus@gmx.net">neuner.markus@gmx.net</a>> wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">Hi Michka,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">You could try to generate volumetric data using Gaussian splats.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">There are two solutions to this problem:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">- Create the 3D Gaussian function on the CPU during application initialization, and create a 3D texture from that.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">- But better and much faster is to compute the Gaussian directly in the fragment shader.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Have a look at vtkGaussianSplatter it may do what you want.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Regards,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Markus<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">On 06/15/2013 05:18 PM, Michka Popoff wrote:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Hi<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">I want to draw a lot of points in VTK (~1.000.000), with each point's color fading out to a transparent value, following a gaussian function.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">So the center will be bright (maximum intensity), and the border will have no color.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">I am able to draw a lot of points using vtkPoints, I can also change their color, but I am looking for a way to apply the fade out to every point. Of course the parameters of the gaussian function will be different for each point (intensity value in the middle, diameter).<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">The result for 1 point would look like this : <a href="http://www.princeton.edu/~rvdb/images/deconv/Gauss2Psf.jpg">http://www.princeton.edu/~rvdb/images/deconv/Gauss2Psf.jpg</a><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Are there some filters/mappers I could use directly ? Or can I perhaps try to "hijack" vtkgaussiansplatter to achieve this ?<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Thanks in advance<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Michka Popoff<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">_______________________________________________<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Powered by <a href="http://www.kitware.com">www.kitware.com</a><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Follow this link to subscribe/unsubscribe:<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><a href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote></div></blockquote></div><br></body></html>