[vtkusers] coordinate transformation between polydata and image data

Rachel aracha2010 at gmail.com
Mon Dec 13 17:10:41 EST 2010


hi Davis Thanks for your suggestion. 
Unfortunately, I could not figure out how to use those functions in  the
link. My problem is :
we have 3D object then : 3D object---->2D  image--> 2D Silhouette.
i need to go from 2D Silhouette---->3D object 

ofcourse we don't have z information but in my knowledge and what i
understood from your solution is:
from each pixel in the silhouette  we project line to the 3D object and take
the closest point.

i did the following, where i try to find the corresponding coordinates to
the pixels (255) 

 imageData->GetOrigin(origImage);
  imageData->GetSpacing(spacing);
  int* dims = imageData->GetDimensions();
    for (int z = 0; z < dims[2]; z++)
    {
    for (int y = 0; y < dims[1]; y++)
      {
      for (int x = 0; x < dims[0]; x++)
        {
   	 unsigned char* pixel =static_cast<unsigned
char*>(imageData->GetScalarPointer(x,y,z));
  			if((int)pixel[0]==255){		 
				double xx = origImage[0] + spacing[0] * x;
				double yy = origImage[1] + spacing[1] * y;
				double zz = origImage[2] + spacing[2] * z;
			    cout<<"new coordinate"<<xx<<"   "<<yy<<"   "<<zz<<endl;
			}
	        }
      }
    }

Any suggestion ? Many thanks


-- 
View this message in context: http://vtk.1045678.n5.nabble.com/coordinate-transformation-between-polydata-and-image-data-tp3216899p3303804.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list