Some problems with ScaleBar (first issue)
- Dominant language
- Java
- Stars
- 786
- Forks
- 267
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I always found a bit tricky a couple of issues about the managing of scale bars in ImageJ.
The first one happens when you call the "Scale Bar..." menu from a macro context without parameters.
The scale bar preferences dialog is opened (which is great because changes can be viewed in real time in the image), but it starts with hard coded values. Especially the fact that the "Overlay" checkbox is unticked, may cause unwanted changes in the image data if the user does not change its status every time that the command is invoked.
To address this, I introduced some ImageJ preferences (and I added some code to ScaleBar.java) to change the default values when ScaleBar is called from a macro and no parameters are passed :
```
scalebar.boldText
scalebar.useOverlay
scalebar.fontSize
scalebar.thickness
```
These preference can be easily set by the user (e.g. using a dedicated macro).
Moreover, I added a further preference (`scalebar.macroPersistent`), which, if set true, makes ScaleBar to use the previously used values even if called from a macro.
If these preferences do not exist the default values are the same as are now, so ScaleBar behaves as usual if nothing is done.
Summing up, first come the macro parameters passed to the plugin, if these are not set, and `scalebar.macroPersistent` is true, the previously set values are used. If `scalebar.macroPersistent` is null or false, the above preferences are checked. If them exist, are used, if instead are null the hard coded values are used.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the ScaleBar.java implementation and the existing ImageJ preference handling. Trace the no-parameter macro path and verify the requested preference precedence, including scalebar.macroPersistent; done means macro-invoked ScaleBar uses the configured defaults without changing image data unexpectedly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- computer-vision, desktop
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100