# Add signature to segmentation

**URL:** <https://discourse.slicer.org/t/add-signature-to-segmentation/18327>\
**Category:** Support\
**Tags:** segmentation\
**Created:** [June 24, 2021, 10:38am UTC](https://discourse.slicer.org/t/add-signature-to-segmentation/18327 "2021-06-24T10:38:48Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ni5h](https://avatars.discourse-cdn.com/v4/letter/n/839c29/32.png) [@ni5h](https://discourse.slicer.org/u/ni5h)\
**Post date:** [June 24, 2021, 10:38am UTC](https://discourse.slicer.org/t/add-signature-to-segmentation/18327/1 "2021-06-24T10:38:48Z")

</div>

@lassoan - an unrelated question and I am unsure if you can answer this (it may require our IT); once we have annotated and segmented an area, are we able to configure and add a medical signature on to the annotation with a time stamp before we export the files (we export into NIFTI format)?

---

<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:** [June 24, 2021, 3:59pm UTC](https://discourse.slicer.org/t/add-signature-to-segmentation/18327/2 "2021-06-24T15:59:07Z")

</div>

If you use nrrd format then you can assign arbitrary metadata to each segment. You could save some kind of signature there.

I would not recommend using nifti format for anything except for maybe storing brain images, because nifti is used widely by the brain imaging community. Nifti has many serious issues, including inability to add arbitrary metadata to the file (you need to use additional files, linked to the nifti file based on similar filename or other unreliable mechanisms).

---

<div class="post-metadata">

**Author:** ![ni5h](https://avatars.discourse-cdn.com/v4/letter/n/839c29/32.png) [@ni5h](https://discourse.slicer.org/u/ni5h)\
**Post date:** [June 25, 2021, 8:32am UTC](https://discourse.slicer.org/t/add-signature-to-segmentation/18327/3 "2021-06-25T08:32:02Z")

</div>

we use nifti as it is preferential for our binary analyses, though it is not a brain/neurological study we are completing.

Could you offer a link or method in how we would add a dicom tag/signature in 3d slicer? This is all experimental we just want to see if we can build upon our segmentations.

Thanks again!

---

<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:** [June 25, 2021, 6:06pm UTC](https://discourse.slicer.org/t/add-signature-to-segmentation/18327/4 "2021-06-25T18:06:47Z")

</div>

You can save the signature into custom key:value pairs in your segmentation using [`vtkSegment.SetTag`](http://apidocs.slicer.org/master/classvtkSegment.html#a75d0c23fc90fc1252acd14278f64c386). For example:

```python
segmentation = getNode('Segmentation').GetSegmentation()
segment = segmentation.GetSegment(segmentation.GetSegmentIdBySegmentName('Segment_1'))
segment.SetTag("Signature", "abcd")

```

Of course, nifti cannot store such custom metadata, so you need to use seg.nrrd.

You can use [slicerio](https://github.com/lassoan/slicerio) Python package (pip-installable in any Python environment) to get segmentation metadata from .seg.nrrd files.

---

<div class="post-metadata">

**Author:** ![ni5h](https://avatars.discourse-cdn.com/v4/letter/n/839c29/32.png) [@ni5h](https://discourse.slicer.org/u/ni5h)\
**Post date:** [July 6, 2021, 4:59pm UTC](https://discourse.slicer.org/t/add-signature-to-segmentation/18327/5 "2021-07-06T16:59:50Z")

</div>

Hi @lassoan,

1/a. I am trying to complete this on one of our data sets but I am unsure how to write the vtk.segment.settag onto one of the nrrd exports, how is this completed within 3d slicer  
1/b. would I need to write this into the code for each segmentation or could we enable this for the whole data set?  
2. i have downloaded the preview release (4.13) and still cannot find mono ai label, do I have to wait for this to be released fully?

---

<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:** [July 9, 2021, 4:44am UTC](https://discourse.slicer.org/t/add-signature-to-segmentation/18327/6 "2021-07-09T04:44:53Z")

</div>

> [@ni5h](#):
>
> I am trying to complete this on one of our data sets but I am unsure how to write the vtk.segment.settag onto one of the nrrd exports, how is this completed within 3d slicer

I gave a complete example above. If you encounter any errors then describe what you did exactly, what you expected to happen, and what happened instead (including any error message that is displayed).

> [@ni5h](#):
>
> would I need to write this into the code for each segmentation or could we enable this for the whole data set?

You can store custom metadata for each segment.

> [@ni5h](#):
>
> i have downloaded the preview release (4.13) and still cannot find mono ai label, do I have to wait for this to be released fully?

MONAILabel is already available. Check the Extensions Manager again and if you still cannot find it then tell us what exact Slicer version and operating system do you use.

---

<div class="post-metadata">

**Author:** ![ni5h](https://avatars.discourse-cdn.com/v4/letter/n/839c29/32.png) [@ni5h](https://discourse.slicer.org/u/ni5h)\
**Post date:** [July 9, 2021, 12:49pm UTC](https://discourse.slicer.org/t/add-signature-to-segmentation/18327/7 "2021-07-09T12:49:21Z")

</div>

> [@lassoan](#):
>
> MONAILabel is already available. Check the Extensions Manager again and if you still cannot find it then tell us what exact Slicer version and operating system do you use.

i am using the latest version 4.11.20210226 I believe, I have also installed the preview release also, 4.13 and cannot find this here either. Windows.

> [@lassoan](#):
>
> I gave a complete example above. If you encounter any errors then describe what you did exactly, what you expected to happen, and what happened instead (including any error message that is displayed).

We (for the time being) do not require the signature, so I can put this to the side for the time being. I was initially unsure where to input the code, if it was the python interactor or a higher skillset was required to input this, something I do not possess. Thanks for your help!

---

<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:** [July 14, 2021, 3:43am UTC](https://discourse.slicer.org/t/add-signature-to-segmentation/18327/8 "2021-07-14T03:43:27Z")

</div>

MONAILabel is available for recent Slicer Preview Releases. If you are in Europe then some extension will only appear in the afternoon. So, after downloading and installing the latest Slicer Preview Release, wait until at least the evening before you install the extension. You can also download and install Slicer Preview Release from the day before using [this](https://download.slicer.org/?offset=-1) link and for that all the extensions should be available immediately.

---

<div class="post-metadata">

**Author:** ![ni5h](https://avatars.discourse-cdn.com/v4/letter/n/839c29/32.png) [@ni5h](https://discourse.slicer.org/u/ni5h)\
**Post date:** [July 15, 2021, 3:54pm UTC](https://discourse.slicer.org/t/add-signature-to-segmentation/18327/9 "2021-07-15T15:54:45Z")

</div>

hi, I have downloaded this, is there a help/how-to guide into using it? I cannot find anything on youtube to perform an annotation…

---

<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:** [July 15, 2021, 3:56pm UTC](https://discourse.slicer.org/t/add-signature-to-segmentation/18327/10 "2021-07-15T15:56:03Z")

</div>

Everything is explained in detail on the extension’s website: [GitHub - Project-MONAI/MONAILabel: MONAI Label is an intelligent open source image labeling and learning tool.](https://github.com/Project-MONAI/MONAILabel)
