[ITK] Decode a medical image from memory buffer in ITK

Dženan Zukić dzenanz at gmail.com
Mon Oct 24 11:23:10 EDT 2016


Hi Fijoy,

as far as I am aware, there is no class to read an image from buffer
instead of file. But the possible workaround is to write that buffer into a
file in temp folder and read that file.

HTH,
Dženan

On Mon, Oct 24, 2016 at 11:13 AM, Fijoy Vadakkumpadan <tofijoy at gmail.com>
wrote:

> Hi Dženan,
>
> Correct me if I'm wrong, but the Import filter assumes that I have the
> medical image metadata (size, resolution, etc.), and the decompressed data
> (the C-array). However, I do not have these.
>
> All I have is a buffer *buf* containing the encoded image, i.e., *buf* is
> filled like so:
>
> unsigned char buf[MAX_FILE_SIZE];
> f = fopen("myImage.dcm", "rb");
> n = fread(buf, MAX_FILE_SIZE, 1, f);
>
> In other words, I'm looking for a class that can read an image from a
> buffer, just like ImageFileReader reads from a file. Does such a class
> exist?
>
> Thanks,
> Fijoy
>
> On Mon, Oct 24, 2016 at 10:57 AM, Dženan Zukić <dzenanz at gmail.com> wrote:
>
>> Hi Fijoy,
>>
>> that is the job of Import
>> <https://itk.org/Doxygen/html/classitk_1_1ImportImageFilter.html> filter.
>>
>> Regards,
>> Dženan
>>
>> On Mon, Oct 24, 2016 at 10:50 AM, Fijoy Vadakkumpadan <tofijoy at gmail.com>
>> wrote:
>>
>>> Hi all,
>>>
>>> I'm wondering if ITK can decode a medical image from a buffer.
>>>
>>> For example, if I have a DICOM file read into a buffer buf using
>>> fread(), is there an API in ITK that I can use to get an itk::Image pointer
>>> from buf?
>>>
>>> Thank you,
>>> Fijoy
>>>
>>> _______________________________________________
>>> 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/20161024/a2d1d134/attachment.html>


More information about the Community mailing list