imagej / imagej/ImageJ

Some problems with ScaleBar (second issue)

Open
#284 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
786
Forks
267
PR merge metrics
No merged PRs in 30d

Description

Another issue is about the need to take note of the parameters used for the rendering of the scale bar, like e.g. the font size and the bar thickness, especially during the writing of a paper or during the revision process, to add images in a consistent manner.

To address this second issue I embedded in the image the scale bar parameters as image properties when the scale bar is added. These properties are named as in the following list:

```hidden.scalebar.width hidden.scalebar.height
hidden.scalebar.thickness hidden.scalebar.fontSize
hidden.scalebar.color hidden.scalebar.background
hidden.scalebar.location hidden.scalebar.horizontal
hidden.scalebar.vertical hidden.scalebar.boldText
hidden.scalebar.hideText hidden.scalebar.serifFont
hidden.scalebar.useOverlay hidden.scalebar.labelAllSlices
```
The reason of the "hidden." prefix is probably best discussed in a dedicated issue, but briefly I also changed ImageInfo.java to not add properties whose name start with "hidden." to the "Show Info..." window, to not fill the output with properties that are intended for internal use only (I know that there is the "HideInfo" property, but it hides all properties, while it seems useful to me to hide only some).

Then, I added a popup menu and a button to the "Scale Bar" dialog (see image) to load the settings from another open image (only images which contain the scalebar properties are added to this choice list). If an image is selected in the choice requester, hitting the "Load settings" button adjusts the values of the "Scale Bar" dialog to the values contained in the selected image (and are shown in real time in the active image).

Image

If you believe that these changes are of some interest, I can make a PR.

Best,
Lorenzo

P.S., some more details below:
If the active image already has the above properties when the plugin is started, their values are stored in a temporary ScaleBarConfiguration structure, to be written to the image again if the requester is canceled. This information, if exist, is also used to rebuild the original scalebar, without using the restoreOverlayScaleBar method. restoreOverlayScaleBar is only used if no scalebar properties info exist (sometimes restoreOverlayScaleBar does not correctly restore the scale bar, while redrawing it from the stored info does. e.g. if the scale bar has the background color set, in some situations).

Contributor guide

No contributing guide indexed for this repository

Research direction

Review ImageInfo.java and the Scale Bar dialog, then trace restoreOverlayScaleBar and the ScaleBarConfiguration behavior described in the issue. Determine how hidden.scalebar properties are persisted, excluded from the Show Info window, and used by Load settings; done means these behaviors work while the existing restore path remains available when properties are absent.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
computer-vision, desktop
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.