Skip to content

Commit

Permalink
PNG: Fix check for too few axes
Browse files Browse the repository at this point in the history
Fixes erroneous check put in place in #2535 (3acf6cc).
  • Loading branch information
Lestropie committed Sep 11, 2023
1 parent fdec23d commit de6d0c3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/formats/png.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ namespace MR
if (H.ndim() == 4 && H.size(3) > 4)
throw Exception ("A 4D image written to PNG must have between one and four volumes (requested: " + str(H.size(3)) + ")");

// TODO After looping over axes via square-bracket notation,
// After looping over axes via square-bracket notation,
// there needs to be at least two axes with size greater than one
size_t unity_axes = 0;
size_t nonunity_axes = 0;
for (size_t axis = 0; axis != H.ndim(); ++axis) {
if (H.size (axis) == 1)
++unity_axes;
if (H.size (axis) > 1)
++nonunity_axes;
}
if (unity_axes - (H.ndim() - num_axes) < 2)
if (nonunity_axes - (H.ndim() - num_axes) < 2)
throw Exception ("Too few (non-unity) image axes to support PNG export");

// For 4D images, can support:
Expand Down

0 comments on commit de6d0c3

Please sign in to comment.