Skip to content

Commit f620d97

Browse files
authored
Merge pull request #87 from CellKai/explain-options
Explain IJ options `iterations` and `count`
2 parents 8abb42d + d9bed2b commit f620d97

File tree

1 file changed

+40
-6
lines changed

1 file changed

+40
-6
lines changed

src/imcflibs/imagej/prefs.py

+40-6
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,35 @@ def debug_mode():
2323
def set_default_ij_options():
2424
"""Configure ImageJ default options for consistency.
2525
26-
Set the following options:
27-
- Ensure ImageJ appearance settings are default values.
26+
Will set the following options to ensure consistent behaviour independent of
27+
how ImageJ is configured on a specific machine.
28+
29+
- Ensure ImageJ appearance settings are the default values.
2830
- Set foreground color to white and background to black.
29-
- Set black background for binary images.
3031
- Set default file saving format to .txt files.
31-
- Ensure images are scaled appropriately when converting between different bit depths.
32+
- Ensure intensities are being scaled when converting between bit depths.
33+
- Options on binary images:
34+
- Set background to black.
35+
- Enable padding to prevent eroding from image edges.
36+
- Enforce defaults on iterations and count for *erosion*, *dilation*,
37+
*opening* and *closing* operations.
38+
39+
References
40+
----------
41+
The ImageJ User Guide is providing detailed explanations of the options
42+
configured by this function:
43+
44+
- [Edit > Options > Appearance][ijo_app]
45+
- [Edit > Options > Colors][ijo_col]
46+
- [Edit > Options > Conversions][ijo_cnv]
47+
- [Edit > Options > Input/Output][ijo_i_o]
48+
- [Process > Binary > Options][ijo_bin]
49+
50+
[ijo_app]: https://imagej.net/ij/docs/guide/146-27.html#sub:Appearance...
51+
[ijo_cnv]: https://imagej.net/ij/docs/guide/146-27.html#sub:Conversions...
52+
[ijo_col]: https://imagej.net/ij/docs/guide/146-27.html#sub:Colors...
53+
[ijo_i_o]: https://imagej.net/ij/docs/guide/146-27.html#sub:Input/Output...
54+
[ijo_bin]: https://imagej.net/ij/docs/guide/146-29.html#sub:BinaryOptions...
3255
"""
3356

3457
# Set all appearance settings to default values (untick all options)
@@ -37,11 +60,22 @@ def set_default_ij_options():
3760
# Set foreground color to be white and background black
3861
IJ.run("Colors...", "foreground=white background=black selection=red")
3962

40-
# Set black background for binary images and set pad edges to true to prevent eroding from image edge
63+
# Options regarding binary images:
64+
# - `black`: set background for binary images to be black.
65+
# - `pad`: enable padding of edges to prevent eroding from image edge.
66+
# - `iterations=1`: number of times erosion (dilation, opening, closing) is
67+
# performed
68+
# - `count=1`: number of adjacent background pixels necessary before a pixel
69+
# is removed from the edge of an object during erosion and the number of
70+
# adjacent foreground pixels necessary before a pixel is added to the edge
71+
# of an object during dilation.
72+
# https://imagej.net/ij/docs/menus/process.html#options
73+
# https://imagej.net/ij/docs/guide/146-29.html#sub:BinaryOptions...
4174
IJ.run("Options...", "iterations=1 count=1 black pad")
4275

4376
# Set default saving format to .txt files
4477
IJ.run("Input/Output...", "file=.txt save_column save_row")
4578

46-
# Scale when converting = checked
79+
# Enable "scale when converting".
80+
# https://imagej.net/ij/docs/menus/edit.html#options
4781
IJ.run("Conversions...", "scale")

0 commit comments

Comments
 (0)