[vtkusers] Get pixel intensity
cquammen at cs.unc.edu
Sat Jul 22 12:54:41 EDT 2006
Here's a simpler way to grab values from a vtkImageData object:
vtkImageData *foo = ...;
double scalar = foo->GetScalarComponentAsDouble(x, y, z, component);
where component = 0 if you have just one scalar component in your image.
It may be slow if you are looping through your entire image, though, so you
may want to use the method described by Chase and Torsten. But if you want
just one value or several values, the above works pretty well.
> Here is one way to do it:
> vtkImageData *foo;
> int *dimensions = foo->GetDimensions();
> pixelValue =
> Anyone have a better way?
> Chase Yarbrough
> Andres Munarriz wrote:
> > Hi everyone,
> > I'm pretty sure someone has already posted a similar question if not
> > the same (for this I apologize), but I haven't been able to find such
> > post. Is there a way to retrieve the pixel intensity at a particular
> > index from a vtkImageData object? Under ITK one can " make" the index
> > then get the pixelData from it.
> > Thanks in advance,
> > Andres E. Munarriz Soto
University of North Carolina at Chapel Hill
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vtkusers