[Insight-users] [vtkusers] resampling vtkPoints

Bill Lorensen bill.lorensen at gmail.com
Fri Jul 23 11:00:42 EDT 2010


Please keep the users list on the replies...

On Fri, Jul 23, 2010 at 11:00 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> You definitely need lines. One polyline for each contour would be
> fine. Without the topology provided by lines, how can a spline be fit
> to the points?
>
> On Fri, Jul 23, 2010 at 10:35 AM, Prathamesh Kulkarni
> <prathameshmkulkarni at gmail.com> wrote:
>> I tried that out. It shows that the sparse_poly has 29 points (which I have
>> inserted using myvtkPoints) and zero lines. I am confused here. Do I have to
>> manually initialize a line for every two points (or one passing through
>> all?) and then pass this line as sparse_poly->SetLines() ? If yes, how
>> should it be done?
>>
>> Ultimately, I want to "densify" the points from whatever I have to a user
>> specified density and I hope to have the dense points using:
>> spline_filter->GetOutput()->GetPoints();
>>
>> Also, please let me know if I should explore any other way of doing this.
>>
>> I appreciate your help.
>>
>> Thanks,
>> Prathamesh
>>
>> On Fri, Jul 23, 2010 at 6:53 AM, Bill Lorensen <bill.lorensen at gmail.com>
>> wrote:
>>>
>>> Try printing some more information before the spline filter:
>>>
>>> sparse_points->Print(std::cout);
>>> sparse_poly->Print(std::cout);
>>>
>>> On Fri, Jul 23, 2010 at 1:25 AM, Prathamesh Kulkarni
>>> <prathameshmkulkarni at gmail.com> wrote:
>>> > Thanks for the direction. I am did the following: (myvtkPoints are
>>> > points
>>> > representative of a contour line which I want to resample with a given
>>> > density):
>>> >         density = 100;
>>> > vtkSmartPointer<vtkPoints> dense_points;
>>> > vtkSmartPointer<vtkPoints> sparse_points = myvtkPoints
>>> > vtkSmartPointer<vtkKochanekSpline> spline_type =
>>> > vtkSmartPointer<vtkKochanekSpline>::New();
>>> > spline_type->SetDefaultContinuity(0.5);
>>> > vtkSmartPointer<vtkPolyData> sparse_poly =
>>> > vtkSmartPointer<vtkPolyData>::New();
>>> > sparse_poly->SetPoints(sparse_points);
>>> > sparse_poly->Update();
>>> > vtkSmartPointer<vtkSplineFilter> spline_filter =
>>> > vtkSmartPointer<vtkSplineFilter>::New();
>>> > spline_filter->SetSpline(spline_type);
>>> > spline_filter->SetInput(sparse_poly);
>>> > spline_filter->SetSubdivideToSpecified();
>>> > spline_filter->SetNumberOfSubdivisions(density);
>>> > spline_filter->Update();
>>> > vtkSmartPointer<vtkPolyData> dense_poly = spline_filter->GetOutput();
>>> > dense_points = dense_poly->GetPoints(); //FAILS HERE: dense_points is
>>> > NULL
>>> > int number_of_sparse_points = sparse_points->GetNumberOfPoints();
>>> > int number_of_dense_points = dense_points->GetNumberOfPoints();
>>> > Could someone please tell me if I am doing something conceptually wrong
>>> > here?
>>> > Thanks,
>>> > Prathamesh
>>> > On Thu, Jul 22, 2010 at 12:27 PM, Bill Lorensen
>>> > <bill.lorensen at gmail.com>
>>> > wrote:
>>> >>
>>> >> Look at this example:
>>> >> http://www.vtk.org/Wiki/VTK/Examples/PolyData/FitSplineToCutterOutput
>>> >> it resamples contour lines using splines.
>>> >>
>>> >>
>>> >> On Thu, Jul 22, 2010 at 12:38 PM, Prathamesh Kulkarni
>>> >> <prathameshmkulkarni at gmail.com> wrote:
>>> >> >
>>> >> > Hello all,
>>> >> >
>>> >> > I have a set of points which represent a contour line. I want to be
>>> >> > able
>>> >> > to
>>> >> > resample them to a given density. I have looked at vvtkSheperdMethod
>>> >> > documentation but could not find a method similar SetDensity() for
>>> >> > its
>>> >> > source.
>>> >> >
>>> >> > What would be the best way to resample a contour data?
>>> >> >
>>> >> >
>>> >> > Thanks,
>>> >> > Prathamesh
>>> >> >
>>> >> > _______________________________________________
>>> >> > 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 Insight-users mailing list