[vtkusers] Locating a 3D position in 3D scheme from a XYZ coordinates
Wagner Sales
wsales at gmail.com
Sat Aug 30 17:41:21 EDT 2008
Hi all,
May be the title are not the best, but i'll explain better the problem:
a) I have a 2D viewer that's shows to me slices from a serie. This 2D viewer
aren't VTK based.
b) I use this 2D viewer to mark seed points for segmentation. The
segmentation works fine for various datasets, then I think the positions
that's I have for marked points are ok.
c) I show the results of segmentation on a 3D view ( ITKImage -> VTKImage ->
vtkContourFilter -> vtkPolyData -> vtkPolyDataMapper -> vtkActor, I think ).
Thats works fine too.
d) I need to mark a point on the 2D viewer and shows this point on 3D view.
After some search, I do:
paraCoords = new double[3];
xyzCoords = new double[3];
vtkcellweights = new double[4];
q = new int[3];
if(!m_CurrentImageData)
{
xyzCoords[0] = 0.0;
xyzCoords[1] = 0.0;
xyzCoords[2] = 0.0;
return xyzCoords;
}
q[0] = m_XPosition;
q[1] = m_YPosition;
q[2] = m_ZPosition;
cellNum = m_CurrentImageData->ComputeCellId(q);
subID = m_CurrentImageData->GetCell( cellNum
)->GetParametricCenter(paraCoords);
int &subIDadd = subID;
m_CurrentImageData->GetCell(cellNum)->EvaluateLocation(subIDadd,
paraCoords,
xyzCoords, vtkcellweights);
return xyzCoords;
Well, the position, when returned, are ok. But some times this crashes ( and
debugger output are useless ). Running under valgrind (I'm on a linux
machine), this shows a useful backtrace, that's passes to this method and go
to vtkVoxel::EvaluateLocation method, where the crash occurs. I tried then
to use vtkCoordinate to convert coordinates, setting all the system
coordinates and getting all the converted values, and no ones are equals the
values I have from my current approach.
Since I'm running on this problem a couple of days, someone can helps? (
another approach, whats wrong, etc ). My VTK version are 5.2 stable.
Regards,
Wagner Sales
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080830/a3faacd2/attachment.htm>
More information about the vtkusers
mailing list