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

Suppress non-fatal errors when loading images #119

Merged
merged 25 commits into from
Apr 24, 2024

Conversation

kostrykin
Copy link
Member

@kostrykin kostrykin commented Apr 22, 2024

When using skimage.io.imread to read an image file, sometimes errors can be reported although the image file will be read successfully:

In [1]: import skimage.io

In [2]: skimage.io.imread('sample2.tif')
TiffPage 0: TypeError: read_bytes() missing 3 required positional arguments: 'dtype', 'count', and 'offsetsize'
Out[2]:
array([[4, 3, 3, ..., 4, 4, 3],
[4, 4, 4, ..., 4, 4, 3],
[4, 4, 3, ..., 4, 3, 3],
...,
[5, 4, 4, ..., 4, 3, 3],
[4, 4, 4, ..., 3, 3, 3],
[4, 4, 4, ..., 4, 4, 4]], dtype=uint8)

In such cases, Galaxy might detect the errors and assume that the tool has failed: https://docs.galaxyproject.org/en/latest/dev/schema.html#error-detection
To prevent this, a wrapper around skimage.io.imread is added which mutes all non-fatal errors:
bioconda/bioconda-recipes#47378


FOR THE CONTRIBUTOR — Please fill out if applicable

Please make sure you have read the CONTRIBUTING.md document (last updated: 2024/03/18).

  • License permits unrestricted use (educational + commercial).

If this PR adds or updates a tool or tool collection:

@kostrykin kostrykin changed the title Harden image loading in "Threshold image" tool Suppress non-fatal errors when loading images Apr 23, 2024
@kostrykin kostrykin marked this pull request as ready for review April 23, 2024 15:29
@kostrykin kostrykin merged commit c86a1b9 into BMCV:master Apr 24, 2024
13 checks passed
@kostrykin kostrykin deleted the 2d_auto_threshold/dev branch April 24, 2024 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants