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. I have a subclass of vtkInteractorStyle that listens for events on the orthogonal slices. When I left click on one of them, I would like to find the nearest cell associated with the picked location. I am using the following code:
<br><br>/********************begin code**********************/<br>...<br> //double p[3] is initialized<br>...<br> vtkEmptyCell * femptycell = vtkEmptyCell::New();<br> vtkCell * fcell = femptycell->NewInstance();<br>
vtkIdType fcellID;<br> double ftol2;<br> int fsubId;<br> double fpcoords[3];<br> double * fweights;<br><br> vtkIdType fFindCell = [instance of vtkImageData *]->FindCell(p, fcell, fcellID, ftol2, fsubId, fpcoords, fweights);
<br><br> std::cout << "cellID returned from FindCell() = " << fFindCell << 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>"cellID returned from FindCell() = 42196578"<br><br>However, it then crashes with a Segmentation Fault. 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> //int ijk[3] is initialized<br>...<br> vtkIdType compCellId;<br> compCellId = [instance of vtkImageData *]->ComputeCellId( ijk );<br> std::cout << "Computed Cell Id = " << compCellId << 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? Thanks in advance for any assistance!<br>
<br>-Jake<br>