[Insight-users] itkImageSource for block of memory

Koen Vermeer koen at vermeer.tv
Fri Jun 19 08:01:23 EDT 2009


On Fri, 2009-06-19 at 07:53 -0400, Bill Lorensen wrote:
> You can get a pointer to an image's pixel buffer with image->GetBufferPointer().

Hmm, that's probably what I wouldn't have done if I hadn't read any
manuals. It seems that accessing the buffer is generally not advised;
instead, iterators are often suggested when processing larger areas,
while SetPixel/GetPixel is used for individual pixels.

Can I safely assume that the image's pixel buffer is just a continuous
area of memory that contains the image data in the expected order?

Also: How do I make sure the buffer isn't freed when the image is
destroyed?

Koen



More information about the Insight-users mailing list