[vtkusers] read image intensity data (scalar data).
    dqchen 
    dqchen at cvip.louisville.edu
       
    Wed Mar 29 19:09:47 EST 2006
    
    
  
Hi, Users:
  I have some problems when I try to read scalar data from each 3D point.
  Now, I have a 3D object with isosurface. On the surface, I can get all the coordinates for every vertex, but some problems appeared when I tried to read the scalaer data (image intensity data, for pgm images) using vtkImageData->GetScalarComponentAsDouble (int x, int y, int z, int component).
 All the values are 0. does anyone know the reason?  I just set the arguememt: component=0 which I found from some other examples. 
 some of  mu codes are listed below:
    deci->Update();
    vtkPolyData *colonPoly = deci->GetOutput();
    long int numofcell=colonPoly->GetNumberOfCells(); //the number of vtkCell
    for (int i=0; i<numofcell; i++)
    {
        printf("This is %d cell of the total %d\n", i, numofcell);
     
     //all the vertices (points) contained in the cell
     
     //1). get each cell
     vtkCell *colonCell=colonPoly->GetCell(i);
     
     //2). get the points
     vtkPoints* colonPts=colonPoly->GetPoints();
     
     //3). get each coordinate and access the scalar data
     int numofpoint=colonCell->GetNumberOfPoints(); 
           double* coord= new double [numofpoint];
     vtkImageData *colonImg=vtkImageData::New();
     for (int j=0; j<numofpoint; j++)
     {
         int ptID=colonCell->GetPointId(j);
      
      colonPts->GetPoint(ptID, coord);
      double inten=colonImg->GetScalarComponentAsDouble((int)coord[0],(int)coord[1],(int)coord[2],0);
     }
      delete [] coord;
    }
    
 Thanks a lot.
Best WIshes,
Dongqing Chen
Rm. 007, Paul C. Lutz Hall 
Computer Vision & Image Processing (CVIP) Lab
Dept. of Electrical & Computer Engineering
University of Louisville
Louisville, KY. 40292
U.S.A.
Email: dqchen at cvip.louisville.edu
Phone: (502)852-6130(Office)
            (502)852-2789(Lab)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060329/f1cd837e/attachment.htm>
    
    
More information about the vtkusers
mailing list