# Embedding URL in MRML format file

**URL:** <https://discourse.slicer.org/t/embedding-url-in-mrml-format-file/25098>\
**Category:** Support\
**Tags:** segmentation\
**Created:** [September 5, 2022, 11:55am UTC](https://discourse.slicer.org/t/embedding-url-in-mrml-format-file/25098 "2022-09-05T11:55:47Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajesh\_Ds](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rajesh_ds/32/16526_2.png) [@Rajesh\_Ds](https://discourse.slicer.org/u/Rajesh_Ds)\
**Post date:** [September 5, 2022, 11:55am UTC](https://discourse.slicer.org/t/embedding-url-in-mrml-format-file/25098/1 "2022-09-05T11:55:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 5, 2022, 12:32pm UTC](https://discourse.slicer.org/t/embedding-url-in-mrml-format-file/25098/2 "2022-09-05T12:32:12Z")

</div>

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](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#launch-slicer-directly-from-a-web-browser). 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.

---

<div class="post-metadata">

**Author:** ![Rajesh\_Ds](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rajesh_ds/32/16526_2.png) [@Rajesh\_Ds](https://discourse.slicer.org/u/Rajesh_Ds)\
**Post date:** [September 15, 2022, 5:41am UTC](https://discourse.slicer.org/t/embedding-url-in-mrml-format-file/25098/3 "2022-09-15T05:41:40Z")

</div>

Thank you so much Lassoan !!!

---

<div class="post-metadata">

**Author:** ![Rajesh\_Ds](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rajesh_ds/32/16526_2.png) [@Rajesh\_Ds](https://discourse.slicer.org/u/Rajesh_Ds)\
**Post date:** [September 19, 2022, 7:00am UTC](https://discourse.slicer.org/t/embedding-url-in-mrml-format-file/25098/4 "2022-09-19T07:00:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 19, 2022, 7:45am UTC](https://discourse.slicer.org/t/embedding-url-in-mrml-format-file/25098/5 "2022-09-19T07:45:46Z")

</div>

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:

[![](https://img.youtube.com/vi/60_hzSlptWY/maxresdefault.jpg "Using 3D Slicer with cloud DICOMweb databases") ](https://www.youtube.com/watch?v=60_hzSlptWY)

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.

---

<div class="post-metadata">

**Author:** ![Rajesh\_Ds](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rajesh_ds/32/16526_2.png) [@Rajesh\_Ds](https://discourse.slicer.org/u/Rajesh_Ds)\
**Post date:** [September 19, 2022, 8:06am UTC](https://discourse.slicer.org/t/embedding-url-in-mrml-format-file/25098/6 "2022-09-19T08:06:55Z")

</div>

> [@Rajesh\_Ds](#):
>
> create a 3D slicer visualization scene

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.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 19, 2022, 1:49pm UTC](https://discourse.slicer.org/t/embedding-url-in-mrml-format-file/25098/7 "2022-09-19T13:49:53Z")

</div>

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)?

---

<div class="post-metadata">

**Author:** ![Rajesh\_Ds](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rajesh_ds/32/16526_2.png) [@Rajesh\_Ds](https://discourse.slicer.org/u/Rajesh_Ds)\
**Post date:** [September 19, 2022, 1:52pm UTC](https://discourse.slicer.org/t/embedding-url-in-mrml-format-file/25098/8 "2022-09-19T13:52:21Z")

</div>

[https://slicer.readthedocs.io/en/latest/developer\_guide/script\_repository.html#segmentations](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#segmentations)

I want to do something like the code in above link

---

<div class="post-metadata">

**Author:** ![Rajesh\_Ds](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rajesh_ds/32/16526_2.png) [@Rajesh\_Ds](https://discourse.slicer.org/u/Rajesh_Ds)\
**Post date:** [September 19, 2022, 1:55pm UTC](https://discourse.slicer.org/t/embedding-url-in-mrml-format-file/25098/9 "2022-09-19T13:55:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rajesh\_Ds](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rajesh_ds/32/16526_2.png) [@Rajesh\_Ds](https://discourse.slicer.org/u/Rajesh_Ds)\
**Post date:** [September 19, 2022, 1:59pm UTC](https://discourse.slicer.org/t/embedding-url-in-mrml-format-file/25098/10 "2022-09-19T13:59:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Rajesh\_Ds](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rajesh_ds/32/16526_2.png) [@Rajesh\_Ds](https://discourse.slicer.org/u/Rajesh_Ds)\
**Post date:** [September 19, 2022, 2:18pm UTC](https://discourse.slicer.org/t/embedding-url-in-mrml-format-file/25098/11 "2022-09-19T14:18:39Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/2/f27e168367857783a3ed178846a4d066aa7de348.png)

The viewer must display this slicer scene

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 19, 2022, 2:40pm UTC](https://discourse.slicer.org/t/embedding-url-in-mrml-format-file/25098/12 "2022-09-19T14:40:13Z")

</div>

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:

```python
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.

---

<div class="post-metadata">

**Author:** ![Rajesh\_Ds](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rajesh_ds/32/16526_2.png) [@Rajesh\_Ds](https://discourse.slicer.org/u/Rajesh_Ds)\
**Post date:** [September 19, 2022, 4:44pm UTC](https://discourse.slicer.org/t/embedding-url-in-mrml-format-file/25098/13 "2022-09-19T16:44:43Z")

</div>

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