#15105 closed defect (fixed)

Reading ImageJ Tiff: IndexError: index out of range

Reported by: christophe.leterrier@… Owned by: Tom Goddard
Priority: moderate Milestone:
Component: Volume Data Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

From: Christophe Leterrier via ChimeraX-users <chimerax-users@…>
Subject: [chimerax-users] Error when opening multiple tiff stacks (32-bit)
Date: May 3, 2024 at 12:15:04 AM PDT
To: ChimeraX Users Help <chimerax-users@…>
Reply-To: Christophe Leterrier

Hi,

I have two 32-bit tiff stacks (generated by ImageJ) and I try to open both to overlay two channels. When opening the second one or trying to open both at the same time (see paths below), I get the following error with the latest stable and daily ChimeraX macOS versions:

UCSF ChimeraX version: 1.7.1 (2024-01-23)
© 2016-2023 Regents of the University of California. All rights reserved.
How to cite UCSF ChimeraX
open "/Users/christo/Travail/Data NSTORM/230811 Patt#56/Figure 4 Article (actin DNA-Paint bass)/3um aligned 3D/Recs TS ROIs 3um aligned (Gxy4z4)/Roi002_C2_N04_ch1_ph647_bas643_sypto_map_3D_48K_DC1C_(22688,12672)_TS3D.tif" "/Users/christo/Travail/Data NSTORM/230811 Patt#56/Figure 4 Article (actin DNA-Paint bass)/3um aligned 3D/Recs TS ROIs 3um aligned (Gxy4z4)/Roi002_C2_N04_ch2_ph647_bas643_sypto_map_3D_7,63K_DC1C_transfo_(22688,12672)_TS3D.tif"Traceback (most recent call last):

File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/open_command/dialog.py", line 334, in _qt_safe

run(session, "open " + " ".join([FileNameArg.unparse(p) for p in paths]) + (""

File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/commands/run.py", line 49, in run

results = command.run(text, log=log, return_json=return_json)


File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/commands/cli.py", line 2908, in run

result = ci.function(session, kw_args)


File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/open_command/cmd.py", line 131, in cmd_open

models = Command(session, registry=registry).run(provider_cmd_text, log=log)[0]


File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/commands/cli.py", line 2908, in run

result = ci.function(session, kw_args)


File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/open_command/cmd.py", line 191, in provider_open

models, status = collated_open(session, None, paths, data_format, _add_models, log_errors,


File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/open_command/cmd.py", line 513, in collated_open

return remember_data_format()


File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/open_command/cmd.py", line 484, in remember_data_format

models, status = func(*func_args, func_kw)


File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/map/init.py", line 182, in open

return open_map(session, path, format=_name, kw)


File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/map/volume.py", line 3621, in open_map

smodels, smsg = open_grids(session, sgrids, name, kw)


File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/map/volume.py", line 3723, in open_grids

v.update_drawings()

File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/map/volume.py", line 813, in update_drawings

self.image_levels, self.image_colors = self.initial_image_levels()


File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/map/volume.py", line 633, in initial_image_levels

mstats = self.matrix_value_statistics()


File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/map/volume.py", line 1734, in matrix_value_statistics

matrices = self.displayed_matrices(read_matrix)


File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/map/volume.py", line 1769, in displayed_matrices

matrices.append(self.matrix(read_matrix))


File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/map/volume.py", line 1252, in matrix

m = self.region_matrix(r, read_matrix)


File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/map/volume.py", line 1276, in region_matrix

m = d.matrix(origin, size, step, progress, from_cache_only)


File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/map_data/griddata.py", line 317, in matrix

m = self.read_matrix(ijk_origin, ijk_size, ijk_step, progress)


File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/map_data/imagestack/imagej_tiff.py", line 74, in read_matrix

a = pi.planes_data(klist, cc, ch, self.time)


File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/map_data/imagestack/imagej_tiff.py", line 199, in planes_data

a = tif.asarray(key = plist)


File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/tifffile/tifffile.py", line 4272, in asarray

pages = pages._getlist(key)


File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/tifffile/tifffile.py", line 7532, in _getlist

pages = [getitem(i, validate=validhash) for i in key]


File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/tifffile/tifffile.py", line 7532, in <listcomp>

pages = [getitem(i, validate=validhash) for i in key]


File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/tifffile/tifffile.py", line 7578, in _getitem

self._seek(key)

File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/tifffile/tifffile.py", line 7481, in _seek

raise IndexError('index out of range')

IndexError: index out of range

IndexError: index out of range

File "/Applications/ChimeraX-1.7.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/tifffile/tifffile.py", line 7481, in _seek
raise IndexError('index out of range')

See log for complete Python traceback.

Any idea of what is going wrong?

Change History (1)

comment:1 by Tom Goddard, 18 months ago

Resolution: fixed
Status: assignedclosed

Fixed in ChimeraX daily build May 4, 2024 and later.

The problem is that the ChimeraX TIFF stack reader sees the "ch2" in the file name and identifies the data as channel 2. But the ImageJ reader actually uses that value to find which plane of data to read, and the file that generated this error has only one channel. I fixed the ChimeraX code so it does not look for "chN" in the file name since the ImageJ TIFF header already declares what channels are present.

Note: See TracTickets for help on using tickets.