Skip to content

Update to 1.6 - #30

Merged
kostrykin merged 54 commits into
masterfrom
develop
Apr 1, 2026
Merged

Update to 1.6#30
kostrykin merged 54 commits into
masterfrom
develop

Conversation

@kostrykin

@kostrykin kostrykin commented Mar 27, 2026

Copy link
Copy Markdown
Member

After merging, also the requirements in https://github.com/bioconda/bioconda-recipes/blob/master/recipes/segmetrics/meta.yaml need to be updated.

kostrykin and others added 30 commits January 16, 2025 15:18
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
…eckout-5

Bump actions/checkout from 4 to 5
…tup-python-6

Bump actions/setup-python from 5 to 6
* Refactor SEG gauge test

* Employ `ISBI_EVALUATION_SOFTWARE_PASSWORD` in CI

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Update .github/workflows/testsuite.yml

* Trigger CI

* Add `delta=1e-5`

* Update .github/workflows/testsuite.yml

Co-authored-by: Copilot <[email protected]>

* Revert "Update .github/workflows/testsuite.yml"

This reverts commit 79a3a65.

---------

Co-authored-by: Copilot <[email protected]>
* Remove tests/isbi_seg.py

* Add `AggregatedJaccardCoefficient` measure

* Fix flake8 linting

* Add `MeasureProtocol.postprocess` and `AggregatedJaccardCoefficient`

* Add `AJCTest`

* Add `AJC` column to expected test output

* Update docstring

* Revert "Remove tests/isbi_seg.py"

This reverts commit f3bc5fb.

* Rename `nominator` to `numerator`

* Add `AJCTest.test__postprocess__empty` and fix

* Update docstring

* Fix `AJCTest.test__multiple_images`
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Apr 1, 2026

Copy link
Copy Markdown

Test coverage of 94a3317: 88%

@kostrykin
kostrykin marked this pull request as ready for review April 1, 2026 13:23
@kostrykin
kostrykin requested a review from Copilot April 1, 2026 13:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the segmetrics package to version 1.6, adds the Aggregated Jaccard Coefficient (AJC) measure, and modernizes packaging/CLI/docs while adjusting the test suite (including removing network download of ISBI evaluation software).

Changes:

  • Add AggregatedJaccardCoefficient measure with new postprocessing support in the measure/study pipeline.
  • Replace the old CLI entrypoint (segmetrics.cli) with a python -m segmetrics module CLI and update docs/tests accordingly.
  • Modernize packaging/versioning (setuptools, __version__, python_requires, install_requires) and update CI/docs configs.

Reviewed changes

Copilot reviewed 20 out of 22 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/testsuite.py Adds AJC coverage, updates CLI invocation, and adjusts dataframe comparison logic + ISBI SEG test gating.
tests/isbi_seg.py Switches ISBI SEG “official” helper to use bundled .7z and a provided password (no network download).
tests/full-study-test.csv Updates golden CSV output to include AJC and rounded numeric formatting.
setup.py Migrates to setuptools, loads version from segmetrics/version.py, adds runtime requirements, sets python_requires.
segmetrics/version.py Introduces canonical __version__ (1.6.0).
segmetrics/study.py Extends result handling to allow intermediate representations and applies postprocess() before aggregation/output.
segmetrics/regional.py Fixes minor naming/docs, and adds AggregatedJaccardCoefficient implementation.
segmetrics/measures.py Adds a centralized measures module with explicit __all__ exports.
segmetrics/measure.py Extends measure protocol to support intermediate outputs via postprocess().
segmetrics/contour.py Switches ndimage import style and uses scipy.ndimage directly for dilation/distance transform.
segmetrics/__main__.py Implements new module CLI (python -m segmetrics) and dynamic measure construction.
segmetrics/__init__.py Refactors exports, adds __version__, preserves VERSION alias for backward compatibility.
README.rst Updates Galaxy link wording and copyright year.
LICENSE Updates copyright year.
docs/source/usage.rst Updates CLI usage examples and help reference to python -m segmetrics.
docs/source/index.rst Removes changelog from the toctree.
docs/source/conf.py Updates project name and copyright year.
docs/source/changelog.rst Removes the changelog page content (file deleted).
.readthedocs.yaml Updates RTD build OS/python and points Sphinx to docs/source/conf.py.
.gitignore Adds .venv and macOS metadata files.
.github/workflows/testsuite.yml Updates action versions, attempts to pass ISBI password into tests, adds setup-install smoke test job.
Comments suppressed due to low confidence (1)

segmetrics/main.py:90

  • The CLI still uses eval(measure_spec, ..., measures_dict) to instantiate measures. Even with restricted globals/locals, this is exploitable because callers can access __globals__ via any provided class (e.g., Dice.__init__.__globals__[...]) and regain __import__/builtins. Please replace eval with a safe parser (e.g., parse the string with ast and only allow Call(Name(...)) with whitelisted class names/kwargs), or implement an explicit mapping from allowed measure names to constructors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/testsuite.py
Comment on lines +58 to +66
def compare_dataframe(test, study_df, expected_csv_filepath, tag=None, precision=3):
study_df = study_df.round(precision)
expected_csv_filepath = pathlib.Path(expected_csv_filepath)
actual_csv_filepath = f'{expected_csv_filepath}-out-{tag}' if tag else f'{expected_csv_filepath}-out'
failure_message = f'Obtained results written to: {actual_csv_filepath}'
try:
test.assertTrue(expected_csv_filepath.is_file(), failure_message)
expected_df = pd.read_csv(str(expected_csv_filepath), sep=',', keep_default_na=False)
test.assertTrue(study_df.round(3).equals(expected_df.round(3)), failure_message)
test.assertTrue(study_df.equals(expected_df), failure_message)

Copilot AI Apr 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compare_dataframe now relies on DataFrame.equals() for float comparisons, which is an exact (bitwise) equality check. This is likely to be flaky across platforms/Python/pandas versions due to float parsing/rounding differences; additionally only study_df is rounded while expected_df is not. Consider using pandas.testing.assert_frame_equal with a tolerance (or round both dataframes before comparing) so the test is robust while still enforcing the intended precision.

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/testsuite.yml
Comment thread tests/isbi_seg.py
@kostrykin
kostrykin merged commit 9b3fa45 into master Apr 1, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants