[vtkusers] How to converting coordinates from dataset to view? - Part two

Wagner Sales wsales at gmail.com
Fri May 16 18:43:14 EDT 2008


Hi all,

This answer are just for future searches in the list.
The code and approach are right. The problem was other, that's don't need to
be mentioned here since aren't VTK related.

Regards,

Wagner Sales

2008/5/14 Wagner Sales <wsales at gmail.com>:

> Hi all,
>
> The following message was sent in some minutes ago.
> I'm trying to show marked points in a 2D view from a dataset in 3D view of
> segmented data from this dataset. To explain more:
> a) I have a DICOM dataset
> b) In 2D view I was marked some points to use in segmentation, done by ITK.
> The segmentation works fine, then I think my points are marked ok.
> c) After segmentation, I extract the polydata and show in a 3D view.
> d) Then, I try to create new points in 2D view and show in 3D. The points
> are created, but in 3D appears in a different location.
> Well, I think I need to convert the coordinates from the point and after
> that set manually the position of the point (a vtkActor) in 3D view.
>
> Are I'm correct? If yes, how to convert these coordinates? Are another more
> simple approach?
>
> Well, taking a look at my VTK book and some examples, I think I need to
> translate the dataset to global coordinates. This are done by the following
> code:
>
> double *Point::translateCoordinates(int x, int y, int z)
> {
>        // m_CurrentImageData are a vtkImageData instance
>         if(!m_CurrentImageData)
>         {
>                 xyzCoords[0] = 0.0;
>                 xyzCoords[1] = 0.0;
>                 xyzCoords[2] = 0.0;
>                 return xyzCoords;
>         }
>         q[0] = x;
>         q[1] = y;
>         q[2] = z;
>         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;
> }
>
> Then I'm trying to set the actor position using xyzCoords, but not working
> ( the point are in wrong position yet ). Any help?
>
> Thks in advance,
>
> Wagner Sales
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080516/7674afbb/attachment.htm>


More information about the vtkusers mailing list