Forwarding to VTK developers.<br><br><div class="gmail_quote">On Fri, Dec 17, 2010 at 5:52 AM, Felipe Bordeu <span dir="ltr"><<a href="mailto:felipe.bordeu@ec-nantes.fr">felipe.bordeu@ec-nantes.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">hi everybody,<br>
<br>
I use the vtkImageData::findpoint(double x[3]) function to retrieve the id of a point.<br>
<br>
in the case the data is 2D ( the dimension of z is 1) the spacing of the z in not relevant. Then if i put 0 in the spacing for z,  then the findpoint function fails to find the point.<br>
After looking at the code, it became clear.<br>
<br>
for know I can put a positive value into the z Spacing to bypass the bug.<br>
<br>
this problem also happens for a 1D image data.<br>
<br>
<br>
vtkImageData.cxx:706<br>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
vtkIdType vtkImageData::FindPoint(double x[3])<br>
{<br>
  int i, loc[3];<br>
  double d;<br>
  const double *origin = this->Origin;<br>
  const double *spacing = this->Spacing;<br>
  const int* extent = this->Extent;<br>
<br>
  vtkIdType dims[3];<br>
  dims[0] = extent[1] - extent[0] + 1;<br>
  dims[1] = extent[3] - extent[2] + 1;<br>
  dims[2] = extent[5] - extent[4] + 1;<br>
<br>
  //<br>
  //  Compute the ijk location<br>
  //<br>
  for (i=0; i<3; i++)<br>
    {<br>
    d = x[i] - origin[i];<br>
    loc[i] = static_cast<int>((d / spacing[i]) + 0.5); <-------------- use of an irrelevant value<br>
    if ( loc[i] < extent[i*2] || loc[i] > extent[i*2+1] )<br>
      {<br>
      return -1;<br>
      }<br>
    // since point id is relative to the first point actually stored<br>
    loc[i] -= extent[i*2];<br>
    }<br>
  //<br>
  //  From this location get the point id<br>
  //<br>
  return loc[2]*dims[0]*dims[1] + loc[1]*dims[0] + loc[0];<br>
<br>
}<br>
<br>
-- <br>
<br>
Felipe Bordeu Weldt<br>
Ingénieur de Recherche<br>
-------------------------------------<br>
Tél. : 33 (0)2 40 37 16 57<br>
Fax. : 33 (0)2 40 74 74 06<br>
<a href="mailto:Felipe.Bordeu@ec-nantes.fr" target="_blank">Felipe.Bordeu@ec-nantes.fr</a><br>
Intitut GeM - UMR CNRS 6183<br>
École Centrale Nantes<br>
1 Rue de La Noë, 44321 Nantes, FRANCE<br>
-------------------------------------<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
</blockquote></div><br>