-
Notifications
You must be signed in to change notification settings - Fork 58
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
Add t-statistic images as valid targets in ImageTransformer #895
Conversation
Reviewer's Guide by SourceryThis pull request adds support for t-statistic images as valid targets in the ImageTransformer class. The changes include updating the valid_targets set in nimare/transforms.py to include 't' and adding test cases in nimare/tests/test_transforms.py to validate the new functionality. File-Level Changes
Tips
|
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.
Hey @JulioAPeraza - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding a specific test to verify that t-statistic images are correctly transformed by the ImageTransformer.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟡 Testing: 2 issues found
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
t_files = dset.images["t"].tolist() | ||
t_transformer = transforms.ImageTransformer(target="t") | ||
new_dset = t_transformer.transform(dset) | ||
new_t_files = new_dset.images["t"].tolist() |
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.
suggestion (testing): Check for correct transformation.
Consider adding assertions to check that the transformation of 't' images is correct, not just that the lists match.
new_t_files = new_dset.images["t"].tolist() | |
new_t_files = new_dset.images["t"].tolist() | |
for old, new in zip(t_files, new_t_files): | |
assert old != new, "Transformation didn't change the image path" | |
assert new.endswith('.nii.gz'), "Transformed image should be in NIfTI format" | |
assert len(t_files) == len(new_t_files), "Number of images should remain the same" |
t_transformer = transforms.ImageTransformer(target="t") | ||
new_dset = t_transformer.transform(dset) | ||
new_t_files = new_dset.images["t"].tolist() | ||
assert t_files[:-1] == new_t_files[:-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.
suggestion (testing): Clarify the purpose of the assertion.
The assertion assert t_files[:-1] == new_t_files[:-1]
is not immediately clear. Consider adding a comment to explain why the last element is excluded from the comparison.
assert t_files[:-1] == new_t_files[:-1] | |
assert t_files[:-1] == new_t_files[:-1], "Transformed t_files should match original, except for the last element" |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #895 +/- ##
=======================================
Coverage 88.23% 88.23%
=======================================
Files 48 48
Lines 6386 6386
=======================================
Hits 5635 5635
Misses 751 751 ☔ View full report in Codecov by Sentry. |
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!
Closes None.
Changes proposed in this pull request:
Summary by Sourcery
Add support for t-statistic images as valid targets in the ImageTransformer and include corresponding tests to ensure proper functionality.
New Features:
Tests: