[ITK-users] ITK Importing Image Data from a Buffer

Matt McCormick matt.mccormick at kitware.com
Mon Oct 27 11:23:53 EDT 2014


Hi Assil,


>
> const unsigned int numberOfPixels = imsize[0] * imsize[1];
> const bool importImageFilterWillOwnTheBuffer = true;
>
> RGBPixelType * localBuffer = new RGBPixelType[ numberOfPixels ];
> memcpy(localBuffer->GetDataPointer(), img.data(), numberOfPixels);

This should be numberOfPixels * 3, since there are three unsigned char
bytes in for every RGB pixel.

HTH,
Matt


More information about the Insight-users mailing list