Git Product home page Git Product logo

bioio-czi's People

Contributors

brianwhitneyai avatar dependabot[bot] avatar seanleroy avatar

Watchers

 avatar  avatar  avatar

bioio-czi's Issues

update aicspylibczi

aicspylibczi is due for a fresh release. After its versioned release we should bump the version here and release this.

merge with aicspylibczi?

Feature Description

Crazy Idea: bring the aicspylibczi code into this repo so it can be maintained separately. Currently aicspylibczi is used by both aicsimageio and bioio-czi.

Use Case

Because this repo can act as a self-contained czi file reader, we don't necessarily need to have aicspylibczi as a dependency. It could all live in this single repo.

Solution

Copy all aicspylibczi code into here, set up and modernize the c++ build with python wrapper object (this is the only heavy lift). Adopt the gh-actions build and test matrix from aicspylibczi. Bring the libCZI dependency up to date.

Alternatives

The alternative is to continue to keep aicspylibczi as a separate dependency.

get time series interval into the xarray coordinates

Feature Description

CZI Metadata value T.Interval has the time in seconds between time samples in a timeseries image. We should use it along with physical_pixel_sizes to determine the xarray coordinate scaling.

This might be a bioio reader api change but I am initiating it from czi first.
We could also have the main api return a time interval from a single api call too.

Use Case

As we process more time series data, we would like to elevate this key piece of metadata to the same precedence as physical pixel sizes.

Solution

bioimage.physical_pixel_size
bioimage.time_interval
This may be connected to adding units as well.

ValidationError: 1 validation error for Laser

I have a set of hyperspectral images that cannot have their metadata read due to a ValidationError.

ValidationError: 1 validation error for Laser
wavelength
  value is not a valid float (type=type_error.float)
Click to expand full error:

[/home/kcutler/.pyenv/versions/3.10.11/lib/python3.10/site-packages/xsdata/formats/converter.py:85]/.pyenv/versions/3.10.11/lib/python3.10/site-packages/xsdata/formats/converter.py#line=84): ConverterWarning: Failed to convert value `` to one of (<class 'float'>,)
warnings.warn(

ValidationError Traceback (most recent call last)
Cell In[18], line 18
15 import bioio_czi
17 img = BioImage(filepath)#, reader=bioio_czi.Reader)
---> 18 img.ome_metadata

File [~/.pyenv/versions/3.10.11/lib/python3.10/site-packages/bioio/bio_image.py:828]/.pyenv/versions/3.10.11/lib/python3.10/site-packages/bioio/bio_image.py#line=827), in BioImage.ome_metadata(self)
813 @Property
814 def ome_metadata(self) -> OME:
815 """
816 Returns
817 -------
(...)
826 No metadata transformer available.
827 """
--> 828 return self.reader.ome_metadata

File [~/.pyenv/versions/3.10.11/lib/python3.10/site-packages/bioio_czi/reader.py:912]/.pyenv/versions/3.10.11/lib/python3.10/site-packages/bioio_czi/reader.py#line=911), in Reader.ome_metadata(self)
910 @Property
911 def ome_metadata(self) -> OME:
--> 912 return metadata_utils.transform_metadata_with_xslt(
913 self.metadata,
914 Path(file).parent / "czi-to-ome-xslt/xslt/czi-to-ome.xsl",
915 )

File [~/.pyenv/versions/3.10.11/lib/python3.10/site-packages/bioio_czi/utils.py:144]/.pyenv/versions/3.10.11/lib/python3.10/site-packages/bioio_czi/utils.py#line=143), in transform_metadata_with_xslt(tree, xslt)
141 ome_etree = transform(lxml_tree)
143 # Dump generated etree to string and read with ome-types
--> 144 ome = OME.from_xml(str(ome_etree))
146 # Regardless of error or succeed, move back to original process dir
147 finally:
148 os.chdir(process_dir)

File [~/.pyenv/versions/3.10.11/lib/python3.10/site-packages/ome_types/_mixins/_base_type.py:201]/.pyenv/versions/3.10.11/lib/python3.10/site-packages/ome_types/_mixins/_base_type.py#line=200), in OMEType.from_xml(cls, xml, **kwargs)
190 """Read an ome-types class from XML.
191
192 See docstring of [ome_types.from_xml][] for kwargs.
(...)
197 document it can provide additional typing information.
198 """
199 from ome_types._conversion import from_xml
--> 201 return cast(T, from_xml(xml, **kwargs))

File [~/.pyenv/versions/3.10.11/lib/python3.10/site-packages/ome_types/_conversion.py:134]/.pyenv/versions/3.10.11/lib/python3.10/site-packages/ome_types/_conversion.py#line=133), in from_xml(source, validate, parser, parser_kwargs, transformations, warn_on_schema_update)
132 OME_type = _get_root_ome_type(xml_2016)
133 parser = XmlParser(**(parser_kwargs or {}))
--> 134 return parser.parse(xml_2016, OME_type)

File [~/.pyenv/versions/3.10.11/lib/python3.10/site-packages/xsdata/formats/dataclass/parsers/bases.py:54]/.pyenv/versions/3.10.11/lib/python3.10/site-packages/xsdata/formats/dataclass/parsers/bases.py#line=53), in NodeParser.parse(self, source, clazz)
51 warnings.filterwarnings("error", category=ConverterWarning)
53 try:
---> 54 result = handler.parse(source)
55 except (ConverterWarning, SyntaxError) as e:
56 raise ParserError(e)

File [~/.pyenv/versions/3.10.11/lib/python3.10/site-packages/xsdata/formats/dataclass/parsers/handlers/lxml.py:52]/.pyenv/versions/3.10.11/lib/python3.10/site-packages/xsdata/formats/dataclass/parsers/handlers/lxml.py#line=51), in LxmlEventHandler.parse(self, source)
43 else:
44 ctx = etree.iterparse(
45 source,
46 EVENTS,
(...)
49 load_dtd=self.parser.config.load_dtd,
50 )
---> 52 return self.process_context(ctx)

File [~/.pyenv/versions/3.10.11/lib/python3.10/site-packages/xsdata/formats/dataclass/parsers/handlers/lxml.py:67]/.pyenv/versions/3.10.11/lib/python3.10/site-packages/xsdata/formats/dataclass/parsers/handlers/lxml.py#line=66), in LxmlEventHandler.process_context(self, context)
58 self.parser.start(
59 self.clazz,
60 self.queue,
(...)
64 element.nsmap,
65 )
66 elif event == EventType.END:
---> 67 self.parser.end(
68 self.queue,
69 self.objects,
70 element.tag,
71 element.text,
72 element.tail,
73 )
74 element.clear()
75 elif event == EventType.START_NS:

File [~/.pyenv/versions/3.10.11/lib/python3.10/site-packages/xsdata/formats/dataclass/parsers/bases.py:152]/.pyenv/versions/3.10.11/lib/python3.10/site-packages/xsdata/formats/dataclass/parsers/bases.py#line=151), in NodeParser.end(self, queue, objects, qname, text, tail)
139 """
140 End element notification receiver.
141
(...)
149 :param tail: Tail content
150 """
151 item = queue.pop()
--> 152 return item.bind(qname, text, tail, objects)

File [~/.pyenv/versions/3.10.11/lib/python3.10/site-packages/xsdata/formats/dataclass/parsers/nodes/element.py:87]/.pyenv/versions/3.10.11/lib/python3.10/site-packages/xsdata/formats/dataclass/parsers/nodes/element.py#line=86), in ElementNode.bind(self, qname, text, tail, objects)
85 self.bind_attrs(params)
86 self.bind_content(params, text, tail, objects)
---> 87 obj = self.config.class_factory(self.meta.clazz, params)
89 if self.derived_factory:
90 obj = self.derived_factory(qname=qname, value=obj, type=self.xsi_type)

File [~/.pyenv/versions/3.10.11/lib/python3.10/site-packages/xsdata/formats/dataclass/parsers/config.py:10]/.pyenv/versions/3.10.11/lib/python3.10/site-packages/xsdata/formats/dataclass/parsers/config.py#line=9), in default_class_factory(cls, params)
9 def default_class_factory(cls: Type[T], params: Dict) -> T:
---> 10 return cls(**params)

File [~/.pyenv/versions/3.10.11/lib/python3.10/site-packages/ome_types/_mixins/_kinded.py:22]/.pyenv/versions/3.10.11/lib/python3.10/site-packages/ome_types/_mixins/_kinded.py#line=21), in KindMixin.init(self, **data)
20 def init(self, **data: Any) -> None:
21 data.pop("kind", None)
---> 22 return super().init(**data)

File [~/.pyenv/versions/3.10.11/lib/python3.10/site-packages/ome_types/_mixins/_base_type.py:117]/.pyenv/versions/3.10.11/lib/python3.10/site-packages/ome_types/_mixins/_base_type.py#line=116), in OMEType.init(self, **data)
115 field_names = set(model_fields(self))
116 _move_deprecated_fields(data, field_names)
--> 117 super().init(**data)
118 kwargs = set(data.keys())
119 extra = kwargs - field_names

File [~/.pyenv/versions/3.10.11/lib/python3.10/site-packages/pydantic/main.py:341]/.pyenv/versions/3.10.11/lib/python3.10/site-packages/pydantic/main.py#line=340), in pydantic.main.BaseModel.init()

ValidationError: 1 validation error for Laser
wavelength
value is not a valid float (type=type_error.float)

Steps to reproduce:

from bioio import BioImage
import bioio_czi

img = BioImage(filepath, reader=bioio_czi.Reader)
img.ome_metadata

As a workaround, I have gotten the metadata out by using

from aicspylibczi import CziFile
czi = CziFile(filepath)
metadata = czi.reader.metadata()

So it seems that there is just something about parsing the metadata that is going wrong.

Environment:

  • OS Version: Ubuntu 20.04
  • bioio-czi Version: bioio-czi-1.0.1.dev10+g5a26a30

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.