[vtkusers] problem with Point Iterator : vtkGenericPointIterator vtkGenericDataSet

Francois Bertel francois.bertel at kitware.com
Fri Aug 19 11:01:05 EDT 2005


Alberto Magrofuoco wrote:
> i get the error: undefined symbol 'vtkDataFloat'

vtkDataFloat does not exist: it is vtkFloatArray

> I get the error: 'GetNormals' is not a member of
> VtkPointData.... what is wrong? Am i missing somefile?

I guess you forgot to include vtkPointData.h


> -------------------------------------------------------
> 
> Hi Alberto,
> 
> vtkGeneric* is made for higher-order elements. There
> is no concrete
> class of the abstract class vtkGenericDataSet, except
> for testing
> purpose in GenericFiltering/Testing/Cxx. So, it will
> not help you.
> 
> For what you are looking for, you may use a
> vtkImageReader to load the
> file. The output of this reader is a vtkImageData.
> 
> Then, to iterate over the points, you may write:
> 
> vtkImageData *image;
> 
> vtkIdType c=image->GetNumberOfPoints();
> double x[3];
> double n[3];
> 
> vtkDataFloat *normals=static_cast<vttFloatArray
> *>(image->GetPointData()->GetNormals());
> 
> vtkIdType i=0;
> while(i<c)
> {
>  image->GetPoint(i,x); // get the point coordinates
>  normals->GetTuple(i,n); // get the normal at this
> point
> ++i;
> }
> 
> Alberto Magrofuoco wrote:
> 
>>I am running vtk on windows (c++).
>>
>>I am working on human head modelling, I extract the
>>skull surface from medical data and I obtain a file
>>containing :
>>- points list with correspoinding value (1 if the
>>surface passes through that voxel 0 otherwise)
>>- normals per each point.
>>
>>something like:
>>
>>
>>--------------------------------------------------
>>vtk output
>>ASCII
>>DATASET STRUCTURED_POINTS
>>DIMENSIONS 8 8 8
>>SPACING 1 1 1
>>ORIGIN 0 0 0
>>CELL_DATA 343
>>POINT_DATA 512
>>SCALARS scalars float
>>LOOKUP_TABLE default
>>0 0 0 0 0 0 0 0 0 
>>0 0 0 0 0 0 0 0 0 
>>1 1 1 1 0 0 0 0 1 
>>1 1 1 0 0 0 0 1 1 
>>
>>(... and so on)
>>
>>NORMALS normals float
>>0 0 0 0 0 0 0 0 0 
>>0 0 0 0 0 0 0 0 0 
>>0 0 0 0 0 0 0 0 0 
>>0 0 0 0 0 0 0 0 0 
>>0 0 0 0 0 0 0 0 0 
>>0 0 0 0 0 0 0 0 0 
>>-0.0524864 -0.0524864 -0.997241 0 -0.0525588
> 
> -0.998618
> 
>>0 -0.0525588 -0.998618 
>>0.0524864 -0.0524864 -0.997241 0 0 0 0 0 0 
>>0 0 0 0 0 0 -0.0525588 0 -0.998618 
>>
>>(..... and so on)
>>
>>----------------------------------------------------
>>
>>I need to be able to iterate in this file, to use a
>>index to individuate a point and the corresponding
>>normals. 
>>
>>1)Which function should I use?
>>
>>I found out vtkGenericPointIterator should work, but
>>it was not installed,
>>so I copied vtkGenericPointIterator.h,
>>vtkGenericDataSet.h, vtkGenericPointIterator.cxx,
>>vtkGenericDataSet.cxx into /VTK/Filtering
>>2)Is that enough or should I install something else?
>>
>>Anyway I do not know how to use it, I could find
> 
> only
> 
>>one example.
>>I am running something like:
>>
>>vtkGenericDataSet *dataset;
>>vtkGenericPointIterator *it =
>>dataset->NewPointIterator();
>>
>>2)How can I choose the input for dataset? (I should
> 
> be
> 
>>able to load structuredpoints data)
>>
>>3)Can I find some examples in which
>>vtkGenericPointIterator performs something similar
> 
> to
> 
>>what I am looking for? 
>>
>>Thanks,
>>Alberto 
> 
> 


-- 
François Bertel, PhD  | Kitware Inc. Suite 204
1 (518) 371 3971 x113 | 28 Corporate Drive
                      | Clifton Park NY 12065, USA



More information about the vtkusers mailing list