Unit support in Slicer

Since almost all our users work with sub-millimeter resolution, I am testing how (well) the Units preference work.
I switched to micrometer in settings, and first issue is the mu sign is not displayed correctly on my platform (shows like this �m) Windows build r28798

I downloaded the MRHead and worked on the Segment Editor and look at the margin effect. Margin size is reported in microns, but values are clearly wrong. Anyways, I want to test this more extensively. What would should I report back? What would be most useful thing?


I’ve fixed the mu character encoding, it should show upwell in r28814 and later.

Making units in Slicer fully configurable requires a number of fixes:

  • 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. 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).
  • 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 length unit is changed.
  • All transformable data in the scene must be rescaled when a scene with a different unit is imported.

Since these are relatively large and independent tasks, probably separate issues should be added to the issue tracker to make sure they are all addressed (all tagged with Category = “Core: Units”). I can help with advice and reviewing code, but don’t expect to have significant amount of development time.

For reference, I have entered an issue to track these tasks: