- read metadata from first file in ome tiff sequence
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import re
|
||||
import warnings
|
||||
from abc import ABC
|
||||
from functools import cached_property
|
||||
from itertools import product
|
||||
@@ -6,8 +8,8 @@ from pathlib import Path
|
||||
import numpy as np
|
||||
import tifffile
|
||||
import yaml
|
||||
import warnings
|
||||
from ome_types import model, from_xml
|
||||
from lfdfiles import TiffFile
|
||||
from ome_types import from_xml, model
|
||||
|
||||
from .. import AbstractReader, try_default
|
||||
|
||||
@@ -31,10 +33,16 @@ class Reader(AbstractReader, ABC):
|
||||
|
||||
def get_ome(self):
|
||||
if self.reader.is_ome:
|
||||
match = re.match(r'^(.*)(pos.*)$', self.path.stem, flags=re.IGNORECASE)
|
||||
if match is not None and len(match.groups()) == 2:
|
||||
a, b = match.groups()
|
||||
file0 = TiffFile(self.path.with_stem(a + re.sub(r'\d', '0', b)))
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter('ignore', category=UserWarning)
|
||||
return from_xml(self.reader.ome_metadata)
|
||||
else:
|
||||
ome = from_xml(file0.ome_metadata)
|
||||
ome.images = [image for image in ome.images if self.path.stem[:len(image.name)] == image.name]
|
||||
return ome
|
||||
|
||||
page = self.reader.pages[0]
|
||||
size_y = page.imagelength
|
||||
size_x = page.imagewidth
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "ndbioimage"
|
||||
version = "2025.3.0"
|
||||
version = "2025.3.1"
|
||||
description = "Bio image reading, metadata and some affine registration."
|
||||
authors = [
|
||||
{ name = "W. Pomp", email = "w.pomp@nki.nl" }
|
||||
|
||||
Reference in New Issue
Block a user