I&#39;m sorry, I thought that Rob was working on this speed issue, if that&#39;s not the case then I&#39;ll see if I can bury the speed hit somewhere in the program.<br><br><div class="gmail_quote">On Mon, Nov 8, 2010 at 11:11 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;">Robert :<br>
<br>
I&#39;m not sure how the locator can improve the speed of initialization.<br>
<br>
It improves the speed of closest point queries. These occur after the<br>
widget is being manipulated (after it has been defined by the user,<br>
interactively or programmatically).<br>
<br>
Please correct me if I am wrong.<br>
<br>
<br>
Jonathan:<br>
<br>
3 seconds is IMHO expected for intialization. As I&#39;ve mentioned<br>
before, the initialization of the widget, when using a Dijkstra<br>
interpolator involves building the adjacency graph to enable single<br>
source shortest path calculations. This takes a little bit of time.<br>
<br>
<br>
Thanks<br>
--<br>
<font color="#888888">karthik<br>
</font><div><div></div><div class="h5"><br>
On Tue, Nov 9, 2010 at 12:06 PM, Jonathan Morra &lt;<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>&gt; wrote:<br>
&gt; I just tested it and it didn&#39;t seem to increase the speed of initialization<br>
&gt; in my case at all.  Here&#39;s what I&#39;m doing<br>
&gt; 1.  Reslice a 3D image into a 2D plane<br>
&gt; 2.  Find the gradient magnitude in 2D.<br>
&gt; 3.  Find the inverse gradient magnitude.<br>
&gt; 4.  Set up the Dijkstra interpolator with the grad inverse as the cost image<br>
&gt; 5.  Set the following options for the interpolator<br>
&gt;<br>
&gt;  interpolator.GetDijkstraImageGeodesicPath().StopWhenEndReachedOn();<br>
&gt;<br>
&gt;  interpolator.GetDijkstraImageGeodesicPath().RepelPathFromVerticesOn();<br>
&gt;<br>
&gt;  interpolator.GetDijkstraImageGeodesicPath().SetCurvatureWeight(0.15);<br>
&gt;<br>
&gt;  interpolator.GetDijkstraImageGeodesicPath().SetEdgeLengthWeight(0.8);<br>
&gt;             interpolator.GetDijkstraImageGeodesicPath().SetImageWeight(1.0);<br>
&gt; 6.  Create a vtkContourWidget and initialize it with the same point twice.<br>
&gt; Everything is fine except the initialization of the contour widget, that<br>
&gt; still takes 3 seconds.<br>
&gt; I changed my version so now I&#39;m getting the latest source code from the git<br>
&gt; head, this is the correct place to get it from right?<br>
&gt; On Mon, Nov 8, 2010 at 1:04 PM, Robert Maynard &lt;<a href="mailto:robert.maynard@kitware.com">robert.maynard@kitware.com</a>&gt;<br>
&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; I have just merged the updated contour widget a couple minutes ago. The<br>
&gt;&gt; changes increase the speed of initializing the widget with large datasets<br>
&gt;&gt; (100K+ points ), and also increases the active point location speed.<br>
&gt;&gt;<br>
&gt;&gt; On Mon, Nov 8, 2010 at 3:53 PM, Sebastien Jourdain<br>
&gt;&gt; &lt;<a href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.com</a>&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; No, we don&#39;t know yet...<br>
&gt;&gt;&gt; Rob still need to validate its fix with our internal users...<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Seb<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Mon, Nov 8, 2010 at 1:48 PM, Jonathan Morra &lt;<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>&gt;<br>
&gt;&gt;&gt; wrote:<br>
&gt;&gt;&gt; &gt; Thanks for this update, do you guys have any idea when this might be<br>
&gt;&gt;&gt; &gt; merged?<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; On Mon, Nov 8, 2010 at 10:46 AM, Sebastien Jourdain<br>
&gt;&gt;&gt; &gt; &lt;<a href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.com</a>&gt; wrote:<br>
&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; Hi Jonathan,<br>
&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; Rob is currently working on vtkContourWidget to make it much faster.<br>
&gt;&gt;&gt; &gt;&gt; Right now, its work is not merged to master yet but it&#39;s available on<br>
&gt;&gt;&gt; &gt;&gt; the git stage of VTK...<br>
&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; Seb<br>
&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; On Mon, Nov 8, 2010 at 1:26 PM, 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; Thanks for your response.  It turns out on my machine that that<br>
&gt;&gt;&gt; &gt;&gt; &gt; initialization is too slow.  What&#39;s happening is the following<br>
&gt;&gt;&gt; &gt;&gt; &gt; 1.  The user click indicating that they want to try a contour<br>
&gt;&gt;&gt; &gt;&gt; &gt; 2.  A new vtkContourWidget is made with the dijkstra interpolator.<br>
&gt;&gt;&gt; &gt;&gt; &gt; 3.  The contour widget is initialized as I described above with just<br>
&gt;&gt;&gt; &gt;&gt; &gt; two<br>
&gt;&gt;&gt; &gt;&gt; &gt; points.  Adding that second point is where the slowdown occurs.<br>
&gt;&gt;&gt; &gt;&gt; &gt; As far as point 2, I am initializing a contour widget with the<br>
&gt;&gt;&gt; &gt;&gt; &gt; output of<br>
&gt;&gt;&gt; &gt;&gt; &gt; vtkCutter, but I am subsampling when I do that (I take 7% of the<br>
&gt;&gt;&gt; &gt;&gt; &gt; points), so<br>
&gt;&gt;&gt; &gt;&gt; &gt; I only have a handful of control points.  Is there a way to<br>
&gt;&gt;&gt; &gt;&gt; &gt; frontload<br>
&gt;&gt;&gt; &gt;&gt; &gt; the<br>
&gt;&gt;&gt; &gt;&gt; &gt; load time so I only have to do it once as opposed to every time a<br>
&gt;&gt;&gt; &gt;&gt; &gt; user<br>
&gt;&gt;&gt; &gt;&gt; &gt; wants<br>
&gt;&gt;&gt; &gt;&gt; &gt; to draw a contour?  That is simply too slow for my application.<br>
&gt;&gt;&gt; &gt;&gt; &gt; Also do you have any idea why rendering the meshes is slow?  Could<br>
&gt;&gt;&gt; &gt;&gt; &gt; it be<br>
&gt;&gt;&gt; &gt;&gt; &gt; related to the point order, or is is something else?<br>
&gt;&gt;&gt; &gt;&gt; &gt; On Sat, Nov 6, 2010 at 8:54 AM, Karthik Krishnan<br>
&gt;&gt;&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; &gt;&gt;<br>
&gt;&gt;&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; &gt;&gt; wrote:<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; on vtkDijkstraImageContourLineInterpolator and am able to<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; successfully<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; create the contour widget with live wire interpolation. However,<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; when<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; I<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; first initialize the contour with the following code it is very<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; slow<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;     // For now, we&#39;re just initializing the data with<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;     // the point that was clicked<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;     vtkPoints points = new vtkPoints();<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;     // The initial data MUST be at least a &quot;line&quot;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;     // by giving the same point twice we are effictively creating<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; a<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; zero<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;     // length line<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;     points.InsertNextPoint(lastContourControlPoint);<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;     points.InsertNextPoint(lastContourControlPoint);<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;     vtkPolyData initialData = new vtkPolyData();<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;     initialData.SetPoints(points);<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt;     contourWidget.Initialize(initialData, 0);<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; The line that is slow is the last line.  The weird part is that<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; if I<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; do<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; not<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; use live wire, and just use the default Bezier curve<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; interpolation<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; the<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; &gt; initialization is instant.<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; Yes. There are 2 issues here.<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; 1. The dijkstra interpolator is a bit slow to start with, since<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; during<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; the time of initialization, it builds the adjacency information.<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; But<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; that&#39;s not a big deal when you are drawing on an image. The very<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; first<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; line segment placement is a bit slow (~3 seconds). After that its<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; fast<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; and interactive.<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; 2. The real issue, I think, here is the fact that you are<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; initializing<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; the contour with the contour with lots of control points. How many<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; of<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; them are there ? As I understand, you are generating these control<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; points from the output of vtkCutter ? Perhaps you want to sample<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; the<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; input polyline and then feed those sample points as the control<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; points.<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; Thanks<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; --<br>
&gt;&gt;&gt; &gt;&gt; &gt;&gt; karthik<br>
&gt;&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt; _______________________________________________<br>
&gt;&gt;&gt; &gt;&gt; &gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt; Visit other Kitware open-source projects at<br>
&gt;&gt;&gt; &gt;&gt; &gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt; Please keep messages on-topic and check the VTK FAQ at:<br>
&gt;&gt;&gt; &gt;&gt; &gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt;&gt; &gt;&gt; &gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; Robert Maynard<br>
&gt;<br>
&gt;<br>
&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>