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

PNG export: Exception on too few axes #2535

Merged
merged 2 commits into from
Dec 7, 2022
Merged

PNG export: Exception on too few axes #2535

merged 2 commits into from
Dec 7, 2022

Conversation

Lestropie
Copy link
Member

Supersedes #2465.

This section of code is also relevant to #2179.

As described in this comment, the usage resulting in a segfault is likely not that intended. But further, attempting to save to out-[].png from a 1 x 128 x 128 image could (theoretically at least) yield either a single 128 x 128 image (effectively "ignoring" the square-bracket syntax), or, more faithfully, 128 different 1 x 128 images. Presence of unity axes is already used within the PNG handling to identify the slice orientation to use for PNG files.

For now, this comment instead catches the likely erroneous but also potentially ambiguous usage and errors out, rather than segfaulting. Later, hopefully for 3.1.0, I'll try to restructure the relevant code in order to address #2179, and hopefully if the code is better structured the right solution in this instance will fall out.

@Lestropie Lestropie added the bug label Dec 7, 2022
@Lestropie Lestropie added this to the 3.0.4 milestone Dec 7, 2022
@Lestropie Lestropie requested a review from a team December 7, 2022 11:38
@Lestropie Lestropie self-assigned this Dec 7, 2022
@Lestropie
Copy link
Member Author

Should also note that unlike #2465 this is better guaranteed to not change behaviour on master under alternative use cases.

Copy link
Member

@jdtournier jdtournier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to catch the problematic usage on my system. 👍

@jdtournier jdtournier enabled auto-merge December 7, 2022 12:24
@jdtournier jdtournier merged commit 346ace6 into master Dec 7, 2022
@jdtournier jdtournier deleted the png_too_few_axes branch December 7, 2022 13:13
Lestropie added a commit that referenced this pull request Sep 11, 2023
Fixes erroneous check put in place in #2535 (3acf6cc).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants