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

Problems with loading 32bit grayscale TIFF #177

Open
alyst opened this issue Jan 12, 2020 · 5 comments
Open

Problems with loading 32bit grayscale TIFF #177

alyst opened this issue Jan 12, 2020 · 5 comments

Comments

@alyst
Copy link
Contributor

alyst commented Jan 12, 2020

The problems are with e.g. the TIFF image attached (generated by Incucyte S3 automatic live imaging microscope).

The original TIFF

Fiji does correctly load the image, but ImageMagick.jl (directly or via FileIO.load()) loads it as 1040×1408×2 Array{Gray{N0f32},3} with eltype Gray{Normed{UInt32,32}}.
The [:, :, 1] image is all 0xFFFFFFFF, the [:, :, 2] image is all zeros (this looks similar to #99).

@alyst
Copy link
Contributor Author

alyst commented Jan 13, 2020

The issue #173 seems related.

It could be that to read 32bit floating point TIFFs, ImageMagick has to be built with --enable-hdri --with-quantum-depth=32.

My current workaround is to install Python's ImRead, and then

using PyCall
py_imread = pyimport("imread")

fp_img = reinterpret(Float32, py_imread.imread(filename))

@timholy
Copy link
Member

timholy commented Jan 13, 2020

There's also ImageIO.jl

@alyst
Copy link
Contributor Author

alyst commented Jan 13, 2020

I was looking at ImageIO.jl today. It's definitely promising, but so far there's only wrapping functions around libtiff (yet incomplete -- key var_arg functions like TIFFGetField() are not wrapped), but no readimage() like for PNG.

@timholy
Copy link
Member

timholy commented Jan 13, 2020

Understood. Nevertheless, if I had to guess, I'd suspect that improving libtiff support would be the fastest route to fixing import of such images in "plain" julia. That said, PyCall works really well.

@tlnagy
Copy link

tlnagy commented Mar 23, 2020

Just a heads up, I've recently written a pure-Julia TIFF parser that should handle 32bit grayscale images such fine: https://github.com/tlnagy/TIFF.jl

It's still technically a WIP (you'll need to git clone it till I register it), but it should already be usable for reading most TIFFs

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

No branches or pull requests

3 participants