# Vertebra segmentation for volume masking

**URL:** <https://discourse.slicer.org/t/vertebra-segmentation-for-volume-masking/19143>\
**Category:** Support\
**Tags:** segmentation, spine\
**Created:** [August 10, 2021, 2:52pm UTC](https://discourse.slicer.org/t/vertebra-segmentation-for-volume-masking/19143 "2021-08-10T14:52:14Z")\
**Posts on this page:** 6\
**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:** [August 10, 2021, 2:52pm UTC](https://discourse.slicer.org/t/vertebra-segmentation-for-volume-masking/19143/1 "2021-08-10T14:52:15Z")

</div>

@lassoan

Operating system: windows  
Slicer version: 4.11.2021  
Expected behavior: i need to annotate off one level only (L1). I cannot crop this because this is not we require for analysis (we need all of the anatomy to landmark the point of our annotation). I have tried to mask this, I have watched the perklab research youtube video ‘mask volume for tools’ for support but I am unsure when I complete the annotation the whole annotation is saved in nrrd.  
Actual behavior: when I mask the l1 level it fills inside and the tool works approriately but i cannot annotate further on the masked level (in 3d it is an expected block). when i use the scissors to mask everything but L1 level the mask volume tool does not work and blanks out the level I need.

I just need to mask everything but the l1 level and complete the annotations of all the areas i require (fat and muscle) and when I save in nrrd it should save the whole raw data giving a landmark of the level annotated for analysis?

---

<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:** [August 10, 2021, 4:11pm UTC](https://discourse.slicer.org/t/vertebra-segmentation-for-volume-masking/19143/2 "2021-08-10T16:11:42Z")

</div>

> [@ni5h](#):
>
> I have tried to mask this, I have watched the perklab research youtube video ‘mask volume for tools’ for support but I am unsure when I complete the annotation the whole annotation is saved in nrrd.

It is a separate volume. It does not change the original volume. You can save it as a separate nrrd.

> [@ni5h](#):
>
> when I mask the l1 level it fills inside and the tool works approriately but i cannot annotate further on the masked level

You can switch the master volume to choose either the original volume or the blanked out volume.

> [@ni5h](#):
>
> when i use the scissors to mask everything but L1 level the mask volume tool does not work and blanks out the level I need

What do you mean by “does not work”? What do you do exactly, what do you expect to happen, and what happens instead?

> [@ni5h](#):
>
> when I save in nrrd it should save the whole raw data giving a landmark of the level annotated for analysis?

What would you like to save in the nrrd? The segmentation, the original, volume, or the blanked out volume (containing only L1 vertebra)?

What do you mean by “giving a landmark of the level”? Is landmark a 3D point, a segmentation, …?

What kind of analysis would you like to do? What is the clinical problem that you are trying to solve?

---

<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:** [August 10, 2021, 4:47pm UTC](https://discourse.slicer.org/t/vertebra-segmentation-for-volume-masking/19143/3 "2021-08-10T16:47:02Z")

</div>

difficult to explain - i have found a workaround that allow me to segment the desired level that I need;

> [@lassoan](#):
>
> What would you like to save in the nrrd? The segmentation, the original, volume, or the blanked out volume (containing only L1 vertebra)?
> 
> What do you mean by “giving a landmark of the level”? Is landmark a 3D point, a segmentation, …?
> 
> What kind of analysis would you like to do? What is the clinical problem that you are trying to solve?

What I need to annotate is fat, bone and muscle at l1 level - only this level - each level above and below and liver etc is not required.

I have found if I crop the image, annotate what I need and then switch back to the master volume I can see what i have annotated within that level.

the issue I am having is when i come to export - I use mri cron to visualise my annotation - i can only see the area, which I have annotated obviously, but what i need to see when I export is the whole series so that the ‘landmark’ is definitely L1 and the rest of the seires L2/3/4/5 and T10/11/12. Therefore, can I mask the area above and below - would that export? will i need to create another segment calling this oustide\_AOI, which will definitely export - but in this case, how can i complete this task quickly, drawing each slice is time consuming and can imapct the rest of the series that I have annotated already.

I hope this makes sense and 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:** [August 10, 2021, 4:58pm UTC](https://discourse.slicer.org/t/vertebra-segmentation-for-volume-masking/19143/4 "2021-08-10T16:58:58Z")

</div>

> [@ni5h](#):
>
> I use mri cron to visualise my annotation

What visualization mode is that you could not set up in Slicer?

> [@ni5h](#):
>
> i can only see the area, which I have annotated obviously, but what i need to see when I export is the whole series

You can save the whole image as well.

> [@ni5h](#):
>
> Therefore, can I mask the area above and below - would that export?

Yes, of course. You can have unlimited number of volumes, segmentations, segments in the scene and you can export all of them to files.

> [@ni5h](#):
>
> drawing each slice is time consuming and can imapct the rest of the series that I have annotated already

Slicer has many tools for spine segmentation.

For example, using classic tools, you can quickly segment the entire spinal column (each vertebra in a separate segment) using Grow from seeds effect, and filling internal holes using [this code snippet](https://gist.github.com/lassoan/0f45db8bae792ea19ccad36ceefbf52d).

There are also several fully automatic neural networks for spine segmentation. There is a pre-trained model for entire spine segmentation in [MONAILabel](https://github.com/Project-MONAI/MONAILabel#readme), but you can also train your own network for segmenting a single vertebra.

---

<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:** [August 11, 2021, 2:52pm UTC](https://discourse.slicer.org/t/vertebra-segmentation-for-volume-masking/19143/5 "2021-08-11T14:52:56Z")

</div>

> [@lassoan](#):
>
> Yes, of course. You can have unlimited number of volumes, segmentations, segments in the scene and you can export all of them to files.

can you merge/combine annotations? I wish to threshold muscle, intercostal muscles on that level and with low resolution it is difficult to do, my method atm is to threshold muscle, split them via islands and then remove the areas which are not muscle, can I combine the segments once I have split them?

---

<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:** [August 11, 2021, 4:35pm UTC](https://discourse.slicer.org/t/vertebra-segmentation-for-volume-masking/19143/6 "2021-08-11T16:35:25Z")

</div>

Yes, you can merge segments. If you need to merge many segments at once then the most efficient is to take advantage of masking settings. See details in this [segmentation recipe](https://lassoan.github.io/SlicerSegmentationRecipes/MergeSegments/).

As a side note, for discussions in the Slicer forum, use the “segmentation” (for a set of structures) or “segment” (for a single structure) term instead of “annotation” (it refers to measurements in Slicer). See list of terms used in Slicer here in the [Glossary](https://slicer.readthedocs.io/en/latest/user_guide/getting_started.html#glossary).
