How to upload itk image to server?


(Andrzej Marciniak) #1

Hello,
I am writing VTK/ITK MRI browser/editor and I would like to save edited image on a server. I found out how to convert vtk to itk (https://github.com/Kitware/paraview-glance/issues/180#issuecomment-408659132) , and now the missing part is to convert itkImage object to binary file in NIFTI format and send it.
Is there any solution for saving ImageArrayBuffer (or directly itkImage) to buffer in memory and streaming to server, without saving to local file? Which one should I use : writeImageLocalFile, writeImageArrayBuffer?
Thanks in advance
Andrzej


(Matt McCormick) #2

Hello @Andrzej_Marciniak,

Welcome to the ITK community! :sunny:

Yes, one option is to create a NIFTI-formatted binary in an ArrayBuffer and upload it to a server that way. Use writeImageArrayBuffer; the arraybuffer data type is supported when sending the file to the server with tools like axios. Another option is to use writeImageBlob and a blob.


(Andrzej Marciniak) #3

Thanks Matt for quick answer and welcoming. I will try with axios and arraybuffer.