tlambert03 / nd2

Full-featured nd2 (Nikon NIS Elements) file reader for python. Outputs to numpy, dask, and xarray. Exhaustive metadata extraction
https://tlambert03.github.io/nd2
BSD 3-Clause "New" or "Revised" License
54 stars 15 forks source link

feat: export to OME-TIFF, include full metadata as StructuredAnnotation #215

Closed tlambert03 closed 7 months ago

tlambert03 commented 7 months ago

This is tracking a feature request from @phisanti (that I also think is a good idea) for exporting as much metadata as we can gather in the ome_types.OME object that we export from ND2File.ome_metadata().

However, while https://github.com/tlambert03/ome-types/pull/249 does make this a bit easier... we still have issues because:

  1. MapAnnotation/Value children must all be M and the value of M must be a plain string... this means that nested dicts are not allowed.
  2. related to the first point, we can only pass strings or other things that can be cast to strings (like integers) as a value. So all of the array values in the unstructured metadata are also not allowed.

So, I think we either have to just dump it all into a single json string, or do a ton of value checking and either exclude or selectively cat to json the stuff that the OME model doesn't take naturally.