Skip to content

Commit 1060f5d

Browse files
authored
Merge pull request #3 from lukmuk/active_v0.2
Updates for version 0.2
2 parents 9fb6404 + 1aa65e6 commit 1060f5d

File tree

4 files changed

+984
-26
lines changed

4 files changed

+984
-26
lines changed

README.md

Lines changed: 74 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,41 +20,53 @@ Batch conversion of SEM images (``Process -> Batch -> Macro...``) from tiff to p
2020

2121
##### QuickScaleBar Tool (Icon: <u>SB</u>)
2222

23-
* One-click action to add a scale bar to an image.
23+
* One-click action to add a scale bar to an image. Right click opens the options menu.
2424

25-
* The scale bar height and font size is adjusted based on image height.
25+
* The scale bar height and font size is adjusted based on image height (or width).
2626

27-
* The scale bar width is adjusted based on scaled image width and rounded to next "good looking" number.
27+
* The scale bar width is adjusted based on scaled image width (or height, or larger/smaller of the two) and rounded to next "good looking" number.
2828

29-
* Will automatically switch units to make scale bar more appealing: E.g. an image with horizontal field width of 0.25 µm will be switched to 250 nm. The scale bar will then also be in nm.
29+
* The scale bar appearance can be set up just like the normal settings for `Analyze -> Tools -> Scale bar...`.
30+
31+
* Optional: Automatically switch units to make scale bar more appealing. E.g., an image with horizontal field width of 0.25 µm will be switched to 250 nm. The scale bar will then also be in nm.
32+
33+
* Optional: Automatically re-scale image to (at least) a specified image size in pixels without interpolation (= nearest neighbor interpolation). This is convenient for programs like PowerPoint which like to automatically interpolate "small" images.
34+
35+
* Optional: Run custom macro commands provided in the options menu, e.g. `run('mpl-viridis');` to change LUT to viridis.
3036

3137
##### FEI Crop Scalebar Tool (Icon: FEI)
3238

33-
* One-click action to crop away the databar from an FEI/TFS SEM/FIB image and to add a scale bar.
39+
* One-click action to crop away the databar from an FEI/TFS SEM/FIB image and to add a scale bar. Right click opens the options menu.
3440

35-
* Scale bar behaviour is the same as for QuickScaleBar tool.
41+
* Scale bar behaviour is the same as for QuickScaleBar tool and settings are taken from the QuickScaleBar options.
3642

37-
* Other image operations can be specified in the script (`process_image()` function). By default a simple "Auto Contrast/Brightness" contrast stretching is run.
43+
* Optional: Run custom macro commands provided in the options menu, e.g. `run('mpl-viridis');` to change LUT to viridis.
3844

39-
* Especially useful for batch conversion of SEM/FIB images (run from `Process->Batch->Macro...` )
45+
* Especially useful for batch conversion of SEM/FIB images (run from `Process -> Batch -> Macro...` ): In the batch processing menu insert the macro command `runMacro('FEI_Crop_Scalebar.ijm');`.
4046

4147
* **Note:** The boundaries for the cropping area **depend on the microscope system type** because older FIB/SEMs use a nearly quadratic image format whereas modern microscope use landscape mode by default. You may need to adjust the microscope list once in the macro for your SEM, see instructions below.
4248

43-
*
49+
##### Move Overlays Tool (Circle icon)
50+
51+
* Move around scale bar for fine tuning of the position. Will anchor to special positions for easier alignment.
52+
53+
* Taken from: [Overlay Editing Tools](https://imagej.nih.gov/ij/source/macros/Overlay%20Editing%20Tools.txt)
54+
55+
##### Remove Overlays Tool (x icon)
4456

45-
##### Edit ScaleBarTools macros... Tool (Icon: ?)
57+
* Remove all overlays including the scale bar.
4658

47-
* Opens the Fiji code editor to quickly edit the macros for future use.
59+
##### About EMScaleBarTools (Icon: ?)
4860

49-
* Adjust the scalebar looks here and add fancy image operations for the FEI Crop Scalebar Tool!
61+
* Opens a short help dialog.
5062

5163
## Requirements and Installation
5264

5365
* Requires the useful [EM tool](https://imagej.net/plugins/imbalence) plugin by **IMBalENce** as FEI/TFS images are scaled with [SEM FEI metadata scale](https://imagej.net/plugins/sem-fei-metadata-scale). Install via the Fiji update site.
5466

55-
* Download the latest [release](https://github.com/lukmuk/em-scalebartools/releases), extract the `macros` folder, and copy it to your Fiji installation folder. It will add the `QuickScaleTools.ijm` and `FEI_Crop_Scalebar.ijm` macros to the macros folder and the `ScaleBarTools.ijm` toolset to the `macros/toolset` folder.
67+
* Download the latest [release](https://github.com/lukmuk/em-scalebartools/releases), extract the `macros` folder, and copy it to your Fiji installation folder. It will add the``FEI_Crop_Scalebar.ijm`` macro to the macros folder and the `EMScaleBarTools.ijm` toolset to the `macros/toolset` folder.
5668

57-
* Restart Fiji and select the `ScaleBarTools` from `More Tools...` (>>) menu.
69+
* Restart Fiji and select the `EMScaleBarTools` from `More Tools...` (>>) menu.
5870

5971
##### Add a new microscope system type
6072

@@ -70,31 +82,49 @@ Currently, only the system types `Helios G4 FX`, `Strata DB`, and `Quanta FEG` a
7082

7183
Warning: Code is not optimized in any way, but should work (?). :-)
7284

73-
###### Scalebar looks:
85+
###### QuickScaleBar Options
86+
87+
``Relative height``: Height of scale bar wrt image height in pixel (default: ``0.02``, 2% of image height)
88+
89+
`Relative width`: Width of scale bar with respect to `Scalebar size reference`option (default: `0.2`, 20% of image width), will get rounded to next smaller "nice" value, see (``vals`` array in the code).
90+
91+
`Relative fontsize`: Font size wrt `Scalebar height` (default: `3`, point size of scale bar height).
92+
93+
`Scalebar color`: Font size color (default: ``'Black'``).
94+
95+
`Background color`: Background color (default: `'White'`). Use ``'None'`` to remove background.
96+
97+
``Scalebar location``: Location/position of scale bar (default: ``'Lower Right'``).
7498

75-
``sb_hfac``: Height of scale bar wrt image height in pixel (default: ``0.02``, 2% of image height)
99+
`Bold`: Bold font (default: `true`).
76100

77-
`sb_wfac`: Width of scale bar wrt image width (default: `0.2`, 20% of image width), will get rounded to next smaller "nice" value, see (``vals`` array in the code).
101+
`Overlay`: Add scale bar as an overlay (default: `true`).
78102

79-
`sb_fsfac`: Font size wrt `sb_hfac` (default: `2`, double of point size of scale bar height).
103+
`Serif font`: Serif font (default: `false`).
80104

81-
`sb_col`: Font size color (default: ``'Black'``).
105+
`Hide`: Hide font, only plot scale bar (default: `false`). Will create a copy of the image with the scale-bar length in the title.
82106

83-
`sb_bg`: Background color (default: `'White'`). Use ``'None'`` to remove background.
107+
`Scalebar size reference`: Base scale bar size on width/height/smaller/larger edge of the image (default: `'Larger'`). You can adjust this for narrow images to modify scale bar appearance. Use `Height`/`Width` if you want to have identical scale bar sizes for images of same `Height`/`Width`.
84108

85-
``sb_loc``: Location/position of scale bar (default: ``'Lower Right'``).
109+
`Auto unit-switching`: Automatically adjusts units between m and Angstrom based on `Check`and `U` values. (default: `true`).
110+
111+
`(Auto unit-switching) Check`: Check width/height/both of image for unit switching (default: `'Width'`).
86112

87113
``U``: Unit switching factor (default: ``3``). Example: Will switch from µm to nm if image width is below 3 µm. Will switch from nm to µm if image width is larger than 3000 nm.
88114

89-
###### QuickScaleBar
115+
`Auto re-scale images`: If true/1, automatically rescale (using no interpolation/nearest interpolation) small image width or height to at least `rescale_target_px` value. (default: `0`, false). Useful to resize small cropped areas of larger images. This is the same as using `CTRL+E` and rescaling with `Interpolation: None`.
116+
117+
`rescale_target_px`: Target minimum pixel size for `auto_rescale`. (default: `512`)
118+
119+
`Run custom macro commands`: Run commands specified in next line (default: `false`). In the `Custom macro commands` field, multiple commands must be separated by `;`.
90120

91-
``auto_rescale``: If true/1, automatically rescale (using no interpolation/nearest interpolation) small image width or height to at least ``rescale_target_px`` value. (default: ``0``, false). Useful to resize small cropped areas of larger images. This is the same as using ``CTRL+E`` and rescaling with ``Interpolation: None``.
121+
###### FEI Crop Scalebar Options
92122

93-
`rescale_target_px`: Target minimum pixel size for ``auto_rescale``. (default: ``800``)
123+
`Crop data bar`: Crop data bar of FEI/TFS image (default: `true`)
94124

95-
###### FEI Crop Scalebar
125+
`Show metadata in log window`: Keep log window open or close it (default: `false`).
96126

97-
``function process_image()``: Add image processing here, especially useful for batch conversion. (default: Auto C/B, i.e. ``run("Enhance Contrast", "saturated=0.35")``)
127+
`Run custom macro commands`: Run commands specified in next line (default: `false`). In the `Custom macro commands` field, multiple commands must be separated by `;`.
98128

99129
## Other useful scalebar tools
100130

@@ -103,3 +133,21 @@ Warning: Code is not optimized in any way, but should work (?). :-)
103133
* DM/GMS: [Scale Bar Control](http://www.dmscripting.com/scalebarcontrol.html) by D. R. G. Mitchell
104134

105135
* Fiji/ImageJ: [asc-ImageJ-Fancy-Labels](https://github.com/peterjlee/asc-ImageJ-Fancy-Labels) by peterjlee
136+
137+
* Fiji/ImageJ: [Scale Bar Tools for Microscopes](http://image.bio.methods.free.fr/ImageJ/?Scale-Bar-Tools-for-Microscopes.html&lang=en) by Gilles Carpentier
138+
139+
## Changelog
140+
141+
### v0.2
142+
143+
* Renamed `ScaleBarTools.ijm` to `EMScaleBarTools.ijm` because there is also a plugin by [Gilles Carpentier](http://image.bio.methods.free.fr/ImageJ/?Scale-Bar-Tools-for-Microscopes.html&lang=en) with a similar name. Makes it clear that is meant for EM.
144+
145+
* Reorganization of the code: `QuickScaleBar.ijm` was merged into `EMScaleBarTools.ijm`. `FEI_Crop_Scalebar.ijm` is still a stand-alone macro for easier use with batch processing.
146+
147+
* Included option menus for some icon tools, which can be accessed by right-click. More convenient editing than in the source code.
148+
149+
* Options parameters are stored internally in java variables and saved for future sessions (`ij.get` and `ij.set` calls). I took inspiration from another toolsets macro: [Roi 1-click tools](https://imagej.net/plugins/roi-1-click-tools)
150+
151+
* Added more options for scale bar appearance (serif font, bold, hide, ...).
152+
153+
* Added two additional tools in the menu: Move Overlays and Remove Overlays for quick manipulation of the scale bar (which is often an overlay).

README.pdf

2.09 MB
Binary file not shown.

0 commit comments

Comments
 (0)