[vtkusers] I need to get the X, Y, Z coordinates of a point in a vtkPolyData

Alessandro Artusi artusialessandro4 at googlemail.com
Mon Oct 26 09:50:04 EDT 2009


Thanks Jerome,

it is very helpfull your explanation. In my case what i can use to get the
info that i need.
>From the Online documentation is not clear to me how the get access to the
x,y,z coordinates making use of the function available to vtkContourFilter.
Any suggestion?
Thanks again.
Alessandro.
On Mon, Oct 26, 2009 at 3:31 PM, Jérôme <jerome.velut at gmail.com> wrote:

> In your code, you defined contour as the vtkContourFilter, not a polydata.
> vtkContourFilter is a subclass of vtkAlgorithm that does not have a
> GetPoints( ) function. You should take a look to VTK online documentation to
> see what you can access from a class.
> Basically, a subclass of vtkAlgorithm allows you to access input/ouput that
> could be vtkPointSet
> From vtkPointSet (such as vtkPolyData, your interest...), you can acces
> geometry through GetPoints( ) or topology through GetLines( ), GetVerts(),
> GetPolys( ),...
>
> In your case (from what I read  in your code), contour is a vtkAlgorithm.
> It cannot be its own output in the same time.
>
> I hope that helps
>
>
> Jerome
>
> 2009/10/26 Alessandro Artusi <artusialessandro4 at googlemail.com>
>
>> Dear Bill thanks a lot but it does not work I have still the same
>> Attribute error.
>>
>> I repeat contour is where i store the output of teh vtkContourFilter(),
>> may be it does not inerithance the GetPoints().....
>>
>> Any other suggestion?
>>
>> The vtkContourFilter has not any
>>
>>   On Mon, Oct 26, 2009 at 2:44 PM, Bill Lorensen <bill.lorensen at gmail.com
>> > wrote:
>>
>>> You must do
>>> contour.Update()
>>>
>>> before accessing the points.
>>>
>>> On Mon, Oct 26, 2009 at 8:26 AM, Alessandro Artusi
>>> <artusialessandro4 at googlemail.com> wrote:
>>> > Thanks a lot Jerome,
>>> >
>>> > I get an errore:
>>> >
>>> > AttributeError GetPoints.
>>> >
>>> > May be I am doing something wrong; what i  am doing is the following:
>>> >
>>> > contour = vtk.vtkContourFilter()
>>> > contour.SetInput(grid) #grid is rectilineargrid()
>>> > contour.ComputeNormalOn()
>>> > contour.SetValue(0, 95) #my isovalue
>>> >
>>> > in contour i should have my polyData right?
>>> >
>>> > when i do what you suggested:
>>> >
>>> > contour.GetPoints( ).GetPoint( pointId, coord )
>>> >
>>> > I got the error.
>>> >
>>> > Any suggestion?
>>> >
>>> > Thanks again,
>>> > Alessandro.
>>> >
>>> >
>>> > On Mon, Oct 26, 2009 at 1:11 PM, Jérôme <jerome.velut at gmail.com>
>>> wrote:
>>> >>
>>> >> Hi,
>>> >> vtkPolyData is a vtkPointSet : you can access points coordinates
>>> through
>>> >>
>>> >> polydata->GetPoints( )->GetPoint( pointId, coord )
>>> >>
>>> >> where polydata is your... polydata, pointId is the point Id you want
>>> to
>>> >> get (from 0 to NumberOfPoints - 1) and coord is double coord[3] filled
>>> by
>>> >> the point coordinate.
>>> >>
>>> >> HTH
>>> >> Jerome
>>> >>
>>> >> 2009/10/26 Alessandro Artusi <artusialessandro4 at googlemail.com>
>>> >>>
>>> >>> Dear All,
>>> >>>
>>> >>> I have a vtkPolyData from the vtkContourFilter and I need to get the
>>> >>> X,Y,Z coordinates of each point in the PolyData. This because I need
>>> to
>>> >>> convert them.
>>> >>> How can i get this info?
>>> >>>
>>> >>> Thanks a lot for teh help,
>>> >>> Alessandro.
>>> >>>
>>> >>>
>>> >>> _______________________________________________
>>> >>> 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
>>> >>>
>>> >>
>>> >
>>> >
>>> > _______________________________________________
>>> > 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
>>> >
>>> >
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091026/2c05f47f/attachment.htm>


More information about the vtkusers mailing list