Repository navigation
tifffile plugin: Various fixes - #567
Conversation
|
Thinking of it, I see two options for reading metadata:
|
I think you're right here. Does Tiff have a notion of global meta data, or would this come down to the metadata of the first image. In
I think option 1 is best, since there is a way to read the global meta data. (Albeit this might perhaps be documented better.) |
and only if no metadata was given for first frame.
This has been tifffile's default since version 2020.9.3 and allows for e.g. per-frame metadata.
if available. `save` was deprecated in tifffile version 2020.9.30.
|
I don't know much about TIFF, but as far as I gather from tifffile, there is no real global metadata, but the first frame is used. As of now, global metadata will be written with the first frame, but only if no metadata was passed to |
|
I fixed two more things:
|
|
Looking good. Thanks @lschr ! |
Reader.get_meta_data(i)already worked correctly, butReader.get_data(i).metacontained the result of the last call toReader.get_meta_dataregardless ofi.Writer.append_data(img, meta)set the global metadata tometa, which was also not what I would expect.Here is a possible fix which hopefully does not break anything. With this, any frame written to a file using
append_data(…, meta=None)will have the global metadata associated with it. This is debatable but resembles the old behavior. The alternative would be to write the global metadata only for frame 0 and no metadata for other frames unless explicitly given—which I think would actually make more sense.