[ITK] Data buffer length

Dženan Zukić dzenanz at gmail.com
Wed Oct 26 12:31:42 EDT 2016


Hi Fijoy,

you can calculate it like this:
SizeValueType
numBytes=sizeof(TPixel)*image->GetBufferedRegion().GetNumberOfPixels();

Regards,
Dženan

On Wed, Oct 26, 2016 at 12:00 PM, Francois Budin <francois.budin at kitware.com
> wrote:

> Hello Fijoy,
>
> I don't think there is a way to do that without computing the product of
> the image size by the pixel size. Here is an example where it is done:
> https://itk.org/pipermail/insight-users/2007-May/022351.html
>
> Francois
>
> On Wed, Oct 26, 2016 at 11:36 AM, Fijoy Vadakkumpadan <tofijoy at gmail.com>
> wrote:
>
>> Hi all,
>>
>> What's the easiest way to get the length of the data buffer of an
>> itk::Image in bytes?
>>
>> I see that GetBufferPointer() gives me a pointer to the buffer, but I
>> also need the length of the buffer in bytes. I can calculate this as a
>> product of image size components and pixel size in bytes, but I'm wondering
>> if that is the easiest way.
>>
>> Thanks,
>> Fijoy
>>
>> _______________________________________________
>> Community mailing list
>> Community at itk.org
>> http://public.kitware.com/mailman/listinfo/community
>>
>>
>
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/mailman/listinfo/community
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20161026/9afc4bdc/attachment.html>


More information about the Community mailing list