[vtkusers] Get pixel intensity
Andres Munarriz
munarriz.a at gmail.com
Sun Jul 23 11:46:01 EDT 2006
Hi Cory,
Thanks, I'll keep your advice in mind.
Regards,
Andres
On 22/07/2006, at 11:54AM, Cory Quammen wrote:
> 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.
>
> Cory
>
> Hi Andres,
>
> Here is one way to do it:
>
> vtkImageData *foo;
> int *dimensions = foo->GetDimensions();
> pixelValue =
> foo->GetPointData()->GetScalar
> s()->GetTuple1(x+y*dimensions[0]+z*dimensions[0]*dimensions[1]);
>
> 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
>
>
> --
> Cory Quammen
> University of North Carolina at Chapel Hill
> http://www.cs.unc.edu/~cquammen
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/
> Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060723/4233f33c/attachment.htm>
More information about the vtkusers
mailing list