[ITK-users] Using Python SimpleITK to Read/Write to BytesIO instance rather than file

Yaniv, Ziv Rafael (NIH/NLM/LHC) [C] zivrafael.yaniv at nih.gov
Wed Oct 26 10:22:43 EDT 2016


Hi Brian,

Currently ITK/SimpleITK do not have components for reading an image
directly from a stream. We usually download, save to disk, and read from
disk using the appropriate IO. We used this approach with our Jupyter
notebooks where the read function either finds the data in a cache or
fetches it from MIDAS into the cache and then reads it
(https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks/blob/mast
er/downloaddata.py).

The challenge with streaming is that we currently don't have a protocol
for interpreting the streamed data (meta-data-dictionary + intensity/color
values). A possible solution is to use a client-server architecture with
the OpenIGTLink protocol (http://openigtlink.org). You can transfer
meta-data (patient name etc.) and complete images. See the specification
on their website.

Out of curiosity, what is the motivation for the streaming only approach
(girder -> SimpleITK -> girder)?

   hope this helps
     Ziv





On 10/25/16, 5:15 PM, "Brian E Chapman" <Brian.Chapman at utah.edu> wrote:

>Hi,
>
>We are looking at using SimpleITK in conjunction with Girder to read
>images from girder manipulate the images with a Python script and then
>write the contents back up to Girder. We would prefer to do this using
>Byte streams rather than saving to a local file, reading/writing to the
>local file and then uploading the file to Girder, but we have not been
>able to find a way within SimpleITK (within Python) to read and write
>from/to streams rather than files.
>
>Any guidance would be appreciated.
>
>Brian
>
>_____________________________________
>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 Insight-users mailing list