[ITK] [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
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list