Skip to content

unify json atlases, CLI segreg changes and CLI segcentroids new#11

Merged
m-reuter merged 3 commits intomainfrom
segreg-mni
Apr 29, 2026
Merged

unify json atlases, CLI segreg changes and CLI segcentroids new#11
m-reuter merged 3 commits intomainfrom
segreg-mni

Conversation

@m-reuter
Copy link
Copy Markdown
Member

  • Redesigned segreg into an LTA-focused centroid-registration CLI using --seg plus exactly one of --target-seg, --centroids, or --flipped as target.
  • --centroids can either be path to a centroid JSON file or name of a provided atlas (fsaverage and min_icbm... see below).
  • Switched centroids files to a single richer JSON format with required centroids and optional embedded geometry.
  • Added new segcentroids CLI for writing centroid target JSON files from segmentations.
  • Unified bundled targets onto that format and exposed both fsaverage and mni_icbm152_t1_tal_nlin_asym_09c.
  • Added segcentroids --input ... --geometry ... mode to add or replace geometry in an existing target JSON without recomputing centroids.
  • Updated tests and docs/README to cover the new CLI and target-file workflow.
  • Validated with Ruff and the full pytest suite.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 redesigns segmentation-centroid registration workflows by standardizing centroid-target JSON files, updating the segreg CLI/API to focus on LTA output, and adding a dedicated segcentroids CLI for generating/editing centroid-target JSON files.

Changes:

  • Unified bundled targets into a single “target JSON” format (required centroids + optional embedded geometry) and added an MNI centroid target alongside fsaverage.
  • Refactored segreg API/CLI to use --seg plus exactly one of --target-seg, --centroids, or --flipped, and to always write an LTA.
  • Added segcentroids CLI and updated tests/docs to cover the new target-file workflow.

Reviewed changes

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

Show a summary per file
File Description
tests/test_segreg.py Updates/extends tests for new target JSON format, new bundled targets, new segreg CLI contract, and new segcentroids CLI.
pyproject.toml Registers the new segcentroids console script.
neuroreg/segreg/register.py Refactors registration entrypoints to target-seg vs centroid-target sources and adds export_segmentation_target.
neuroreg/segreg/labels.py Renames the label preset literal from fsaverage_centroids to target_centroids.
neuroreg/segreg/io.py Introduces rich target JSON read/write with optional geometry + legacy centroid-only compatibility.
neuroreg/segreg/data/mni_icbm152_t1_tal_nlin_asym_09c.json Adds bundled MNI centroid target (centroids-only, no geometry).
neuroreg/segreg/data/fsaverage_data.json Removes old standalone fsaverage geometry resource (superseded by unified target JSON).
neuroreg/segreg/data/fsaverage_centroids.json Removes old standalone fsaverage centroids resource (superseded by unified target JSON).
neuroreg/segreg/data/fsaverage.json Adds unified fsaverage target JSON with centroids + embedded geometry.
neuroreg/segreg/atlas.py Reworks atlas helpers to load unified target JSON bundles and expose load_atlas_target.
neuroreg/cli/segreg.py Updates CLI args/behavior to new target selection model and LTA-only output.
neuroreg/cli/segcentroids.py New CLI to generate/edit centroid target JSON files and optionally embed/replace geometry.
neuroreg/cli/__init__.py Documents the new CLI entrypoint.
doc/api/segreg.rst Updates API docs to match refactors (removes old exports, adds new one).
README.md Updates user-facing CLI documentation and adds segcentroids section.
Comments suppressed due to low confidence (1)

tests/test_segreg.py:537

  • The indentation inside this @pytest.mark.parametrize payload is over-indented (e.g., the 7, line). This is likely to trip Ruff/pycodestyle continuation-indentation rules (E12x) and makes the parameter table harder to read. Reformat the tuples so the values align with the surrounding parentheses indentation.
    [
        (
                7,
                np.array(
                    [

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

Comment thread neuroreg/segreg/io.py Outdated
Comment thread neuroreg/cli/segcentroids.py Outdated
Comment thread neuroreg/segreg/register.py Outdated
@m-reuter m-reuter merged commit 4b7b9f6 into main Apr 29, 2026
26 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