Is there anything I can do to speed up the Render time?<br><br><div class="gmail_quote">On Mon, Nov 8, 2010 at 8:13 PM, Karthik Krishnan <span dir="ltr">&lt;<a href="mailto:karthik.krishnan@kitware.com">karthik.krishnan@kitware.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">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; More information that I&#39;ve found about the first issue I reported.  I&#39;ve<br>
&gt; been narrowing down the issue, and the issue appears to be with<br>
&gt; vtkImageViewer2.SetSlice(int slice).  This method is very slow when I&#39;m<br>
&gt; rendering a vtkPolyData that represents a mesh (whether it&#39;s cut or not is<br>
&gt; actually irrelevant)<br>
<br>
</div>Contrary to what you assume, It is relevant. The SetSlice method<br>
internally invokes render, so as to update the display in response to<br>
changes. A &quot;Render&quot; implies that everything displayed on this<br>
renderwindow is re-rendered. This includes the rendering the polydata.<br>
If uncut, it can be slow depending on the number of cells. If cut, it<br>
can take time to update the cutter, since the cut-function (plane) has<br>
been translated.<br>
<div class="im"><br>
&gt; and fast when I&#39;m rendering either nothing or a<br>
&gt; vtkPolyData that represents a stack of 2D contours.  Does this help at all?<br>
<br>
</div>Indeed, as mentioned above, there is no cutting to perform here.<br>
Rendering a bunch of 2D contours is probably faster than rendering<br>
your entire mesh.<br>
<div><div></div><div class="h5"><br>
&gt;<br>
&gt; On Mon, Nov 8, 2010 at 10:26 AM, Jonathan Morra &lt;<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Thanks for your response.  It turns out on my machine that that<br>
&gt;&gt; initialization is too slow.  What&#39;s happening is the following<br>
&gt;&gt; 1.  The user click indicating that they want to try a contour<br>
&gt;&gt; 2.  A new vtkContourWidget is made with the dijkstra interpolator.<br>
&gt;&gt; 3.  The contour widget is initialized as I described above with just two<br>
&gt;&gt; points.  Adding that second point is where the slowdown occurs.<br>
&gt;&gt; As far as point 2, I am initializing a contour widget with the output of<br>
&gt;&gt; vtkCutter, but I am subsampling when I do that (I take 7% of the points), so<br>
&gt;&gt; I only have a handful of control points.  Is there a way to frontload the<br>
&gt;&gt; load time so I only have to do it once as opposed to every time a user wants<br>
&gt;&gt; to draw a contour?  That is simply too slow for my application.<br>
&gt;&gt; Also do you have any idea why rendering the meshes is slow?  Could it be<br>
&gt;&gt; related to the point order, or is is something else?<br>
&gt;&gt; On Sat, Nov 6, 2010 at 8:54 AM, Karthik Krishnan<br>
&gt;&gt; &lt;<a href="mailto:karthik.krishnan@kitware.com">karthik.krishnan@kitware.com</a>&gt; wrote:<br>
&gt;&gt;&gt;<br>
&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; wrote:<br>
&gt;&gt;&gt; &gt; on vtkDijkstraImageContourLineInterpolator and am able to successfully<br>
&gt;&gt;&gt; &gt; create the contour widget with live wire interpolation. However, when I<br>
&gt;&gt;&gt; &gt; first initialize the contour with the following code it is very slow<br>
&gt;&gt;&gt; &gt;     // For now, we&#39;re just initializing the data with<br>
&gt;&gt;&gt; &gt;     // the point that was clicked<br>
&gt;&gt;&gt; &gt;     vtkPoints points = new vtkPoints();<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;     // The initial data MUST be at least a &quot;line&quot;<br>
&gt;&gt;&gt; &gt;     // by giving the same point twice we are effictively creating a<br>
&gt;&gt;&gt; &gt; zero<br>
&gt;&gt;&gt; &gt;     // length line<br>
&gt;&gt;&gt; &gt;     points.InsertNextPoint(lastContourControlPoint);<br>
&gt;&gt;&gt; &gt;     points.InsertNextPoint(lastContourControlPoint);<br>
&gt;&gt;&gt; &gt;     vtkPolyData initialData = new vtkPolyData();<br>
&gt;&gt;&gt; &gt;     initialData.SetPoints(points);<br>
&gt;&gt;&gt; &gt;     contourWidget.Initialize(initialData, 0);<br>
&gt;&gt;&gt; &gt; The line that is slow is the last line.  The weird part is that if I do<br>
&gt;&gt;&gt; &gt; not<br>
&gt;&gt;&gt; &gt; use live wire, and just use the default Bezier curve interpolation the<br>
&gt;&gt;&gt; &gt; initialization is instant.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Yes. There are 2 issues here.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; 1. The dijkstra interpolator is a bit slow to start with, since during<br>
&gt;&gt;&gt; the time of initialization, it builds the adjacency information. But<br>
&gt;&gt;&gt; that&#39;s not a big deal when you are drawing on an image. The very first<br>
&gt;&gt;&gt; line segment placement is a bit slow (~3 seconds). After that its fast<br>
&gt;&gt;&gt; and interactive.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; 2. The real issue, I think, here is the fact that you are initializing<br>
&gt;&gt;&gt; the contour with the contour with lots of control points. How many of<br>
&gt;&gt;&gt; them are there ? As I understand, you are generating these control<br>
&gt;&gt;&gt; points from the output of vtkCutter ? Perhaps you want to sample the<br>
&gt;&gt;&gt; input polyline and then feed those sample points as the control<br>
&gt;&gt;&gt; points.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Thanks<br>
&gt;&gt;&gt; --<br>
&gt;&gt;&gt; karthik<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br>