# Error while segmenting

**URL:** https://discourse.slicer.org/t/error-while-segmenting/32957
**Category:** Support
**Created:** [November 22, 2023, 12:31pm UTC](https://discourse.slicer.org/t/error-while-segmenting/32957 "2023-11-22T12:31:31Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![towfi\_islam](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/towfi_islam/32/68407_2.png) [@towfi\_islam](https://discourse.slicer.org/u/towfi_islam)
#### Post date: [November 22, 2023, 12:31pm UTC](https://discourse.slicer.org/t/error-while-segmenting/32957/1 "2023-11-22T12:31:31Z")

</div>

Hello,

I’m trying to segment a ct scan, while segmenting I get this error -

Slicer has caught an application error, please save your work and restart.

If you have a repeatable sequence of steps that causes this message, please report the issue following instructions available at [https://slicer.org](https://slicer.org)

The message detail is:

Exception thrown in event: vector

---

<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: [November 22, 2023, 12:33pm UTC](https://discourse.slicer.org/t/error-while-segmenting/32957/2 "2023-11-22T12:33:44Z")

</div>

Please test with the latest Slicer Preview Release. If you still experience any errors then provide screen capture video or step-by-step instructions (every click you make) that we can use to reproduce what you see.

---

<div class="post-metadata">

### Author: ![towfi\_islam](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/towfi_islam/32/68407_2.png) [@towfi\_islam](https://discourse.slicer.org/u/towfi_islam)
#### Post date: [November 22, 2023, 4:56pm UTC](https://discourse.slicer.org/t/error-while-segmenting/32957/3 "2023-11-22T16:56:30Z")

</div>

Tested it with 5.5, was using 5.4 before and the error remains. Here is the click by click -

Open Slicer - drag a mrml file into slicer and the scan loads up - click on segment editor - click on paint - click on one of the segments - click on the scan on axial view to paint - error pops up.

Is this clear enough? If not I can make a screen recording.

---

<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: [November 22, 2023, 5:58pm UTC](https://discourse.slicer.org/t/error-while-segmenting/32957/4 "2023-11-22T17:58:29Z")

</div>

I cannot reproduce the problem by following the steps you described. No error for me.

Can you share the .mrml file? (upload somewhere and post the link here; make sure there is no patient information in it)

---

<div class="post-metadata">

### Author: ![Masahiro](https://avatars.discourse-cdn.com/v4/letter/m/f17d59/32.png) [@Masahiro](https://discourse.slicer.org/u/Masahiro)
#### Post date: [November 23, 2023, 7:52am UTC](https://discourse.slicer.org/t/error-while-segmenting/32957/5 "2023-11-23T07:52:33Z")

</div>

Almost same error occurred to me.  
Is there any solution?

---

<div class="post-metadata">

### Author: ![towfi\_islam](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/towfi_islam/32/68407_2.png) [@towfi\_islam](https://discourse.slicer.org/u/towfi_islam)
#### Post date: [November 23, 2023, 8:03am UTC](https://discourse.slicer.org/t/error-while-segmenting/32957/6 "2023-11-23T08:03:54Z")

</div>

Found a fix, I just had to go back to slicer version 5.2.1 which solved it for me. 5.4 and 5.5 didnt work.

---

<div class="post-metadata">

### Author: ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)
#### Post date: [November 23, 2023, 8:25am UTC](https://discourse.slicer.org/t/error-while-segmenting/32957/7 "2023-11-23T08:25:38Z")

</div>

> [@towfi\_islam](#):
>
> 5.4 and 5.5 didnt work.

Could not reproduce this in 5.5 neither, with multiple saved scenes.

---

<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: [November 23, 2023, 12:13pm UTC](https://discourse.slicer.org/t/error-while-segmenting/32957/8 "2023-11-23T12:13:55Z")

</div>

Older Slicer versions do not get any feature updates or fixes, so going back is not a solution. There are so many updates and news features and so many more coming that you really don’t want to miss those.

All you need is to provide us information that allows us to reproduce the problem.

Most likely the issue is related to the content of the saved scene, so you could send us the scene files (upload somewhere and post the link here). We can also set up a meeting with you (with screen sharing) to see what you do and what the scene contains that may cause problems.

---

<div class="post-metadata">

### Author: ![Lin\_Li](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lin_li/32/67957_2.png) [@Lin\_Li](https://discourse.slicer.org/u/Lin_Li)
#### Post date: [November 24, 2023, 3:11am UTC](https://discourse.slicer.org/t/error-while-segmenting/32957/9 "2023-11-24T03:11:07Z")

</div>

I got this problem too. Exact the same thing. I solved it by changing header data in nrrd file from float32 to int32 and it’s fixed.

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [November 24, 2023, 2:31pm UTC](https://discourse.slicer.org/t/error-while-segmenting/32957/10 "2023-11-24T14:31:03Z")

</div>

Please report the exact steps to reproduce the issue if the workflow was contained within Slicer. Or if there was another program that generated a nrrd file with inconsistent header data please report to the maintainers of that program so the issue can be resolved.

---

<div class="post-metadata">

### Author: ![Lin\_Li](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lin_li/32/67957_2.png) [@Lin\_Li](https://discourse.slicer.org/u/Lin_Li)
#### Post date: [December 5, 2023, 1:58am UTC](https://discourse.slicer.org/t/error-while-segmenting/32957/11 "2023-12-05T01:58:18Z")

</div>

I’m not sure where the mask is generated. But I change the segmentation matrix element dtype from float32 to int32 and it’s solved. I didn’t change the header. I think some python package generate the classification label matrix by float32 but not int32 and that is the problem.

---

<div class="post-metadata">

### Author: ![da5ideber](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/da5ideber/32/69396_2.png) [@da5ideber](https://discourse.slicer.org/u/da5ideber)
#### Post date: [February 19, 2024, 9:47pm UTC](https://discourse.slicer.org/t/error-while-segmenting/32957/12 "2024-02-19T21:47:53Z")

</div>

is everyone having this issue running on Mac? I am getting the same issue and the only clue I can seem to find is that it happens when the volume and the segmentation are in different types (float/short) and the sizes are different, however on windows, slicer seems to have no problem with the same files that crash on Mac - also worth noting is the issue happens only in the brush tool, not in the erase or other paint based tools for me

---

<div class="post-metadata">

### Author: ![da5ideber](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/da5ideber/32/69396_2.png) [@da5ideber](https://discourse.slicer.org/u/da5ideber)
#### Post date: [February 19, 2024, 10:04pm UTC](https://discourse.slicer.org/t/error-while-segmenting/32957/13 "2024-02-19T22:04:15Z")

</div>

As an update, a colleague has found converting the segmentation node to a binary label map, then back to a segmentation node seems to fix the issue

---

<div class="post-metadata">

### Author: ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)
#### Post date: [February 19, 2024, 10:42pm UTC](https://discourse.slicer.org/t/error-while-segmenting/32957/14 "2024-02-19T22:42:08Z")

</div>

This came up again recently and it seems there’s a floating point exception generated on the arm64 (apple silicon) when editing float segmentations. It wasn’t the case with intel macs. For now yes, converting to an integer format via the workaround suggested by @da5ideber sounds like a good option.

---

<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: [February 20, 2024, 7:27pm UTC](https://discourse.slicer.org/t/error-while-segmenting/32957/15 "2024-02-20T19:27:13Z")

</div>

Using floating-point types for storing binary labelmaps is bad for performance and may result in additional complications. Therefore, never use float or double type for storing labelmaps and if you get data sets like this from somewhere then report it as an issue to the developers of that software.

Unfortunately, we cannot rely on other software producing valid output, so Slicer needs to detect and report this error (maybe even do an automatic conversion to a suitable integer type). We already have an issue for this:

> <https://github.com/Slicer/Slicer/issues/6941>
>
> \## Summary
> 
> When a seg.nrrd file uses \`type: float\` voxels then closed surface… representation is not generated (nothing appears or only a single segment's 3D representation appears).
> 
> See full error report here: https://discourse.slicer.org/t/only-one-of-28-segments-is-showing-in-3d/28934/3
> 
> \## Steps to reproduce
> 
> \- Load https://github.com/lassoan/PublicTestingData/releases/download/data/InvalidFloatSegmentationArterialAtlas.seg.nrrd into Slicer
> \- Create closed surface representation
> \- Only one segment appears in 3D
> 
> \## Expected behavior
> 
> All segments should appear in 3D
> 
> \## Environment
> \- Slicer version: Slicer-5.2.2
> \- Operating system: Windows
