image2image-io 0.1.10__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.
- image2image_io-0.1.10/.gitattributes +2 -0
- image2image_io-0.1.10/.github/ISSUE_TEMPLATE.md +15 -0
- image2image_io-0.1.10/.github/TEST_FAIL_TEMPLATE.md +12 -0
- image2image_io-0.1.10/.github/dependabot.yml +10 -0
- image2image_io-0.1.10/.github/workflows/ci.yml +117 -0
- image2image_io-0.1.10/.github_changelog_generator +6 -0
- image2image_io-0.1.10/.gitignore +119 -0
- image2image_io-0.1.10/.pre-commit-config.yaml +50 -0
- image2image_io-0.1.10/LICENSE +29 -0
- image2image_io-0.1.10/Makefile +32 -0
- image2image_io-0.1.10/PKG-INFO +176 -0
- image2image_io-0.1.10/README.md +122 -0
- image2image_io-0.1.10/misc/writer.py +21 -0
- image2image_io-0.1.10/pyproject.toml +197 -0
- image2image_io-0.1.10/setup.cfg +4 -0
- image2image_io-0.1.10/src/image2image_io/__init__.py +11 -0
- image2image_io-0.1.10/src/image2image_io/_version.py +21 -0
- image2image_io-0.1.10/src/image2image_io/cli/__init__.py +100 -0
- image2image_io-0.1.10/src/image2image_io/cli/_common.py +40 -0
- image2image_io-0.1.10/src/image2image_io/cli/convert.py +90 -0
- image2image_io-0.1.10/src/image2image_io/cli/czi2tiff.py +99 -0
- image2image_io-0.1.10/src/image2image_io/cli/merge.py +99 -0
- image2image_io-0.1.10/src/image2image_io/cli/thumbnail.py +54 -0
- image2image_io-0.1.10/src/image2image_io/cli/transform.py +305 -0
- image2image_io-0.1.10/src/image2image_io/config.py +174 -0
- image2image_io-0.1.10/src/image2image_io/enums.py +51 -0
- image2image_io-0.1.10/src/image2image_io/exceptions.py +6 -0
- image2image_io-0.1.10/src/image2image_io/merge.py +55 -0
- image2image_io-0.1.10/src/image2image_io/models/__init__.py +7 -0
- image2image_io-0.1.10/src/image2image_io/models/base.py +71 -0
- image2image_io-0.1.10/src/image2image_io/models/merge.py +82 -0
- image2image_io-0.1.10/src/image2image_io/models/preprocess.py +50 -0
- image2image_io-0.1.10/src/image2image_io/models/transform.py +223 -0
- image2image_io-0.1.10/src/image2image_io/py.typed +0 -0
- image2image_io-0.1.10/src/image2image_io/readers/__init__.py +806 -0
- image2image_io-0.1.10/src/image2image_io/readers/_base_reader.py +767 -0
- image2image_io-0.1.10/src/image2image_io/readers/_czi.py +351 -0
- image2image_io-0.1.10/src/image2image_io/readers/array_reader.py +45 -0
- image2image_io-0.1.10/src/image2image_io/readers/coordinate_reader.py +195 -0
- image2image_io-0.1.10/src/image2image_io/readers/czi_reader.py +177 -0
- image2image_io-0.1.10/src/image2image_io/readers/geojson_utils.py +600 -0
- image2image_io-0.1.10/src/image2image_io/readers/points_reader.py +122 -0
- image2image_io-0.1.10/src/image2image_io/readers/shapes_reader.py +343 -0
- image2image_io-0.1.10/src/image2image_io/readers/tiff_reader.py +159 -0
- image2image_io-0.1.10/src/image2image_io/readers/tiff_utils.py +112 -0
- image2image_io-0.1.10/src/image2image_io/readers/utilities.py +428 -0
- image2image_io-0.1.10/src/image2image_io/utils/__init__.py +0 -0
- image2image_io-0.1.10/src/image2image_io/utils/_appdirs.py +13 -0
- image2image_io-0.1.10/src/image2image_io/utils/_test.py +110 -0
- image2image_io-0.1.10/src/image2image_io/utils/itk.py +116 -0
- image2image_io-0.1.10/src/image2image_io/utils/lazy.py +66 -0
- image2image_io-0.1.10/src/image2image_io/utils/mask.py +286 -0
- image2image_io-0.1.10/src/image2image_io/utils/utilities.py +264 -0
- image2image_io-0.1.10/src/image2image_io/utils/warp.py +140 -0
- image2image_io-0.1.10/src/image2image_io/wrapper.py +286 -0
- image2image_io-0.1.10/src/image2image_io/writers/__init__.py +628 -0
- image2image_io-0.1.10/src/image2image_io/writers/merge_tiff_writer.py +445 -0
- image2image_io-0.1.10/src/image2image_io/writers/tiff_writer.py +769 -0
- image2image_io-0.1.10/src/image2image_io.egg-info/PKG-INFO +176 -0
- image2image_io-0.1.10/src/image2image_io.egg-info/SOURCES.txt +83 -0
- image2image_io-0.1.10/src/image2image_io.egg-info/dependency_links.txt +1 -0
- image2image_io-0.1.10/src/image2image_io.egg-info/entry_points.txt +2 -0
- image2image_io-0.1.10/src/image2image_io.egg-info/requires.txt +35 -0
- image2image_io-0.1.10/src/image2image_io.egg-info/top_level.txt +1 -0
- image2image_io-0.1.10/tests/_test_data/Example_Continuous.ibd +0 -0
- image2image_io-0.1.10/tests/_test_data/Example_Continuous.icache +0 -0
- image2image_io-0.1.10/tests/_test_data/Example_Continuous.imzML +380 -0
- image2image_io-0.1.10/tests/_test_data/ims2micro-1.png +0 -0
- image2image_io-0.1.10/tests/_test_data/mask_pr1.ome.tiff +0 -0
- image2image_io-0.1.10/tests/_test_data/mask_pr2.npy +0 -0
- image2image_io-0.1.10/tests/_test_data/mask_pr2.ome.tiff +0 -0
- image2image_io-0.1.10/tests/_test_data/multi_polygon.geojson +1 -0
- image2image_io-0.1.10/tests/_test_data/polygons.geojson +1 -0
- image2image_io-0.1.10/tests/_test_data/transform/test-1.ome.tiff +0 -0
- image2image_io-0.1.10/tests/_test_data/transform/test_transform1.i2r.json +237 -0
- image2image_io-0.1.10/tests/_test_data/transform/test_transform2.i2r.json +237 -0
- image2image_io-0.1.10/tests/_test_data/transform/test_transform3.i2r.json +237 -0
- image2image_io-0.1.10/tests/_test_data/transform/test_transform4.i2r.json +237 -0
- image2image_io-0.1.10/tests/_test_data/transform/test_transform5.i2r.json +237 -0
- image2image_io-0.1.10/tests/test_cli.py +38 -0
- image2image_io-0.1.10/tests/test_points_reader.py +14 -0
- image2image_io-0.1.10/tests/test_reader.py +102 -0
- image2image_io-0.1.10/tests/test_shapes_reader.py +20 -0
- image2image_io-0.1.10/tests/test_utilities.py +30 -0
- image2image_io-0.1.10/tests/test_writer.py +235 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
* image2image-io version:
|
|
2
|
+
* Python version:
|
|
3
|
+
* Operating System:
|
|
4
|
+
|
|
5
|
+
### Description
|
|
6
|
+
|
|
7
|
+
Describe what you were trying to get done.
|
|
8
|
+
Tell us what happened, what went wrong, and what you expected to happen.
|
|
9
|
+
|
|
10
|
+
### What I Did
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
Paste the command(s) you ran and the output.
|
|
14
|
+
If there was a crash, please include the traceback here.
|
|
15
|
+
```
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "{{ env.TITLE }}"
|
|
3
|
+
labels: [bug]
|
|
4
|
+
---
|
|
5
|
+
The {{ workflow }} workflow failed on {{ date | date("YYYY-MM-DD HH:mm") }} UTC
|
|
6
|
+
|
|
7
|
+
The most recent failing test was on {{ env.PLATFORM }} py{{ env.PYTHON }}
|
|
8
|
+
with commit: {{ sha }}
|
|
9
|
+
|
|
10
|
+
Full run: https://github.com/{{ repo }}/actions/runs/{{ env.RUN_ID }}
|
|
11
|
+
|
|
12
|
+
(This post will be updated if another test fails, as long as this issue remains open.)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
2
|
+
|
|
3
|
+
version: 2
|
|
4
|
+
updates:
|
|
5
|
+
- package-ecosystem: "github-actions"
|
|
6
|
+
directory: "/"
|
|
7
|
+
schedule:
|
|
8
|
+
interval: "weekly"
|
|
9
|
+
commit-message:
|
|
10
|
+
prefix: "ci(dependabot):"
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
tags:
|
|
8
|
+
- "v*"
|
|
9
|
+
pull_request:
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
schedule:
|
|
12
|
+
- cron: "0 0 * * 0" # every week (for --pre release tests)
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
16
|
+
cancel-in-progress: true
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
check-manifest:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
- run: pipx run check-manifest
|
|
24
|
+
|
|
25
|
+
test:
|
|
26
|
+
uses: pyapp-kit/workflows/.github/workflows/test-pyrepo.yml@v2
|
|
27
|
+
secrets: inherit
|
|
28
|
+
with:
|
|
29
|
+
os: ${{ matrix.os }}
|
|
30
|
+
python-version: ${{ matrix.python-version }}
|
|
31
|
+
pip-install-pre-release: ${{ github.event_name == 'schedule' }}
|
|
32
|
+
report-failures: ${{ github.event_name == 'schedule' }}
|
|
33
|
+
extras: 'test'
|
|
34
|
+
# changing this to "artifact" prevents uploading to codecov here,
|
|
35
|
+
# instead it uploads an artifact with the coverage data
|
|
36
|
+
coverage-upload: artifact
|
|
37
|
+
strategy:
|
|
38
|
+
fail-fast: false
|
|
39
|
+
matrix:
|
|
40
|
+
os: [ubuntu-latest, windows-latest]
|
|
41
|
+
python-version: ["3.10", "3.11", "3.12"]#, "3.13"]
|
|
42
|
+
include:
|
|
43
|
+
- python-version: "3.9"
|
|
44
|
+
os: ubuntu-latest
|
|
45
|
+
- python-version: "3.9"
|
|
46
|
+
os: macos-13
|
|
47
|
+
- python-version: "3.11"
|
|
48
|
+
os: macos-latest
|
|
49
|
+
- python-version: "3.12"
|
|
50
|
+
os: macos-latest
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# now add another job to combine and upload the coverage
|
|
54
|
+
upload_coverage:
|
|
55
|
+
if: always()
|
|
56
|
+
needs: [test]
|
|
57
|
+
uses: pyapp-kit/workflows/.github/workflows/upload-coverage.yml@v2
|
|
58
|
+
secrets:
|
|
59
|
+
codecov_token: ${{ secrets.CODECOV_TOKEN }}
|
|
60
|
+
|
|
61
|
+
deploy_test:
|
|
62
|
+
name: Deploy to PyPI (test)
|
|
63
|
+
needs: [check-manifest, test]
|
|
64
|
+
if: success() && startsWith(github.ref, 'refs/tags/') && github.event_name != 'schedule'
|
|
65
|
+
runs-on: ubuntu-latest
|
|
66
|
+
|
|
67
|
+
steps:
|
|
68
|
+
- uses: actions/checkout@v4
|
|
69
|
+
|
|
70
|
+
- name: Set up Python
|
|
71
|
+
uses: actions/setup-python@v5
|
|
72
|
+
with:
|
|
73
|
+
python-version: "3.x"
|
|
74
|
+
|
|
75
|
+
- name: install
|
|
76
|
+
run: |
|
|
77
|
+
pip install -U pip build twine
|
|
78
|
+
python -m build
|
|
79
|
+
twine check dist/*
|
|
80
|
+
|
|
81
|
+
- name: Build and publish
|
|
82
|
+
run: twine upload --repository testpypi dist/*
|
|
83
|
+
env:
|
|
84
|
+
TWINE_USERNAME: __token__
|
|
85
|
+
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
|
|
86
|
+
|
|
87
|
+
deploy:
|
|
88
|
+
name: Deploy
|
|
89
|
+
needs: [check-manifest, test, deploy_test]
|
|
90
|
+
if: success() && startsWith(github.ref, 'refs/tags/') && github.event_name != 'schedule'
|
|
91
|
+
runs-on: ubuntu-latest
|
|
92
|
+
|
|
93
|
+
steps:
|
|
94
|
+
- uses: actions/checkout@v4
|
|
95
|
+
|
|
96
|
+
- name: Set up Python
|
|
97
|
+
uses: actions/setup-python@v5
|
|
98
|
+
with:
|
|
99
|
+
python-version: "3.x"
|
|
100
|
+
|
|
101
|
+
- name: install
|
|
102
|
+
run: |
|
|
103
|
+
git tag
|
|
104
|
+
pip install -U pip build twine
|
|
105
|
+
python -m build
|
|
106
|
+
twine check dist/*
|
|
107
|
+
ls -lh dist
|
|
108
|
+
|
|
109
|
+
- name: Build and publish
|
|
110
|
+
run: twine upload dist/*
|
|
111
|
+
env:
|
|
112
|
+
TWINE_USERNAME: __token__
|
|
113
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
|
114
|
+
|
|
115
|
+
- uses: softprops/action-gh-release@v2
|
|
116
|
+
with:
|
|
117
|
+
generate_release_notes: true
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
user=vandeplaslab
|
|
2
|
+
project=image2image-io
|
|
3
|
+
issues=false
|
|
4
|
+
exclude-labels=duplicate,question,invalid,wontfix,hide
|
|
5
|
+
add-sections={"tests":{"prefix":"**Tests & CI:**","labels":["tests"]}, "documentation":{"prefix":"**Documentation:**", "labels":["documentation"]}}
|
|
6
|
+
exclude-tags-regex=.*rc
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
env/
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
|
|
28
|
+
# PyInstaller
|
|
29
|
+
# Usually these files are written by a python script from a template
|
|
30
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
31
|
+
*.manifest
|
|
32
|
+
*.spec
|
|
33
|
+
|
|
34
|
+
# Installer logs
|
|
35
|
+
pip-log.txt
|
|
36
|
+
pip-delete-this-directory.txt
|
|
37
|
+
|
|
38
|
+
# Unit test / coverage reports
|
|
39
|
+
htmlcov/
|
|
40
|
+
.tox/
|
|
41
|
+
.coverage
|
|
42
|
+
.coverage.*
|
|
43
|
+
.cache
|
|
44
|
+
nosetests.xml
|
|
45
|
+
coverage.xml
|
|
46
|
+
*.cover
|
|
47
|
+
.hypothesis/
|
|
48
|
+
.pytest_cache/
|
|
49
|
+
|
|
50
|
+
# Translations
|
|
51
|
+
*.mo
|
|
52
|
+
*.pot
|
|
53
|
+
|
|
54
|
+
# Django stuff:
|
|
55
|
+
*.log
|
|
56
|
+
local_settings.py
|
|
57
|
+
|
|
58
|
+
# Flask stuff:
|
|
59
|
+
instance/
|
|
60
|
+
.webassets-cache
|
|
61
|
+
|
|
62
|
+
# Scrapy stuff:
|
|
63
|
+
.scrapy
|
|
64
|
+
|
|
65
|
+
# Sphinx documentation
|
|
66
|
+
docs/_build/
|
|
67
|
+
|
|
68
|
+
# PyBuilder
|
|
69
|
+
target/
|
|
70
|
+
|
|
71
|
+
# Jupyter Notebook
|
|
72
|
+
.ipynb_checkpoints
|
|
73
|
+
|
|
74
|
+
# pyenv
|
|
75
|
+
.python-version
|
|
76
|
+
|
|
77
|
+
# celery beat schedule file
|
|
78
|
+
celerybeat-schedule
|
|
79
|
+
|
|
80
|
+
# SageMath parsed files
|
|
81
|
+
*.sage.py
|
|
82
|
+
|
|
83
|
+
# dotenv
|
|
84
|
+
.env
|
|
85
|
+
|
|
86
|
+
# virtualenv
|
|
87
|
+
.venv
|
|
88
|
+
venv/
|
|
89
|
+
ENV/
|
|
90
|
+
|
|
91
|
+
# Spyder project settings
|
|
92
|
+
.spyderproject
|
|
93
|
+
.spyproject
|
|
94
|
+
|
|
95
|
+
# Rope project settings
|
|
96
|
+
.ropeproject
|
|
97
|
+
|
|
98
|
+
# mkdocs documentation
|
|
99
|
+
/site
|
|
100
|
+
|
|
101
|
+
# mypy
|
|
102
|
+
.mypy_cache/
|
|
103
|
+
|
|
104
|
+
# IDE settings
|
|
105
|
+
.vscode/
|
|
106
|
+
|
|
107
|
+
_version.py
|
|
108
|
+
|
|
109
|
+
# nuitka
|
|
110
|
+
*.build/
|
|
111
|
+
|
|
112
|
+
# idea
|
|
113
|
+
*.iml
|
|
114
|
+
.idea/modules.xml
|
|
115
|
+
.idea/misc.xml
|
|
116
|
+
.idea/workspace.xml
|
|
117
|
+
.idea/watcherTasks.xml
|
|
118
|
+
.idea/vcs.xml
|
|
119
|
+
/.idea
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
ci:
|
|
2
|
+
autoupdate_schedule: monthly
|
|
3
|
+
autofix_commit_msg: "style(pre-commit.ci): auto fixes [...]"
|
|
4
|
+
autoupdate_commit_msg: "ci(pre-commit.ci): autoupdate"
|
|
5
|
+
|
|
6
|
+
default_install_hook_types: [pre-commit, commit-msg]
|
|
7
|
+
|
|
8
|
+
repos:
|
|
9
|
+
# - repo: https://github.com/pre-commit/pre-commit-hooks
|
|
10
|
+
# rev: v4.4.0
|
|
11
|
+
# hooks:
|
|
12
|
+
# - id: no-commit-to-branch
|
|
13
|
+
# args: ['--branch', 'master', "--branch", "main"]
|
|
14
|
+
|
|
15
|
+
- repo: https://github.com/MarcoGorelli/absolufy-imports
|
|
16
|
+
rev: v0.3.1
|
|
17
|
+
hooks:
|
|
18
|
+
- id: absolufy-imports
|
|
19
|
+
exclude: _vendor|vendored
|
|
20
|
+
|
|
21
|
+
- repo: https://github.com/hadialqattan/pycln
|
|
22
|
+
rev: v2.1.3
|
|
23
|
+
hooks:
|
|
24
|
+
- id: pycln
|
|
25
|
+
|
|
26
|
+
- repo: https://github.com/abravalheri/validate-pyproject
|
|
27
|
+
rev: v0.12.1
|
|
28
|
+
hooks:
|
|
29
|
+
- id: validate-pyproject
|
|
30
|
+
|
|
31
|
+
- repo: https://github.com/psf/black
|
|
32
|
+
rev: 23.1.0
|
|
33
|
+
hooks:
|
|
34
|
+
- id: black
|
|
35
|
+
pass_filenames: true
|
|
36
|
+
|
|
37
|
+
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
|
38
|
+
rev: v0.0.252
|
|
39
|
+
hooks:
|
|
40
|
+
- id: ruff
|
|
41
|
+
args: [--fix]
|
|
42
|
+
|
|
43
|
+
# - repo: https://github.com/pre-commit/mirrors-mypy
|
|
44
|
+
# rev: v1.0.1
|
|
45
|
+
# hooks:
|
|
46
|
+
# - id: mypy
|
|
47
|
+
# files: "^src/"
|
|
48
|
+
# # # you have to add the things you want to type check against here
|
|
49
|
+
# # additional_dependencies:
|
|
50
|
+
# # - numpy
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023, Lukasz G. Migas
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.PHONY: pre watch dist settings-schema untrack
|
|
2
|
+
|
|
3
|
+
# note: much faster to run mypy as daemon,
|
|
4
|
+
# dmypy run -- ...
|
|
5
|
+
# https://mypy.readthedocs.io/en/stable/mypy_daemon.html
|
|
6
|
+
typecheck:
|
|
7
|
+
tox -e mypy
|
|
8
|
+
|
|
9
|
+
check-manifest:
|
|
10
|
+
pip install -U check-manifest
|
|
11
|
+
check-manifest
|
|
12
|
+
|
|
13
|
+
dist: check-manifest
|
|
14
|
+
pip install -U build
|
|
15
|
+
python -m build
|
|
16
|
+
|
|
17
|
+
pre:
|
|
18
|
+
pre-commit run -a
|
|
19
|
+
|
|
20
|
+
# If the first argument is "watch"...
|
|
21
|
+
ifeq (watch,$(firstword $(MAKECMDGOALS)))
|
|
22
|
+
# use the rest as arguments for "watch"
|
|
23
|
+
WATCH_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
|
|
24
|
+
# ...and turn them into do-nothing targets
|
|
25
|
+
$(eval $(WATCH_ARGS):;@:)
|
|
26
|
+
endif
|
|
27
|
+
|
|
28
|
+
.PHONY: untrack
|
|
29
|
+
untrack:
|
|
30
|
+
git rm -r --cached .
|
|
31
|
+
git add .
|
|
32
|
+
git commit -m ".gitignore fix"
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: image2image-io
|
|
3
|
+
Version: 0.1.10
|
|
4
|
+
Summary: Various image readers
|
|
5
|
+
Author-email: "Lukasz G. Migas" <lukas.migas@yahoo.com>
|
|
6
|
+
License: BSD 3-Clause License
|
|
7
|
+
Project-URL: homepage, https://github.com/vandeplaslab/image2image-io
|
|
8
|
+
Project-URL: repository, https://github.com/vandeplaslab/image2image-io
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
11
|
+
Classifier: Natural Language :: English
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Typing :: Typed
|
|
17
|
+
Requires-Python: >=3.8
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: zarr
|
|
21
|
+
Requires-Dist: h5py
|
|
22
|
+
Requires-Dist: imzy
|
|
23
|
+
Requires-Dist: czifile
|
|
24
|
+
Requires-Dist: tifffile
|
|
25
|
+
Requires-Dist: imagecodecs
|
|
26
|
+
Requires-Dist: aicsimageio[bioformats]
|
|
27
|
+
Requires-Dist: ome_types
|
|
28
|
+
Requires-Dist: rasterio
|
|
29
|
+
Requires-Dist: shapely
|
|
30
|
+
Requires-Dist: pint
|
|
31
|
+
Requires-Dist: pydantic>=2
|
|
32
|
+
Requires-Dist: scikit-image
|
|
33
|
+
Requires-Dist: SimpleITK
|
|
34
|
+
Requires-Dist: opencv-python
|
|
35
|
+
Requires-Dist: dicttoxml
|
|
36
|
+
Requires-Dist: appdirs
|
|
37
|
+
Requires-Dist: geojson
|
|
38
|
+
Requires-Dist: pyarrow
|
|
39
|
+
Requires-Dist: fastparquet
|
|
40
|
+
Requires-Dist: numcodecs<0.16.0
|
|
41
|
+
Provides-Extra: test
|
|
42
|
+
Requires-Dist: pytest>=6.0; extra == "test"
|
|
43
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
44
|
+
Provides-Extra: dev
|
|
45
|
+
Requires-Dist: black; extra == "dev"
|
|
46
|
+
Requires-Dist: ipython; extra == "dev"
|
|
47
|
+
Requires-Dist: mypy; extra == "dev"
|
|
48
|
+
Requires-Dist: pdbpp; extra == "dev"
|
|
49
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
50
|
+
Requires-Dist: rich; extra == "dev"
|
|
51
|
+
Requires-Dist: ruff; extra == "dev"
|
|
52
|
+
Requires-Dist: image2image-io[test]; extra == "dev"
|
|
53
|
+
Dynamic: license-file
|
|
54
|
+
|
|
55
|
+
# image2image-io
|
|
56
|
+
|
|
57
|
+
[](https://github.com/vandeplaslab/image2image-io/raw/main/LICENSE)
|
|
58
|
+
[](https://pypi.org/project/image2image-io)
|
|
59
|
+
[](https://python.org)
|
|
60
|
+
[](https://github.com/vandeplaslab/image2image-io/actions/workflows/ci.yml)
|
|
61
|
+
[](https://codecov.io/gh/vandeplaslab/image2image-io)
|
|
62
|
+
|
|
63
|
+
## Overview
|
|
64
|
+
|
|
65
|
+
This library provides reader/writer interface to several popular image formats. The main goal is to give a unified
|
|
66
|
+
interface to access the image data (e.g. for specific channel or pyramid level).
|
|
67
|
+
|
|
68
|
+
## Getting started
|
|
69
|
+
|
|
70
|
+
Currently supported formats:
|
|
71
|
+
- Standard image formats (.png, .jpg, .jpeg)
|
|
72
|
+
- TIFF (.tif, .tiff, .ome.tiff, .scn, .svs, .ndpi, .qptiff, .qptiff.raw, .qptiff.intermediate)
|
|
73
|
+
- CZI (.czi)
|
|
74
|
+
- Bruker (.tsf, .tdf, .d)
|
|
75
|
+
- ImzML (.imzML, .ibd)
|
|
76
|
+
- HDF5 (.h5, .hdf5) - specific schema required
|
|
77
|
+
- Numpy (.npy, .npz) - expects 2D or 3D numpy array
|
|
78
|
+
- GeoJSON (.geojson) - expects a dictionary with 'type' and 'features' keys (e.g. from QuPath or GeoPandas)
|
|
79
|
+
- Points (.csv, .txt, .parquet) - specific schema required
|
|
80
|
+
|
|
81
|
+
If you want to open an image, you can use the `get_simple_reader` function. This function will automatically detect the
|
|
82
|
+
image format and return the appropriate reader.
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from image2image_io.readers import get_simple_reader
|
|
86
|
+
|
|
87
|
+
# Path to your image
|
|
88
|
+
path_to_image = "path/to/image.ome.tiff"
|
|
89
|
+
|
|
90
|
+
# Get instance of the reader.
|
|
91
|
+
reader = get_simple_reader(
|
|
92
|
+
path_to_image,
|
|
93
|
+
init_pyramid=True # initialize the pyramid upon loading the image
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
# Retrieve the pyramid stack. In this case 'pyramid' is a list of numpy or dask arrays.
|
|
97
|
+
pyramid = reader.pyramid
|
|
98
|
+
|
|
99
|
+
# Retrieve the first channel of the first pyramid level
|
|
100
|
+
channel_first = reader.get_channel(0, 0) # channel_id, pyramid_level
|
|
101
|
+
|
|
102
|
+
# Retrieve the first channel of the last pyramid level
|
|
103
|
+
channel_last = reader.get_channel(0, -1) # channel_id, pyramid_level
|
|
104
|
+
|
|
105
|
+
# Writing to file is relatively easy
|
|
106
|
+
reader.to_ome_tiff(
|
|
107
|
+
'path/to/output.ome.tiff',
|
|
108
|
+
as_uint8=True, # will convert the data to uint8
|
|
109
|
+
tile_size=1024, # tile size for the output image
|
|
110
|
+
channel_ids=[0, 2], # channel ids - specify which channels to write
|
|
111
|
+
channel_names=['Channel 1', 'Channel 3'], # channel names - specify the names of the channels
|
|
112
|
+
)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Writing a numpy array to an OME-TIFF file is also possible:
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
import numpy as np
|
|
119
|
+
from image2image_io.writers import write_ome_tiff_from_array
|
|
120
|
+
|
|
121
|
+
# Create a numpy array
|
|
122
|
+
array = np.random.randint(0, 255, (100, 100, 3), dtype=np.uint8) # RGB image
|
|
123
|
+
|
|
124
|
+
# Write the numpy array to an OME-TIFF file
|
|
125
|
+
write_ome_tiff_from_array(
|
|
126
|
+
"path/to/output.ome.tiff",
|
|
127
|
+
None,
|
|
128
|
+
array,
|
|
129
|
+
tile_size=1024, # tile size for the output image
|
|
130
|
+
channel_names=["R", "G", "B"], # for RGB images, this might now have any effect
|
|
131
|
+
resolution=0.5, # resolution of the image in microns
|
|
132
|
+
)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Merging multiple images is alsy fairly easy to do:
|
|
136
|
+
|
|
137
|
+
```python
|
|
138
|
+
from image2image_io.writers import merge_images
|
|
139
|
+
|
|
140
|
+
# Paths to the images
|
|
141
|
+
paths = ["path/to/image1.ome.tiff", "path/to/image2.ome.tiff"]
|
|
142
|
+
|
|
143
|
+
# Merge the images
|
|
144
|
+
merge_images(
|
|
145
|
+
"output.ome.tiff", # filename
|
|
146
|
+
paths, # list of paths to the images
|
|
147
|
+
output_dir="path/to/output/dir", # output directory for the final image
|
|
148
|
+
tile_size=1024, # tile size for the output image
|
|
149
|
+
metadata={ # metadata for the output image - this specifies which channels to use in the export
|
|
150
|
+
"path/to/image1.ome.tiff": {
|
|
151
|
+
0: {
|
|
152
|
+
"name": "image-1",
|
|
153
|
+
"channel_ids": [0, 2],
|
|
154
|
+
"channel_names": ["Channel 1", "Channel 3"],
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"path/to/image2.ome.tiff": {
|
|
158
|
+
0: {
|
|
159
|
+
"name": "image-2",
|
|
160
|
+
"channel_ids": [0, 1],
|
|
161
|
+
"channel_names": ["Channel 1", "Channel 2"],
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
)
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Contributing
|
|
169
|
+
|
|
170
|
+
Contributions are always welcome. Please feel free to submit PRs with new features, bug fixes, or documentation improvements.
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
git clone https://github.com/vandeplaslab/image2image-io.git
|
|
174
|
+
|
|
175
|
+
pip install -e .[dev]
|
|
176
|
+
```
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# image2image-io
|
|
2
|
+
|
|
3
|
+
[](https://github.com/vandeplaslab/image2image-io/raw/main/LICENSE)
|
|
4
|
+
[](https://pypi.org/project/image2image-io)
|
|
5
|
+
[](https://python.org)
|
|
6
|
+
[](https://github.com/vandeplaslab/image2image-io/actions/workflows/ci.yml)
|
|
7
|
+
[](https://codecov.io/gh/vandeplaslab/image2image-io)
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
This library provides reader/writer interface to several popular image formats. The main goal is to give a unified
|
|
12
|
+
interface to access the image data (e.g. for specific channel or pyramid level).
|
|
13
|
+
|
|
14
|
+
## Getting started
|
|
15
|
+
|
|
16
|
+
Currently supported formats:
|
|
17
|
+
- Standard image formats (.png, .jpg, .jpeg)
|
|
18
|
+
- TIFF (.tif, .tiff, .ome.tiff, .scn, .svs, .ndpi, .qptiff, .qptiff.raw, .qptiff.intermediate)
|
|
19
|
+
- CZI (.czi)
|
|
20
|
+
- Bruker (.tsf, .tdf, .d)
|
|
21
|
+
- ImzML (.imzML, .ibd)
|
|
22
|
+
- HDF5 (.h5, .hdf5) - specific schema required
|
|
23
|
+
- Numpy (.npy, .npz) - expects 2D or 3D numpy array
|
|
24
|
+
- GeoJSON (.geojson) - expects a dictionary with 'type' and 'features' keys (e.g. from QuPath or GeoPandas)
|
|
25
|
+
- Points (.csv, .txt, .parquet) - specific schema required
|
|
26
|
+
|
|
27
|
+
If you want to open an image, you can use the `get_simple_reader` function. This function will automatically detect the
|
|
28
|
+
image format and return the appropriate reader.
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from image2image_io.readers import get_simple_reader
|
|
32
|
+
|
|
33
|
+
# Path to your image
|
|
34
|
+
path_to_image = "path/to/image.ome.tiff"
|
|
35
|
+
|
|
36
|
+
# Get instance of the reader.
|
|
37
|
+
reader = get_simple_reader(
|
|
38
|
+
path_to_image,
|
|
39
|
+
init_pyramid=True # initialize the pyramid upon loading the image
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
# Retrieve the pyramid stack. In this case 'pyramid' is a list of numpy or dask arrays.
|
|
43
|
+
pyramid = reader.pyramid
|
|
44
|
+
|
|
45
|
+
# Retrieve the first channel of the first pyramid level
|
|
46
|
+
channel_first = reader.get_channel(0, 0) # channel_id, pyramid_level
|
|
47
|
+
|
|
48
|
+
# Retrieve the first channel of the last pyramid level
|
|
49
|
+
channel_last = reader.get_channel(0, -1) # channel_id, pyramid_level
|
|
50
|
+
|
|
51
|
+
# Writing to file is relatively easy
|
|
52
|
+
reader.to_ome_tiff(
|
|
53
|
+
'path/to/output.ome.tiff',
|
|
54
|
+
as_uint8=True, # will convert the data to uint8
|
|
55
|
+
tile_size=1024, # tile size for the output image
|
|
56
|
+
channel_ids=[0, 2], # channel ids - specify which channels to write
|
|
57
|
+
channel_names=['Channel 1', 'Channel 3'], # channel names - specify the names of the channels
|
|
58
|
+
)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Writing a numpy array to an OME-TIFF file is also possible:
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
import numpy as np
|
|
65
|
+
from image2image_io.writers import write_ome_tiff_from_array
|
|
66
|
+
|
|
67
|
+
# Create a numpy array
|
|
68
|
+
array = np.random.randint(0, 255, (100, 100, 3), dtype=np.uint8) # RGB image
|
|
69
|
+
|
|
70
|
+
# Write the numpy array to an OME-TIFF file
|
|
71
|
+
write_ome_tiff_from_array(
|
|
72
|
+
"path/to/output.ome.tiff",
|
|
73
|
+
None,
|
|
74
|
+
array,
|
|
75
|
+
tile_size=1024, # tile size for the output image
|
|
76
|
+
channel_names=["R", "G", "B"], # for RGB images, this might now have any effect
|
|
77
|
+
resolution=0.5, # resolution of the image in microns
|
|
78
|
+
)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Merging multiple images is alsy fairly easy to do:
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from image2image_io.writers import merge_images
|
|
85
|
+
|
|
86
|
+
# Paths to the images
|
|
87
|
+
paths = ["path/to/image1.ome.tiff", "path/to/image2.ome.tiff"]
|
|
88
|
+
|
|
89
|
+
# Merge the images
|
|
90
|
+
merge_images(
|
|
91
|
+
"output.ome.tiff", # filename
|
|
92
|
+
paths, # list of paths to the images
|
|
93
|
+
output_dir="path/to/output/dir", # output directory for the final image
|
|
94
|
+
tile_size=1024, # tile size for the output image
|
|
95
|
+
metadata={ # metadata for the output image - this specifies which channels to use in the export
|
|
96
|
+
"path/to/image1.ome.tiff": {
|
|
97
|
+
0: {
|
|
98
|
+
"name": "image-1",
|
|
99
|
+
"channel_ids": [0, 2],
|
|
100
|
+
"channel_names": ["Channel 1", "Channel 3"],
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"path/to/image2.ome.tiff": {
|
|
104
|
+
0: {
|
|
105
|
+
"name": "image-2",
|
|
106
|
+
"channel_ids": [0, 1],
|
|
107
|
+
"channel_names": ["Channel 1", "Channel 2"],
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Contributing
|
|
115
|
+
|
|
116
|
+
Contributions are always welcome. Please feel free to submit PRs with new features, bug fixes, or documentation improvements.
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
git clone https://github.com/vandeplaslab/image2image-io.git
|
|
120
|
+
|
|
121
|
+
pip install -e .[dev]
|
|
122
|
+
```
|