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

Writing 3D tiffs throws deprecation warning #45

Closed
K-Meech opened this issue Mar 11, 2024 · 5 comments · Fixed by #46
Closed

Writing 3D tiffs throws deprecation warning #45

K-Meech opened this issue Mar 11, 2024 · 5 comments · Fixed by #46
Labels
bug Something isn't working

Comments

@K-Meech
Copy link
Contributor

K-Meech commented Mar 11, 2024

Writing a 3D tiff via the image_io sub-module throws a DeprecationWarning e.g.:

image = np.ones((4, 4, 4))
file_path = Path(tmp_dir) / "test_array.tif"
save.to_tiff(image, file_path)
DeprecationWarning: <tifffile.TiffWriter.write> data with shape (4, 4, 4) and dtype 'float64' are stored as RGB with contiguous samples. Future versions will store such data as MINISBLACK in separate pages by default, unless the 'photometric' parameter is specified.

Should the photometric / planarconfig be set explicitly to keep the old settings? Or are you happy to use the new tifffile defaults and just add this warning to the list of those ignored by pytest?

@K-Meech K-Meech added the bug Something isn't working label Mar 11, 2024
@adamltyson
Copy link
Member

It would be good to know what's going on here, so we can explicitly set the parameter. We rarely (if ever) need to write either float64 or RGB though, so it would be good to know what this should be set to for our "normal" usage (typically 16bit greyscale, 2/3D).

@K-Meech
Copy link
Contributor Author

K-Meech commented Mar 11, 2024

The same error occurs with int32 data, so it's more to do with the image's shape. It appears to be recognising any image with a length of 3 or 4 in the last axis as rgb. In their examples they recommend using photometric='minisblack' for grayscale images. The explanation of the different photometric options is linked here

@adamltyson
Copy link
Member

In that case I would definitely set it to MINISBLACK (ideally as a default parameter in the BrainGlobe function rather than hardcoding) unless @alessandrofelder thinks differently?

@alessandrofelder
Copy link
Member

I would definitely set it to MINISBLACK

Yep, I agree with this

@K-Meech
Copy link
Contributor Author

K-Meech commented Mar 11, 2024

Ok - will do! I'll make a PR to add this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants