lavlab-pythomics 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ ../Dockerfile
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "Python 3",
3
+ "build": {
4
+ "dockerfile": "Dockerfile",
5
+ "context": "..",
6
+ "target": "dev",
7
+ },
8
+ "customizations": {
9
+ "vscode": {
10
+ "settings": {
11
+ "terminal.integrated.defaultProfile.linux": "bash",
12
+ "python.defaultInterpreterPath": "/usr/bin/python3",
13
+ "autoDocstring.docstringFormat": "sphinx",
14
+ "[python]": {
15
+ "editor.defaultFormatter": "charliermarsh.ruff",
16
+ "editor.formatOnSave": true,
17
+ "editor.codeActionsOnSave": {
18
+ "source.fixAll.ruff": "explicit",
19
+ "source.organizeImports.ruff": "explicit",
20
+ },
21
+ },
22
+ },
23
+ "extensions": [
24
+ "ms-toolsai.jupyter",
25
+ "ms-python.python",
26
+ "charliermarsh.ruff",
27
+ "ms-python.mypy-type-checker",
28
+ "editorconfig.editorconfig",
29
+ "njpwerner.autodocstring",
30
+ "usernamehw.errorlens",
31
+ "Gruntfuggly.todo-tree",
32
+ "eamodio.gitlens",
33
+ "github.vscode-github-actions",
34
+ ],
35
+ },
36
+ },
37
+ "remoteUser": "vscode",
38
+ }
@@ -0,0 +1,36 @@
1
+ # EditorConfig — https://editorconfig.org
2
+
3
+ root = true
4
+
5
+ [*]
6
+ indent_style = space
7
+ indent_size = 4
8
+ end_of_line = lf
9
+ charset = utf-8
10
+ trim_trailing_whitespace = true
11
+ insert_final_newline = true
12
+
13
+ [*.py]
14
+ indent_size = 4
15
+ max_line_length = 88
16
+
17
+ [*.{yml,yaml}]
18
+ indent_size = 2
19
+
20
+ [*.{json,jsonc}]
21
+ indent_size = 2
22
+
23
+ [*.{toml,cfg,ini}]
24
+ indent_size = 4
25
+
26
+ [*.md]
27
+ trim_trailing_whitespace = false
28
+
29
+ [*.{sh,bash,zsh}]
30
+ indent_size = 2
31
+
32
+ [Makefile]
33
+ indent_style = tab
34
+
35
+ [Dockerfile*]
36
+ indent_size = 4
@@ -0,0 +1,16 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "pip"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+
8
+ - package-ecosystem: "github-actions"
9
+ directory: "/"
10
+ schedule:
11
+ interval: "weekly"
12
+
13
+ - package-ecosystem: "docker"
14
+ directory: "/"
15
+ schedule:
16
+ interval: "weekly"
@@ -0,0 +1,31 @@
1
+ name: Build Wheel using Hatch
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+
9
+ jobs:
10
+ build-wheel:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - name: Set up Python
15
+ uses: actions/setup-python@v4
16
+ with:
17
+ python-version: '3.12'
18
+
19
+ - name: Install build tools
20
+ run: |
21
+ python -m pip install --upgrade pip setuptools wheel
22
+ python -m pip install "virtualenv==20.23.1"
23
+ python -m pip install --upgrade hatch
24
+
25
+ - name: Build wheel with hatch
26
+ run: hatch build
27
+ - name: Upload wheel
28
+ uses: actions/upload-artifact@v4
29
+ with:
30
+ name: wheel
31
+ path: dist/*.whl
@@ -0,0 +1,19 @@
1
+ name: Lint and Format with Ruff
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+ branches:
7
+ - main
8
+
9
+ jobs:
10
+ lint-and-format:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - name: Build Docker image
15
+ run: docker build --target hatch -t shell:hatch .
16
+ - name: Check formatting with Ruff
17
+ run: docker run --rm -e HATCH_ENV=lint -v "${{ github.workspace }}:/app" shell:hatch format-check
18
+ - name: Run Ruff linter
19
+ run: docker run --rm -e HATCH_ENV=lint -v "${{ github.workspace }}:/app" shell:hatch check
@@ -0,0 +1,38 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: write
9
+ id-token: write
10
+
11
+ jobs:
12
+ pypi:
13
+ name: Publish to PyPI
14
+ runs-on: ubuntu-latest
15
+ environment: pypi
16
+ steps:
17
+ - name: Checkout
18
+ uses: actions/checkout@v4
19
+
20
+ - name: Build Docker image (hatch stage)
21
+ uses: docker/build-push-action@v4
22
+ with:
23
+ context: .
24
+ file: ./Dockerfile
25
+ target: hatch
26
+ tags: shell-ci:latest
27
+
28
+ - name: Build wheel and sdist inside Docker
29
+ run: |
30
+ docker run --rm \
31
+ -v "${{ github.workspace }}:/app" \
32
+ -w /app \
33
+ shell-ci:latest build
34
+
35
+ - name: Publish to PyPI
36
+ uses: pypa/gh-action-pypi-publish@release/v1
37
+ with:
38
+ packages-dir: dist/
@@ -0,0 +1,37 @@
1
+ name: Run Pytest and Codecov with Hatch
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+
13
+ - name: Set up Python
14
+ uses: actions/setup-python@v4
15
+ with:
16
+ python-version: '3.12'
17
+
18
+ - name: Install test dependencies
19
+ run: |
20
+ python -m pip install --upgrade pip
21
+ python -m pip install ".[test]"
22
+
23
+ - name: Run pytest and generate coverage report
24
+ run: |
25
+ pytest --cov=src --cov-report=xml:coverage.xml
26
+
27
+ - name: Upload coverage artifact
28
+ uses: actions/upload-artifact@v4
29
+ with:
30
+ name: coverage-xml
31
+ path: ${{ github.workspace }}/coverage.xml
32
+
33
+ - name: Upload coverage reports to Codecov
34
+ uses: codecov/codecov-action@v5
35
+ with:
36
+ token: ${{ secrets.CODECOV_TOKEN }}
37
+ slug: laviolette-lab/taps
@@ -0,0 +1,84 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Distribution / packaging
7
+ dist/
8
+ build/
9
+ *.egg-info/
10
+ *.egg
11
+ *.whl
12
+ sdist/
13
+
14
+ # Virtual environments
15
+ .venv/
16
+ venv/
17
+ ENV/
18
+ env/
19
+
20
+ # Hatch
21
+ .hatch/
22
+
23
+ # IDE / Editor
24
+ .vscode/
25
+ .idea/
26
+ *.swp
27
+ *.swo
28
+ *~
29
+ .project
30
+ .settings/
31
+
32
+ # OS files
33
+ .DS_Store
34
+ Thumbs.db
35
+
36
+ # Testing / Coverage
37
+ htmlcov/
38
+ .coverage
39
+ .coverage.*
40
+ coverage.xml
41
+ *.cover
42
+ .pytest_cache/
43
+ .mypy_cache/
44
+
45
+ # Documentation builds
46
+ site/
47
+
48
+ # Jupyter Notebooks
49
+ .ipynb_checkpoints/
50
+ <<<<<<< HEAD
51
+ *.jp2
52
+ outputs
53
+ dist
54
+ =======
55
+
56
+ # Ruff
57
+ .ruff_cache/
58
+
59
+ # Environment variables
60
+ .env
61
+ .env.*
62
+ !.env.example
63
+
64
+ # Secrets — never commit these
65
+ *.pem
66
+ *.key
67
+
68
+ # Logs
69
+ *.log
70
+
71
+ # Type stubs
72
+ .pytype/
73
+ dmypy.json
74
+
75
+ # Pre-commit
76
+ .pre-commit-cache/
77
+
78
+ # Misc
79
+ *.bak
80
+ *.tmp
81
+ *.ipynb
82
+ !visualize_outputs.ipynb
83
+ /outputs/
84
+ *.jp2
@@ -0,0 +1,27 @@
1
+ # See https://pre-commit.com for more information
2
+ # See https://pre-commit.com/hooks.html for more hooks
3
+ repos:
4
+ - repo: https://github.com/pre-commit/pre-commit-hooks
5
+ rev: v4.6.0
6
+ hooks:
7
+ - id: trailing-whitespace
8
+ - id: end-of-file-fixer
9
+ - id: check-yaml
10
+ - id: check-toml
11
+ - id: check-added-large-files
12
+ - id: check-merge-conflict
13
+ - id: debug-statements
14
+
15
+ - repo: https://github.com/astral-sh/ruff-pre-commit
16
+ rev: v0.4.8
17
+ hooks:
18
+ - id: ruff
19
+ args: [--fix]
20
+ - id: ruff-format
21
+
22
+ - repo: https://github.com/pre-commit/mirrors-mypy
23
+ rev: v1.10.0
24
+ hooks:
25
+ - id: mypy
26
+ additional_dependencies: []
27
+ args: [--ignore-missing-imports]
@@ -0,0 +1,120 @@
1
+ # Contributing
2
+
3
+ Thank you for your interest in contributing! This document provides guidelines for working with this project.
4
+
5
+ ## Development Setup
6
+
7
+ 1. **Clone the repository:**
8
+
9
+ ```console
10
+ git clone https://github.com/laviolette-lab/taps.git
11
+ cd taps
12
+ ```
13
+
14
+ 2. **Install Hatch** (build & environment manager):
15
+
16
+ ```console
17
+ pip install hatch
18
+ ```
19
+
20
+ 3. **Install pre-commit hooks:**
21
+
22
+ ```console
23
+ pip install pre-commit
24
+ pre-commit install
25
+ ```
26
+
27
+ ## Common Tasks
28
+
29
+ All project tasks are managed through [Hatch environments](https://hatch.pypa.io/latest/environment/):
30
+
31
+ | Task | Command |
32
+ |-------------------------|------------------------------|
33
+ | Run tests | `hatch run test:test` |
34
+ | Run tests with coverage | `hatch run test:cov` |
35
+ | Lint code | `hatch run lint:check` |
36
+ | Format code | `hatch run lint:format` |
37
+ | Auto-fix lint issues | `hatch run lint:fix` |
38
+ | Run all lint checks | `hatch run lint:all` |
39
+ | Type check | `hatch run types:check` |
40
+ | Build docs | `hatch run docs:build-docs` |
41
+ | Serve docs locally | `hatch run docs:serve-docs` |
42
+ | Build wheel | `hatch build` |
43
+
44
+ ## Code Style
45
+
46
+ - **Formatter & Linter:** [Ruff](https://docs.astral.sh/ruff/) handles both formatting and linting. Configuration lives in `pyproject.toml` under `[tool.ruff]`.
47
+ - **Line length:** 88 characters (consistent with Black's default).
48
+ - **Docstrings:** Use [Sphinx-style](https://sphinx-rtd-tutorial.readthedocs.io/en/latest/docstrings.html) docstrings (`:param:`, `:type:`, `:return:`, `:rtype:`).
49
+ - **Type hints:** Encouraged. The project includes a `py.typed` marker for PEP 561 compliance.
50
+
51
+ ## Project Architecture
52
+
53
+ This project follows a **library-first** design:
54
+
55
+ 1. **Library modules** (`src/taps/`) contain all business logic as importable functions and classes.
56
+ 2. **CLI** (`src/taps/cli.py`) is a thin wrapper that parses arguments and delegates to library functions.
57
+ 3. **Tests** (`tests/`) import directly from the library — never from the CLI.
58
+
59
+ When adding new functionality:
60
+
61
+ - Write the logic as a function or class in a library module.
62
+ - Add tests that call the function directly.
63
+ - If CLI access is needed, add a subcommand in `cli.py` that wraps the library function.
64
+
65
+ ## Writing Tests
66
+
67
+ - Tests live in `tests/` and use [pytest](https://docs.pytest.org/).
68
+ - Shared fixtures belong in `tests/conftest.py`.
69
+ - Name test files `test_<module>.py` and test functions `test_<behavior>`.
70
+ - Aim for descriptive test names that explain what is being verified.
71
+
72
+ ```python
73
+ def test_resolve_checkpoint_uses_bundled_model_by_default():
74
+ """Verify resolve_checkpoint falls back to the packaged model."""
75
+ assert resolve_checkpoint(None).name == "model_v1.pth"
76
+ ```
77
+
78
+ ## Submitting Changes
79
+
80
+ 1. **Create a branch** from `main`:
81
+
82
+ ```console
83
+ git checkout -b feature/my-change
84
+ ```
85
+
86
+ 2. **Make your changes** and ensure all checks pass:
87
+
88
+ ```console
89
+ hatch run lint:all
90
+ hatch run test:cov
91
+ hatch run types:check
92
+ ```
93
+
94
+ 3. **Commit** with a clear, descriptive message. Pre-commit hooks will run Ruff automatically.
95
+
96
+ 4. **Open a Pull Request** against `main`. The CI pipeline will run linting, tests, and build checks.
97
+
98
+ ## Docker
99
+
100
+ The project includes multi-stage Docker builds:
101
+
102
+ | Target | Purpose |
103
+ |----------|--------------------------------------------|
104
+ | `base` | Base image with source and non-root user |
105
+ | `hatch` | Runs Hatch commands (used in CI) |
106
+ | `dev` | Full development environment |
107
+ | `prod` | Minimal production image with only the wheel installed |
108
+
109
+ ```console
110
+ # Build and run tests via Docker
111
+ docker build --target hatch -t myapp:hatch .
112
+ docker run --rm -e HATCH_ENV=test taps:hatch cov
113
+
114
+ # Build production image
115
+ docker build --target prod -t taps:prod .
116
+ ```
117
+
118
+ ## Questions?
119
+
120
+ Open an issue on GitHub if you have questions or run into problems.
@@ -0,0 +1,39 @@
1
+ ARG PY_VERSION=3.12
2
+
3
+ FROM python:${PY_VERSION}-slim AS base
4
+
5
+ # create non-root user (primarily for devcontainer)
6
+ RUN groupadd --gid 1000 vscode \
7
+ && useradd --uid 1000 --gid 1000 -m vscode
8
+
9
+ WORKDIR /app
10
+
11
+ # install dependencies first for better layer caching
12
+ COPY pyproject.toml README.md LICENSE.txt ./
13
+ COPY src/ src/
14
+
15
+ RUN chown -R vscode:vscode /app
16
+
17
+ FROM base AS hatch
18
+ RUN pip3 install --no-cache-dir hatch
19
+ ENV HATCH_ENV=default
20
+ ENTRYPOINT ["hatch", "run"]
21
+
22
+ FROM base AS dev
23
+ COPY requirements.txt ./
24
+ COPY tests/ tests/
25
+ COPY docs/ docs/
26
+ COPY mkdocs.yml ./
27
+ RUN pip3 install --no-cache-dir hatch \
28
+ && hatch build \
29
+ && pip3 install --no-cache-dir uv \
30
+ && uv pip install --system --no-deps "$(python -c 'import tomllib; print(tomllib.load(open(\"pyproject.toml\", \"rb\"))[\"project\"][\"dependencies\"])')"
31
+ USER vscode
32
+
33
+ FROM base AS prod
34
+ COPY --from=dev /app/dist/*.whl /tmp/
35
+ RUN pip3 install --no-cache-dir /tmp/*.whl \
36
+ && rm -rf /tmp/*.whl
37
+ USER vscode
38
+ HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
39
+ CMD python -c "import taps" || exit 1
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-present barrettMCW <mjbarrett@mcw.edu>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,57 @@
1
+ .DEFAULT_GOAL := help
2
+
3
+ .PHONY: help test cov lint format fix types docs serve-docs build clean install pre-commit
4
+
5
+ help: ## Show this help message
6
+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
7
+ awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
8
+
9
+ install: ## Install the package in development mode with hatch
10
+ pip install hatch
11
+ hatch env create
12
+
13
+ test: ## Run tests
14
+ hatch run test:test
15
+
16
+ cov: ## Run tests with coverage report
17
+ hatch run test:cov
18
+
19
+ lint: ## Run Ruff linter
20
+ hatch run lint:check
21
+
22
+ format: ## Format code with Ruff
23
+ hatch run lint:format
24
+
25
+ fix: ## Auto-fix lint issues and format
26
+ hatch run lint:all
27
+
28
+ types: ## Run mypy type checking
29
+ hatch run types:check
30
+
31
+ docs: ## Build documentation
32
+ hatch run docs:build-docs
33
+
34
+ serve-docs: ## Serve documentation locally
35
+ hatch run docs:serve-docs
36
+
37
+ build: ## Build wheel and sdist
38
+ hatch build
39
+
40
+ clean: ## Remove build artifacts and caches
41
+ rm -rf dist/ build/ site/ htmlcov/
42
+ rm -f coverage.xml .coverage
43
+ find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
44
+ find . -type d -name .pytest_cache -exec rm -rf {} + 2>/dev/null || true
45
+ find . -type d -name .mypy_cache -exec rm -rf {} + 2>/dev/null || true
46
+ find . -type d -name .ruff_cache -exec rm -rf {} + 2>/dev/null || true
47
+ find . -type d -name '*.egg-info' -exec rm -rf {} + 2>/dev/null || true
48
+
49
+ pre-commit: ## Install and run pre-commit hooks
50
+ pre-commit install
51
+ pre-commit run --all-files
52
+
53
+ docker-dev: ## Build and run dev Docker image
54
+ docker build --target dev -t myapp:dev .
55
+
56
+ docker-prod: ## Build production Docker image
57
+ docker build --target prod -t myapp:prod .
@@ -0,0 +1,62 @@
1
+ Metadata-Version: 2.5
2
+ Name: lavlab-pythomics
3
+ Version: 0.1.0
4
+ Summary: Feature extraction from histology label maps
5
+ Project-URL: Documentation, https://github.com/laviolette-lab/pythomics#readme
6
+ Project-URL: Issues, https://github.com/laviolette-lab/pythomics/issues
7
+ Project-URL: Source, https://github.com/laviolette-lab/pythomics
8
+ Author-email: barrettMCW <mjbarrett@mcw.edu>
9
+ License-Expression: MIT
10
+ License-File: LICENSE.txt
11
+ Keywords: feature-extraction,histology,image-analysis
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Python :: Implementation :: CPython
20
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
21
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
22
+ Requires-Python: >=3.10
23
+ Requires-Dist: numpy
24
+ Requires-Dist: pandas
25
+ Requires-Dist: scikit-image
26
+ Requires-Dist: scipy
27
+ Provides-Extra: test
28
+ Requires-Dist: coverage[toml]>=6.2; extra == 'test'
29
+ Requires-Dist: pytest; extra == 'test'
30
+ Requires-Dist: pytest-cov; extra == 'test'
31
+ Provides-Extra: visualization
32
+ Requires-Dist: glymur; extra == 'visualization'
33
+ Requires-Dist: matplotlib; extra == 'visualization'
34
+ Description-Content-Type: text/markdown
35
+
36
+ # Standalone pythomics feature extraction
37
+
38
+ Extract per-object lumen and epithelium measurements and block-summed density maps from an integer label-map image. This folder is self-contained and does not import the repository's model/inference code.
39
+
40
+ ## Install
41
+
42
+ From this directory, install the listed dependencies into your environment:
43
+
44
+ ```bash
45
+ python -m pip install -r requirements.txt
46
+ ```
47
+
48
+ Image readers are provided by scikit-image. Parquet output is deliberately not required; object-level tables are CSV, density arrays are compressed NPZ, and MAT output is optional.
49
+
50
+ ## CLI
51
+
52
+ Run from the repository root:
53
+
54
+ ```bash
55
+ python -m pythomics_standalone path/to/labels.png --output-dir output --save-mat
56
+ ```
57
+
58
+ The default label values are lumen=1, epithelium=2, stroma=4, epithelial-cells=5, stromal-cells=6. Override with `--lumen-label`, `--epithelium-label`, `--stroma-label`, `--epithelial-cells-label`, and `--stromal-cells-label`. `--min-area` sets the minimum connected component size in source pixels (default 16); `--block-size HEIGHT WIDTH` sets density aggregation blocks (default 20 20).
59
+
60
+ Epithelium regions include both epithelium and epithelial-cell pixels. Stroma density includes stromal-cell pixels. Connected components are labeled independently in each tissue mask. Tables contain source-pixel area, circularity (`roundness`), and for epithelium average skeleton thickness and epithelial-cell fraction. Density NPZ arrays are block sums, with edge blocks padded with zeros. The optional MAT file includes densities plus feature maps projected across every source-resolution pixel.
61
+
62
+ Outputs are `<input-stem>_lumen_features.csv`, `<input-stem>_epithelium_features.csv`, and `<input-stem>_densities.npz`; with `--save-mat`, also `<input-stem>_features.mat`.
@@ -0,0 +1,27 @@
1
+ # Standalone pythomics feature extraction
2
+
3
+ Extract per-object lumen and epithelium measurements and block-summed density maps from an integer label-map image. This folder is self-contained and does not import the repository's model/inference code.
4
+
5
+ ## Install
6
+
7
+ From this directory, install the listed dependencies into your environment:
8
+
9
+ ```bash
10
+ python -m pip install -r requirements.txt
11
+ ```
12
+
13
+ Image readers are provided by scikit-image. Parquet output is deliberately not required; object-level tables are CSV, density arrays are compressed NPZ, and MAT output is optional.
14
+
15
+ ## CLI
16
+
17
+ Run from the repository root:
18
+
19
+ ```bash
20
+ python -m pythomics_standalone path/to/labels.png --output-dir output --save-mat
21
+ ```
22
+
23
+ The default label values are lumen=1, epithelium=2, stroma=4, epithelial-cells=5, stromal-cells=6. Override with `--lumen-label`, `--epithelium-label`, `--stroma-label`, `--epithelial-cells-label`, and `--stromal-cells-label`. `--min-area` sets the minimum connected component size in source pixels (default 16); `--block-size HEIGHT WIDTH` sets density aggregation blocks (default 20 20).
24
+
25
+ Epithelium regions include both epithelium and epithelial-cell pixels. Stroma density includes stromal-cell pixels. Connected components are labeled independently in each tissue mask. Tables contain source-pixel area, circularity (`roundness`), and for epithelium average skeleton thickness and epithelial-cell fraction. Density NPZ arrays are block sums, with edge blocks padded with zeros. The optional MAT file includes densities plus feature maps projected across every source-resolution pixel.
26
+
27
+ Outputs are `<input-stem>_lumen_features.csv`, `<input-stem>_epithelium_features.csv`, and `<input-stem>_densities.npz`; with `--save-mat`, also `<input-stem>_features.mat`.
@@ -0,0 +1,9 @@
1
+ # API Reference
2
+
3
+ ## `taps.inference`
4
+
5
+ ::: taps.inference
6
+
7
+ ## `taps.cli`
8
+
9
+ ::: taps.cli