Hi All,<br><br>I have an application that uses ITK, VTK, and KWWidgets to display a 3D surface created from a dataset and its 3 corresponding orthogonal views.&nbsp; I have a subclass of vtkInteractorStyle that listens for events on the orthogonal slices.&nbsp; When I left click on one of them, I would like to find the nearest cell associated with the picked location.&nbsp; I am using the following code:
<br><br>/********************begin code**********************/<br>...<br>&nbsp; //double p[3] is initialized<br>...<br>&nbsp; vtkEmptyCell * femptycell = vtkEmptyCell::New();<br>&nbsp; vtkCell * fcell = femptycell-&gt;NewInstance();<br>
&nbsp; vtkIdType fcellID;<br>&nbsp; double ftol2;<br>&nbsp; int fsubId;<br>&nbsp; double fpcoords[3];<br>&nbsp; double * fweights;<br><br>&nbsp; vtkIdType fFindCell = [instance of vtkImageData *]-&gt;FindCell(p, fcell, fcellID, ftol2, fsubId, fpcoords, fweights);
<br><br>&nbsp; std::cout &lt;&lt; &quot;cellID returned from FindCell() = &quot; &lt;&lt; fFindCell &lt;&lt; std::endl;<br>/********************end code**********************/<br><br>When I click on one of the orthogonal slices, my application successfully prints out the cellId, for instance:
<br><br>&quot;cellID returned from FindCell() = 42196578&quot;<br><br>However, it then crashes with a Segmentation Fault.&nbsp; I have narrowed the problem down to this chunk of code because when I replace it with similar code to compute the cell ID (pasted below), it runs fine without any seg fault.
<br><br>/********************begin code**********************/<br>...<br>&nbsp; //int ijk[3] is initialized<br>...<br>&nbsp; vtkIdType compCellId;<br>&nbsp; compCellId = [instance of vtkImageData *]-&gt;ComputeCellId( ijk );<br>&nbsp; std::cout &lt;&lt; &quot;Computed Cell Id = &quot; &lt;&lt; compCellId &lt;&lt; std::endl;
<br>/********************end code**********************/<br><br>Does anyone see a problem with my first code segment that tries to find the cell associated with an X, Y, Z location?&nbsp; Thanks in advance for any assistance!<br>
<br>-Jake<br>