My data is about 512*512*100 and the meshes are contained within the data.  The thing that was weird to me is that the render speed is the same whether or not I decimate the mesh.  I tried decimating the mesh by .999 and the speed was just as slow.  How can I inspect my pipeline for any weirdness that I might be doing?<br>
<br><div class="gmail_quote">On Mon, Nov 8, 2010 at 8:59 PM, David Gobbi <span dir="ltr">&lt;<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Jonathan,<br>
<br>
Turning on wireframe will usually slow down the rendering (but in this<br>
case, since you are rendering just 2D contours, it might not make a<br>
difference).<br>
<br>
But I suspect that it isn&#39;t the rendering itself that is slowing you<br>
down, I think that the slowdown is the result of undesired VTK<br>
pipeline execution within the Render call.  The reason I say this is<br>
that modern 3D graphics cards can draw over 100 million triangles per<br>
second, and assuming that your voxel data is around 256*x256*256, your<br>
meshes will have approximately 500000 triangles and your graphics card<br>
will be able to draw them at over 200 frames per second.<br>
<br>
So either your meshes are much larger than my estimate, or else<br>
something is happening in the VTK pipeline to cause the mesh to be<br>
re-generated at every render.<br>
<font color="#888888"><br>
  David<br>
</font><div><div></div><div class="h5"><br>
On Mon, Nov 8, 2010 at 9:15 PM, Jonathan Morra &lt;<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>&gt; wrote:<br>
&gt; Is there anything I can do to speed up the Render time?<br>
&gt;<br>
&gt; On Mon, Nov 8, 2010 at 8:13 PM, Karthik Krishnan<br>
&gt; &lt;<a href="mailto:karthik.krishnan@kitware.com">karthik.krishnan@kitware.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; On Tue, Nov 9, 2010 at 2:54 AM, Jonathan Morra &lt;<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt; More information that I&#39;ve found about the first issue I reported.  I&#39;ve<br>
&gt;&gt; &gt; been narrowing down the issue, and the issue appears to be with<br>
&gt;&gt; &gt; vtkImageViewer2.SetSlice(int slice).  This method is very slow when I&#39;m<br>
&gt;&gt; &gt; rendering a vtkPolyData that represents a mesh (whether it&#39;s cut or not<br>
&gt;&gt; &gt; is<br>
&gt;&gt; &gt; actually irrelevant)<br>
&gt;&gt;<br>
&gt;&gt; Contrary to what you assume, It is relevant. The SetSlice method<br>
&gt;&gt; internally invokes render, so as to update the display in response to<br>
&gt;&gt; changes. A &quot;Render&quot; implies that everything displayed on this<br>
&gt;&gt; renderwindow is re-rendered. This includes the rendering the polydata.<br>
&gt;&gt; If uncut, it can be slow depending on the number of cells. If cut, it<br>
&gt;&gt; can take time to update the cutter, since the cut-function (plane) has<br>
&gt;&gt; been translated.<br>
&gt;&gt;<br>
&gt;&gt; &gt; and fast when I&#39;m rendering either nothing or a<br>
&gt;&gt; &gt; vtkPolyData that represents a stack of 2D contours.  Does this help at<br>
&gt;&gt; &gt; all?<br>
&gt;&gt;<br>
&gt;&gt; Indeed, as mentioned above, there is no cutting to perform here.<br>
&gt;&gt; Rendering a bunch of 2D contours is probably faster than rendering<br>
&gt;&gt; your entire mesh.<br>
&gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On Mon, Nov 8, 2010 at 10:26 AM, Jonathan Morra &lt;<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>&gt;<br>
&gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Thanks for your response.  It turns out on my machine that that<br>
&gt;&gt; &gt;&gt; initialization is too slow.  What&#39;s happening is the following<br>
&gt;&gt; &gt;&gt; 1.  The user click indicating that they want to try a contour<br>
&gt;&gt; &gt;&gt; 2.  A new vtkContourWidget is made with the dijkstra interpolator.<br>
&gt;&gt; &gt;&gt; 3.  The contour widget is initialized as I described above with just<br>
&gt;&gt; &gt;&gt; two<br>
&gt;&gt; &gt;&gt; points.  Adding that second point is where the slowdown occurs.<br>
&gt;&gt; &gt;&gt; As far as point 2, I am initializing a contour widget with the output<br>
&gt;&gt; &gt;&gt; of<br>
&gt;&gt; &gt;&gt; vtkCutter, but I am subsampling when I do that (I take 7% of the<br>
&gt;&gt; &gt;&gt; points), so<br>
&gt;&gt; &gt;&gt; I only have a handful of control points.  Is there a way to frontload<br>
&gt;&gt; &gt;&gt; the<br>
&gt;&gt; &gt;&gt; load time so I only have to do it once as opposed to every time a user<br>
&gt;&gt; &gt;&gt; wants<br>
&gt;&gt; &gt;&gt; to draw a contour?  That is simply too slow for my application.<br>
&gt;&gt; &gt;&gt; Also do you have any idea why rendering the meshes is slow?  Could it<br>
&gt;&gt; &gt;&gt; be<br>
&gt;&gt; &gt;&gt; related to the point order, or is is something else?<br>
&gt;&gt; &gt;&gt; On Sat, Nov 6, 2010 at 8:54 AM, Karthik Krishnan<br>
&gt;&gt; &gt;&gt; &lt;<a href="mailto:karthik.krishnan@kitware.com">karthik.krishnan@kitware.com</a>&gt; wrote:<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; On Tue, Nov 2, 2010 at 6:31 AM, Jonathan Morra &lt;<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt;&gt; &gt; on vtkDijkstraImageContourLineInterpolator and am able to<br>
&gt;&gt; &gt;&gt;&gt; &gt; successfully<br>
&gt;&gt; &gt;&gt;&gt; &gt; create the contour widget with live wire interpolation. However,<br>
&gt;&gt; &gt;&gt;&gt; &gt; when I<br>
&gt;&gt; &gt;&gt;&gt; &gt; first initialize the contour with the following code it is very slow<br>
&gt;&gt; &gt;&gt;&gt; &gt;     // For now, we&#39;re just initializing the data with<br>
&gt;&gt; &gt;&gt;&gt; &gt;     // the point that was clicked<br>
&gt;&gt; &gt;&gt;&gt; &gt;     vtkPoints points = new vtkPoints();<br>
&gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt;     // The initial data MUST be at least a &quot;line&quot;<br>
&gt;&gt; &gt;&gt;&gt; &gt;     // by giving the same point twice we are effictively creating a<br>
&gt;&gt; &gt;&gt;&gt; &gt; zero<br>
&gt;&gt; &gt;&gt;&gt; &gt;     // length line<br>
&gt;&gt; &gt;&gt;&gt; &gt;     points.InsertNextPoint(lastContourControlPoint);<br>
&gt;&gt; &gt;&gt;&gt; &gt;     points.InsertNextPoint(lastContourControlPoint);<br>
&gt;&gt; &gt;&gt;&gt; &gt;     vtkPolyData initialData = new vtkPolyData();<br>
&gt;&gt; &gt;&gt;&gt; &gt;     initialData.SetPoints(points);<br>
&gt;&gt; &gt;&gt;&gt; &gt;     contourWidget.Initialize(initialData, 0);<br>
&gt;&gt; &gt;&gt;&gt; &gt; The line that is slow is the last line.  The weird part is that if I<br>
&gt;&gt; &gt;&gt;&gt; &gt; do<br>
&gt;&gt; &gt;&gt;&gt; &gt; not<br>
&gt;&gt; &gt;&gt;&gt; &gt; use live wire, and just use the default Bezier curve interpolation<br>
&gt;&gt; &gt;&gt;&gt; &gt; the<br>
&gt;&gt; &gt;&gt;&gt; &gt; initialization is instant.<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; Yes. There are 2 issues here.<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; 1. The dijkstra interpolator is a bit slow to start with, since during<br>
&gt;&gt; &gt;&gt;&gt; the time of initialization, it builds the adjacency information. But<br>
&gt;&gt; &gt;&gt;&gt; that&#39;s not a big deal when you are drawing on an image. The very first<br>
&gt;&gt; &gt;&gt;&gt; line segment placement is a bit slow (~3 seconds). After that its fast<br>
&gt;&gt; &gt;&gt;&gt; and interactive.<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; 2. The real issue, I think, here is the fact that you are initializing<br>
&gt;&gt; &gt;&gt;&gt; the contour with the contour with lots of control points. How many of<br>
&gt;&gt; &gt;&gt;&gt; them are there ? As I understand, you are generating these control<br>
&gt;&gt; &gt;&gt;&gt; points from the output of vtkCutter ? Perhaps you want to sample the<br>
&gt;&gt; &gt;&gt;&gt; input polyline and then feed those sample points as the control<br>
&gt;&gt; &gt;&gt;&gt; points.<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; Thanks<br>
&gt;&gt; &gt;&gt;&gt; --<br>
&gt;&gt; &gt;&gt;&gt; karthik<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;<br>
&gt;<br>
</div></div><div><div></div><div class="h5">&gt; _______________________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the VTK FAQ at:<br>
&gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br>