- OmeCache: detect changes in ome.xml

This commit is contained in:
Wim Pomp
2024-04-10 15:20:12 +02:00
parent 37364d9cfa
commit db4bd63b94
4 changed files with 9 additions and 8 deletions

View File

@@ -10,9 +10,9 @@ jobs:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies

View File

@@ -24,7 +24,7 @@ pip install ndbioimage
```
import matplotlib.pyplot as plt
from ndbioimage import Imread
with Imread('image_file.tif', axes='ctxy', dtype=int) as im:
with Imread('image_file.tif', axes='ctyx', dtype=int) as im:
plt.imshow(im[2, 1])
```
@@ -41,7 +41,7 @@ with Imread('image_file.tif') as im:
```
from ndbioimage import Imread
with Imread('image_file.tif', axes='cztxy') as im:
with Imread('image_file.tif', axes='cztyx') as im:
sliced_im = im[1, :, :, 100:200, 100:200]
```
@@ -53,7 +53,7 @@ sliced_im is an instance of Imread which will load any image data from file only
```
from ndbioimage import Imread
import numpy as np
with Imread('image_file.tif', axes='cztxy') as im:
with Imread('image_file.tif', axes='cztyx') as im:
array = np.asarray(im[0, 0])
```

View File

@@ -159,9 +159,10 @@ class OmeCache(DequeDict):
return super().__contains__(self.path_and_lstat(path))
@staticmethod
def path_and_lstat(path: str | Path) -> tuple[Path, Optional[os.stat_result]]:
def path_and_lstat(path: str | Path) -> tuple[Path, Optional[os.stat_result], Optional[os.stat_result]]:
path = Path(path)
return path, (path.lstat() if path.exists() else None)
return (path, (path.lstat() if path.exists() else None),
(path.with_suffix('.ome.xml').lstat() if path.with_suffix('.ome.xml').exists() else None))
class Imread(np.lib.mixins.NDArrayOperatorsMixin, ABC):

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "ndbioimage"
version = "2024.4.3"
version = "2024.4.4"
description = "Bio image reading, metadata and some affine registration."
authors = ["W. Pomp <w.pomp@nki.nl>"]
license = "GPLv3"