swilm
(Sara Wilmsen)
July 24, 2023, 8:39pm
1
Hi
I loaded in a nrrd file that was properly scaled and it is showing that the scale of the volume is correct, however when I add a scale bar it is in the wrong units. is there a way to change the units on the scale bar? In the screenshot you can see that the volume scale is in microns but the 3D scale bar is in cm.
lassoan
(Andras Lasso)
July 25, 2023, 5:14am
2
Thanks for reporting. This is a known issue - see View ruler (horizontal ruler displayed in slice and 3D view nodes)
in:
opened 06:44PM - 11 Jul 20 UTC
type:bug
For numerical stability of various processing methods, it is important to avoid … very small and very large numbers.
By default, Slicer uses millimeter as unit, therefore for microscopy images the image spacing could be very small (for example, 0.00006mm) and derived values even smaller (volume of a voxel would be 0.000000000000216mm3). This could lead to display issues (hard to read the numbers, not enough space to display them) and numerical instabilities and loss of precision. The solution is to use a more appropriate unit, such as micrometer or tenth of a micrometer.
Slicer allows specifying what is the unit of length values of the scene and has unit-aware slider and spinbox widgets to correctly display them. However, the implementation is not fully complete and consistent. Remaining tasks:
- [ ] Use unit-aware widgets (or unit-aware formatting) whenever displaying numerical values with units. There are a number of places where “mm” unit is hardcoded and should be display should be replaced with unit-aware widgets.
- [ ] Transforms module display settings: I remember I had crashes with these widgets in Transform module’s display section and could not easily find the root cause, so just hardcoded mm, but we should give this another go. Examples include: view rulers (horizontal line at the bottom of views) and markups measurements (length of line and curves, surface area of closed curves).
- [x] Markups measurements
- [x] Slice offset slider
- [ ] Segment statistics
- [ ] Labelmap statistics
- [ ] View ruler (horizontal ruler displayed in slice and 3D view nodes)
- [ ] Models module, information section
- [ ] Importers should convert distance units. For example, when loading a DICOM file and the length unit is not mm, the voxel size must be scaled accordingly.
- [ ] Exporters should write distance units into files.
- [ ] CLI module interface should be made unit-aware.
- [ ] All transformable data in the scene must be rescaled when a scene with a different unit is imported.
- [ ] Maybe offer the user to rescale all spatial data in the scene when length unit is changed.
Until all these are implemented, a workaround is to enter values in a different unit (e.g., enter 0.06 "mm" instead of the real 0.06 micrometer), but don't change the unit in application settings. Then user would know that all units that Slicer displays in millimeters are actually in the other chosen unit (i.e., micrometer). See some more details and explanation here: https://discourse.slicer.org/t/distance-measurement-and-rendering-of-microscopy-images/791
These fixes would probably require contribution from the community - either contribution of development efforts or funding. This issue may also get more attention if it turns out to be a highly requested feature - so I move it now to the “Feature request” category so that people can vote on it.