-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Storage of pyramid data in OME-TIFF #74
Comments
Could I propose another way for your consideration. Using Sub-IFDs to store low-res pyramid levels would require no changes to OME-TIFF schema, keep images fully backward compatible and allow supporting software to access pyramids. In libbioimage I've chosen the Photoshop sub-ifd approach as the default one and so far it has been working great. |
Yes, use of the SubIFD tag could be considered (also suggested in ome/bioformats#2747 (comment)) instead of point (1) in the OME-TIFF section. This still requires a specification change, and points (2), (3) and part of (4) above may still be relevant in either case. |
Coming a bit late to the discussion. Thanks @dimin for your comments and the Sub-IFD suggestion. We completely agree that backwards compatibility should be considered as a requirement for this proposal. One comment regarding the semantics: we effectively maintain and discuss two related specifications: the OME Data Model and the OME-TIFF format. The initial idea is certainly to explore extensions of the OME-TIFF format specification without requiring any Data Model change (i.e. no new schema release). In that sense, using annotations and/or implicit conventions for the prototyping should be sufficient while working on enforcing rules for the numbers and order of the sub-resolutions. While we are still brainstorming/exploring alternatives, a completely different approach would be to make use of the Folder introduced in the 2016-06 as the container for the various pyramidal resolutions. In this case,
|
Thanks @mtbc for the alert and pointing me to this existing discussion. Looks like most of what I wrote was already being considered by @melissalinkert and @sbesson in the above. I'm hoping this is a good time to pick this topic up again. We specifically need something like this for our highly multiplex IF imaging workflow where we cyclic-ly (4-5 channels per cycle) acquire many (>30) channels from tissues or TMAs. Our pre-processing performs the image registration between the "cycles" and ideally would output the single pyramidal OME-TIFF image or a channel-stack of pyramidal single-channel (OME-)TIFFs which can then be imported into OMERO for downstream analysis, visualization with PathViewer or iViewer, etc. I'm about to start our programmers on implementing my proposed changes to libtiff and hopefully with @rleigh-codelibre 's help into OME Files. Any work on Bio-Formats and possible model changes is of course fully in your wheelhouse. |
@dsudar To keep you up to date, I've spent most of last week looking at how to implement SubIFD properly in TiffWriter, so we can create proper TIFF images with sub-resolutions, and I'm writing it up as I go. I'll follow up in a few days once I have something concrete to show and discuss. |
Thanks @rleigh-codelibre . So is it the team's preference to use the SubIFD structure for the sub-resolution images? I'm perfectly fine with that approach even though most existing ad-hoc implementations use a sequence of top-level IFDs so it might be harder to get the wider community on-board. I look forward to your findings. |
@dsudar Either approach should work, and there are tradeoffs for both. Using top-level IFDs is better for interoperability with software lacking SubIFD support, and also for being able to reference these IFDs from OME-XML. However, libtiff supports writing out SubIFDs properly as part of its basic functionality, and it's likely difficult to change that behaviour to write out top-level IFDs (though I still need to test this further). If we wish to care about Bio-Formats and OME Files C++ being able to create and read the same data, something which works for both is likely a prerequisite. Could I clarify a few points from your forum post?
Thanks, |
Hi @rleigh-codelibre. Thanks for the detailed comments.
Cheers, |
On the last item re: thumbnails: what I said is probably not correct. In regular TIFFs, aren't thumbnail images (if present) not always the first SubIFD? However, if we end up using SubIFDs for the subresolutions, then the thumbnail could simply be the last of the SubIFDs (or maybe better, keep it as the first??). |
@dsudar If using an EXIF thumbnail then I think you would use and |
@rleigh-codelibre Ah yes, thanks. I had not realized that the thumbnail is typically stuffed into the Exif IFD structure. Yes, indeed, that would make such a "general purpose" thumbnail fully independent from what we are discussing here. |
Based on the discussion so far, I have changed my original write-up so it specifies use of the SubIFD structure for the subresolutions and more. The new draft is enclosed here. And I just noticed @rleigh-codelibre 's write-up in the Code section. Looks great and addresses pretty much everything in detail. For clarity strategy C looks best to me but strategy B has the hidden benefit that it maintains some compatibility with the "subresolutions in top-level IFDs" approaches. |
@dsudar The design proposal for implementing sub-resolutions is now available at http://openmicroscopy.github.io/design/OME005/ (no changes since you looked at it under the |
Closing this issue given this has moved into a more formal proposal #74 (comment). As mentioned above, looking forward to hearing additional comments and feedback about http://openmicroscopy.github.io/design/OME005. |
Hi all, I'd like to add a few comments to @rleigh-codelibre 's excellent design doc OME005.
|
Dear Damir, Thanks for raising all these interesting points. To respond to them:
Kind regards, |
Dear Roger, |
Regarding (4), we can certainly extend the documentation to make it clear that this is possible. For (5) it is a possibility that TIFF pyramids could be used in the future to replace OMERO pyramids, but we will have to wait until we have a working pyramid implementation before we can think about testing it. Bio-Formats already has JPEG2000 support, so we could certainly make use of that to create JPEG2000-compressed pyramids. We can certainly discuss HDF5 at the user’s meeting. It might be best suited as an ad-hoc discussion with interested participants on Friday, but I can also look into running a workshop on HDF5-related matters if there is wider interest. Thanks, |
This issue has been mentioned on Image.sc Forum. There might be relevant details there: https://forum.image.sc/t/next-generation-file-formats-for-bioimaging/31361/1 |
Current status
With http://github.com/openmicroscopy/bioformats/pull/2747, pyramid data can be stored in a hybrid format that combines the Faas lab pyramid TIFF format (cf. "the fish") with OME-TIFF. The storage of pixel data is consistent with Faas pyramid TIFFs: there is one IFD per plane per pyramid resolution, with planes ordered like so:
IFD 0 = plane 0, largest resolution
...
IFD n = plane n, largest resolution
...
IFD (r * plane_count + n) = plane n, resolution r
An OME-XML comment is included in the first IFD, consistent with OME-TIFF. This provides any additional metadata, including the
SizeZ
,SizeC
,SizeT
, andDimensionOrder
necessary for determining how IFDs should be mapped to a specificImage
and ZCT index.TiffData
elements in the OME-XML are ignored; IFD orderings other than the natural order implied byDimensionOrder
are not supported. Multiple pyramids and extraImages
outside the pyramid are also not supported.Detection of hybrid pyramid TIFF files is done via the
Software
IFD tag. IfPyramidTiffReader
is missing from the list of valid readers, then the files would be detected as OME-TIFF.This was chosen as a temporary solution for storing pyramid data as it required minimal changes to the existing
PyramidTiffReader
and did not incur the extensive testing burden of modifyingOMETiffReader
. A complete solution for storing pyramid data would require changes to the OME data model, OME-TIFF specification,OMETiffReader
, andOMETiffWriter
. Proposed model and specification changes follow.Proposed changes to support pyramids in OME-TIFF
All IFDs containing a pyramid sub-resolution must set the
NewSubfileType
tag (254) with a value of 1 (if the image count is 1) or 2 (if the image count is greater than 1). See page 36 ofdata_repo/curated/specs/tiff.pdf
).The number of sub-resolutions for each full resolution image must be specified in the OME-XML. The specific use case for which http://github.com/openmicroscopy/bioformats/pull/2747 was intended only requires a single pyramid per file, but in general it is possible to have multiple pyramids stored together (cf. CZI, VSI) which can each potentially contain a different number of sub-resolutions. The sub-resolution count could be specified as either a new attribute or an annotation on
Image
.The specification should explicitly define that the number of
Images
must match the number of pyramids, and not the sum of all resolution counts. This is consistent with the OME-XML generated by Bio-Formats when resolution flattening is disabled.Ordering and mapping of sub-resolution IFDs must be defined. In the long term, a
FirstResolution
attribute could be added toTiffData
, which would allow for explicit mapping such that the IFDs can be stored in any order. In the medium term, annotations similar toTiffData
could be added to Image (similar toModulo
). In the short term, all resolutions could be assumed to be stored in order from largest to smallest, with the plane ordering within a resolution being defined by existingTiffData
elements and assumed to be constant across all resolutions.Possible changes to hybrid pyramid format
If we decide to reject http://github.com/openmicroscopy/bioformats/pull/2747 outright, this section is not relevant. Otherwise, these changes could be implemented easily to address some of the concerns there before any OME-TIFF model/specification changes are complete.
If the type detection of hybrid pyramid TIFF vs. OME-TIFF is too problematic, an option is to move the OME-XML from the comment (
ImageDescription
tag) to some other tag that would not be checked byOMETiffReader
. This should preventOMETiffReader
from picking up pyramid TIFFs in all cases, and would allow changes toreaders.txt
to be reverted.A new extension could be used for pyramid TIFFs which makes it clear that this is a new custom format.
/cc @sbesson, @chris-allan, @rleigh-codelibre, @emilroz, @dgault
The text was updated successfully, but these errors were encountered: