Volumes widget is too wide when there are many decimals

Title and screenshot image say it all. The module widget takes more than 50% of my screen and I can’t resize it.

It says 4 decimals here:
https://github.com/Slicer/Slicer/blob/eefeac9286f48552e8418a11f412b2823a09b407/Libs/MRML/Widgets/Resources/UI/qMRMLVolumeInfoWidget.ui#L95-L98

When I try to access the widget, I get 3:

v = slicer.modules.volumes.widgetRepresentation()
>>> for cw in v.findChildren('qMRMLCoordinatesWidget'):
...     print(cw.decimals)
... 
0
3
3

But in Slicer there are many more.

P.S.: I’m not sure if it’s the right category or if I should’ve posted directly in the issue tracker.

1 Like

Should I report this somewhere else? I can try to help with some guidance.

I cannot reproduce this. Can you give detailed instructions?

Does it help if you reduce the number of shown digits using Ctrl+- shortcut? Is it possible that you’ve accidentally hit Ctrl++ several times and that increased the number of shown digits?

  1. Open Slicer
  2. Open this volume
  3. Go to Volumes module
  4. Click on Volume Information

Nothing happens when I click Ctrl + - or Cmd + - (I’m on a MacBook Pro Retina 13").

No, and this is something that has happened to me as long as I can remember. Just hadn’t reported it yet.

Maybe a macOS user can reproduce. @fedorov?

@Fernando I cannot reproduce it either

image

I can also confirm that if I put the cursor into a field from Image Origin, I can then use Command + + / Command + - to increase/decrease the number of decimals.

That’s probably because MRHead has fewer decimals in its header than the image I shared.

I didn’t know I was supposed to enable one of the widget’s spin boxes. I can decrease the number of decimals of one spin box now, but as soon as I do the same on another one, the former goes back to its initial length so the module widget’s width stays the same.

No, I checked that:

image

I don’t know if this detail matters, but for this experiment I was using a nightly build from August.

@Fernando Have you adjusted units in your application (Edit/Application Settings/Units)? It may effect how length values are displayed.

I was able to replicate the behavior reported by @Fernando using the volume he provided.

As a workaround I can change the behavior by changing the decimalsOption like this:

>>> for w in findChildren(className='qMRMLCoordinatesWidget'):
...   w.decimalsOption = 0

I didn’t look deeper but there are a number of options and maybe we should pick a different default (or debug the version we are using which is 7 = DecimalsByShortcuts | DecimalsByKey | DecimalsByValue) for the ImageOrigin.

1 Like

Sorry, I missed that link! Interesting that the issue is specific to the dataset.

1 Like

This didn’t have any effect.

This made the Image Spacing widget use 4 decimals and 1 out of 3 spin boxes from Image Origin use 3.

The snippet I pasted will change the modes for all the coordinate widgets. If there’s a good combination of ‘decimals’ and ‘decimalsOption’ that works well we could make that the new default. I didn’t try all the enum combinations for decimalsOptions.

Hi Steve,

I just tried again your snippet and it helped me reduce the size of the widget, but it still takes a lot of space (around 45% of the screen) and it feels like it should need much less, maybe 30%. Shall I work on a PR to change the defaults of the module?

By the way, when I collapse the Volume Information button, I can reduce a the size of the widget to a reasonable width.

It could be also possible to change the coordinate widget to use flow layout (http://www.commontk.org/docs/html/classctkFlowLayout.html), which automatically places widgets into several rows if horizontal space is limited.

1 Like

Yes, if you find a new set of defaults or other change (like layout as @lassoan suggested) it would be great to have a PR to test.