Skip to content

Some problems with ScaleBar (first issue) #283

@AFMiJ

Description

@AFMiJ

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions