Ticket #1651 (closed defect: fixed)

Opened 7 years ago

Last modified 5 years ago

NumberWidget: sliders and scrolls don't work with doubles

Reported by: bdezonia Owned by: curtis
Priority: major Milestone: imagej2-unscheduled
Component: UI Framework Version:
Severity: serious Keywords:
Cc: Blocked By:
Blocking: #1632

Description

While working on the Threshold plugin I came across an issue with NumberWidget. If one chooses widget style of slider or scroll any defined callbacks for the field are never called. Ideally the min and max values in the Threshold plugin would have the style of scroll/slider that shows tick marks and most importantly labels the axis with min and max values. We need to make the widget work correctly and change the definitions in the Threshold plugin.

Change History

comment:1 Changed 7 years ago by bdezonia

  • Blocking 1273 added

comment:2 Changed 7 years ago by curtis

I thought a bit about how to make sliders & scroll bar number widgets support doubles and other non-integers, but in general it is a rather nasty problem. In essence, you have to decide how to reduce a Number from its native min/max/step to a discrete subset of positive ints. I think the general mathematical solution is non-trivial.

For our sanity, we may just want to special-case a few specific supported cases. In particular, a float or double with bounded min/max.

The naive math is steps = (max - min) / stepSize, but there are many corner cases where it will be wrong. In the case where either min or max isn't actually bounded, for example, it blatantly fails.

We could also play some tricks with the UI widgets themselves, updating the ranges dynamically, etc., but it may be more trouble than it is worth. Just having support for doubles with bounded min/max ranges may be sufficient for most use cases.

comment:3 Changed 7 years ago by bdezonia

  • Milestone changed from imagej2-b8-analysis to imagej2-b7-ndim-data

comment:4 Changed 7 years ago by bdezonia

  • Blocking 1632 added; 1273 removed
  • Milestone changed from imagej2-b7-ndim-data to imagej2-unscheduled

comment:5 Changed 7 years ago by curtis

  • Component changed from Core to UI Framework

comment:6 Changed 6 years ago by bdezonia

curtis, was this one handled recently?

comment:7 Changed 6 years ago by curtis

Sort of. See:  https://github.com/imagej/imagej-tutorials/commit/7f828032e407f7e29e434da7c8f0edf87e28c9c3

With respect to the Threshold command specifically, I did not test it recently.

comment:8 Changed 5 years ago by curtis

  • Status changed from new to closed
  • Resolution set to fixed

I declare this ticket "close enough" for now.

Note: See TracTickets for help on using tickets.