From db4bd63b94baa4bd86da8584219488a1842e3152 Mon Sep 17 00:00:00 2001 From: Wim Pomp Date: Wed, 10 Apr 2024 15:20:12 +0200 Subject: [PATCH] - OmeCache: detect changes in ome.xml --- .github/workflows/pytest.yml | 4 ++-- README.md | 6 +++--- ndbioimage/__init__.py | 5 +++-- pyproject.toml | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index eeca7d0..9a54b74 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -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 diff --git a/README.md b/README.md index 6577c4f..93b337e 100644 --- a/README.md +++ b/README.md @@ -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]) ``` diff --git a/ndbioimage/__init__.py b/ndbioimage/__init__.py index 1267c95..3b4474b 100755 --- a/ndbioimage/__init__.py +++ b/ndbioimage/__init__.py @@ -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): diff --git a/pyproject.toml b/pyproject.toml index 9d2703d..e8ac9d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 "] license = "GPLv3"