Help with importing/exporting ROIs

1,520 views
Skip to first unread message

ah...@berkeley.edu

unread,
Dec 28, 2018, 12:52:52 PM12/28/18
to Horos Project
Hello,

I am a student/undergraduate researcher working on a Machine Learning project related to Chest CT.

My machine learning model is predicting ROIs, and I am looking for a way to display those ROIs in Horos. I can save the ROIs in any file format (it seems like Horos prefers XML and CSV?).

I found this Horos plugin for exporting ROIs

Screen Shot 2018-12-25 at 4.46.05 PM.pngWhen I use this plugin to export a couple of rectangular ROIs that I create manually using the mouse button tool, I get the following CSV:

Screen Shot 2018-12-25 at 4.45.06 PM.png


I was figuring I could make my model export its predictions in the same format, but when I use the `ROI -> Import ROI(s)...` button, it doesn't allow me to select CSVs (is another plugin required? Could anyone point me towards it?) It allows me to select XMLs, but when I import the XML exported by the plugin, which looks like this:

Screen Shot 2018-12-25 at 5.09.56 PM.png

  
Nothing happens (the ROI does not appear). The only way that the standard `ROI -> Import ROI(s)...` seems to work is if I am importing a `_.roi` or a `_.rois_series` file format created by just using the `ROI -> Save Selected ROI(s)...` or `ROI -> Save all ROIs of this series...` options. But that file format is very esoteric: the files look like this:

Screen Shot 2018-12-25 at 5.12.53 PM.png

  So I suppose I am asking how I might import ROIs from XML or (preferably) CSV format, rather than this unintuitive format. Is there a plugin that will help me do this? To reiterate, my goal is to generate ROIs (using AI / deep neural nets, saved in whatever format is necessary) and then display them on Horos.Thanks for your help!Aarash Heydari

Matthew Lewis

unread,
Dec 28, 2018, 12:58:54 PM12/28/18
to ah...@berkeley.edu, Horos Project
you can programmatically create arbitrary tPlain ROIs in Python using 
the pyOsiriX plugin.  at present you can only read (not create) oval, rect, line, and point ROIs,
although hopefully that will change in the near future.

you can also add up to 16 binary mask ROIs to the DICOM header.
I have pyOsiriX scripts that will put ROIs into DICOM headers and extract them.
You could conceivably take the output of your deep learning and stuff it into the DICOM header.

--
You received this message because you are subscribed to the Google Groups "Horos Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to horos-projec...@googlegroups.com.
To post to this group, send email to horos-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/horos-project/0eae0aa4-b4ff-448e-8477-c71e42c371fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

aar...@gmail.com

unread,
Dec 28, 2018, 1:09:27 PM12/28/18
to Horos Project
Hi Matthew Lewis, thanks for your response. I will look into the approach of adding to the dicom header. If you are willing to share some of that code with me over email, I would appreciate that too.

Cheers,
Aarash Heydari

samber

unread,
Dec 28, 2018, 1:40:22 PM12/28/18
to aar...@gmail.com, Horos Project

Hi!
I too would very much appreciate access to the code that allows you to add ROIs via the Dicom header!
I know that although Osirix has a plugin to export ROIs in CSV & XML, Osirix NATIVELY saves & imports ROIs in some funky format and had given up on being able to deal with this.
So.... any help appreciated!

Dan

--
You received this message because you are subscribed to the Google Groups "Horos Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to horos-projec...@googlegroups.com.
To post to this group, send email to horos-...@googlegroups.com.

Matthew Lewis

unread,
Dec 28, 2018, 3:18:11 PM12/28/18
to samber, aar...@gmail.com, Horos Project
Extract_ROIs_from_DICOM_Overlays.py
Embed_ROIs_in_DICOM_Overlays.py
Delete_ROIs_from_DICOM_Overlays.py

Matthew Lewis

unread,
Dec 28, 2018, 3:20:45 PM12/28/18
to samber, aar...@gmail.com, Horos Project
caveat: this code only works for classic DICOM with 1 image per file.
it does not work with multiframe extended DICOM.
also, there may be recent modalities that do not support DICOM overlays in their standard. 
Reply all
Reply to author
Forward
0 new messages