OMETIFF.jl icon indicating copy to clipboard operation
OMETIFF.jl copied to clipboard

Re: error with opening a ome.tiff file.

Open mdhe1248 opened this issue 10 months ago • 6 comments

Hi,

My images was acquired by a Zeiss confocal microscope and saved images as ome.tiff. When I tried to load the file in julia, I got this error:

julia> load(movingfns[10])                                                                                                                                                             
Error encountered while load FileIO.File{FileIO.DataFormat{:OMETIFF}, String}("/media/donghoon_001/imaging_dat/birc_nikon_confocal/230808_and_230725_adlib_fasted_refed/tif/230725_2_3_
3_2_refed_round3_dapi_hcrt_gal_cartpt_Stitch.ome.tiff").                                                                                                                               
                                                                                                                                                                                       
Fatal error:                                                                                                                                                                           
ERROR: ArgumentError: collection must be non-empty 
Stacktrace:                                                                                                                                                                  [194/1469]
  [1] first                                                                                                                                                                            
    @ ./abstractarray.jl:466 [inlined]                                                                                                                                                 
  [2] inmemoryarray(ifds::OrderedCollections.OrderedDict{NTuple{4, Int64}, Tuple{TiffImages.TiffFile{UInt32}, TiffImages.IFD{UInt32}}}, dims::NamedTuple{(:Y, :X, :Z, :C, :T, :P), NTup
le{6, Int64}}; verbose::Bool)                                                                                                                                                          
    @ OMETIFF ~/.julia/packages/OMETIFF/3RcZb/src/loader.jl:122                                                                                                                        
  [3] load(io::FileIO.Stream{FileIO.DataFormat{:OMETIFF}, IOStream, String}; dropunused::Bool, verbose::Bool, inmemory::Bool)                                                          
    @ OMETIFF ~/.julia/packages/OMETIFF/3RcZb/src/loader.jl:90
  [4] load                                   
    @ ~/.julia/packages/OMETIFF/3RcZb/src/loader.jl:29 [inlined]
  [5] #33                                    
    @ ~/.julia/packages/OMETIFF/3RcZb/src/loader.jl:3 [inlined]
  [6] open(f::OMETIFF.var"#33#34"{Bool, Bool}, args::FileIO.File{FileIO.DataFormat{:OMETIFF}, String}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base ./io.jl:395                       
  [7] open                                   
    @ ./io.jl:392 [inlined]                  
  [8] #load#32                               
    @ ~/.julia/packages/OMETIFF/3RcZb/src/loader.jl:2 [inlined]
  [9] load(f::FileIO.File{FileIO.DataFormat{:OMETIFF}, String})
    @ OMETIFF ~/.julia/packages/OMETIFF/3RcZb/src/loader.jl:1
 [10] #invokelatest#2
    @ ./essentials.jl:819 [inlined]                                                                                                                                          [173/1469]
 [11] invokelatest                           
    @ ./essentials.jl:816 [inlined]          
 [12] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::FileIO.Formatted; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ FileIO ~/.julia/packages/FileIO/BE7iZ/src/loadsave.jl:219
 [13] action                                 
    @ ~/.julia/packages/FileIO/BE7iZ/src/loadsave.jl:196 [inlined]
 [14] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::Symbol, ::String; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ FileIO ~/.julia/packages/FileIO/BE7iZ/src/loadsave.jl:185
 [15] action                                 
    @ ~/.julia/packages/FileIO/BE7iZ/src/loadsave.jl:185 [inlined]
 [16] load(::String; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ FileIO ~/.julia/packages/FileIO/BE7iZ/src/loadsave.jl:113
 [17] load(::String)                         
    @ FileIO ~/.julia/packages/FileIO/BE7iZ/src/loadsave.jl:109
 [18] top-level scope                        
    @ REPL[266]:1                            
Stacktrace:                                  
 [1] handle_error(e::ArgumentError, q::Base.PkgId, bt::Vector{Union{Ptr{Nothing}, Base.InterpreterIP}})
   @ FileIO ~/.julia/packages/FileIO/BE7iZ/src/error_handling.jl:61
 [2] handle_exceptions(exceptions::Vector{Tuple{Any, Union{Base.PkgId, Module}, Vector}}, action::String)
   @ FileIO ~/.julia/packages/FileIO/BE7iZ/src/error_handling.jl:56                                                                                                          [152/1469]
 [3] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::FileIO.Formatted; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ FileIO ~/.julia/packages/FileIO/BE7iZ/src/loadsave.jl:228
 [4] action                                  
   @ ~/.julia/packages/FileIO/BE7iZ/src/loadsave.jl:196 [inlined]
 [5] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::Symbol, ::String; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ FileIO ~/.julia/packages/FileIO/BE7iZ/src/loadsave.jl:185
 [6] action                                  
   @ ~/.julia/packages/FileIO/BE7iZ/src/loadsave.jl:185 [inlined]
 [7] load(::String; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ FileIO ~/.julia/packages/FileIO/BE7iZ/src/loadsave.jl:113
 [8] load(::String)                          
   @ FileIO ~/.julia/packages/FileIO/BE7iZ/src/loadsave.jl:109
 [9] top-level scope                         
   @ REPL[266]:1

Interestingly, I was able to load the same files in Fiji (but the pixel parameters were were not correct). I also checked the header file with tiffcomment command:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!--Warning: this comment is an OME-XML metadata block, which contains crucial dimensional parameters and other important metadata. Please edit cautiously (if at all), and back up the original data before doing so. For more information, see the OME-TIFF web site: http://loci.wisc.edu/ome/ome-tiff.html.-->
<OME xmlns="http://www.openmicroscopy.org/Schemas/OME/2010-04" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openmicroscopy.org/Schemas/OME/2010-04/ome.xsd http://www.openmicroscopy.org/Schemas/OME/2010-04/ome.xsd">
  <Instrument ID="Instrument:0">
    <Detector Gain="1" Voltage="650" Zoom="1" AmplificationGain="1" ID="Detector:0:0" Type="PMT" />
    <Detector Gain="1" Voltage="650" Zoom="1" AmplificationGain="1" ID="Detector:1:0" Type="PMT" />
    <Detector Gain="1" Voltage="650" Zoom="1" AmplificationGain="1" ID="Detector:1:1" Type="PMT" />
    <Detector Gain="1" Voltage="649.981" Zoom="1" AmplificationGain="1" ID="Detector:2:0" Type="PMT" />
    <Objective ID="Objective:0" Immersion="Air" LensNA="0.45" NominalMagnification="10" />
  </Instrument>
  <Image ID="Image:1" Name="230725_2_3_2_6_fasted_round3_dapi_hcrt_gal_cartpt_Stitch.ome">
    <AcquiredDate>2023-08-30T00:43:52</AcquiredDate>
    <Description></Description>
    <InstrumentRef ID="Instrument:0" />
    <ObjectiveSettings ID="Objective:0" />
    <Pixels ID="Pixels:Uint12" DimensionOrder="XYZCT" Type="uint12" SizeX="2867" SizeY="4712" SizeZ="5" SizeT="1" SizeC="4" PhysicalSizeX="0.830266" PhysicalSizeY="0.830266" PhysicalSizeZ="6">
      <Channel ID="Channel:0" Name="Ch1-T1" PinholeSize="25.835" Fluor="DAPI" SamplesPerPixel="1">
        <DetectorSettings ID="Detector:0:0" Binning="1x1" />
      </Channel>
      <Channel ID="Channel:1" Name="Ch1-T2" PinholeSize="28.9734" Fluor="Alexa Fluor 488" SamplesPerPixel="1">
        <DetectorSettings ID="Detector:1:0" Binning="1x1" />
      </Channel>
      <Channel ID="Channel:2" Name="Ch2 GaAsP-T2" PinholeSize="28.9734" Fluor="Alexa Fluor 647" SamplesPerPixel="1">
        <DetectorSettings ID="Detector:1:1" Binning="1x1" />
      </Channel>
      <Channel ID="Channel:3" Name="Ch2 GaAsP-T3" PinholeSize="33.3092" Fluor="Alexa Fluor 546" SamplesPerPixel="1">
        <DetectorSettings ID="Detector:2:0" Binning="1x1" />
      </Channel>
      <TiffData />
      <Plane TheZ="0" TheT="0" TheC="0" DeltaT="0" PositionX="0" PositionY="0" PositionZ="0" />
      <Plane TheZ="0" TheT="0" TheC="1" DeltaT="0" PositionX="0" PositionY="0" PositionZ="0" />
      <Plane TheZ="0" TheT="0" TheC="2" DeltaT="0" PositionX="0" PositionY="0" PositionZ="0" />
      <Plane TheZ="0" TheT="0" TheC="3" DeltaT="0" PositionX="0" PositionY="0" PositionZ="0" />
      <Plane TheZ="1" TheT="0" TheC="0" DeltaT="0" PositionX="0" PositionY="0" PositionZ="0" />
      <Plane TheZ="1" TheT="0" TheC="1" DeltaT="0" PositionX="0" PositionY="0" PositionZ="0" />
      <Plane TheZ="1" TheT="0" TheC="2" DeltaT="0" PositionX="0" PositionY="0" PositionZ="0" />
      <Plane TheZ="1" TheT="0" TheC="3" DeltaT="0" PositionX="0" PositionY="0" PositionZ="0" />
      <Plane TheZ="2" TheT="0" TheC="0" DeltaT="0" PositionX="0" PositionY="0" PositionZ="0" />
      <Plane TheZ="2" TheT="0" TheC="1" DeltaT="0" PositionX="0" PositionY="0" PositionZ="0" />
      <Plane TheZ="2" TheT="0" TheC="2" DeltaT="0" PositionX="0" PositionY="0" PositionZ="0" />
      <Plane TheZ="2" TheT="0" TheC="3" DeltaT="0" PositionX="0" PositionY="0" PositionZ="0" />
      <Plane TheZ="3" TheT="0" TheC="0" DeltaT="0" PositionX="0" PositionY="0" PositionZ="0" />
      <Plane TheZ="3" TheT="0" TheC="1" DeltaT="0" PositionX="0" PositionY="0" PositionZ="0" />
      <Plane TheZ="3" TheT="0" TheC="2" DeltaT="0" PositionX="0" PositionY="0" PositionZ="0" />
      <Plane TheZ="3" TheT="0" TheC="3" DeltaT="0" PositionX="0" PositionY="0" PositionZ="0" />
      <Plane TheZ="4" TheT="0" TheC="0" DeltaT="0" PositionX="0" PositionY="0" PositionZ="0" />
      <Plane TheZ="4" TheT="0" TheC="1" DeltaT="0" PositionX="0" PositionY="0" PositionZ="0" />
      <Plane TheZ="4" TheT="0" TheC="2" DeltaT="0" PositionX="0" PositionY="0" PositionZ="0" />
      <Plane TheZ="4" TheT="0" TheC="3" DeltaT="0" PositionX="0" PositionY="0" PositionZ="0" />
    </Pixels>
  </Image>
</OME>

Also I have the "original" czi file format. If I open it in fiji and store it as ome.tif, Julia could load the resulting ome.tif file. While I can convert all files in Fiji, I wanted to check if these is better ways to solve this issue.

mdhe1248 avatar Sep 01 '23 14:09 mdhe1248