# A drawing disappears after Cropping Volume

**URL:** https://discourse.slicer.org/t/a-drawing-disappears-after-cropping-volume/12924
**Category:** Support
**Tags:** segmentation
**Created:** [August 10, 2020, 12:52pm UTC](https://discourse.slicer.org/t/a-drawing-disappears-after-cropping-volume/12924 "2020-08-10T12:52:55Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![whirl](https://avatars.discourse-cdn.com/v4/letter/w/7cd45c/32.png) [@whirl](https://discourse.slicer.org/u/whirl)
#### Post date: [August 10, 2020, 12:52pm UTC](https://discourse.slicer.org/t/a-drawing-disappears-after-cropping-volume/12924/1 "2020-08-10T12:52:55Z")

</div>

Hello,  
I try to segment femoral cartilage. To do so, firstly I crop volume containing the area and then try to segment the cartilage using “Draw”. The problem is that I’m unable to do it - it disappears. A painting option works - it marks the area.  
Could you help me?

---

<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, 2020, 1:25pm UTC](https://discourse.slicer.org/t/a-drawing-disappears-after-cropping-volume/12924/2 "2020-08-10T13:25:31Z")

</div>

This could happen when the slice view is positioned right at the boundary between two slices. This is not likely to happen if you use latest Slicer Preview Release. If you the issue is not resolved then let us know and we can give further advice.

---

<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: [May 20, 2021, 12:18pm UTC](https://discourse.slicer.org/t/a-drawing-disappears-after-cropping-volume/12924/3 "2021-05-20T12:18:52Z")

</div>

2 posts were split to a new topic: [Cannot paint segments on video](https://discourse.slicer.org/t/cannot-paint-segments-on-video/17710)

---

<div class="post-metadata">

### Author: ![caesarsalad](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@caesarsalad](https://discourse.slicer.org/u/caesarsalad)
#### Post date: [May 21, 2021, 4:44am UTC](https://discourse.slicer.org/t/a-drawing-disappears-after-cropping-volume/12924/4 "2021-05-21T04:44:06Z")

</div>

Hello,

As a follow up is it possible to save the 2D annotations into a .json file? I wish to use the annotations to train a model.

Thanks as always 🙂

---

<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: [May 21, 2021, 4:48am UTC](https://discourse.slicer.org/t/a-drawing-disappears-after-cropping-volume/12924/5 "2021-05-21T04:48:26Z")

</div>

You can get voxels of a segment as a numpy array by calling `slicer.util.arrayFromSegment` (see an example [here](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#get-centroid-of-a-segment-in-world-ras-coordinates)) and save it in any file format you like.

---

<div class="post-metadata">

### Author: ![caesarsalad](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@caesarsalad](https://discourse.slicer.org/u/caesarsalad)
#### Post date: [May 21, 2021, 5:47am UTC](https://discourse.slicer.org/t/a-drawing-disappears-after-cropping-volume/12924/6 "2021-05-21T05:47:24Z")

</div>

I’ve looked over the code but can’t quite understand.  
I used the segmentation editor tool to draw annotations free handedly, and it seems like 3d slicer saves them in .nrrd by default. Does the call also work for shapes that are not a fixed polygon?

---

<div class="post-metadata">

### Author: ![caesarsalad](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@caesarsalad](https://discourse.slicer.org/u/caesarsalad)
#### Post date: [May 21, 2021, 7:12am UTC](https://discourse.slicer.org/t/a-drawing-disappears-after-cropping-volume/12924/7 "2021-05-21T07:12:18Z")

</div>

Also quite relatively new to programming in Python, I would appreciate it if you could guide me through how to save the freehand annotations (2D) into a json file format. I appreciate your time sir.

---

<div class="post-metadata">

### Author: ![caesarsalad](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@caesarsalad](https://discourse.slicer.org/u/caesarsalad)
#### Post date: [May 21, 2021, 8:26am UTC](https://discourse.slicer.org/t/a-drawing-disappears-after-cropping-volume/12924/8 "2021-05-21T08:26:30Z")

</div>

For clarity, I wish to obtain the coordinates of the annotated region that I drew free-hand. Would such a thing be possible?

---

<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: [May 21, 2021, 12:33pm UTC](https://discourse.slicer.org/t/a-drawing-disappears-after-cropping-volume/12924/9 "2021-05-21T12:33:22Z")

</div>

> [@caesarsalad](#):
>
> Also quite relatively new to programming in Python, I would appreciate it if you could guide me through how to save the freehand annotations (2D) into a json file format.

JSON just specifies low-level syntax for data storage but it does not tell what you store and exactly how. You need to choose a commonly used file format for storing the segmentation result.

> [@caesarsalad](#):
>
> For clarity, I wish to obtain the coordinates of the annotated region that I drew free-hand.

This does not sound right. It is not likely that you need a polygonal representation as input for CNN. If you mean that you would like to encode the segmentation by storing coordinate of each pixel that would be very wasteful and I don’t think it is commonly used for CNN input.

I would recommend to check out [MONAI](https://monai.io/) tutorials for learning how to train models for medical image segmentation. Since you work with RGB camera images, you can use computer vision deep learning tutorials, too.
