Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Bug report
description: Something crashes or gives an error.
labels: [bug]
body:
- type: textarea
id: what
attributes:
label: What happened
description: What did you run, and what did you expect instead?
validations: {required: true}
- type: textarea
id: output
attributes:
label: Full error output
render: shell
validations: {required: true}
- type: textarea
id: info
attributes:
label: Output of `subcellseg info`
render: shell
validations: {required: true}
- type: input
id: image
attributes:
label: Image format and size
placeholder: "OME-TIFF, 3 channels, 60 x 1024 x 1024"
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Usage question
url: https://github.com/AllenCell/SubCellSeg/discussions
about: Ask how to do something, or share what you made.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Feature request
description: Suggest an improvement or a new capability.
labels: [enhancement]
body:
- type: textarea
id: problem
attributes:
label: What are you trying to do?
validations: {required: true}
- type: textarea
id: proposal
attributes:
label: What would you like SubCellSeg to do?
- type: textarea
id: alternatives
attributes:
label: What do you do today instead?
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/segmentation_quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Segmentation looks wrong
description: The command runs, but the mask misses or over-segments the structure.
labels: [segmentation-quality]
body:
- type: input
id: structure
attributes:
label: Which structure is tagged, and with what?
placeholder: "Golgi, sialyltransferase-1 (ST6GAL1) tagged with mEGFP"
validations: {required: true}
- type: textarea
id: what
attributes:
label: What is wrong with the mask
description: Missed regions, extra regions, blobs merged, too thin, too thick?
validations: {required: true}
- type: textarea
id: pictures
attributes:
label: Screenshots
description: One z-slice of the raw image next to the mask. Drag images here.
validations: {required: true}
- type: input
id: sample
attributes:
label: Link to an example image (if you can share one)
description: A public URL or a small cropped stack lets us reproduce it.
- type: textarea
id: command
attributes:
label: Command you ran, and `subcellseg info`
render: shell
validations: {required: true}
- type: input
id: microscope
attributes:
label: Microscope and voxel size
placeholder: "Zeiss spinning disk, 100x, 0.108 x 0.108 x 0.29 um"
15 changes: 15 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## What changed

## Why

## How it was tested

<!-- pytest? which OS? For anything that can change segmentation output, paste
the before/after table from tools/benchmark/bench_predict.sh. -->

## Checklist

- [ ] Tests pass locally (`pytest`)
- [ ] Docs updated if behaviour or commands changed
- [ ] `CHANGELOG.md` has an entry under *Unreleased* (if a user would notice)
- [ ] No weights, outputs or notebook outputs committed
44 changes: 44 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,21 @@ on:
push:
branches: [main]
pull_request:
schedule:
- cron: "17 6 * * 1" # Mondays: catches breakage from new dependency releases
workflow_dispatch:

jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v3
with:
version: "0.17.4"
- run: ruff format --check .

test:
name: ${{ matrix.os }} / Python ${{ matrix.python }}
runs-on: ${{ matrix.os }}
Expand All @@ -30,3 +43,34 @@ jobs:
run: subcellseg info
- name: Run tests
run: pytest -q

# Runs the quickstart notebook end to end on the CPU. It downloads the
# weights and a public image, so it only runs on the weekly schedule and on
# demand, not on every pull request.
notebook:
name: quickstart notebook
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install
run: |
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install -e ".[zarr,notebook]" nbconvert ipykernel
- name: Execute
run: jupyter nbconvert --to notebook --execute examples/quickstart.ipynb --output /tmp/out.ipynb

# Single check to require in branch protection.
ok:
name: all checks passed
if: always()
needs: [lint, test]
runs-on: ubuntu-latest
steps:
- run: |
echo "lint: ${{ needs.lint.result }} test: ${{ needs.test.result }}"
test "${{ needs.lint.result }}" = success && test "${{ needs.test.result }}" = success
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-added-large-files
args: ["--maxkb=500"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.17.4
hooks:
- id: ruff-check
args: ["--fix"]
- id: ruff-format
- repo: https://github.com/kynan/nbstripout
rev: 0.9.1
hooks:
- id: nbstripout
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

All notable changes to SubCellSeg are listed here. The format follows
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## Unreleased

### Added
- Benchmarks section in the README and `tools/benchmark/` scripts.
- Contributing guide, code of conduct, security policy, citation file,
issue and pull request templates.
- ruff formatting and linting, pre-commit hooks, lint job in CI.

## 0.1.0 - 2026-11-05

First public release: pretrained model, `subcellseg predict`, `train`,
`finetune` and `make-csv` commands, Python API, quickstart notebook.
14 changes: 14 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cff-version: 1.2.0
message: "If you use SubCellSeg, please cite the paper below."
type: software
title: "SubCellSeg"
version: 0.1.0
date-released: 2026-11-08
license: BSD-3-Clause
repository-code: "https://github.com/AllenCell/SubCellSeg"
authors:
- name: "Allen Institute for Cell Science"
city: Seattle
country: US
# RELEASE TODO: add the individual authors and the preferred-citation block
# (journal, DOI) once the paper is out.
84 changes: 84 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@

# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.

Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at <!-- RELEASE TODO: add a monitored address -->. All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of actions.

**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
71 changes: 71 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Contributing to SubCellSeg

Thank you for helping. Bug reports, documentation fixes and new features are
all welcome. This page explains how we work so that your contribution lands
quickly.

## Reporting a problem

Open an [issue](https://github.com/AllenCell/SubCellSeg/issues/new/choose) and
pick the matching template. For a segmentation that looks wrong, the template
asks for the output of `subcellseg info`, the structure that is tagged, and an
example image or screenshot. Without those we usually cannot reproduce it.

Usage questions go to [Discussions](https://github.com/AllenCell/SubCellSeg/discussions).

## Setting up for development

```bash
git clone https://github.com/AllenCell/SubCellSeg
cd SubCellSeg
uv venv --python 3.12
uv pip install --python .venv --torch-backend auto -e ".[dev,zarr]"
source .venv/bin/activate # Windows: .venv\Scripts\activate
pre-commit install
pytest
```

`pre-commit install` sets up the hooks that format code with ruff and strip
notebook outputs before each commit. Run `pre-commit run --all-files` to apply
them to everything at once.

## Branches, commits and pull requests

- `main` is protected. All changes, including documentation, go through a pull
request and must pass the `tests` workflow (Linux and Windows, Python 3.10
and 3.12) and the lint job.
- Branch from `main` and name the branch by purpose: `fix/windows-spawn`,
`docs/colab-badge`, `feat/nd2-reader`. Contributors from outside the
organisation work from a fork.
- Commit messages: a short imperative summary line (under 72 characters) and,
when the reason is not obvious from the diff, a body that explains why.
- Pull requests are squash-merged, so one PR becomes one commit on `main`.
Keep each PR to one topic. The PR template asks what changed, why, and how
it was tested.
- One approving review is required. Maintainers may merge small documentation
fixes themselves once CI is green.
- A change that can alter segmentation output (model code, pre- or
post-processing, default parameters) must include before-and-after numbers
from `tools/benchmark/bench_predict.sh` on the three variance images listed
in the README, so reviewers can see the effect.
- Add a line to `CHANGELOG.md` under *Unreleased* for anything a user would
notice.

## What not to commit

Model weights, checkpoints, output folders and notebook outputs. The
`.gitignore` and the `check-added-large-files` hook (500 kB) catch most of
these. Weights are distributed as GitHub release assets, never in git.

## Releases

Releases are tagged `vX.Y.Z` from `main`. The release PR bumps the version in
`pyproject.toml`, moves the *Unreleased* section of the changelog under the new
version, and updates the install URL in the README. Model weights have their
own tag series (`weights-v1`, `weights-v2`, ...). A weights asset is never
replaced in place: new weights get a new tag and a package release that pins
the new SHA256.

## Code of conduct

This project follows the [Contributor Covenant](CODE_OF_CONDUCT.md). Be kind.
Loading
Loading