how to create itk image from buffered dicom data

hello,
i am currently able to nicely create itk images from dicom data by utilizing the gdcmimageio and the imagefilereader by reading a file from disk. However, i am writing an application in which the .dcm file is transmitted to me via binary data in a buffer over a network. Can anyone help me to figure out how to instead of forcing the imageio to read from disk to use the data already in memory? I couldn’t find a lot of clear answers on this anywhere and I don’t want to write the data from memory to disk and read it back in from disk as that is time consuming and not very elegant.
thanks,

Take a look at this post:

I don’t think this will work for DICOM images. That is more of a question for GDCM project or DCMTK forum.

As ITK IO is file oriented, possibly consider a RAM disk. It’s not an elegant solution as it still requires write/read, but it may be fast enough.

For future reference: Added some code to this SimpleITK notebook illustrating this possible workaround in Python (setting up a RAM disk may not be critical if you have an NVMe drive).