tlnagy / OMETIFF.jl

I/O operations for OME-TIFF files in Julia
Other
24 stars 7 forks source link

Change in tiff reading since 0.3.5 #111

Open warnerwarner opened 2 months ago

warnerwarner commented 2 months ago

Hi,

I've been using OMETIFF with Images to read in some ome.tiff files. I initially had been using v0.3.5 which was correctly reading my files in. However, I recently updated to v0.4.5 which seems to read all of my data values as close to 0s? I replicated my environment but with OMETIFF downgraded and it worked correctly again.

Here is my example code : using Images tiff_file = "example_tiff.ome.tiff" ome = Images.load(tiff_file); img = Float64.(ome.data); img[1:10, 100, 50, 20, 2] Which the output with OMETIFF = 0.3.5 is: 0.0 0.0 9.9402579968e10 2.27090563072e11 3.4585493504e11 3.74746185728e11 3.22445049856e11 1.2199846912e10 0.0 0.0

Which I validated was correct with another ome.tiff viewer.

However, if I repeat this same code in an enviroment with OMETIFF=0.4.5 I get the following output: 0.0 0.0 1.816473723e-314 2.733680534326e-312 4.766792508506e-312 1.361377490515e-312 1.375216308147e-312 6.86310032404e-313 0.0 0.0

The only differences with my environments is the version of OMETIFF:

(working_env) pkg> status Project viewer_3d v0.1.0 Status~/Documents/Github/3d_volumes/viewer_3d/Project.toml [e9467ef8] GLMakie v0.10.4 [916415d5] Images v0.26.1 ⌃ [2d0ec36b] OMETIFF v0.3.14 Info Packages marked with ⌃ have new versions available and may be upgradable.

(not_working_env) pkg> status Status~/Documents/Github/3d_volumes/viewer_3d_BIG/Project.toml [e9467ef8] GLMakie v0.10.4 [916415d5] Images v0.26.1 [2d0ec36b] OMETIFF v0.4.5

I'd appreciate any guidance. I'm not super familiar with this kind of work, but because the 0s are still being correctly read as 0s, I'm guessing its misinterpreting the bit values?

warnerwarner commented 1 month ago

Hi,

Just to add, I'm pretty certain its the little vs big Endian read - if I use bswap on the values I get the correct values. A fix for now is just to bswap.(img) but it would be good to include this somewhere.

Thanks