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

Dataset.from_images fails for some multipage tif files with IndexError: list index out of range #1255

Open
fm3 opened this issue Feb 17, 2025 · 0 comments
Labels

Comments

@fm3
Copy link
Member

fm3 commented Feb 17, 2025

Saw exception in Dataset.from_images called with a tif file.

Stack trace:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/concurrent/futures/process.py", line 261, in _process_worker
    r = call_item.fn(*call_item.args, **call_item.kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/cluster_tools/executors/multiprocessing_.py", line 159, in _setup_logging_and_execute
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "site-packages/webknossos/dataset/_utils/pims_images.py", line 555, in copy_to_view
    for image_slice in images[z_start:z_end]:
  File "site-packages/slicerator/__init__.py", line 226, in <genexpr>
    return (self._get(i) for i in self.indices)
            ^^^^^^^^^^^^
  File "site-packages/slicerator/__init__.py", line 206, in _get
    return self._ancestor[key]
           ~~~~~~~~~~~~~~^^^^^
  File "site-packages/slicerator/__init__.py", line 187, in __getitem__
    return self._get(indices)
           ^^^^^^^^^^^^^^^^^^
  File "site-packages/pims/base_frames.py", line 100, in __getitem__
    return self.get_frame(key)
           ^^^^^^^^^^^^^^^^^^^
  File "site-packages/pims/base_frames.py", line 598, in get_frame
    result = self._get_frame_wrapped(**coords)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/webknossos/dataset/_utils/pims_tiff_reader.py", line 114, in get_frame_2D
    page = _tiff.asarray(key=i)
           ^^^^^^^^^^^^^^^^^^^^
  File "site-packages/tifffile/tifffile.py", line 12514, in asarray
    result = self.parent.asarray(series=self, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/tifffile/tifffile.py", line 4534, in asarray
    pages = [pages[int(key)]]
             ~~~~~^^^^^^^^^^
  File "site-packages/tifffile/tifffile.py", line 12641, in __getitem__
    return self._getitem(int(key))
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "site-packages/tifffile/tifffile.py", line 12624, in _getitem
    return self._pages[key]
           ~~~~~~~~~~~^^^^^
IndexError: list index out of range

Example images can be found in /srv/stores/webknossos.org/595d33d9f64a8589/.converting/

@fm3 fm3 added the bug label Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant