-
Notifications
You must be signed in to change notification settings - Fork 264
MRG: Cleaner tests #254
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
Merged
Merged
MRG: Cleaner tests #254
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,7 +169,7 @@ def rotation_matrix(self): | |
""" | ||
iop = self.image_orient_patient | ||
s_norm = self.slice_normal | ||
if None in (iop, s_norm): | ||
if iop is None or s_norm is None: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These show up a lot. Without these changes to how |
||
return None | ||
R = np.eye(3) | ||
# np.fliplr(iop) gives matrix F in | ||
|
@@ -235,7 +235,7 @@ def slice_indicator(self): | |
""" | ||
ipp = self.image_position | ||
s_norm = self.slice_normal | ||
if None in (ipp, s_norm): | ||
if ipp is None or s_norm is None: | ||
return None | ||
return np.inner(ipp, s_norm) | ||
|
||
|
@@ -304,7 +304,7 @@ def get_affine(self): | |
# column, slice) | ||
vox = self.voxel_sizes | ||
ipp = self.image_position | ||
if None in (orient, vox, ipp): | ||
if any(p is None for p in (orient, vox, ipp)): | ||
raise WrapperError('Not enough information for affine') | ||
aff = np.eye(4) | ||
aff[:3, :3] = orient * np.array(vox) | ||
|
@@ -786,7 +786,7 @@ def image_position(self): | |
md_rows, md_cols = (self.get('Rows'), self.get('Columns')) | ||
iop = self.image_orient_patient | ||
pix_spacing = self.get('PixelSpacing') | ||
if None in (ipp, md_rows, md_cols, iop, pix_spacing): | ||
if any(x is None for x in (ipp, md_rows, md_cols, iop, pix_spacing)): | ||
return None | ||
# PixelSpacing values are python Decimal in pydicom 0.9.7 | ||
pix_spacing = np.array(list(map(float, pix_spacing))) | ||
|
@@ -881,8 +881,8 @@ def none_or_close(val1, val2, rtol=1e-5, atol=1e-6): | |
>>> none_or_close([0,1], [0,2]) | ||
False | ||
""" | ||
if (val1, val2) == (None, None): | ||
if val1 is None and val2 is None: | ||
return True | ||
if None in (val1, val2): | ||
if val1 is None or val2 is None: | ||
return False | ||
return np.allclose(val1, val2, rtol, atol) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
These skips were necessary on my system or tests would fail.
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.
What happens on your system for these? Presumably you are running
make doctests
on the docs?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.
Yeah, let me test again on current
master
...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.
e.g.:
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.
Try adding a semicolon at the end of the line instead?
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.
That should indeed suppress it, I'll add it
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.
...actually it does not suppress it. Back to the
SKIP
?