Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#869 closed defect (fixed)

keyError PhysicalSizeX opening sample OME-TIFF data

Reported by: Elaine Meng Owned by: Tom Goddard
Priority: major Milestone:
Component: Input/Output Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

I tried opening some sample data downloaded from the OME-TIFF website but got tracebacks. I downloaded the Tubhiswt-3D and Tubhiswt-4D data sets from here:

https://docs.openmicroscopy.org/ome-model/5.5.7/ome-tiff/data.html

In each of the resulting folders I started ChimeraX and then tried to open all the *tif files in that folder, but both gave me a traceback (the same one, as far as I could tell):

open tub*tif
Traceback (most recent call last):
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/chimerax/cmd_line/tool.py", line 188, in execute
cmd.run(cmd_text)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/chimerax/core/commands/cli.py", line 2499, in run
result = ci.function(session, kw_args)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/chimerax/core/commands/open.py", line 104, in open
models = handle_unknown_kw(session.models.open, paths, format=format, name=name,
kw)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/chimerax/core/commands/open.py", line 57, in handle_unknown_kw
return f(*args, kw)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/chimerax/core/models.py", line 439, in open
session, filenames, format=format, name=name,
kw)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/chimerax/core/io.py", line 435, in open_multiple_data
models, status = open_func(session, paths, name, kw)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/chimerax/core/map/volume.py", line 3286, in open_map_format
return open_map(session, stream, name=name, format=format,
kw)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/chimerax/core/map/volume.py", line 2983, in open_map
grids = data.open_file(map_path, file_type = format)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/chimerax/core/map/data/fileformats.py", line 132, in open_file
data = module.open(apath)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/chimerax/core/map/data/imagestack/init.py", line 33, in open
grids.extend(ome_tiff.ome_image_grids(p))
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/chimerax/core/map/data/imagestack/ome_tiff.py", line 14, in ome_image_grids
images = parse_ome_tiff_header(path)
File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/chimerax/core/map/data/imagestack/ome_tiff.py", line 119, in parse_ome_tiff_header
sx, sy, sz = [float(s) for s in (paPhysicalSizeX, paPhysicalSizeY, paPhysicalSizeZ)]
KeyError: 'PhysicalSizeX'

Change History (6)

comment:1 by Elaine Meng, 8 years ago

I guess it's not related to the traceback, but incidentally, neither set follows the naming rules for automatic identification of channels or time points, however. The 3D set has 2 channels, filenames:

tubhiswt_C0.ome.tif
tubhiswt_C1.ome.tif

The 4D set has filenames:

tubhiswt_C0_TP0.ome.tif tubhiswt_C1_TP0.ome.tif
tubhiswt_C0_TP1.ome.tif tubhiswt_C1_TP1.ome.tif
(etc.)

comment:2 by Tom Goddard, 8 years ago

Resolution: fixed
Status: assignedclosed

Fixed.

OME TIF file header value PhysicalSizeX is optional. If not present use voxel size 1.0.

in reply to:  3 ; comment:3 by Elaine Meng, 8 years ago

The files open now without obvious error.  However, I’m extremely confused because EACH file in tubhiswt-4D is interpreted as having 2 channels and 43 time points, when at least according to file naming, each file has one channel and one time point.  The 4D set has filenames:

tubhiswt_C0_TP0.ome.tif         tubhiswt_C1_TP0.ome.tif
tubhiswt_C0_TP1.ome.tif         tubhiswt_C1_TP1.ome.tif
(etc.)

and the description on https://docs.openmicroscopy.org/ome-model/5.5.7/ome-tiff/data.html for the dataset is XYZCT 512 × 512 × 10 × 2 × 43 with number of files 86.

If I open all the files in that 4D folder, the slider goes to time 3697.  If I open a single file, there are two channels and the slider goes up to 43.  Is this a bug?  I looked at the header of a single file and it does report

mageJ=
hyperstack=true
images=860
channels=2
slices=10
frames=43

The question is whether that really has to apply to the contents of only that single file, or the dataset of multiple files to which it belongs.  The latter sounds like a nightmare for file interpretation, so maybe this is just my own misunderstanding.

in reply to:  4 ; comment:4 by goddard@…, 8 years ago

Yeah, I’ll need to fix this.  The problem is OME TIFF header can describe maps spanning multiple files.  ChimeraX is smart and on opening one of those 86 files it sees in its header the other 85 files are referenced as different times and channels and so it opens them.  But every one of the files has the information about all the files.  I’ll need to make the code smarter so it sees this situation.  Maybe I should make the code dumber and simply ignore all the references to the other files.  That would allow you to open just one time/channel map if you wanted.

in reply to:  5 ; comment:5 by goddard@…, 8 years ago

OME TIFF can put all the times and channels in one file.  One reason it supports splitting them across many files is that TIFF files have a 4 Gbyte limit which is not big enough.

comment:6 by Tom Goddard, 8 years ago

Fixed problem where multiple copies of tubhiswt_C*_TP*..ome.tif multichannel time series were opened one full series for every file. Now only one copy is opened when all files are specified.

Note: See TracTickets for help on using tickets.