We use Segment Editor dilation for a project, and today I realized that the behavior is somewhat unexpected. Apparently, it is not possible to grow the margin in a given direction unless the “Margin size” parameter is above spacing*2 in that direction.
So if the spacing of the image is 0.5x0.5x3, the margin will not be dilated in the z direction unless the margin size parameter is larger than 6mm.
Is this the correct behavior?
Does it make sense to instead specify the margin parameter in voxels, since it will grow in voxels? (and this operation will only work when the master representation is “binary”).
This is correct. Minimum margin increase/decrease is 1 voxel. For representing smaller margins, you need to set a smaller voxel size in the segmentation (conveniently using the recently added feature that allows adjusting segmentation geometry - https://github.com/Slicer/Slicer/pull/975).
You can see the exact number of voxels that are used in the dilation/erosion. Maybe we could display a warning message when the difference between the requested and feasible size is too large. In general, users don’t know (and don’t really care to find out) what the axis directions are and what the spacing values are along each axis, so specifing size in voxels would be too much to ask for.
Andras, thanks! I still have two questions:
- Since the goal of this functionality is to add pixel layers, why is margin size specified in mm? It seems quite confusing, since margin changes only have effect in multiples of 2 of the pixel dimensions.
- Why should the margin parameter be 2 times voxel size in given direction to add a layer of 1 voxel?
Those 2 issues above are very counter-intuitive to me.
Physical space has real-world, absolute meaning, which users can directly interpret. Users should not care about voxel size, they should only make sure that voxel size is small enough to be able to represent all relevant details.
Kernel diameter must be an odd number, that’s why the minimum increment is two voxels.