Draw effect sometimes not applying

Does anyone know what might be going on here? I created the new segmentation from an option in the SegmentEditor segmentation node combobox and then the foreground volume (“FusedVolume”) was selected instead of the “Select Master Volume to enable editing”. As shown in the first image, I am able to use the draw effect to apply a segment. However it appears I can only apply/modify this segment if I’m in the center of a voxel in the foreground volume which is also the original master volume for the segmentation node.

When I scroll to another slice offset (note the background volume is a finer resolution), then I cannot use the draw tool anymore to modify the segment. The yellow draw disappears, but nothing changes about the segment.

What is weird is that I can use the Paint effect to modify the segment at this other offset, but not the draw effect.

Slice thickness is determined by the slice spacing of the view, which comes from the background volume. If the background volume is not the same as the master volume then the effect has to handle this difference correctly. Newly developed effects, such as Paint and Scissors should work well, but Draw effect uses an extremely old code (vtkImageFillROI from Slicer2), which has a number of limitations (for example, it does not work at all with non-axis-aligned views).

We should retire the Draw effect and improve Scissors effect to have the “delayed apply” mode (drawing is not applied immediately when the mouse button is release but on double-click), as described here. It would be awesome if you could work on this.

When using the Scissors effect as shown below, I’m still observing the same behavior that it doesn’t apply the effect successfully unless I’m in the middle of the voxel of the foreground volume which is my master volume for the segmentation. For slice cut “0 means that only the current slice is included.” I would expect this to work regardless of the volume’s slice thickness. It appears that it will fill only if I set the slice thickness to a value so that it will cross over the middle position of the voxel. This is because the required minimum slice thickness to fill increases the farther I’m away from the voxel center.

When I scroll to another slice offset (note the background volume is a finer resolution), then I cannot use the scissors tool anymore to modify the segment. The yellow scissors free-form disappears, but nothing changes about the segment.

Draw effect is fairly heavily used in manual segmentations. I am not aware of a mode in scissors which allows me to draw and paint a polygon. While the proposal calls for closed curves from markups for this functionality, will it be as quick and efficient as the polygon tool in draw?

Yes, the fill ROI code is some of the oldest code in Slicer. I remember that when working on the Editor in Slicer3 I looked through vtk and itk but didn’t find a good replacement so I kept the old code.

That’s why we still have both effects. If the Scissors effect would not apply the drawing immediately when the mouse button is released then you could draw polygons the same way as in the current Draw effect.

It may be faster and more efficient than that very very old single-threaded image rasterizing code and it will allow drawing thick slices, erasing, application to all segments, work on arbitrary slice orientations, etc. There is really no reason to maintain a completely separate, very limited Draw effect if the only unique feature is the delayed apply (polygon drawing).

In Scissors effect we will also be able to implement spline drawing, not just polyline (using a temporary curve node, similarly to Draw tube effect).

What you describe is the intended behavior. Only those voxels are filled which have their center inside the 3D closed surface that is generated by extruding the drawn contour by half of the current slice spacing in both directions. This image demonstrates the rationale for this (and why can you have empty regions when the drawing brush thickness is comparable or smaller than the slice thickness, with some more information here):

You could try to implement some kind of “nearest neighbor” behavior for cases when the slice plane is aligned to the labelmap axis directions, but you would need to develop some kind of a generalized Bresenham algorithm for drawing planes in 3D binary images in arbitrary orientation with arbitrary thickness.

We don’t have such algorithm and I’m not sure if such algorithm exists at all (especially implemented in C++, open-source, with non-restrictive license), so if you really must work with such image and segmentation geometries then I would recommend to either set thick manual slice spacing (that’s what is used when you set slice cut thickness to 0) or set a larger slice cut thickness.