Embedding URL in MRML format file

I wanted to embed the URL of a segmentation (segmentation generated on Slicer in .nrrd file format) in the MRML file which contains segmentation results visualized on Slicer. So that I can send this MRML to my friends who can in turn view the segmentation results remotely on their systems.

So your mean that your would like to send a short file that Slicer would download and Slicer would download the bulk data when that file is opened?

Slicer used to support such use cases and maybe it still works. However, there are simpler or more flexible alternatives now.

You can simply send an url to a scene saved as an .mrb file (scene saved in a single-file). When the user clicks on the file it gets downloaded in the default web browser and it opens in Slicer. Mrb files are associated to be opened in Slicer on Windows by default (the installer takes care of this). On Linux and macOS you need to set up the file association manually (or you can add a module that sets this up automatically).

You can also associate the slicer custom URL protocol so that such links are opened auto]matically in Slicer. See more information here. You can use a simple http server or a DICOMweb server. DICOMweb server may be more complicated to set up (unless you use Kheops or you have some other DICOMweb compatible server set up already), but it allows interoperability with other software, you can upload data from Slicer, browse patient data in Slicer, etc.

Thank you so much Lassoan !!!

Hello Andras Lasso
I have lung nodule segmentation results (in nii.gz format), using which I want to create a 3D slicer visualization scene and store the scene in “.mrb” format. This scene, later, I can share with my remote research friends who can provide comments/suggestions on the segmentation quality. May I know if there any python scripts available on the web which do the same ? It would be great if I know these details

Thank you
Rajesh

Load the segmentation from NIFTI into Slicer. Then you can use Kheops (“dropbox for DICOM”) for sharing segmentations exported to DICOMweb as shown in this tutorial video:

If you don’t want to mess with setting up a server then you save the scene in .mrb format to a dropbox folder and have your collaborators open them from there.

I want to create a 3D slicer visualization scene for the segmentations (in nii.gz format) using Python coding, using “Slicer” library. Not using 3D slicer application.

Do you mean you would like to show a simplified user interface - for example, just a viewer and a feedback form (accept and reject button and a comment field)?

https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#segmentations

I want to do something like the code in above link

I have written python simpleitk code to perform nodule segmentation (the label volume is in nii.gz) and at the end of the code I want to create slicer scene visualization of this nodule segmentation using python. This scene visualization must be stored in .mrb format

All of the above must happen via python coding (using Slicer python library). This .mrb output file, i can share with a remote user on web. When clicked open must generate the 3D slicer visualization on the remote users 3D slicer application.

The viewer must display this slicer scene

To import a NIFTI file as segmentation (with custom color and name assigned to each segment), you can load the color table file (or create the color table using Python scripting) then use that when loading the segmentation:

colorNode = slicer.util.loadColorTable(r'c:\tmp\Segmentation-label_ColorTable.ctbl')
slicer.util.loadNodeFromFile(r'c:\tmp\Segmentation-label.nii.gz','SegmentationFile',{'colorNodeID': colorNode.GetID()})

You can save this as a .mrb file and it will show up for your users as in your screenshot above.

It worked. Got my work done. A lot of thanks to you Andras Lasso.

1 Like