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

TiffImages fails to open a bfconvert converted OME-TIFF #151

Open
adityanprasad opened this issue Mar 5, 2024 · 1 comment
Open

TiffImages fails to open a bfconvert converted OME-TIFF #151

adityanprasad opened this issue Mar 5, 2024 · 1 comment

Comments

@adityanprasad
Copy link

I used the bftools command-line tool bfconvert to convert a Zeiss CZI mosaic into an OME-TIFF. I'm having trouble reading into Julia using either OMETIFF.jl or TiffImages.jl. The error message is attached below (same error for OMETIFF and TiffImages.jl). I am using Julia 1.10.1 on MacOS. The image I used is available here: https://drive.google.com/file/d/1PD7BthTuj-UgJhltqyp64oqmv2MwF1Es/view?usp=sharing. pyometiff seems to be able to read the image.

Thanks for all your work on these packages!

In [3]: img = TiffImages.load("/Users/adityaprasad/Downloads/output1.ome.tiff")
ERROR: BoundsError: attempt to access 0-element Vector{TiffImages.Tag} at index [1]
Stacktrace:
  [1] getindex
    @ ./essentials.jl:13 [inlined]
  [2] first
    @ ./abstractarray.jl:452 [inlined]
  [3] getindex
    @ ~/.julia/packages/TiffImages/yETMK/src/ifds.jl:69 [inlined]
  [4] getindex
    @ ~/.julia/packages/TiffImages/yETMK/src/ifds.jl:68 [inlined]
  [5] read!(target::Matrix{TiffImages.Palette{…}}, tf::TiffFile{UInt32, FileIO.Stream{…}}, ifd::TiffImages.IFD{UInt32})
    @ TiffImages ~/.julia/packages/TiffImages/yETMK/src/ifds.jl:207
  [6] macro expansion
    @ ~/.julia/packages/TiffImages/yETMK/src/load.jl:85 [inlined]
  [7] macro expansion
    @ ~/.julia/packages/ProgressMeter/vnCY0/src/ProgressMeter.jl:957 [inlined]
  [8] load(tf::TiffFile{UInt32, FileIO.Stream{…}}, ifds::Vector{TiffImages.IFD{…}}, N::Int64; verbose::Bool)
    @ TiffImages ~/.julia/packages/TiffImages/yETMK/src/load.jl:84
  [9] load
    @ ~/.julia/packages/TiffImages/yETMK/src/load.jl:77 [inlined]
 [10] load(tf::TiffFile{UInt32, FileIO.Stream{…}}; verbose::Bool, mmap::Bool, lazyio::Bool)
    @ TiffImages ~/.julia/packages/TiffImages/yETMK/src/load.jl:38
 [11] load(tf::TiffFile{UInt32, FileIO.Stream{FileIO.DataFormat{:TIFF}, IOStream, String}})
    @ TiffImages ~/.julia/packages/TiffImages/yETMK/src/load.jl:18
 [12] load(io::IOStream; kwargs::@Kwargs{})
    @ TiffImages ~/.julia/packages/TiffImages/yETMK/src/load.jl:17
 [13] load
    @ ~/.julia/packages/TiffImages/yETMK/src/load.jl:17 [inlined]
 [14] tlnagy/OMETIFF.jl#13
    @ ~/.julia/packages/TiffImages/yETMK/src/load.jl:13 [inlined]
 [15] open(::TiffImages.var"#13#14"{@Kwargs{}}, ::String, ::Vararg{String}; kwargs::@Kwargs{})
    @ Base ./io.jl:396
 [16] open
    @ ./io.jl:393 [inlined]
 [17] #load#12
    @ ~/.julia/packages/TiffImages/yETMK/src/load.jl:12 [inlined]
 [18] load(filepath::String)
    @ TiffImages ~/.julia/packages/TiffImages/yETMK/src/load.jl:11
 [19] top-level scope
    @ REPL[5]:1
 [20] top-level scope
    @ ~/.julia/juliaup/julia-1.10.1+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:1428
Some type information was truncated. Use `show(err)` to see complete types.
@tlnagy tlnagy transferred this issue from tlnagy/OMETIFF.jl Mar 5, 2024
@tlnagy tlnagy added the bug Something isn't working label Mar 5, 2024
@tlnagy tlnagy changed the title Trouble converting a bfconvert converted OME-TIFF TiffImages fails to open a bfconvert converted OME-TIFF Mar 5, 2024
@tlnagy
Copy link
Owner

tlnagy commented Mar 5, 2024

I get a slightly different error on TiffImages master:

julia> TiffImages.load("output1.ome.tiff")
Loading:  25%|██████████████████████████████▌                                                                                           |  ETA: 0:00:05ERROR: EOFError: read end of file
Stacktrace:
  [1] unsafe_read(s::IOStream, p::Ptr{UInt8}, nb::UInt64)
    @ Base ./iostream.jl:428
  [2] unsafe_read
    @ ./io.jl:761 [inlined]
  [3] read!
    @ ./io.jl:779 [inlined]
  [4] read!
    @ ~/.julia/dev/TiffImages/src/files.jl:94 [inlined]
  [5] read!(target::Matrix{TiffImages.Palette{FixedPointNumbers.N0f16}}, tf::TiffFile{UInt32, FileIO.Stream{FileIO.DataFormat{:TIFF}, IOStream, String}}, ifd::TiffImages.IFD{UInt32})
    @ TiffImages ~/.julia/dev/TiffImages/src/ifds.jl:325
  [6] macro expansion
    @ ~/.julia/dev/TiffImages/src/load.jl:92 [inlined]
  [7] macro expansion
    @ ~/.julia/packages/ProgressMeter/dMfiC/src/ProgressMeter.jl:1010 [inlined]
  [8] load(tf::TiffFile{UInt32, FileIO.Stream{FileIO.DataFormat{:TIFF}, IOStream, String}}, ifds::Vector{TiffImages.IFD{UInt32}}, N::Int64; verbose::Bool)
    @ TiffImages ~/.julia/dev/TiffImages/src/load.jl:91
  [9] load
    @ ~/.julia/dev/TiffImages/src/load.jl:84 [inlined]
 [10] load(tf::TiffFile{UInt32, FileIO.Stream{FileIO.DataFormat{:TIFF}, IOStream, String}}; verbose::Bool, mmap::Bool, lazyio::Bool)
    @ TiffImages ~/.julia/dev/TiffImages/src/load.jl:43
 [11] load(tf::TiffFile{UInt32, FileIO.Stream{FileIO.DataFormat{:TIFF}, IOStream, String}})
    @ TiffImages ~/.julia/dev/TiffImages/src/load.jl:23
 [12] load(io::IOStream; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ TiffImages ~/.julia/dev/TiffImages/src/load.jl:22
 [13] load
    @ ~/.julia/dev/TiffImages/src/load.jl:22 [inlined]
 [14] #49
    @ ~/.julia/dev/TiffImages/src/load.jl:18 [inlined]
 [15] open(::TiffImages.var"#49#50"{Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::String, ::Vararg{String}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base ./io.jl:395
 [16] open
    @ ./io.jl:392 [inlined]
 [17] #load#48
    @ ~/.julia/dev/TiffImages/src/load.jl:17 [inlined]
 [18] load(filepath::String)
    @ TiffImages ~/.julia/dev/TiffImages/src/load.jl:16
 [19] top-level scope
    @ REPL[9]:1

So I tried to open the file using Fiji/ImageJ and it similarly fails to open so this might not be a TiffImages issue:

(Fiji Is Just) ImageJ 2.3.0/1.53q; Java 1.8.0_172 [64-bit]; Linux 6.5.0-18-generic; 358MB of 25500MB (1%)
 
java.lang.NullPointerException
	at loci.formats.in.MinimalTiffReader.initFile(MinimalTiffReader.java:510)
	at loci.formats.FormatReader.setId(FormatReader.java:1443)
	at loci.formats.in.OMETiffReader.initializeReader(OMETiffReader.java:1476)
	at loci.formats.in.OMETiffReader.openBytes(OMETiffReader.java:368)
	at loci.formats.ChannelFiller.openBytes(ChannelFiller.java:167)
	at loci.formats.ChannelSeparator.openBytes(ChannelSeparator.java:229)
	at loci.formats.ChannelSeparator.openBytes(ChannelSeparator.java:161)
	at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:334)
	at loci.formats.DimensionSwapper.openBytes(DimensionSwapper.java:233)
	at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:334)
	at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:334)
	at loci.plugins.util.ImageProcessorReader.openProcessors(ImageProcessorReader.java:186)
	at loci.plugins.util.ImageProcessorReader.openProcessors(ImageProcessorReader.java:83)
	at loci.plugins.util.ImageProcessorSource.getObject(ImageProcessorSource.java:72)
	at loci.formats.cache.Cache.recache(Cache.java:204)
	at loci.formats.cache.Cache.recache(Cache.java:224)
	at loci.formats.cache.Cache.setCurrentPos(Cache.java:175)
	at loci.plugins.util.BFVirtualStack.getProcessor(BFVirtualStack.java:176)
	at ij.ImagePlus.setSlice(ImagePlus.java:1961)
	at ij.ImagePlus.setPosition(ImagePlus.java:1847)
	at ij.ImagePlus.setPositionWithoutUpdate(ImagePlus.java:1858)
	at loci.plugins.in.Colorizer$1.show(Colorizer.java:186)
	at ij.ImagePlus.show(ImagePlus.java:479)
	at loci.plugins.in.DisplayHandler.displayNormal(DisplayHandler.java:144)
	at loci.plugins.in.DisplayHandler.displayImage(DisplayHandler.java:130)
	at loci.plugins.in.DisplayHandler.displayImages(DisplayHandler.java:122)
	at loci.plugins.in.Importer.run(Importer.java:89)
	at loci.plugins.LociImporter.run(LociImporter.java:78)
	at ij.IJ.runUserPlugIn(IJ.java:243)
	at ij.IJ.runPlugIn(IJ.java:204)
	at ij.IJ.runPlugIn(IJ.java:193)
	at HandleExtraFileTypes.openImage(HandleExtraFileTypes.java:524)
	at HandleExtraFileTypes.run(HandleExtraFileTypes.java:97)
	at ij.IJ.runUserPlugIn(IJ.java:243)
	at ij.IJ.runPlugIn(IJ.java:204)
	at ij.IJ.runPlugIn(IJ.java:193)
	at ij.io.Opener.openWithHandleExtraFileTypes(Opener.java:555)
	at ij.io.Opener.openUsingHandleExtraFileTypes(Opener.java:407)
	at ij.io.Opener.openTiff(Opener.java:913)
	at ij.io.Opener.openImage(Opener.java:335)
	at ij.io.Opener.openImage(Opener.java:241)
	at ij.io.Opener.open(Opener.java:104)
	at ij.io.Opener.openAndAddToRecent(Opener.java:310)
	at ij.plugin.DragAndDrop.openFile(DragAndDrop.java:194)
	at ij.plugin.DragAndDrop.run(DragAndDrop.java:160)
	at java.lang.Thread.run(Thread.java:748)

Perhaps this is an issue with bfconvert?

@tlnagy tlnagy added waiting on author and removed bug Something isn't working labels Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants