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

Fixed SPIDER images for use with Bio-formats library #5956

Merged
merged 2 commits into from Jan 15, 2022

Conversation

radarhere
Copy link
Member

@radarhere radarhere commented Jan 12, 2022

Resolves #2518

The issue reports that Spider images saved with Pillow have a black line at the end when opened with Fiji.

Fiji uses bioformats as a dependency. So https://github.com/ome/bioformats/blob/develop/components/formats-gpl/src/loci/formats/in/SpiderReader.java would be the reader that Fiji is using.

Testing, I find that doubling the length of the header fixes the display of the image in Fiji. There is code in bioformats that looks like it could double the header length. This code is apparently searching for a local header for each frame, not just the global header.

That code is triggered based on the irec value. According to a specification, irec is the

Total number of records (including header records) in each image of a simple image or stacked image file.

So Bio-Formats is using the number of records to determine if we have included local headers.

We don't currently write an irec value - possibly because one specification denotes it as unused.

This PR adds the number of records in an image as an irec value. I have tested this in Fiji and found it to work.

@hugovk
Copy link
Member

hugovk commented Jan 15, 2022

Thank you, nice to fix an old one!

@hugovk hugovk merged commit 47bac9b into python-pillow:main Jan 15, 2022
@radarhere radarhere deleted the spider branch January 15, 2022 22:15
@radarhere radarhere changed the title Fixed Spider images for use with Bio-formats library Fixed SPIDER images for use with Bio-formats library Jan 16, 2022
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.

Spider file with last line black
2 participants