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