[vtkusers] What the array contains in this case?
Arnaud Gelas
arnaud_gelas at hms.harvard.edu
Tue Oct 28 13:22:57 EDT 2008
Hi butterfly,
If you look at the code of vtkCurvatures (vtkCurvatures.cxx), you will
see that the meaningful data (the one you are interested in) are stored
in the polydata int the pointdata container. To be able to access any of
these values (min, max, mean, or gaussian), you just need to get the
right array containing the information you want:
Mean_Curvature => mean curvature
Gauss_Curvature => Gaussian curvature
Minimum_Curvature => min curvature
Maximum_Curvature => max curvature
So by doing: vtkDoubleArray *myArray =
newPolyData->GetPointData()->GetArray("Mean_Curvature");
You get an array which contains the mean curvature information...
Then if you want to access the mean curvature of the point number 6, you
can get it by using GetTuple...
Then you just need to adapt it...
I hope this would help you...
Regards,
Arnaud
B. C. wrote:
> Thank you David for your help.
> Can you make me a favour and tell me what does 'Mean_Curvature' means
> in this line?
> vtkDoubleArray *myArray =
> newPolyData->GetPointData()->GetArray("Mean_Curvature");
>
> - 'myArray' in this case, what does it contain exactly? the mean
> curvatures?
> - If i want to store the maximum curvatures of the points, should i do?
>
>
>
> --- En date de : *Mar 28.10.08, David E DeMarle
> /<dave.demarle at kitware.com>/* a écrit :
>
> De: David E DeMarle <dave.demarle at kitware.com>
> Objet: Re: [vtkusers] What the array contains in this case?
> À: butterfly.1688 at yahoo.fr
> Cc: vtkusers at vtk.org
> Date: Mardi 28 Octobre 2008, 12h44
>
> On Tue, Oct 28, 2008 at 7:47 AM, B. C. <butterfly.1688 at yahoo.fr> wrote:
> > Hi everyone,
> > Please, i need help.
> > I have a polydata, i used vtkCurvatures to compute the maximum curavtures.
> I
> > did this:
> > vtkCurvatures *curve = vtkCurvatures::New();
> > curve->SetInput(myPolyData);
> > curve->SetCurvatureTypeToMaximum();
> >
>
> You need to call:
> curve->Update();
> here, to tell the filter to go ahead and run.
>
> > vtkPolyData *newPolyData = vtkPolyData::New();
>
> You don't have to create a new poly data structure above.
> Instead, the above line can be:
> vtkPolyData *newPolyData;
> since you are setting the pointer below to something else.
>
> > newPolyData = curve->GetOutput();
> >
> > Then, i used a double aray to store the values of the curvatures and i did
> > this:
> > vtkDoubleArray *myArray =
> > vtkDoubleArray::SafeDownCast(objetRes->GetPoints());
> >
>
> objectRes should be newPolyData above. And you are getting the spatial
> coordinates, not the data values. Instead you need call:
> vtkDoubleArray *myArray =
> newPolyData->GetPointData()->GetArray("Mean_Curvature");
> The difference is that you are getting a point associated array call
> Mean_Curvature.
>
> > To access to the curves values stored in the array, i used this:
> > double curveValue;
> > vtkIdType nPoints = myArray->GetNumberOfTuples();
> > for (vtkIdType i=0; i<nPoints; i++)
> > curveValue = myArray->GetValue(i);
> >
> > Can you tell me if what i did is right?
> > - 'newPolyData' is it 'myPolyData' with maximum
> curvatures?
> > - What the array 'myArray' really contanis?
> > - To access to the curev values, is is right to use the finction
> > 'GetValue(i)'?
> >
> > Thank you
> >
> >
>
> Read the VTK Users guide chapter 11 to learn the layout of vtk's data
> structures. Also, pease read some of the Examples that come with code
> to get a feel for how to use and manipulate filters and finally read
> the vtkCurvatures.cxx class to see exactly what it does.
>
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at:
> > http://www.vtk.org/Wiki/VTK_FAQ
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
> >
>
>
> cheers,
> --
> David E DeMarle
> Kitware, Inc.
> R&D Engineer
> 28 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-371-3971 x109
>
>
>
More information about the vtkusers
mailing list