Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.

Commit fc545b0

Browse files
authored
feature/cleanup-np2 (#50)
* Change README to remove plugin variant * Use fsspec size instead of Path stat size
1 parent ea06866 commit fc545b0

4 files changed

Lines changed: 15 additions & 13 deletions

File tree

.napari/DESCRIPTION.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121

2222
_While upstream `aicsimageio` is released under BSD-3 license, this plugin is released under GPLv3 license because it installs all format reader dependencies._
2323

24-
### Plugin Variants
24+
### Reading Mode Threshold
2525

26-
![screenshot of plugin sorter showing that napari-aicsimageio-in-memory should be placed above napari-aicsimageio-out-of-memory](https://raw.githubusercontent.com/AllenCellModeling/napari-aicsimageio/main/images/plugin-sorter.png)
26+
This image reading plugin will load the provided image directly into memory if it meets
27+
the following two conditions:
2728

28-
There are two variants of this plugin that are added during installation:
29+
1. The filesize is less than 4GB.
30+
2. The filesize is less than 30% of machine memory available.
2931

30-
- `aicsimageio-in-memory`, which reads an image fully into memory
31-
- `aicsimageio-out-of-memory`, which delays reading ZYX chunks until required.
32-
This allows for incredibly large files to be read and displayed.
32+
If either of these conditions isn't met, the image is loaded in chunks only as needed.
3333

3434
## Examples of Features
3535

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ _While upstream `aicsimageio` is released under BSD-3 license, this plugin is re
3636
**Stable Release:** `pip install napari-aicsimageio` or `conda install napari-aicsimageio -c conda-forge`<br>
3737
**Development Head:** `pip install git+https://github.com/AllenCellModeling/napari-aicsimageio.git`
3838

39-
### Plugin Variants
39+
### Reading Mode Threshold
4040

41-
![screenshot of plugin sorter showing that napari-aicsimageio-in-memory should be placed above napari-aicsimageio-out-of-memory](https://raw.githubusercontent.com/AllenCellModeling/napari-aicsimageio/main/images/plugin-sorter.png)
41+
This image reading plugin will load the provided image directly into memory if it meets
42+
the following two conditions:
4243

43-
There are two variants of this plugin that are added during installation:
44+
1. The filesize is less than 4GB.
45+
2. The filesize is less than 30% of machine memory available.
4446

45-
- `aicsimageio-in-memory`, which reads an image fully into memory
46-
- `aicsimageio-out-of-memory`, which delays reading ZYX chunks until required.
47-
This allows for incredibly large files to be read and displayed.
47+
If either of these conditions isn't met, the image is loaded in chunks only as needed.
4848

4949
## Examples of Features
5050

images/plugin-sorter.png

-395 KB
Binary file not shown.

napari_aicsimageio/core.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,11 @@ def reader_function(
208208
return None
209209

210210
if in_memory is None:
211+
from aicsimageio.utils.io_utils import pathlike_to_fs
211212
from psutil import virtual_memory
212213

213-
imsize = Path(path).stat().st_size
214+
fs, path = pathlike_to_fs(path)
215+
imsize = fs.size(path)
214216
available_mem = virtual_memory().available
215217
_in_memory = (
216218
imsize <= IN_MEM_THRESHOLD_SIZE_BYTES

0 commit comments

Comments
 (0)