napari-mlarray 0.0.1__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.
- napari_mlarray-0.0.1/.copier-answers.yml +19 -0
- napari_mlarray-0.0.1/.github/ISSUE_TEMPLATE/bug_report.yml +87 -0
- napari_mlarray-0.0.1/.github/ISSUE_TEMPLATE/documentation.md +11 -0
- napari_mlarray-0.0.1/.github/ISSUE_TEMPLATE/feature_request.md +27 -0
- napari_mlarray-0.0.1/.github/ISSUE_TEMPLATE/task.md +11 -0
- napari_mlarray-0.0.1/.github/PULL_REQUEST_TEMPLATE.md +12 -0
- napari_mlarray-0.0.1/.github/dependabot.yml +25 -0
- napari_mlarray-0.0.1/.github/workflows/test_and_deploy.yml +85 -0
- napari_mlarray-0.0.1/.gitignore +86 -0
- napari_mlarray-0.0.1/.napari-hub/DESCRIPTION.md +9 -0
- napari_mlarray-0.0.1/.napari-hub/config.yml +9 -0
- napari_mlarray-0.0.1/LICENSE +22 -0
- napari_mlarray-0.0.1/MANIFEST.in +5 -0
- napari_mlarray-0.0.1/PKG-INFO +119 -0
- napari_mlarray-0.0.1/README.md +69 -0
- napari_mlarray-0.0.1/pyproject.toml +124 -0
- napari_mlarray-0.0.1/setup.cfg +4 -0
- napari_mlarray-0.0.1/src/napari_mlarray/__init__.py +13 -0
- napari_mlarray-0.0.1/src/napari_mlarray/_reader.py +77 -0
- napari_mlarray-0.0.1/src/napari_mlarray/_version.py +34 -0
- napari_mlarray-0.0.1/src/napari_mlarray/_widget.py +128 -0
- napari_mlarray-0.0.1/src/napari_mlarray/_writer.py +41 -0
- napari_mlarray-0.0.1/src/napari_mlarray/napari.yaml +22 -0
- napari_mlarray-0.0.1/src/napari_mlarray.egg-info/PKG-INFO +119 -0
- napari_mlarray-0.0.1/src/napari_mlarray.egg-info/SOURCES.txt +30 -0
- napari_mlarray-0.0.1/src/napari_mlarray.egg-info/dependency_links.txt +1 -0
- napari_mlarray-0.0.1/src/napari_mlarray.egg-info/entry_points.txt +2 -0
- napari_mlarray-0.0.1/src/napari_mlarray.egg-info/requires.txt +4 -0
- napari_mlarray-0.0.1/src/napari_mlarray.egg-info/top_level.txt +1 -0
- napari_mlarray-0.0.1/tests/__init__.py +0 -0
- napari_mlarray-0.0.1/tests/test_default.py +4 -0
- napari_mlarray-0.0.1/tox.ini +33 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
|
|
2
|
+
_commit: v2.0.1
|
|
3
|
+
_src_path: https://github.com/napari/napari-plugin-template
|
|
4
|
+
display_name: Mlarray
|
|
5
|
+
email: karol.gotkowski@dkfz.de
|
|
6
|
+
full_name: Karol-G
|
|
7
|
+
github_repository_url: provide later
|
|
8
|
+
github_username_or_organization: MIC-DKFZ
|
|
9
|
+
include_reader_plugin: true
|
|
10
|
+
include_sample_data_plugin: false
|
|
11
|
+
include_widget_plugin: true
|
|
12
|
+
include_writer_plugin: true
|
|
13
|
+
install_dependabot: true
|
|
14
|
+
install_precommit: false
|
|
15
|
+
license: MIT
|
|
16
|
+
module_name: napari_mlarray
|
|
17
|
+
plugin_name: napari-mlarray
|
|
18
|
+
short_description: Reader/Writer for MLArray data, an array format specialized for
|
|
19
|
+
machine learning with Blosc2 backend and standardized metadata
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
name: "\U0001F41B Bug Report"
|
|
2
|
+
description: Report a bug encountered while using napari-mlarray
|
|
3
|
+
labels:
|
|
4
|
+
- "bug"
|
|
5
|
+
|
|
6
|
+
body:
|
|
7
|
+
- type: markdown
|
|
8
|
+
attributes:
|
|
9
|
+
value: |
|
|
10
|
+
Thanks for taking the time to report this issue! 🙏🏼
|
|
11
|
+
|
|
12
|
+
Please fill out the sections below to help us reproduce the problem.
|
|
13
|
+
|
|
14
|
+
- type: textarea
|
|
15
|
+
id: bug-report
|
|
16
|
+
attributes:
|
|
17
|
+
label: "\U0001F41B Bug Report"
|
|
18
|
+
description: "Please provide a clear and concise description of the bug."
|
|
19
|
+
placeholder: "What went wrong? What did you expect to happen?"
|
|
20
|
+
validations:
|
|
21
|
+
required: true
|
|
22
|
+
|
|
23
|
+
- type: textarea
|
|
24
|
+
id: steps-to-reproduce
|
|
25
|
+
attributes:
|
|
26
|
+
label: "\U0001F4A1 Steps to Reproduce"
|
|
27
|
+
description: "Please provide a minimal code snippet or list of steps to reproduce the bug."
|
|
28
|
+
placeholder: |
|
|
29
|
+
1. Go to '...'
|
|
30
|
+
2. Click on '....'
|
|
31
|
+
3. Scroll down to '....'
|
|
32
|
+
4. See error
|
|
33
|
+
validations:
|
|
34
|
+
required: true
|
|
35
|
+
|
|
36
|
+
- type: textarea
|
|
37
|
+
id: expected-behavior
|
|
38
|
+
attributes:
|
|
39
|
+
label: "\U0001F4A1 Expected Behavior"
|
|
40
|
+
description: "Please provide a clear and concise description of what you expected to happen."
|
|
41
|
+
placeholder: "What did you expect to happen?"
|
|
42
|
+
|
|
43
|
+
- type: textarea
|
|
44
|
+
id: environment
|
|
45
|
+
attributes:
|
|
46
|
+
label: "\U0001F30E Environment"
|
|
47
|
+
description: |
|
|
48
|
+
Please provide detailed information regarding your environment. Please paste the output of `napari --info` here or copy the information from the "napari info" dialog in the napari Help menu.
|
|
49
|
+
|
|
50
|
+
Otherwise, please provide information regarding your operating system (OS), Python version, napari version, Qt backend and version, Qt platform, method of installation, and any other relevant information related to your environment.
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
placeholder: |
|
|
54
|
+
napari: 0.5.0
|
|
55
|
+
Platform: macOS-13.2.1-arm64-arm-64bit
|
|
56
|
+
System: MacOS 13.2.1
|
|
57
|
+
Python: 3.11.4 (main, Aug 7 2023, 20:34:01) [Clang 14.0.3 (clang-1403.0.22.14.1)]
|
|
58
|
+
Qt: 5.15.10
|
|
59
|
+
PyQt5: 5.15.10
|
|
60
|
+
NumPy: 1.25.1
|
|
61
|
+
SciPy: 1.11.1
|
|
62
|
+
Dask: 2023.7.1
|
|
63
|
+
VisPy: 0.13.0
|
|
64
|
+
magicgui: 0.7.2
|
|
65
|
+
superqt: 0.5.4
|
|
66
|
+
in-n-out: 0.1.8
|
|
67
|
+
app-model: 0.2.0
|
|
68
|
+
npe2: 0.7.2
|
|
69
|
+
|
|
70
|
+
OpenGL:
|
|
71
|
+
- GL version: 2.1 Metal - 83
|
|
72
|
+
- MAX_TEXTURE_SIZE: 16384
|
|
73
|
+
|
|
74
|
+
Screens:
|
|
75
|
+
- screen 1: resolution 1512x982, scale 2.0
|
|
76
|
+
|
|
77
|
+
Settings path:
|
|
78
|
+
- /Users/.../napari/napari_5c6993c40c104085444cfc0c77fa392cb5cb8f56/settings.yaml
|
|
79
|
+
validations:
|
|
80
|
+
required: true
|
|
81
|
+
|
|
82
|
+
- type: textarea
|
|
83
|
+
id: additional-context
|
|
84
|
+
attributes:
|
|
85
|
+
label: "\U0001F4A1 Additional Context"
|
|
86
|
+
description: "Please provide any additional information or context regarding the problem here."
|
|
87
|
+
placeholder: "Add any other context about the problem here."
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "\U0001F4DA Documentation"
|
|
3
|
+
about: Report an issue with napari-mlarray documentation
|
|
4
|
+
title: ''
|
|
5
|
+
labels: documentation
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 📚 Documentation
|
|
11
|
+
<!-- A clear and concise description of the documentation that needs to be created/updated -->
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "\U0001F680 Feature Request"
|
|
3
|
+
about: Submit a proposal/request for a new napari-mlarray feature
|
|
4
|
+
title: ''
|
|
5
|
+
labels: feature
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 🚀 Feature
|
|
11
|
+
<!-- A clear and concise description of the feature proposal -->
|
|
12
|
+
|
|
13
|
+
## Motivation
|
|
14
|
+
|
|
15
|
+
<!-- Please outline the motivation for the proposal. Is your feature request related to a problem? e.g., I'm always frustrated when [...]. If this is related to another GitHub issue, please link here too -->
|
|
16
|
+
|
|
17
|
+
## Pitch
|
|
18
|
+
|
|
19
|
+
<!-- A clear and concise description of what you want to happen. -->
|
|
20
|
+
|
|
21
|
+
## Alternatives
|
|
22
|
+
|
|
23
|
+
<!-- A clear and concise description of any alternative solutions or features you've considered, if any. -->
|
|
24
|
+
|
|
25
|
+
## Additional context
|
|
26
|
+
|
|
27
|
+
<!-- Add any other context or screenshots about the feature request here. -->
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# References and relevant issues
|
|
2
|
+
<!-- What relevant resources were used in the creation of this PR?
|
|
3
|
+
If this PR addresses an existing issue on the repo,
|
|
4
|
+
please link to that issue here as "Closes #(issue-number)"
|
|
5
|
+
If this PR depends on another PR/issue (even in another repo),
|
|
6
|
+
please link to it with "Depends on #PR-number" or "Depends on org/repo#PR-number"
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
# Description
|
|
10
|
+
<!-- What does this pull request (PR) do? Is it a new feature, a bug fix,
|
|
11
|
+
an improvement, or something else? Why is it necessary? If relevant, please add
|
|
12
|
+
a screenshot or a screen capture: "An image is worth a thousand words!" -->
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Dependabot configuration
|
|
2
|
+
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates#enabling-github-dependabot-version-updates
|
|
3
|
+
# https://til.simonwillison.net/github/dependabot-python-setup
|
|
4
|
+
|
|
5
|
+
version: 2
|
|
6
|
+
updates:
|
|
7
|
+
# Monitor pip dependencies
|
|
8
|
+
- package-ecosystem: pip
|
|
9
|
+
directory: "/"
|
|
10
|
+
schedule:
|
|
11
|
+
interval: monthly
|
|
12
|
+
groups:
|
|
13
|
+
python-packages:
|
|
14
|
+
patterns:
|
|
15
|
+
- "*"
|
|
16
|
+
|
|
17
|
+
# Monitor GitHub Actions and propose updates for security and maintenance
|
|
18
|
+
- package-ecosystem: github-actions
|
|
19
|
+
directory: "/"
|
|
20
|
+
schedule:
|
|
21
|
+
interval: monthly
|
|
22
|
+
groups:
|
|
23
|
+
github-actions:
|
|
24
|
+
patterns:
|
|
25
|
+
- "*"
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# This workflows will upload a Python Package using Twine when a release is created
|
|
2
|
+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
|
|
3
|
+
name: tests
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
branches:
|
|
8
|
+
- main
|
|
9
|
+
- npe2
|
|
10
|
+
tags:
|
|
11
|
+
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
|
|
12
|
+
pull_request:
|
|
13
|
+
branches:
|
|
14
|
+
- main
|
|
15
|
+
- npe2
|
|
16
|
+
workflow_dispatch:
|
|
17
|
+
|
|
18
|
+
concurrency:
|
|
19
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
20
|
+
cancel-in-progress: true
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
test:
|
|
24
|
+
name: ${{ matrix.platform }} py${{ matrix.python-version }}
|
|
25
|
+
runs-on: ${{ matrix.platform }}
|
|
26
|
+
timeout-minutes: 30
|
|
27
|
+
strategy:
|
|
28
|
+
fail-fast: false
|
|
29
|
+
matrix:
|
|
30
|
+
platform: [ubuntu-latest, windows-latest, macos-latest]
|
|
31
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
32
|
+
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@v5
|
|
35
|
+
|
|
36
|
+
- name: Setup python
|
|
37
|
+
uses: astral-sh/setup-uv@v7
|
|
38
|
+
with:
|
|
39
|
+
python-version: ${{ matrix.python-version }}
|
|
40
|
+
activate-environment: "true"
|
|
41
|
+
- name: Install Windows OpenGL
|
|
42
|
+
uses: pyvista/setup-headless-display-action@v4.2
|
|
43
|
+
with:
|
|
44
|
+
qt: true
|
|
45
|
+
wm: herbstluftwm
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# note: if you need dependencies from conda, considering using
|
|
49
|
+
# setup-miniconda: https://github.com/conda-incubator/setup-miniconda
|
|
50
|
+
# and
|
|
51
|
+
# tox-conda: https://github.com/tox-dev/tox-conda
|
|
52
|
+
# this runs the platform-specific tests declared in tox.ini
|
|
53
|
+
- name: Test with tox
|
|
54
|
+
run: uvx --with tox-gh-actions tox
|
|
55
|
+
env:
|
|
56
|
+
PLATFORM: ${{ matrix.platform }}
|
|
57
|
+
|
|
58
|
+
- name: Coverage
|
|
59
|
+
uses: codecov/codecov-action@v5
|
|
60
|
+
|
|
61
|
+
build-and-inspect-package:
|
|
62
|
+
name: Build & inspect package.
|
|
63
|
+
runs-on: ubuntu-latest
|
|
64
|
+
|
|
65
|
+
steps:
|
|
66
|
+
- uses: actions/checkout@v4
|
|
67
|
+
- uses: hynek/build-and-inspect-python-package@v2
|
|
68
|
+
|
|
69
|
+
deploy:
|
|
70
|
+
# this will run when you have tagged a commit, starting with "v*"
|
|
71
|
+
# and requires that you have put your twine API key in your
|
|
72
|
+
# github secrets (see readme for details)
|
|
73
|
+
needs: [test, build-and-inspect-package]
|
|
74
|
+
runs-on: ubuntu-latest
|
|
75
|
+
if: contains(github.ref, 'tags')
|
|
76
|
+
permissions:
|
|
77
|
+
id-token: write
|
|
78
|
+
steps:
|
|
79
|
+
- name: Download built artifact to dist/
|
|
80
|
+
uses: actions/download-artifact@v5
|
|
81
|
+
with:
|
|
82
|
+
name: Packages
|
|
83
|
+
path: dist
|
|
84
|
+
- name: Publish to PyPI
|
|
85
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,86 @@
|
|
|
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
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
|
|
27
|
+
# PyInstaller
|
|
28
|
+
# Usually these files are written by a python script from a template
|
|
29
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
30
|
+
*.manifest
|
|
31
|
+
*.spec
|
|
32
|
+
|
|
33
|
+
# Installer logs
|
|
34
|
+
pip-log.txt
|
|
35
|
+
pip-delete-this-directory.txt
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.coverage
|
|
41
|
+
.coverage.*
|
|
42
|
+
.cache
|
|
43
|
+
nosetests.xml
|
|
44
|
+
coverage.xml
|
|
45
|
+
*,cover
|
|
46
|
+
.hypothesis/
|
|
47
|
+
.napari_cache
|
|
48
|
+
|
|
49
|
+
# Translations
|
|
50
|
+
*.mo
|
|
51
|
+
*.pot
|
|
52
|
+
|
|
53
|
+
# Django stuff:
|
|
54
|
+
*.log
|
|
55
|
+
local_settings.py
|
|
56
|
+
|
|
57
|
+
# Flask instance folder
|
|
58
|
+
instance/
|
|
59
|
+
|
|
60
|
+
# Sphinx documentation
|
|
61
|
+
docs/_build/
|
|
62
|
+
|
|
63
|
+
# MkDocs documentation
|
|
64
|
+
/site/
|
|
65
|
+
|
|
66
|
+
# PyBuilder
|
|
67
|
+
target/
|
|
68
|
+
|
|
69
|
+
# Pycharm and VSCode
|
|
70
|
+
.idea/
|
|
71
|
+
venv/
|
|
72
|
+
.vscode/
|
|
73
|
+
|
|
74
|
+
# IPython Notebook
|
|
75
|
+
.ipynb_checkpoints
|
|
76
|
+
|
|
77
|
+
# pyenv
|
|
78
|
+
.python-version
|
|
79
|
+
|
|
80
|
+
# OS
|
|
81
|
+
.DS_Store
|
|
82
|
+
|
|
83
|
+
# written by setuptools_scm
|
|
84
|
+
**/_version.py
|
|
85
|
+
|
|
86
|
+
run_example.py
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<!-- This file is a placeholder for customizing description of your plugin
|
|
2
|
+
on the napari hub if you wish. The readme file will be used by default if
|
|
3
|
+
you wish not to do any customization for the napari hub listing.
|
|
4
|
+
|
|
5
|
+
If you need some help writing a good description, check out our
|
|
6
|
+
[guide](https://github.com/chanzuckerberg/napari-hub/wiki/Writing-the-Perfect-Description-for-your-Plugin)
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
The developer has not yet provided a napari-hub specific description.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# You may use this file to customize how your plugin page appears
|
|
2
|
+
# on the napari hub: https://www.napari-hub.org/
|
|
3
|
+
# See their wiki for details https://github.com/chanzuckerberg/napari-hub/wiki
|
|
4
|
+
|
|
5
|
+
# Please note that this file should only be used IN ADDITION to entering
|
|
6
|
+
# metadata fields (such as summary, description, authors, and various URLS)
|
|
7
|
+
# in your standard python package metadata (e.g. setup.cfg, setup.py, or
|
|
8
|
+
# pyproject.toml), when you would like those fields to be displayed
|
|
9
|
+
# differently on the hub than in the napari application.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
The MIT License (MIT)
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2026 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
|
14
|
+
all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: napari-mlarray
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A reader/writer Napari plugin for MLArray images.
|
|
5
|
+
Author: Karol-G
|
|
6
|
+
Author-email: karol.gotkowski@dkfz.de
|
|
7
|
+
License:
|
|
8
|
+
The MIT License (MIT)
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2026 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in
|
|
20
|
+
all copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
28
|
+
THE SOFTWARE.
|
|
29
|
+
|
|
30
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
31
|
+
Classifier: Framework :: napari
|
|
32
|
+
Classifier: Intended Audience :: Developers
|
|
33
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
+
Classifier: Operating System :: OS Independent
|
|
35
|
+
Classifier: Programming Language :: Python
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
42
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
43
|
+
Requires-Python: >=3.10
|
|
44
|
+
Description-Content-Type: text/markdown
|
|
45
|
+
License-File: LICENSE
|
|
46
|
+
Requires-Dist: mlarray
|
|
47
|
+
Provides-Extra: all
|
|
48
|
+
Requires-Dist: napari[all]; extra == "all"
|
|
49
|
+
Dynamic: license-file
|
|
50
|
+
|
|
51
|
+
# napari-mlarray
|
|
52
|
+
|
|
53
|
+
[](https://github.com/MIC-DKFZ/napari-mlarray/raw/main/LICENSE)
|
|
54
|
+
[](https://pypi.org/project/napari-mlarray)
|
|
55
|
+
[](https://python.org)
|
|
56
|
+
[](https://github.com/MIC-DKFZ/napari-mlarray/actions)
|
|
57
|
+
[](https://codecov.io/gh/MIC-DKFZ/napari-mlarray)
|
|
58
|
+
[](https://napari-hub.org/plugins/napari-mlarray)
|
|
59
|
+
[](https://napari.org/stable/plugins/index.html)
|
|
60
|
+
[](https://github.com/copier-org/copier)
|
|
61
|
+
|
|
62
|
+
A reader/writer Napari plugin for [MLArray](https://github.com/MIC-DKFZ/mlarray) images. MLArray is an array format specialized for Machine Learning with Blosc2 backend and standardized metadata.
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
You can install `napari-mlarray` via [pip]:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
pip install napari-mlarray
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
If napari is not already installed, you can install `napari-mlarray` with napari and Qt via:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
pip install "napari-mlarray[all]"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
## Contributing
|
|
81
|
+
|
|
82
|
+
Contributions are very welcome. Tests can be run with [tox], please ensure
|
|
83
|
+
the coverage at least stays the same before you submit a pull request.
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
Distributed under the terms of the [MIT] license,
|
|
88
|
+
"napari-mlarray" is free and open source software
|
|
89
|
+
|
|
90
|
+
## Issues
|
|
91
|
+
|
|
92
|
+
If you encounter any problems, please [file an issue] along with a detailed description.
|
|
93
|
+
|
|
94
|
+
[napari]: https://github.com/napari/napari
|
|
95
|
+
[copier]: https://copier.readthedocs.io/en/stable/
|
|
96
|
+
[@napari]: https://github.com/napari
|
|
97
|
+
[MIT]: http://opensource.org/licenses/MIT
|
|
98
|
+
[BSD-3]: http://opensource.org/licenses/BSD-3-Clause
|
|
99
|
+
[GNU GPL v3.0]: http://www.gnu.org/licenses/gpl-3.0.txt
|
|
100
|
+
[GNU LGPL v3.0]: http://www.gnu.org/licenses/lgpl-3.0.txt
|
|
101
|
+
[Apache Software License 2.0]: http://www.apache.org/licenses/LICENSE-2.0
|
|
102
|
+
[Mozilla Public License 2.0]: https://www.mozilla.org/media/MPL/2.0/index.txt
|
|
103
|
+
[napari-plugin-template]: https://github.com/napari/napari-plugin-template
|
|
104
|
+
|
|
105
|
+
[napari]: https://github.com/napari/napari
|
|
106
|
+
[tox]: https://tox.readthedocs.io/en/latest/
|
|
107
|
+
[pip]: https://pypi.org/project/pip/
|
|
108
|
+
[PyPI]: https://pypi.org/
|
|
109
|
+
|
|
110
|
+
## Acknowledgments
|
|
111
|
+
|
|
112
|
+
<p align="left">
|
|
113
|
+
<img src="https://github.com/MIC-DKFZ/vidata/raw/main/imgs/Logos/HI_Logo.png" width="150">
|
|
114
|
+
<img src="https://github.com/MIC-DKFZ/vidata/raw/main/imgs/Logos/DKFZ_Logo.png" width="500">
|
|
115
|
+
</p>
|
|
116
|
+
|
|
117
|
+
This repository is developed and maintained by the Applied Computer Vision Lab (ACVL)
|
|
118
|
+
of [Helmholtz Imaging](https://www.helmholtz-imaging.de/) and the
|
|
119
|
+
[Division of Medical Image Computing](https://www.dkfz.de/en/medical-image-computing) at DKFZ.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# napari-mlarray
|
|
2
|
+
|
|
3
|
+
[](https://github.com/MIC-DKFZ/napari-mlarray/raw/main/LICENSE)
|
|
4
|
+
[](https://pypi.org/project/napari-mlarray)
|
|
5
|
+
[](https://python.org)
|
|
6
|
+
[](https://github.com/MIC-DKFZ/napari-mlarray/actions)
|
|
7
|
+
[](https://codecov.io/gh/MIC-DKFZ/napari-mlarray)
|
|
8
|
+
[](https://napari-hub.org/plugins/napari-mlarray)
|
|
9
|
+
[](https://napari.org/stable/plugins/index.html)
|
|
10
|
+
[](https://github.com/copier-org/copier)
|
|
11
|
+
|
|
12
|
+
A reader/writer Napari plugin for [MLArray](https://github.com/MIC-DKFZ/mlarray) images. MLArray is an array format specialized for Machine Learning with Blosc2 backend and standardized metadata.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
You can install `napari-mlarray` via [pip]:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
pip install napari-mlarray
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
If napari is not already installed, you can install `napari-mlarray` with napari and Qt via:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
pip install "napari-mlarray[all]"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Contributing
|
|
31
|
+
|
|
32
|
+
Contributions are very welcome. Tests can be run with [tox], please ensure
|
|
33
|
+
the coverage at least stays the same before you submit a pull request.
|
|
34
|
+
|
|
35
|
+
## License
|
|
36
|
+
|
|
37
|
+
Distributed under the terms of the [MIT] license,
|
|
38
|
+
"napari-mlarray" is free and open source software
|
|
39
|
+
|
|
40
|
+
## Issues
|
|
41
|
+
|
|
42
|
+
If you encounter any problems, please [file an issue] along with a detailed description.
|
|
43
|
+
|
|
44
|
+
[napari]: https://github.com/napari/napari
|
|
45
|
+
[copier]: https://copier.readthedocs.io/en/stable/
|
|
46
|
+
[@napari]: https://github.com/napari
|
|
47
|
+
[MIT]: http://opensource.org/licenses/MIT
|
|
48
|
+
[BSD-3]: http://opensource.org/licenses/BSD-3-Clause
|
|
49
|
+
[GNU GPL v3.0]: http://www.gnu.org/licenses/gpl-3.0.txt
|
|
50
|
+
[GNU LGPL v3.0]: http://www.gnu.org/licenses/lgpl-3.0.txt
|
|
51
|
+
[Apache Software License 2.0]: http://www.apache.org/licenses/LICENSE-2.0
|
|
52
|
+
[Mozilla Public License 2.0]: https://www.mozilla.org/media/MPL/2.0/index.txt
|
|
53
|
+
[napari-plugin-template]: https://github.com/napari/napari-plugin-template
|
|
54
|
+
|
|
55
|
+
[napari]: https://github.com/napari/napari
|
|
56
|
+
[tox]: https://tox.readthedocs.io/en/latest/
|
|
57
|
+
[pip]: https://pypi.org/project/pip/
|
|
58
|
+
[PyPI]: https://pypi.org/
|
|
59
|
+
|
|
60
|
+
## Acknowledgments
|
|
61
|
+
|
|
62
|
+
<p align="left">
|
|
63
|
+
<img src="https://github.com/MIC-DKFZ/vidata/raw/main/imgs/Logos/HI_Logo.png" width="150">
|
|
64
|
+
<img src="https://github.com/MIC-DKFZ/vidata/raw/main/imgs/Logos/DKFZ_Logo.png" width="500">
|
|
65
|
+
</p>
|
|
66
|
+
|
|
67
|
+
This repository is developed and maintained by the Applied Computer Vision Lab (ACVL)
|
|
68
|
+
of [Helmholtz Imaging](https://www.helmholtz-imaging.de/) and the
|
|
69
|
+
[Division of Medical Image Computing](https://www.dkfz.de/en/medical-image-computing) at DKFZ.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "napari-mlarray"
|
|
3
|
+
dynamic = ["version"]
|
|
4
|
+
description = "A reader/writer Napari plugin for MLArray images."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = {file = "LICENSE"}
|
|
7
|
+
authors = [
|
|
8
|
+
{name = "Karol-G"},
|
|
9
|
+
{email = "karol.gotkowski@dkfz.de"},
|
|
10
|
+
]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
13
|
+
"Framework :: napari",
|
|
14
|
+
"Intended Audience :: Developers",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
"Programming Language :: Python",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
|
+
"Topic :: Scientific/Engineering :: Image Processing",
|
|
25
|
+
]
|
|
26
|
+
requires-python = ">=3.10"
|
|
27
|
+
# napari can be included in dependencies if napari imports are required.
|
|
28
|
+
# However, you should not include napari[all], napari[qt],
|
|
29
|
+
# or any other Qt bindings directly (e.g. PyQt5, PySide2).
|
|
30
|
+
# See best practices: https://napari.org/stable/plugins/building_a_plugin/best_practices.html
|
|
31
|
+
dependencies = [
|
|
32
|
+
"mlarray"
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
# Allow easily installation with the full, default napari installation
|
|
37
|
+
# (including Qt backend) using napari-mlarray[all].
|
|
38
|
+
all = ["napari[all]"]
|
|
39
|
+
|
|
40
|
+
[dependency-groups]
|
|
41
|
+
dev = [
|
|
42
|
+
"tox-uv",
|
|
43
|
+
"pytest", # https://docs.pytest.org/en/latest/contents.html
|
|
44
|
+
"pytest-cov", # https://pytest-cov.readthedocs.io/en/latest/
|
|
45
|
+
"pytest-qt", # https://pytest-qt.readthedocs.io/en/latest/
|
|
46
|
+
"napari[qt]", # test with napari's default Qt bindings
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[project.entry-points."napari.manifest"]
|
|
50
|
+
napari-mlarray = "napari_mlarray:napari.yaml"
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
[build-system]
|
|
55
|
+
requires = ["setuptools>=42.0.0", "setuptools_scm"]
|
|
56
|
+
build-backend = "setuptools.build_meta"
|
|
57
|
+
|
|
58
|
+
[tool.setuptools]
|
|
59
|
+
include-package-data = true
|
|
60
|
+
|
|
61
|
+
[tool.setuptools.packages.find]
|
|
62
|
+
where = ["src"]
|
|
63
|
+
|
|
64
|
+
[tool.setuptools.package-data]
|
|
65
|
+
"*" = ["*.yaml"]
|
|
66
|
+
|
|
67
|
+
[tool.setuptools_scm]
|
|
68
|
+
write_to = "src/napari_mlarray/_version.py"
|
|
69
|
+
fallback_version = "0.0.1+nogit"
|
|
70
|
+
|
|
71
|
+
[tool.pytest.ini_options]
|
|
72
|
+
minversion = "6.0"
|
|
73
|
+
addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"]
|
|
74
|
+
xfail_strict = true
|
|
75
|
+
# filterwarnings = ["error"] # recommended by PP309; deprecation warnings cause failures so leaving for the user to enable if desired
|
|
76
|
+
log_cli_level = "INFO"
|
|
77
|
+
testpaths = ["tests"]
|
|
78
|
+
|
|
79
|
+
[tool.black]
|
|
80
|
+
line-length = 79
|
|
81
|
+
target-version = ['py310', 'py311', 'py312', 'py313']
|
|
82
|
+
|
|
83
|
+
[tool.ruff]
|
|
84
|
+
line-length = 79
|
|
85
|
+
lint.select = [
|
|
86
|
+
"E", "F", "W", #flake8
|
|
87
|
+
"UP", # pyupgrade
|
|
88
|
+
"I", # isort
|
|
89
|
+
"BLE", # flake8-blind-exception
|
|
90
|
+
"B", # flake8-bugbear
|
|
91
|
+
"A", # flake8-builtins
|
|
92
|
+
"C4", # flake8-comprehensions
|
|
93
|
+
"ISC", # flake8-implicit-str-concat
|
|
94
|
+
"G", # flake8-logging-format
|
|
95
|
+
"PIE", # flake8-pie
|
|
96
|
+
"SIM", # flake8-simplify
|
|
97
|
+
]
|
|
98
|
+
lint.ignore = [
|
|
99
|
+
"E501", # line too long. let black handle this
|
|
100
|
+
"UP006", "UP007", # type annotation. As using magicgui require runtime type annotation then we disable this.
|
|
101
|
+
]
|
|
102
|
+
|
|
103
|
+
exclude = [
|
|
104
|
+
".bzr",
|
|
105
|
+
".direnv",
|
|
106
|
+
".eggs",
|
|
107
|
+
".git",
|
|
108
|
+
".mypy_cache",
|
|
109
|
+
".pants.d",
|
|
110
|
+
".ruff_cache",
|
|
111
|
+
".svn",
|
|
112
|
+
".tox",
|
|
113
|
+
".venv",
|
|
114
|
+
"__pypackages__",
|
|
115
|
+
"_build",
|
|
116
|
+
"buck-out",
|
|
117
|
+
"build",
|
|
118
|
+
"dist",
|
|
119
|
+
"node_modules",
|
|
120
|
+
"venv",
|
|
121
|
+
"*vendored*",
|
|
122
|
+
"*_vendor*",
|
|
123
|
+
]
|
|
124
|
+
fix = true
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
try:
|
|
2
|
+
from ._version import version as __version__
|
|
3
|
+
except ImportError:
|
|
4
|
+
__version__ = "unknown"
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
from ._reader import napari_get_reader
|
|
8
|
+
from ._writer import write_single_image
|
|
9
|
+
|
|
10
|
+
__all__ = (
|
|
11
|
+
"napari_get_reader",
|
|
12
|
+
"write_single_image",
|
|
13
|
+
)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module is an example of a barebones numpy reader plugin for napari.
|
|
3
|
+
|
|
4
|
+
It implements the Reader specification, but your plugin may choose to
|
|
5
|
+
implement multiple readers or even other plugin contributions. see:
|
|
6
|
+
https://napari.org/stable/plugins/building_a_plugin/guides.html#readers
|
|
7
|
+
"""
|
|
8
|
+
from mlarray import MLArray
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def napari_get_reader(path):
|
|
12
|
+
"""A basic implementation of a Reader contribution.
|
|
13
|
+
|
|
14
|
+
Parameters
|
|
15
|
+
----------
|
|
16
|
+
path : str or list of str
|
|
17
|
+
Path to file, or list of paths.
|
|
18
|
+
|
|
19
|
+
Returns
|
|
20
|
+
-------
|
|
21
|
+
function or None
|
|
22
|
+
If the path is a recognized format, return a function that accepts the
|
|
23
|
+
same path or list of paths, and returns a list of layer data tuples.
|
|
24
|
+
"""
|
|
25
|
+
if isinstance(path, list):
|
|
26
|
+
# reader plugins may be handed single path, or a list of paths.
|
|
27
|
+
# if it is a list, it is assumed to be an image stack...
|
|
28
|
+
# so we are only going to look at the first file.
|
|
29
|
+
path = path[0]
|
|
30
|
+
|
|
31
|
+
# the get_reader function should make as many checks as possible
|
|
32
|
+
# (without loading the full file) to determine if it can read
|
|
33
|
+
# the path. Here, we check the dtype of the array by loading
|
|
34
|
+
# it with memmap, so that we don't actually load the full array into memory.
|
|
35
|
+
# We pretend that this reader can only read integer arrays.
|
|
36
|
+
try:
|
|
37
|
+
if not str(path).endswith(".mla"):
|
|
38
|
+
return None
|
|
39
|
+
# napari_get_reader should never raise an exception, because napari
|
|
40
|
+
# raises its own specific errors depending on what plugins are
|
|
41
|
+
# available for the given path, so we catch
|
|
42
|
+
# the OSError that np.load might raise if the file is malformed
|
|
43
|
+
except OSError:
|
|
44
|
+
return None
|
|
45
|
+
|
|
46
|
+
# otherwise we return the *function* that can read ``path``.
|
|
47
|
+
return reader_function
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def reader_function(path):
|
|
51
|
+
"""Take a path or list of paths and return a list of LayerData tuples.
|
|
52
|
+
|
|
53
|
+
Readers are expected to return data as a list of tuples, where each tuple
|
|
54
|
+
is (data, [add_kwargs, [layer_type]]), "add_kwargs" and "layer_type" are
|
|
55
|
+
both optional.
|
|
56
|
+
|
|
57
|
+
Parameters
|
|
58
|
+
----------
|
|
59
|
+
path : str or list of str
|
|
60
|
+
Path to file, or list of paths.
|
|
61
|
+
|
|
62
|
+
Returns
|
|
63
|
+
-------
|
|
64
|
+
layer_data : list of tuples
|
|
65
|
+
A list of LayerData tuples where each tuple in the list contains
|
|
66
|
+
(data, metadata, layer_type), where data is a numpy array, metadata is
|
|
67
|
+
a dict of keyword arguments for the corresponding viewer.add_* method
|
|
68
|
+
in napari, and layer_type is a lower-case string naming the type of
|
|
69
|
+
layer. Both "meta", and "layer_type" are optional. napari will
|
|
70
|
+
default to layer_type=="image" if not provided
|
|
71
|
+
"""
|
|
72
|
+
# handle both a string and a list of strings
|
|
73
|
+
paths = [path] if isinstance(path, str) else path
|
|
74
|
+
# load all files into array
|
|
75
|
+
mlarrays = [MLArray.open(_path) for _path in paths]
|
|
76
|
+
layer_data = [(mlarray, {"affine": mlarray.affine, "metadata": mlarray.meta.to_dict()}, "labels" if mlarray.meta.is_seg.is_seg == True else "image") for mlarray in mlarrays]
|
|
77
|
+
return layer_data
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# file generated by setuptools-scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
|
|
4
|
+
__all__ = [
|
|
5
|
+
"__version__",
|
|
6
|
+
"__version_tuple__",
|
|
7
|
+
"version",
|
|
8
|
+
"version_tuple",
|
|
9
|
+
"__commit_id__",
|
|
10
|
+
"commit_id",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
TYPE_CHECKING = False
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from typing import Tuple
|
|
16
|
+
from typing import Union
|
|
17
|
+
|
|
18
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
19
|
+
COMMIT_ID = Union[str, None]
|
|
20
|
+
else:
|
|
21
|
+
VERSION_TUPLE = object
|
|
22
|
+
COMMIT_ID = object
|
|
23
|
+
|
|
24
|
+
version: str
|
|
25
|
+
__version__: str
|
|
26
|
+
__version_tuple__: VERSION_TUPLE
|
|
27
|
+
version_tuple: VERSION_TUPLE
|
|
28
|
+
commit_id: COMMIT_ID
|
|
29
|
+
__commit_id__: COMMIT_ID
|
|
30
|
+
|
|
31
|
+
__version__ = version = '0.0.1'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 0, 1)
|
|
33
|
+
|
|
34
|
+
__commit_id__ = commit_id = 'g905e69a09'
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module contains four napari widgets declared in
|
|
3
|
+
different ways:
|
|
4
|
+
|
|
5
|
+
- a pure Python function flagged with `autogenerate: true`
|
|
6
|
+
in the plugin manifest. Type annotations are used by
|
|
7
|
+
magicgui to generate widgets for each parameter. Best
|
|
8
|
+
suited for simple processing tasks - usually taking
|
|
9
|
+
in and/or returning a layer.
|
|
10
|
+
- a `magic_factory` decorated function. The `magic_factory`
|
|
11
|
+
decorator allows us to customize aspects of the resulting
|
|
12
|
+
GUI, including the widgets associated with each parameter.
|
|
13
|
+
Best used when you have a very simple processing task,
|
|
14
|
+
but want some control over the autogenerated widgets. If you
|
|
15
|
+
find yourself needing to define lots of nested functions to achieve
|
|
16
|
+
your functionality, maybe look at the `Container` widget!
|
|
17
|
+
- a `magicgui.widgets.Container` subclass. This provides lots
|
|
18
|
+
of flexibility and customization options while still supporting
|
|
19
|
+
`magicgui` widgets and convenience methods for creating widgets
|
|
20
|
+
from type annotations. If you want to customize your widgets and
|
|
21
|
+
connect callbacks, this is the best widget option for you.
|
|
22
|
+
- a `QWidget` subclass. This provides maximal flexibility but requires
|
|
23
|
+
full specification of widget layouts, callbacks, events, etc.
|
|
24
|
+
|
|
25
|
+
References:
|
|
26
|
+
- Widget specification: https://napari.org/stable/plugins/building_a_plugin/guides.html#widgets
|
|
27
|
+
- magicgui docs: https://pyapp-kit.github.io/magicgui/
|
|
28
|
+
|
|
29
|
+
Replace code below according to your needs.
|
|
30
|
+
"""
|
|
31
|
+
from typing import TYPE_CHECKING
|
|
32
|
+
|
|
33
|
+
from magicgui import magic_factory
|
|
34
|
+
from magicgui.widgets import CheckBox, Container, create_widget
|
|
35
|
+
from qtpy.QtWidgets import QHBoxLayout, QPushButton, QWidget
|
|
36
|
+
from skimage.util import img_as_float
|
|
37
|
+
|
|
38
|
+
if TYPE_CHECKING:
|
|
39
|
+
import napari
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# Uses the `autogenerate: true` flag in the plugin manifest
|
|
43
|
+
# to indicate it should be wrapped as a magicgui to autogenerate
|
|
44
|
+
# a widget.
|
|
45
|
+
def threshold_autogenerate_widget(
|
|
46
|
+
img: "napari.types.ImageData",
|
|
47
|
+
threshold: "float",
|
|
48
|
+
) -> "napari.types.LabelsData":
|
|
49
|
+
return img_as_float(img) > threshold
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
# the magic_factory decorator lets us customize aspects of our widget
|
|
53
|
+
# we specify a widget type for the threshold parameter
|
|
54
|
+
# and use auto_call=True so the function is called whenever
|
|
55
|
+
# the value of a parameter changes
|
|
56
|
+
@magic_factory(
|
|
57
|
+
threshold={"widget_type": "FloatSlider", "max": 1}, auto_call=True
|
|
58
|
+
)
|
|
59
|
+
def threshold_magic_widget(
|
|
60
|
+
img_layer: "napari.layers.Image", threshold: "float"
|
|
61
|
+
) -> "napari.types.LabelsData":
|
|
62
|
+
return img_as_float(img_layer.data) > threshold
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
# if we want even more control over our widget, we can use
|
|
66
|
+
# magicgui `Container`
|
|
67
|
+
class ImageThreshold(Container):
|
|
68
|
+
def __init__(self, viewer: "napari.viewer.Viewer"):
|
|
69
|
+
super().__init__()
|
|
70
|
+
self._viewer = viewer
|
|
71
|
+
# use create_widget to generate widgets from type annotations
|
|
72
|
+
self._image_layer_combo = create_widget(
|
|
73
|
+
label="Image", annotation="napari.layers.Image"
|
|
74
|
+
)
|
|
75
|
+
self._threshold_slider = create_widget(
|
|
76
|
+
label="Threshold", annotation=float, widget_type="FloatSlider"
|
|
77
|
+
)
|
|
78
|
+
self._threshold_slider.min = 0
|
|
79
|
+
self._threshold_slider.max = 1
|
|
80
|
+
# use magicgui widgets directly
|
|
81
|
+
self._invert_checkbox = CheckBox(text="Keep pixels below threshold")
|
|
82
|
+
|
|
83
|
+
# connect your own callbacks
|
|
84
|
+
self._threshold_slider.changed.connect(self._threshold_im)
|
|
85
|
+
self._invert_checkbox.changed.connect(self._threshold_im)
|
|
86
|
+
|
|
87
|
+
# append into/extend the container with your widgets
|
|
88
|
+
self.extend(
|
|
89
|
+
[
|
|
90
|
+
self._image_layer_combo,
|
|
91
|
+
self._threshold_slider,
|
|
92
|
+
self._invert_checkbox,
|
|
93
|
+
]
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
def _threshold_im(self):
|
|
97
|
+
image_layer = self._image_layer_combo.value
|
|
98
|
+
if image_layer is None:
|
|
99
|
+
return
|
|
100
|
+
|
|
101
|
+
image = img_as_float(image_layer.data)
|
|
102
|
+
name = image_layer.name + "_thresholded"
|
|
103
|
+
threshold = self._threshold_slider.value
|
|
104
|
+
if self._invert_checkbox.value:
|
|
105
|
+
thresholded = image < threshold
|
|
106
|
+
else:
|
|
107
|
+
thresholded = image > threshold
|
|
108
|
+
if name in self._viewer.layers:
|
|
109
|
+
self._viewer.layers[name].data = thresholded
|
|
110
|
+
else:
|
|
111
|
+
self._viewer.add_labels(thresholded, name=name)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class ExampleQWidget(QWidget):
|
|
115
|
+
# your QWidget.__init__ can optionally request the napari viewer instance
|
|
116
|
+
# use a type annotation of 'napari.viewer.Viewer' for any parameter
|
|
117
|
+
def __init__(self, viewer: "napari.viewer.Viewer"):
|
|
118
|
+
super().__init__()
|
|
119
|
+
self.viewer = viewer
|
|
120
|
+
|
|
121
|
+
btn = QPushButton("Click me!")
|
|
122
|
+
btn.clicked.connect(self._on_click)
|
|
123
|
+
|
|
124
|
+
self.setLayout(QHBoxLayout())
|
|
125
|
+
self.layout().addWidget(btn)
|
|
126
|
+
|
|
127
|
+
def _on_click(self):
|
|
128
|
+
print("napari has", len(self.viewer.layers), "layers")
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module is an example of a barebones writer plugin for napari.
|
|
3
|
+
|
|
4
|
+
It implements the Writer specification.
|
|
5
|
+
see: https://napari.org/stable/plugins/building_a_plugin/guides.html#writers
|
|
6
|
+
|
|
7
|
+
Replace code below according to your needs.
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from collections.abc import Sequence
|
|
12
|
+
from typing import TYPE_CHECKING, Any, Union
|
|
13
|
+
from mlarray import MLArray, Meta
|
|
14
|
+
|
|
15
|
+
if TYPE_CHECKING:
|
|
16
|
+
DataType = Union[Any, Sequence[Any]]
|
|
17
|
+
FullLayerData = tuple[DataType, dict, str]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def write_single_image(path: str, data: Any, meta: dict) -> list[str]:
|
|
21
|
+
"""Writes a single image layer.
|
|
22
|
+
|
|
23
|
+
Parameters
|
|
24
|
+
----------
|
|
25
|
+
path : str
|
|
26
|
+
A string path indicating where to save the image file.
|
|
27
|
+
data : The layer data
|
|
28
|
+
The `.data` attribute from the napari layer.
|
|
29
|
+
meta : dict
|
|
30
|
+
A dictionary containing all other attributes from the napari layer
|
|
31
|
+
(excluding the `.data` layer attribute).
|
|
32
|
+
|
|
33
|
+
Returns
|
|
34
|
+
-------
|
|
35
|
+
[path] : A list containing the string path to the saved file.
|
|
36
|
+
"""
|
|
37
|
+
mlarray = MLArray(data, meta=Meta.from_dict(meta["metadata"]))
|
|
38
|
+
mlarray.save(path)
|
|
39
|
+
|
|
40
|
+
# return path to any file(s) that were successfully written
|
|
41
|
+
return [path]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: napari-mlarray
|
|
2
|
+
display_name: Mlarray
|
|
3
|
+
# use 'hidden' to remove plugin from napari hub search results
|
|
4
|
+
visibility: public
|
|
5
|
+
# see https://napari.org/stable/plugins/technical_references/manifest.html#fields for valid categories
|
|
6
|
+
# categories: []
|
|
7
|
+
contributions:
|
|
8
|
+
commands:
|
|
9
|
+
- id: napari-mlarray.get_reader
|
|
10
|
+
python_name: napari_mlarray._reader:napari_get_reader
|
|
11
|
+
title: Open data with Mlarray
|
|
12
|
+
- id: napari-mlarray.write_single_image
|
|
13
|
+
python_name: napari_mlarray._writer:write_single_image
|
|
14
|
+
title: Save image data with Mlarray
|
|
15
|
+
readers:
|
|
16
|
+
- command: napari-mlarray.get_reader
|
|
17
|
+
accepts_directories: false
|
|
18
|
+
filename_patterns: ['*.mla']
|
|
19
|
+
writers:
|
|
20
|
+
- command: napari-mlarray.write_single_image
|
|
21
|
+
layer_types: ['image']
|
|
22
|
+
filename_extensions: ['.mla']
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: napari-mlarray
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A reader/writer Napari plugin for MLArray images.
|
|
5
|
+
Author: Karol-G
|
|
6
|
+
Author-email: karol.gotkowski@dkfz.de
|
|
7
|
+
License:
|
|
8
|
+
The MIT License (MIT)
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2026 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in
|
|
20
|
+
all copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
28
|
+
THE SOFTWARE.
|
|
29
|
+
|
|
30
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
31
|
+
Classifier: Framework :: napari
|
|
32
|
+
Classifier: Intended Audience :: Developers
|
|
33
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
+
Classifier: Operating System :: OS Independent
|
|
35
|
+
Classifier: Programming Language :: Python
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
42
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
43
|
+
Requires-Python: >=3.10
|
|
44
|
+
Description-Content-Type: text/markdown
|
|
45
|
+
License-File: LICENSE
|
|
46
|
+
Requires-Dist: mlarray
|
|
47
|
+
Provides-Extra: all
|
|
48
|
+
Requires-Dist: napari[all]; extra == "all"
|
|
49
|
+
Dynamic: license-file
|
|
50
|
+
|
|
51
|
+
# napari-mlarray
|
|
52
|
+
|
|
53
|
+
[](https://github.com/MIC-DKFZ/napari-mlarray/raw/main/LICENSE)
|
|
54
|
+
[](https://pypi.org/project/napari-mlarray)
|
|
55
|
+
[](https://python.org)
|
|
56
|
+
[](https://github.com/MIC-DKFZ/napari-mlarray/actions)
|
|
57
|
+
[](https://codecov.io/gh/MIC-DKFZ/napari-mlarray)
|
|
58
|
+
[](https://napari-hub.org/plugins/napari-mlarray)
|
|
59
|
+
[](https://napari.org/stable/plugins/index.html)
|
|
60
|
+
[](https://github.com/copier-org/copier)
|
|
61
|
+
|
|
62
|
+
A reader/writer Napari plugin for [MLArray](https://github.com/MIC-DKFZ/mlarray) images. MLArray is an array format specialized for Machine Learning with Blosc2 backend and standardized metadata.
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
You can install `napari-mlarray` via [pip]:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
pip install napari-mlarray
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
If napari is not already installed, you can install `napari-mlarray` with napari and Qt via:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
pip install "napari-mlarray[all]"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
## Contributing
|
|
81
|
+
|
|
82
|
+
Contributions are very welcome. Tests can be run with [tox], please ensure
|
|
83
|
+
the coverage at least stays the same before you submit a pull request.
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
Distributed under the terms of the [MIT] license,
|
|
88
|
+
"napari-mlarray" is free and open source software
|
|
89
|
+
|
|
90
|
+
## Issues
|
|
91
|
+
|
|
92
|
+
If you encounter any problems, please [file an issue] along with a detailed description.
|
|
93
|
+
|
|
94
|
+
[napari]: https://github.com/napari/napari
|
|
95
|
+
[copier]: https://copier.readthedocs.io/en/stable/
|
|
96
|
+
[@napari]: https://github.com/napari
|
|
97
|
+
[MIT]: http://opensource.org/licenses/MIT
|
|
98
|
+
[BSD-3]: http://opensource.org/licenses/BSD-3-Clause
|
|
99
|
+
[GNU GPL v3.0]: http://www.gnu.org/licenses/gpl-3.0.txt
|
|
100
|
+
[GNU LGPL v3.0]: http://www.gnu.org/licenses/lgpl-3.0.txt
|
|
101
|
+
[Apache Software License 2.0]: http://www.apache.org/licenses/LICENSE-2.0
|
|
102
|
+
[Mozilla Public License 2.0]: https://www.mozilla.org/media/MPL/2.0/index.txt
|
|
103
|
+
[napari-plugin-template]: https://github.com/napari/napari-plugin-template
|
|
104
|
+
|
|
105
|
+
[napari]: https://github.com/napari/napari
|
|
106
|
+
[tox]: https://tox.readthedocs.io/en/latest/
|
|
107
|
+
[pip]: https://pypi.org/project/pip/
|
|
108
|
+
[PyPI]: https://pypi.org/
|
|
109
|
+
|
|
110
|
+
## Acknowledgments
|
|
111
|
+
|
|
112
|
+
<p align="left">
|
|
113
|
+
<img src="https://github.com/MIC-DKFZ/vidata/raw/main/imgs/Logos/HI_Logo.png" width="150">
|
|
114
|
+
<img src="https://github.com/MIC-DKFZ/vidata/raw/main/imgs/Logos/DKFZ_Logo.png" width="500">
|
|
115
|
+
</p>
|
|
116
|
+
|
|
117
|
+
This repository is developed and maintained by the Applied Computer Vision Lab (ACVL)
|
|
118
|
+
of [Helmholtz Imaging](https://www.helmholtz-imaging.de/) and the
|
|
119
|
+
[Division of Medical Image Computing](https://www.dkfz.de/en/medical-image-computing) at DKFZ.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.copier-answers.yml
|
|
2
|
+
.gitignore
|
|
3
|
+
LICENSE
|
|
4
|
+
MANIFEST.in
|
|
5
|
+
README.md
|
|
6
|
+
pyproject.toml
|
|
7
|
+
tox.ini
|
|
8
|
+
.github/PULL_REQUEST_TEMPLATE.md
|
|
9
|
+
.github/dependabot.yml
|
|
10
|
+
.github/ISSUE_TEMPLATE/bug_report.yml
|
|
11
|
+
.github/ISSUE_TEMPLATE/documentation.md
|
|
12
|
+
.github/ISSUE_TEMPLATE/feature_request.md
|
|
13
|
+
.github/ISSUE_TEMPLATE/task.md
|
|
14
|
+
.github/workflows/test_and_deploy.yml
|
|
15
|
+
.napari-hub/DESCRIPTION.md
|
|
16
|
+
.napari-hub/config.yml
|
|
17
|
+
src/napari_mlarray/__init__.py
|
|
18
|
+
src/napari_mlarray/_reader.py
|
|
19
|
+
src/napari_mlarray/_version.py
|
|
20
|
+
src/napari_mlarray/_widget.py
|
|
21
|
+
src/napari_mlarray/_writer.py
|
|
22
|
+
src/napari_mlarray/napari.yaml
|
|
23
|
+
src/napari_mlarray.egg-info/PKG-INFO
|
|
24
|
+
src/napari_mlarray.egg-info/SOURCES.txt
|
|
25
|
+
src/napari_mlarray.egg-info/dependency_links.txt
|
|
26
|
+
src/napari_mlarray.egg-info/entry_points.txt
|
|
27
|
+
src/napari_mlarray.egg-info/requires.txt
|
|
28
|
+
src/napari_mlarray.egg-info/top_level.txt
|
|
29
|
+
tests/__init__.py
|
|
30
|
+
tests/test_default.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
napari_mlarray
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# For more information about tox, see https://tox.readthedocs.io/en/latest/
|
|
2
|
+
[tox]
|
|
3
|
+
envlist = py{310,311,312,313}-{linux,macos,windows}
|
|
4
|
+
isolated_build=true
|
|
5
|
+
|
|
6
|
+
[gh-actions]
|
|
7
|
+
python =
|
|
8
|
+
3.10: py310
|
|
9
|
+
3.11: py311
|
|
10
|
+
3.12: py312
|
|
11
|
+
3.13: py313
|
|
12
|
+
|
|
13
|
+
[gh-actions:env]
|
|
14
|
+
PLATFORM =
|
|
15
|
+
ubuntu-latest: linux
|
|
16
|
+
macos-latest: macos
|
|
17
|
+
windows-latest: windows
|
|
18
|
+
|
|
19
|
+
[testenv]
|
|
20
|
+
platform =
|
|
21
|
+
macos: darwin
|
|
22
|
+
linux: linux
|
|
23
|
+
windows: win32
|
|
24
|
+
passenv =
|
|
25
|
+
CI
|
|
26
|
+
GITHUB_ACTIONS
|
|
27
|
+
DISPLAY
|
|
28
|
+
XAUTHORITY
|
|
29
|
+
NUMPY_EXPERIMENTAL_ARRAY_FUNCTION
|
|
30
|
+
PYVISTA_OFF_SCREEN
|
|
31
|
+
dependency_groups =
|
|
32
|
+
dev
|
|
33
|
+
commands = pytest -v --color=yes --cov=napari_mlarray --cov-report=xml
|