Skip to content

BUG: force_sktiff does not work in tiff.ome_to_binary #1250

Description

@mhturner

Describe the issue:

I was running into a Exception: Resource temporarily unavailable error when opening Bruker .ome.tif files on a compute cluster. I'm not sure why I was getting that error in the first place but this bug report is about my attempted workaround.

I tried to force suite2p to use tifffile.imread with force_sktiff = True however the same exception was generated the same way, so I think it is still trying to use scanimage-tiff-reader. I believe this line in tiff.ome_to_binary() may be the culprit, since it's just checking if scanimage-tiff-reader is installed and not regarding the db dictionary:

use_sktiff = not HAS_SCANIMAGE

I'm not sure if a similar issue arises from other methods in the tiff module as well. I got around it by uninstalling scanimage-tiff-reader, and files are loading just fine using tifffile.

Reproduce the code example:

import suite2p

datadir = ...
database = {
    'data_path': [datadir],
    'input_format': 'bruker',
    'nchannels': 1,
    'nplanes': 1,
    'batch_size': 2000, 
    'functional_chan': 2,  
    'force_sktiff': 1,
}

settings = suite2p.default_settings()


output_ops = suite2p.run_s2p(settings=settings, db=database)

Example input dataset used to reproduce the issue:

No response

Error message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/network/rit/lab/turner_lab/miniconda/envs/turnersuite/lib/python3.10/site-packages/suite2p/run_s2p.py", line 438, in run_s2p
    dbs = files_to_binary[db["input_format"]](dbs, settings, files, files_chan2)
  File "/network/rit/lab/turner_lab/miniconda/envs/turnersuite/lib/python3.10/site-packages/suite2p/io/tiff.py", line 396, in ome_to_binary
    im = read_tiff(file, tif, Ltif, ix, batch_size, use_sktiff)
  File "/network/rit/lab/turner_lab/miniconda/envs/turnersuite/lib/python3.10/site-packages/suite2p/io/tiff.py", line 126, in read_tiff
    im = tif.data(beg=ix, end=ix + nfr)
  File "/network/rit/lab/turner_lab/miniconda/envs/turnersuite/lib/python3.10/site-packages/ScanImageTiffReader/__init__.py", line 309, in data
    raise Exception(self.__ctx.log.decode("utf-8","strict"))
Exception: Resource temporarily unavailable

Version information:

suite2p v1.1.0

Context for the issue:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions