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

Tifffile _biggestSeries() bug for large images #1547

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Dany546
Copy link

@Dany546 Dany546 commented Jun 14, 2024

The _biggestSeries() method used to read tifffile sources rely on np.prod(shape) to find the biggest series in the file (macro image > image). This leads to an overflow for big images and the macro image is wrongly selected as the main content of the file. Simple fix is done with np.sqrt(), though a better solution could be found.

@manthey
Copy link
Member

manthey commented Jun 17, 2024

Do you have an example image where it fails? If it can't be shared, can the output of tifftools dump <image> be shared?

I don't understand why the sqrt of the shape product would be desirable. The intent is that the main series would be the series with the most total pixels. If it is overflowing do to data types, a better choice might be to samples = np.prod(float(x) for x in s.shape) to cast the values to float values before multiplication.

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