napari-memmap-tiff 1.0.0__py3-none-any.whl

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,7 @@
1
+ try:
2
+ from ._version import version as __version__
3
+ except ImportError:
4
+ __version__ = "unknown"
5
+ from ._widget import memmap_config_widget
6
+
7
+ __all__ = ("memmap_config_widget",)
File without changes
@@ -0,0 +1,12 @@
1
+ from napari_memmap_tiff._widget import memmap_config_widget
2
+
3
+
4
+ def test_memmap_config_widget():
5
+ from imageio.config.plugins import known_plugins
6
+
7
+ widget = memmap_config_widget()
8
+
9
+ widget(True)
10
+ assert "tifffile_memmap" in known_plugins
11
+ widget(False)
12
+ assert "tifffile_memmap" not in known_plugins
@@ -0,0 +1,21 @@
1
+ # file generated by setuptools-scm
2
+ # don't change, don't track in version control
3
+
4
+ __all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
5
+
6
+ TYPE_CHECKING = False
7
+ if TYPE_CHECKING:
8
+ from typing import Tuple
9
+ from typing import Union
10
+
11
+ VERSION_TUPLE = Tuple[Union[int, str], ...]
12
+ else:
13
+ VERSION_TUPLE = object
14
+
15
+ version: str
16
+ __version__: str
17
+ __version_tuple__: VERSION_TUPLE
18
+ version_tuple: VERSION_TUPLE
19
+
20
+ __version__ = version = '1.0.0'
21
+ __version_tuple__ = version_tuple = (1, 0, 0)
@@ -0,0 +1,56 @@
1
+ from typing import TYPE_CHECKING
2
+
3
+ import numpy as np
4
+ from imageio.config.extensions import extension_list
5
+ from imageio.config.plugins import PluginConfig, known_plugins
6
+ from imageio.plugins.tifffile_v3 import TifffilePlugin
7
+ from magicgui import magic_factory
8
+
9
+ if TYPE_CHECKING:
10
+ pass
11
+
12
+
13
+ class MemmapTifffilePlugin(TifffilePlugin):
14
+
15
+ def read(self, *args, **kwargs) -> np.ndarray:
16
+ return super().read(*args, **kwargs, out="memmap")
17
+
18
+
19
+ @magic_factory(auto_call=True, persist=False)
20
+ def memmap_config_widget(
21
+ enable_memory_map: bool,
22
+ ) -> None:
23
+ """
24
+ Sets whether to use memory mapping.
25
+
26
+ :param enable_memory_map: If enabled, tiff or tif files will be loaded as
27
+ memory mapped data directly from disk, instead of loading it fully into
28
+ memory at once.
29
+ """
30
+ if enable_memory_map:
31
+ if "tifffile_memmap" in known_plugins:
32
+ return
33
+
34
+ known_plugins["tifffile_memmap"] = PluginConfig(
35
+ name="tifffile_memmap",
36
+ class_name="MemmapTifffilePlugin",
37
+ module_name="napari_memmap_tiff._widget",
38
+ is_legacy=False,
39
+ )
40
+ for ext in extension_list:
41
+ if (
42
+ ext.extension in (".tif", ".tiff")
43
+ and "tifffile_memmap" not in ext.priority
44
+ ):
45
+ ext.priority.insert(0, "tifffile_memmap")
46
+ else:
47
+ if "tifffile_memmap" not in known_plugins:
48
+ return
49
+
50
+ del known_plugins["tifffile_memmap"]
51
+ for ext in extension_list:
52
+ if (
53
+ ext.extension in (".tif", ".tiff")
54
+ and "tifffile_memmap" in ext.priority
55
+ ):
56
+ ext.priority.remove("tifffile_memmap")
@@ -0,0 +1,14 @@
1
+ name: napari-memmap-tiff
2
+ display_name: Loading tiffs using memory map
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: ["Annotation", "Segmentation", "Acquisition"]
7
+ contributions:
8
+ commands:
9
+ - id: napari-memmap-tiff.make_function_widget
10
+ python_name: napari_memmap_tiff:memmap_config_widget
11
+ title: Make memmap config widget
12
+ widgets:
13
+ - command: napari-memmap-tiff.make_function_widget
14
+ display_name: Enable / disable memory mapping tiffs
@@ -0,0 +1,138 @@
1
+ Metadata-Version: 2.4
2
+ Name: napari-memmap-tiff
3
+ Version: 1.0.0
4
+ Summary: When installed and enabled in the options, it adds an option that when enabled will make napari load tiffs via memory mapping instead of fully into RAM.
5
+ Author: Matthew Einhorn
6
+ Author-email: matt@einhorn.dev
7
+ License:
8
+ The MIT License (MIT)
9
+
10
+ Copyright (c) 2025 Matthew Einhorn
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
+ Project-URL: Bug Tracker, https://github.com/matham/napari-memmap-tiff/issues
31
+ Project-URL: Documentation, https://github.com/matham/napari-memmap-tiff#README.md
32
+ Project-URL: Source Code, https://github.com/matham/napari-memmap-tiff
33
+ Project-URL: User Support, https://github.com/matham/napari-memmap-tiff/issues
34
+ Classifier: Development Status :: 2 - Pre-Alpha
35
+ Classifier: Framework :: napari
36
+ Classifier: Intended Audience :: Developers
37
+ Classifier: License :: OSI Approved :: MIT License
38
+ Classifier: Operating System :: OS Independent
39
+ Classifier: Programming Language :: Python
40
+ Classifier: Programming Language :: Python :: 3
41
+ Classifier: Programming Language :: Python :: 3 :: Only
42
+ Classifier: Programming Language :: Python :: 3.10
43
+ Classifier: Programming Language :: Python :: 3.11
44
+ Classifier: Programming Language :: Python :: 3.12
45
+ Classifier: Programming Language :: Python :: 3.13
46
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
47
+ Requires-Python: >=3.10
48
+ Description-Content-Type: text/markdown
49
+ License-File: LICENSE
50
+ Requires-Dist: numpy
51
+ Requires-Dist: magicgui
52
+ Requires-Dist: qtpy
53
+ Requires-Dist: scikit-image
54
+ Requires-Dist: tifffile
55
+ Provides-Extra: testing
56
+ Requires-Dist: tox; extra == "testing"
57
+ Requires-Dist: pytest; extra == "testing"
58
+ Requires-Dist: pytest-cov; extra == "testing"
59
+ Requires-Dist: pytest-qt; extra == "testing"
60
+ Requires-Dist: napari; extra == "testing"
61
+ Requires-Dist: pyqt5; extra == "testing"
62
+ Dynamic: license-file
63
+
64
+ # napari-memmap-tiff
65
+
66
+ [![License MIT](https://img.shields.io/pypi/l/napari-memmap-tiff.svg?color=green)](https://github.com/matham/napari-memmap-tiff/raw/main/LICENSE)
67
+ [![PyPI](https://img.shields.io/pypi/v/napari-memmap-tiff.svg?color=green)](https://pypi.org/project/napari-memmap-tiff)
68
+ [![Python Version](https://img.shields.io/pypi/pyversions/napari-memmap-tiff.svg?color=green)](https://python.org)
69
+ [![tests](https://github.com/matham/napari-memmap-tiff/workflows/tests/badge.svg)](https://github.com/matham/napari-memmap-tiff/actions)
70
+ [![codecov](https://codecov.io/gh/matham/napari-memmap-tiff/branch/main/graph/badge.svg)](https://codecov.io/gh/matham/napari-memmap-tiff)
71
+ [![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/napari-memmap-tiff)](https://napari-hub.org/plugins/napari-memmap-tiff)
72
+ [![npe2](https://img.shields.io/badge/plugin-npe2-blue?link=https://napari.org/stable/plugins/index.html)](https://napari.org/stable/plugins/index.html)
73
+ [![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-purple.json)](https://github.com/copier-org/copier)
74
+
75
+ When installed and enabled in the options, it adds an option that when enabled
76
+ will make napari load tiffs via memory mapping instead of fully into RAM.
77
+
78
+ That is, `.tif` and `.tiff` files will be loaded into memory using memory
79
+ mapping, which loads the data directly from disk instead of loading the file
80
+ at once into RAM. This is beneficial for large files that may not fit into
81
+ available RAM.
82
+
83
+ ----------------------------------
84
+
85
+ This [napari] plugin was generated with [copier] using the [napari-plugin-template].
86
+
87
+ <!--
88
+ Don't miss the full getting started guide to set up your new package:
89
+ https://github.com/napari/napari-plugin-template#getting-started
90
+
91
+ and review the napari docs for plugin developers:
92
+ https://napari.org/stable/plugins/index.html
93
+ -->
94
+
95
+ ## Installation
96
+
97
+ You can install `napari-memmap-tiff` via [pip]:
98
+
99
+ pip install napari-memmap-tiff
100
+
101
+
102
+
103
+ To install latest development version :
104
+
105
+ pip install git+https://github.com/matham/napari-memmap-tiff.git
106
+
107
+
108
+ ## Contributing
109
+
110
+ Contributions are very welcome. Tests can be run with [tox], please ensure
111
+ the coverage at least stays the same before you submit a pull request.
112
+
113
+ ## License
114
+
115
+ Distributed under the terms of the [MIT] license,
116
+ "napari-memmap-tiff" is free and open source software
117
+
118
+ ## Issues
119
+
120
+ If you encounter any problems, please [file an issue] along with a detailed description.
121
+
122
+ [napari]: https://github.com/napari/napari
123
+ [copier]: https://copier.readthedocs.io/en/stable/
124
+ [@napari]: https://github.com/napari
125
+ [MIT]: http://opensource.org/licenses/MIT
126
+ [BSD-3]: http://opensource.org/licenses/BSD-3-Clause
127
+ [GNU GPL v3.0]: http://www.gnu.org/licenses/gpl-3.0.txt
128
+ [GNU LGPL v3.0]: http://www.gnu.org/licenses/lgpl-3.0.txt
129
+ [Apache Software License 2.0]: http://www.apache.org/licenses/LICENSE-2.0
130
+ [Mozilla Public License 2.0]: https://www.mozilla.org/media/MPL/2.0/index.txt
131
+ [napari-plugin-template]: https://github.com/napari/napari-plugin-template
132
+
133
+ [file an issue]: https://github.com/matham/napari-memmap-tiff/issues
134
+
135
+ [napari]: https://github.com/napari/napari
136
+ [tox]: https://tox.readthedocs.io/en/latest/
137
+ [pip]: https://pypi.org/project/pip/
138
+ [PyPI]: https://pypi.org/
@@ -0,0 +1,12 @@
1
+ napari_memmap_tiff/__init__.py,sha256=QjsJIUwEYceKGbOvURi2pHFOa2XFhBXiHyzzPsgnM4I,181
2
+ napari_memmap_tiff/_version.py,sha256=fo5PXsZuloQZu3LdpIFTUAXvJmY2L9N5sNGe2tvdU98,511
3
+ napari_memmap_tiff/_widget.py,sha256=hEotDzhU3CmwV-gdB9SpZ1824b7v2rtyW4rgWWUORDA,1710
4
+ napari_memmap_tiff/napari.yaml,sha256=WW43IHcG3Hi_8LEgUVopoUrsQsXd-ZteKOcWj3fKYn8,612
5
+ napari_memmap_tiff/_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ napari_memmap_tiff/_tests/test_widget.py,sha256=rltLZlP8bLvyRK4WVpX4I8fAjSRTQzBpgcXxTviz8A0,317
7
+ napari_memmap_tiff-1.0.0.dist-info/licenses/LICENSE,sha256=AKMeoFqPgD4lKUkLDHO1Hj5-Noqm2LFV8_qK6VlposU,1083
8
+ napari_memmap_tiff-1.0.0.dist-info/METADATA,sha256=WEeWqtbFQKaRFOI-qSwtSSNoW7HSGEfpieGmRcjer-E,6339
9
+ napari_memmap_tiff-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
+ napari_memmap_tiff-1.0.0.dist-info/entry_points.txt,sha256=F2ggm_mIQqjB0RzmAKAAWYA6Ut2NKT25xlUz0i5nvLo,70
11
+ napari_memmap_tiff-1.0.0.dist-info/top_level.txt,sha256=xgp7Jn5_5Cyj_qhu67lx2Wz176Gp4aecnmVF95jB_K4,19
12
+ napari_memmap_tiff-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [napari.manifest]
2
+ napari-memmap-tiff = napari_memmap_tiff:napari.yaml
@@ -0,0 +1,22 @@
1
+
2
+ The MIT License (MIT)
3
+
4
+ Copyright (c) 2025 Matthew Einhorn
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 @@
1
+ napari_memmap_tiff