[Insight-users] (no subject)

David Doria daviddoria at gmail.com
Tue Feb 15 09:38:34 EST 2011


On Tue, Feb 15, 2011 at 9:14 AM, john smith <mkitkinsightuser at gmail.com> wrote:
>
> Hello to everybody,
>
> As a beginner, I am trying to read an image and get a pixel value. Does anybody know where I can find some specific code examples that will be usefull?
> I think that it must be done by creating a pipeline of a reader output and a getpixel() and setpixel() method input. But I do not realy know how it must be created.
>
> Thanks

The functions take a ImageType::IndexType (usually itk::Index<2> if
you're dealing with 2D images).

ImageType::IndexType pixelIndex;
pixelIndex[0] = r;
pixelIndex[1] = c;
image->SetPixel(pixelIndex, 255);

and

ImageType::ValueType value = image->GetPixel(pixelIndex);

David


More information about the Insight-users mailing list