Skip to content
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

Merged
merged 4 commits into from
Aug 22, 2017

Conversation

tlnagy
Copy link
Contributor

@tlnagy tlnagy commented Aug 3, 2017

See more discussion in #144

@tlnagy
Copy link
Contributor Author

tlnagy commented Aug 3, 2017

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
@tlnagy
Copy link
Contributor Author

tlnagy commented Aug 3, 2017

ffc.pcx is released under a CC0 license from here: http://www.fileformatcommons.com/pcx-file-format/

tlnagy added a commit to tlnagy/OMETIFF.jl that referenced this pull request Aug 4, 2017
JuliaIO/FileIO.jl#147 now uses format"OMETIFF"
to differentiate ome-tiffs from normal tiffs
Copy link
Member

@timholy timholy left a 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])
Copy link
Member

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.

Copy link
Contributor Author

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
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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
@tlnagy
Copy link
Contributor Author

tlnagy commented Aug 21, 2017

Hey @timholy, I made the changes you suggested. I think the failures on nightly aren't related to this PR.

@timholy timholy merged commit bf2c3b3 into JuliaIO:master Aug 22, 2017
@timholy
Copy link
Member

timholy commented Aug 22, 2017

This is great, thanks!

@tlnagy tlnagy deleted the tn/add-ometiff-support branch August 22, 2017 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants