-
Notifications
You must be signed in to change notification settings - Fork 259
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
BF+TST: Fix 'frame_order' for single frame files #1387
base: master
Are you sure you want to change the base?
Conversation
Don't assume StackID is int (it is a str), don't assume DimensionIndexValues has more than one value.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1387 +/- ##
=======================================
Coverage 95.37% 95.38%
=======================================
Files 207 207
Lines 29672 29697 +25
Branches 3018 3020 +2
=======================================
+ Hits 28300 28325 +25
Misses 934 934
Partials 438 438 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Small suggestion for your consideration.
try: | ||
frame_indices = np.array( | ||
[frame.FrameContentSequence[0].DimensionIndexValues for frame in self.frames] | ||
) | ||
except AttributeError: | ||
raise WrapperError("Can't find frame 'DimensionIndexValues'") | ||
if len(frame_indices.shape) == 1: | ||
frame_indices = frame_indices.reshape(frame_indices.shape + (1,)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should achieve the same result, and I think is a bit more immediately obvious. Might even avoid a copy.
try: | |
frame_indices = np.array( | |
[frame.FrameContentSequence[0].DimensionIndexValues for frame in self.frames] | |
) | |
except AttributeError: | |
raise WrapperError("Can't find frame 'DimensionIndexValues'") | |
if len(frame_indices.shape) == 1: | |
frame_indices = frame_indices.reshape(frame_indices.shape + (1,)) | |
try: | |
frame_indices = np.atleast_2d( | |
[frame.FrameContentSequence[0].DimensionIndexValues for frame in self.frames] | |
) | |
except AttributeError: | |
raise WrapperError("Can't find frame 'DimensionIndexValues'") |
The
_frame_indices
attribute on theMultiframeWrapper
was empty for single frame files, causing use of theframe_order
property to raise an exception.Also, don't assume StackID is int (it is a str), don't assume DimensionIndexValues has more than one value. Fix how we assign multiple values to DimensionIndexValues when making fake test data (need to pass list instead of tuple).