[vtkusers] Please help!!! Problem with vtkPointLocator

Łukasz Tutaj ltutaj at wp.pl
Wed Apr 27 16:49:42 EDT 2005


Hello vtkUsers.

My question may seem very silly to most of the users of vtk but I'm new 
in this matter. I would like to find in my data the nearest point to the 
point coordinates which coordinates are for example (p[1],p[2],p[3]). 
The part of my program looks as follows:

...
vtkDICOMImageReader *v16 = vtkDICOMImageReader::New();
reader->SetDirectoryName(argv[1]);
vtkIdType pointId;
double p[3];
p[1] = atoi(argv[7]);
p[2] = atoi(argv[8]);
p[3] = atoi(argv[9]);
vtkPointLocator *pointLocator = vtkPointLocator::New();
pointLocator->SetDataSet((vtkDataSet*)reader->GetOutput());
pointLocator->BuildLocator();
pointId = pointLocator->FindClosestPoint(p[1], p[2], p[3]);
...

Building process works fine but while working program throws an error 
"No points to subdivide". What did I do wrong??
And the second question is why I have to typecast from vtkImageData to 
vtkDataSet despite vtkImageData inherits from vtkDataSet?? Is it 
possible that this typecasting causes the error??

Forgive me my language mistakes but English isn't my native language.
Thanks for any help.




More information about the vtkusers mailing list