-
Notifications
You must be signed in to change notification settings - Fork 79
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
add support for loading OME-TIFFs #147
Conversation
See more discussion in JuliaIO#144
This needs to wait till tlnagy/OMETIFF.jl#7 is merged and a OMETIFF.jl is tagged and merged into Metadata.jl. |
Since OME-TIFFs are essentially identical to normal TIFFs only with additional metadata, they have identical magic bytes to normal TIFFs so I had to modify the TIFF loader as well to check whether a file has the TIFF magic bytes and does not contain ".ome.tiff" or ".ome.tif" in the filename
ffc.pcx is released under a CC0 license from here: http://www.fileformatcommons.com/pcx-file-format/ |
JuliaIO/FileIO.jl#147 now uses format"OMETIFF" to differentiate ome-tiffs from normal tiffs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am so looking forward to this!
src/registry.jl
Outdated
@@ -154,6 +147,21 @@ add_format(format"FLAC","fLaC",".flac",[:FLAC]) | |||
|
|||
### Complex cases | |||
|
|||
# Handle OME-TIFFs, which are identical to normal TIFFs with the primary difference being the filename and embedded XML metadata | |||
tiff_magic = (UInt8[0x4d,0x4d,0x00,0x2a], UInt8[0x4d,0x4d,0x00,0x2b], UInt8[0x49,0x49,0x2a,0x00],UInt8[0x49,0x49,0x2b,0x00]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add const
in front of this? Doing so should make detecttiff
faster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing!
test/query.jl
Outdated
open(q) do io | ||
@test position(io) == 0 | ||
skipmagic(io) | ||
@test position(io) == 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that each function has its own type, we could change how skipmagic
works:
skipmagic(io, ::typeof(detect_ometiff)) = seek(io, 4)
skipmagic(io, ::typeof(detect_noometiff)) = seek(io, 4)
and then I think the original test would pass?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where would it be best to put these skipmagic
definitions? In registry.jl
or query.jl
where skipmagic is defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These specializations probably have to go in registry.jl
, since we need detect_ometiff
to be defined already.
needed since no unified way exists for detecting magic length in custom detection functions as now implemented for TIFFs/OME-TIFFs
6dfaede
to
517f1df
Compare
Hey @timholy, I made the changes you suggested. I think the failures on nightly aren't related to this PR. |
This is great, thanks! |
See more discussion in #144