A drawing disappears after Cropping Volume

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?

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.

1 Like

2 posts were split to a new topic: Cannot paint segments on video

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 :slight_smile:

You can get voxels of a segment as a numpy array by calling slicer.util.arrayFromSegment (see an example here) and save it in any file format you like.

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?

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.

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

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.

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

1 Like