From fbf9137707799a2553c40861ecea013656b6a021 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter Date: Wed, 9 Apr 2025 10:55:30 +0200 Subject: [PATCH 01/14] Rework workflow titles a bit The previous length and style was inconvenient in several places: the actions view, the badges, ... --- .github/workflows/build.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/pytest-poetry.yml | 2 +- .github/workflows/pytest-python2.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index de54ef54..0e65aa9d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: 🚚🌍 Publish to πŸ”¬β˜• SciJava and πŸŽͺ PyPI +name: "Packages: SciJava πŸ”¬β˜• + PyPI πŸŽͺ" on: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6a7fd051..83600f72 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,4 @@ -name: πŸ”Ž Code Linting ⚑ +name: Code Linting πŸ”Žβš‘ on: push: diff --git a/.github/workflows/pytest-poetry.yml b/.github/workflows/pytest-poetry.yml index a53043f8..93049871 100644 --- a/.github/workflows/pytest-poetry.yml +++ b/.github/workflows/pytest-poetry.yml @@ -1,6 +1,6 @@ ## action file inspired by https://jacobian.org/til/github-actions-poetry/ -name: πŸ§ͺ pytest (via 🎭 Poetry) +name: Pytest-Poetry πŸ§ͺ🎭 on: push: diff --git a/.github/workflows/pytest-python2.yml b/.github/workflows/pytest-python2.yml index 91fa23ba..f0856cc6 100644 --- a/.github/workflows/pytest-python2.yml +++ b/.github/workflows/pytest-python2.yml @@ -1,4 +1,4 @@ -name: πŸ§ͺ pytest (using 🐍 Python2) +name: Pytest-Python2 πŸ§ͺ🐍 on: push: From 25d69bc0fcdfd32ade95be77df86654ca6d63a52 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter Date: Wed, 9 Apr 2025 11:13:30 +0200 Subject: [PATCH 02/14] Another workflow title modification --- .github/workflows/dispatch-deploy-pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dispatch-deploy-pages.yml b/.github/workflows/dispatch-deploy-pages.yml index 88feb100..fad11786 100644 --- a/.github/workflows/dispatch-deploy-pages.yml +++ b/.github/workflows/dispatch-deploy-pages.yml @@ -1,4 +1,4 @@ -name: πŸš€ Dispatch foreign workflows +name: Dispatch foreign workflows πŸš€πŸŒ– on: workflow_dispatch: From 941fba4d79fb6a6e6297f905407567975cc590e8 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter Date: Wed, 9 Apr 2025 11:14:25 +0200 Subject: [PATCH 03/14] Add badges for tests, reorganize layout --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index db18ef35..199d1010 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,11 @@ # IMCFlibs 🐍 β˜• πŸ”© πŸ”§ πŸͺ› -[![Build Status](https://github.com/imcf/python-imcflibs/actions/workflows/build.yml/badge.svg)][build] [![Linting ⚑](https://github.com/imcf/python-imcflibs/actions/workflows/lint.yml/badge.svg)](https://github.com/imcf/python-imcflibs/actions/workflows/lint.yml) +[![Pytest-Python2 πŸ§ͺ🐍](https://github.com/imcf/python-imcflibs/actions/workflows/pytest-python2.yml/badge.svg)](https://github.com/imcf/python-imcflibs/actions/workflows/pytest-python2.yml) +[![Pytest-Poetry πŸ§ͺ🎭](https://github.com/imcf/python-imcflibs/actions/workflows/pytest-poetry.yml/badge.svg)](https://github.com/imcf/python-imcflibs/actions/workflows/pytest-poetry.yml) + +[![Build Status](https://github.com/imcf/python-imcflibs/actions/workflows/build.yml/badge.svg)][build] [![DOI](https://zenodo.org/badge/156891364.svg)][doi] This package contains a diverse collection of Python functions dealing with From eb8ed55508be9cde568a1d3c24bef9a38ed279c4 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter Date: Wed, 9 Apr 2025 11:17:19 +0200 Subject: [PATCH 04/14] Add codecov badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 199d1010..0718c2d8 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![Linting ⚑](https://github.com/imcf/python-imcflibs/actions/workflows/lint.yml/badge.svg)](https://github.com/imcf/python-imcflibs/actions/workflows/lint.yml) [![Pytest-Python2 πŸ§ͺ🐍](https://github.com/imcf/python-imcflibs/actions/workflows/pytest-python2.yml/badge.svg)](https://github.com/imcf/python-imcflibs/actions/workflows/pytest-python2.yml) [![Pytest-Poetry πŸ§ͺ🎭](https://github.com/imcf/python-imcflibs/actions/workflows/pytest-poetry.yml/badge.svg)](https://github.com/imcf/python-imcflibs/actions/workflows/pytest-poetry.yml) +[![codecov](https://codecov.io/github/imcf/python-imcflibs/branch/devel/graph/badge.svg?token=JTDK74OT79)](https://codecov.io/github/imcf/python-imcflibs) [![Build Status](https://github.com/imcf/python-imcflibs/actions/workflows/build.yml/badge.svg)][build] [![DOI](https://zenodo.org/badge/156891364.svg)][doi] From 65f49da899d4bd5f7d73cc2ebf95744d16086428 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter Date: Wed, 9 Apr 2025 11:36:30 +0200 Subject: [PATCH 05/14] Un-ignore VS Code project settings --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index a071a9a5..7125412e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ # VS Code files *.code-workspace -.vscode/ # maven / release generated files target/ @@ -9,7 +8,6 @@ pom.xml.releaseBackup # bytecode created when importing directly in Jython: *py.class - *.py[cod] # C extensions From b25b41ac91ab787816d5c2f169a950e13aaefbe5 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter Date: Wed, 9 Apr 2025 11:36:39 +0200 Subject: [PATCH 06/14] Add VS Code tasks definitions --- .vscode/tasks.json | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .vscode/tasks.json diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..86d7ca87 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,27 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "verify", + "type": "shell", + "command": "mvn -B verify", + "group": "build" + }, + { + "label": "test", + "type": "shell", + "command": "mvn -B test", + "group": "test" + }, + { + "label": "deploy", + "type": "shell", + "command": "mvn -Dscijava.app.directory=/opt/Fiji.app", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [] + } + ] +} \ No newline at end of file From 64d8e3cd05cbb1dcf5706cfc2ca7d6f2ecfa8b78 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter Date: Wed, 9 Apr 2025 11:37:14 +0200 Subject: [PATCH 07/14] Add VS Code / markdownlint settings --- .vscode/settings.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..b0104751 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,13 @@ +{ + "markdownlint.config": { + "emphasis-style": { + "style": "asterisk" + }, + "line-length": { + "line_length": 80, + "stern": true, + "code_blocks": false, + "tables": false + } + }, +} \ No newline at end of file From 82df88781aa30ea5195ed075597a9faa7440996c Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter Date: Wed, 9 Apr 2025 11:38:47 +0200 Subject: [PATCH 08/14] Automatic formatting changes by markdownlint --- CHANGELOG.md | 1 - DEVELOPMENT.md | 6 +++--- TESTING.md | 26 +++++++++++++------------- poetry.lock.md | 2 +- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7503eb67..eca8576c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,4 @@ - # Changelog 🧾 diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 1d2f6f45..82c19d34 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -31,7 +31,7 @@ git push origin $RELEASE_TAG ``` **IMPORTANT 2**: in case a **pre-releaes** was created, the last commit needs to -be discarded as the _release-script_ places a wrong version / snapshot +be discarded as the *release-script* places a wrong version / snapshot combination in the `pom.xml`: ```bash @@ -43,7 +43,7 @@ git reset --hard HEAD~1 Building and deploying the package can be greatly simplified using "tasks" in [Visual Studio Code][www_vscode]. By adding the following settings to the `.vscode/tasks.json` file, you can simply press `Ctrl+Shift+B` in VS Code and -select the _deploy_ task for running Maven and have the resulting JAR file being +select the *deploy* task for running Maven and have the resulting JAR file being placed in `/opt/fiji-packaging/Fiji.app/jars/` (adjust to your path as necessary): @@ -80,7 +80,7 @@ necessary): ## Linting Python 2.7 with VS Code For being able to lint the old Python code properly, you'll need to set up an -appropriate _virtualenv_ with `pylint` being installed. +appropriate *virtualenv* with `pylint` being installed. Using [`fish`][www_fish] and [virtualfish][www_vf], this can be done as follows: diff --git a/TESTING.md b/TESTING.md index 356d6462..cdbcbb81 100644 --- a/TESTING.md +++ b/TESTING.md @@ -7,7 +7,7 @@ be tested via [`pytest`][pytest] up to a certain level, some (most?) of them should even work in a Python 3 environment. To perform those tests, the packges otherwise provided by ImageJ need to be -mocked using the `imcf-fiji-mocks` package. For seting up a _venv_ use the steps +mocked using the `imcf-fiji-mocks` package. For seting up a *venv* use the steps described here: ```bash @@ -37,7 +37,7 @@ pip install --upgrade \ pip install -e . ``` -Using this _venv_, tests can be triggered just the usual way. To run only +Using this *venv*, tests can be triggered just the usual way. To run only specific tests, use e.g. ```bash @@ -48,12 +48,12 @@ pytest tests/bdv/test_processingoptions.py For running [`pytest`][pytest] in a C-Python 2 environment, things are slightly more complicated than the approach described for Python 3 above as `pip` for -Python 2 cannot install a project in _editable_ mode unless it has a `setup.py` +Python 2 cannot install a project in *editable* mode unless it has a `setup.py` file (which we don't have and don't want). Therefore, a wheel needs to be built (e.g. using [`poetry`][poetry]) and installed (every time) into the corresponding virtualenv when performing the -tests. Assuming you're having a working _poetry_ setup on your machine, you can +tests. Assuming you're having a working *poetry* setup on your machine, you can simply use the provided `scripts/py2-pytest.sh` wrapper that will create the virtualenv, build and install the `imcflibs` wheel and launch `pytest` with the parameters specified, e.g. @@ -68,7 +68,7 @@ Unfortunately there is nothing like `pytest` available for the parts that are running exclusively in a ImageJ2 / Fiji context. So in order to provide at least some basic, semi-interactive tests the following conventions are being used: -* Each _**function**_ in any of the `imcflibs.imagej` submodules should have its +* Each ***function*** in any of the `imcflibs.imagej` submodules should have its own directory underneath `/tests/interactive-imagej/`, using their fully qualified name as the path (only skipping the `imcflibs.` prefix). For example test scripts for `imcflibs.imagej.bioformats.import_image()` will be placed in @@ -76,27 +76,27 @@ some basic, semi-interactive tests the following conventions are being used: * The scripts inside those directories are intended to be run interactively / manually in a (freshly started) Fiji instance. Yes, really. Any other suggestions are highly welcome! -* To facilitate this, a collection of _test images_ (and possibly other input +* To facilitate this, a collection of *test images* (and possibly other input data) should be cloned to the local file system. Currently this `sample-data` - repository is _NOT_ publicly available due to legal βš– uncertainties. A repo + repository is *NOT* publicly available due to legal βš– uncertainties. A repo containing test data πŸ—ž that can be published should be assembled over time though! -* Any _interactive_ test script should start with a header similar to the one - described below. Paths to input data _inside_ the test scripts **has** to be +* Any *interactive* test script should start with a header similar to the one + described below. Paths to input data *inside* the test scripts **has** to be relative to the location of the `sample-data` repository mentioned above. This will allow for a fairly okayish testing workflow like this: * Make your changes in VS Code, then trigger a build by pressing `Shift` + - `Ctrl` + `B`. If things are configured as described in the _DEVELOPMENT_ + `Ctrl` + `B`. If things are configured as described in the *DEVELOPMENT* document, the resulting `.jar` file will be automatically placed in Fiji's `jars/` folder. * Next, start a fresh instance of the Fiji that received the newly built JAR. * After Fiji has started, simply drag and drop the desired test script onto - the main window. This will open the _Script Editor_, then press `Ctrl` + `R` + the main window. This will open the *Script Editor*, then press `Ctrl` + `R` to launch the script. * Only on the first run on the machine being used you will have to select the base location of the `sample-data` repository. - * All subsequent runs of _**any**_ test script using the defined _Script - Parameter_ `IMCF_TESTDATA` will remember this selection, so it will be + * All subsequent runs of ***any*** test script using the defined *Script + Parameter* `IMCF_TESTDATA` will remember this selection, so it will be sufficient to just confirm the dialog by pressing `Enter`. ### Quick Workflow Summary diff --git a/poetry.lock.md b/poetry.lock.md index 2eefdcfa..6bc2a1c5 100644 --- a/poetry.lock.md +++ b/poetry.lock.md @@ -1,4 +1,4 @@ -## Updating `poetry.lock` πŸŽ­πŸ” +# Updating `poetry.lock` πŸŽ­πŸ” Every time dependencies in `pyproject.toml` have been modified (e.g. when pulling in a newer version of the [`imcf-fiji-mocks`][1] package), [Poetry's From 24bf189906809f09f9e34500023679cbfd953c09 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter Date: Wed, 9 Apr 2025 13:17:41 +0200 Subject: [PATCH 09/14] Update author mail address --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 31da3a7b..cc2969d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,8 +3,7 @@ authors = [ "Niko Ehrenfeuchter ", "Laurent Guerard ", "Kai Schleicher ", - "SΓ©bastien Herbert ", - "Rohan Girish ", + "Rohan Girish ", ] description = "Mostly ImageJ/Fiji-related Python helper functions." documentation = "https://imcf.one/apidocs/imcflibs/imcflibs.html" From f9b6e9909894a994a0876f1ba37ed5ef46e61e1a Mon Sep 17 00:00:00 2001 From: "kai.schleicher@unibas.ch" Date: Wed, 9 Apr 2025 13:21:03 +0200 Subject: [PATCH 10/14] Add explanation to iteration and count options --- src/imcflibs/imagej/prefs.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/imcflibs/imagej/prefs.py b/src/imcflibs/imagej/prefs.py index 5162e89d..dbdc4531 100644 --- a/src/imcflibs/imagej/prefs.py +++ b/src/imcflibs/imagej/prefs.py @@ -37,6 +37,11 @@ def set_default_ij_options(): # Set foreground color to be white and background black IJ.run("Colors...", "foreground=white background=black selection=red") + # Set iterations and count to 1 + # - Iterations: number of times erosion (dilation, opening, closing) is performed + # - Count: number of adjacent background pixels necessary before a pixel is removed + # from the edge of an object during erosion and the number of adjacent foreground + # pixels necessary before a pixel is added to the edge of an object during dilation. # Set black background for binary images and set pad edges to true to prevent eroding from image edge IJ.run("Options...", "iterations=1 count=1 black pad") From 62fc98c8ca2451e4c1cd9b85bc91f75074c2391d Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter Date: Wed, 9 Apr 2025 13:26:44 +0200 Subject: [PATCH 11/14] Have ruff config a bit more compact --- pyproject.toml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index cc2969d6..c722202b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,22 +40,17 @@ exclude = [ ] select = [ - "D", - # summary lines have to be placed on the first physical line of the docstring - "D212", - # imperative mood for all docstrings - "D401", - # summary line has to end in a punctuation mark - "D415", - # require documentation for _all_ function parameters - "D417", + "D", # enable "pydocstyle" rules + "D212", # summary lines must be on the first physical line of the docstring + "D401", # imperative mood for all docstrings + "D415", # summary line has to end in a punctuation mark + "D417", # require documentation for *all* function parameters + ] ignore = [ - # no blank lines allowed after function docstring - "D202", + "D202", # no blank lines allowed after function docstring ] - [tool.ruff.lint.pydocstyle] convention = "numpy" \ No newline at end of file From 52dc3134619051fab35b9e15b5625201126a7898 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter Date: Wed, 9 Apr 2025 13:45:09 +0200 Subject: [PATCH 12/14] Have consistent indenting --- .github/workflows/pytest-poetry.yml | 6 +++--- .github/workflows/pytest-python2.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pytest-poetry.yml b/.github/workflows/pytest-poetry.yml index 93049871..4e0b72ad 100644 --- a/.github/workflows/pytest-poetry.yml +++ b/.github/workflows/pytest-poetry.yml @@ -5,15 +5,15 @@ name: Pytest-Poetry πŸ§ͺ🎭 on: push: branches: - - master + - master tags: - run-pytest* - py3-pytest* - "*-[0-9]+.*" pull_request: branches: - - master - - devel + - master + - devel jobs: pytest-poetry: diff --git a/.github/workflows/pytest-python2.yml b/.github/workflows/pytest-python2.yml index f0856cc6..fc95a100 100644 --- a/.github/workflows/pytest-python2.yml +++ b/.github/workflows/pytest-python2.yml @@ -3,15 +3,15 @@ name: Pytest-Python2 πŸ§ͺ🐍 on: push: branches: - - master + - master tags: - run-pytest* - py2-pytest* - "*-[0-9]+.*" pull_request: branches: - - master - - devel + - master + - devel env: PY_VERSION: 2.7.18 From 8abb42d0276c0f7649965b2209d789f0ca52f731 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter Date: Wed, 9 Apr 2025 13:44:54 +0200 Subject: [PATCH 13/14] Add "workflow_dispatch" trigger, cleanup tag triggers --- .github/workflows/pytest-poetry.yml | 3 +-- .github/workflows/pytest-python2.yml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pytest-poetry.yml b/.github/workflows/pytest-poetry.yml index 4e0b72ad..2f97b48c 100644 --- a/.github/workflows/pytest-poetry.yml +++ b/.github/workflows/pytest-poetry.yml @@ -3,12 +3,11 @@ name: Pytest-Poetry πŸ§ͺ🎭 on: + workflow_dispatch: push: branches: - master tags: - - run-pytest* - - py3-pytest* - "*-[0-9]+.*" pull_request: branches: diff --git a/.github/workflows/pytest-python2.yml b/.github/workflows/pytest-python2.yml index fc95a100..8c984850 100644 --- a/.github/workflows/pytest-python2.yml +++ b/.github/workflows/pytest-python2.yml @@ -1,12 +1,11 @@ name: Pytest-Python2 πŸ§ͺ🐍 on: + workflow_dispatch: push: branches: - master tags: - - run-pytest* - - py2-pytest* - "*-[0-9]+.*" pull_request: branches: From d9bed2b9100fb89becbb239846b9a64fbd37e5e9 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter Date: Wed, 9 Apr 2025 14:40:26 +0200 Subject: [PATCH 14/14] Add references to the ImageJ User Guide Refers to #82 --- src/imcflibs/imagej/prefs.py | 51 ++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 11 deletions(-) diff --git a/src/imcflibs/imagej/prefs.py b/src/imcflibs/imagej/prefs.py index dbdc4531..a976f03e 100644 --- a/src/imcflibs/imagej/prefs.py +++ b/src/imcflibs/imagej/prefs.py @@ -23,12 +23,35 @@ def debug_mode(): def set_default_ij_options(): """Configure ImageJ default options for consistency. - Set the following options: - - Ensure ImageJ appearance settings are default values. + Will set the following options to ensure consistent behaviour independent of + how ImageJ is configured on a specific machine. + + - Ensure ImageJ appearance settings are the default values. - Set foreground color to white and background to black. - - Set black background for binary images. - Set default file saving format to .txt files. - - Ensure images are scaled appropriately when converting between different bit depths. + - Ensure intensities are being scaled when converting between bit depths. + - Options on binary images: + - Set background to black. + - Enable padding to prevent eroding from image edges. + - Enforce defaults on iterations and count for *erosion*, *dilation*, + *opening* and *closing* operations. + + References + ---------- + The ImageJ User Guide is providing detailed explanations of the options + configured by this function: + + - [Edit > Options > Appearance][ijo_app] + - [Edit > Options > Colors][ijo_col] + - [Edit > Options > Conversions][ijo_cnv] + - [Edit > Options > Input/Output][ijo_i_o] + - [Process > Binary > Options][ijo_bin] + + [ijo_app]: https://imagej.net/ij/docs/guide/146-27.html#sub:Appearance... + [ijo_cnv]: https://imagej.net/ij/docs/guide/146-27.html#sub:Conversions... + [ijo_col]: https://imagej.net/ij/docs/guide/146-27.html#sub:Colors... + [ijo_i_o]: https://imagej.net/ij/docs/guide/146-27.html#sub:Input/Output... + [ijo_bin]: https://imagej.net/ij/docs/guide/146-29.html#sub:BinaryOptions... """ # Set all appearance settings to default values (untick all options) @@ -37,16 +60,22 @@ def set_default_ij_options(): # Set foreground color to be white and background black IJ.run("Colors...", "foreground=white background=black selection=red") - # Set iterations and count to 1 - # - Iterations: number of times erosion (dilation, opening, closing) is performed - # - Count: number of adjacent background pixels necessary before a pixel is removed - # from the edge of an object during erosion and the number of adjacent foreground - # pixels necessary before a pixel is added to the edge of an object during dilation. - # Set black background for binary images and set pad edges to true to prevent eroding from image edge + # Options regarding binary images: + # - `black`: set background for binary images to be black. + # - `pad`: enable padding of edges to prevent eroding from image edge. + # - `iterations=1`: number of times erosion (dilation, opening, closing) is + # performed + # - `count=1`: number of adjacent background pixels necessary before a pixel + # is removed from the edge of an object during erosion and the number of + # adjacent foreground pixels necessary before a pixel is added to the edge + # of an object during dilation. + # https://imagej.net/ij/docs/menus/process.html#options + # https://imagej.net/ij/docs/guide/146-29.html#sub:BinaryOptions... IJ.run("Options...", "iterations=1 count=1 black pad") # Set default saving format to .txt files IJ.run("Input/Output...", "file=.txt save_column save_row") - # Scale when converting = checked + # Enable "scale when converting". + # https://imagej.net/ij/docs/menus/edit.html#options IJ.run("Conversions...", "scale")