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

Add t-statistic images as valid targets in ImageTransformer #895

Merged
merged 1 commit into from
Aug 7, 2024

Conversation

JulioAPeraza
Copy link
Collaborator

@JulioAPeraza JulioAPeraza commented Aug 7, 2024

Closes None.

Changes proposed in this pull request:

  • Add t-statistic images as valid targets in ImageTransformer

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:

  • Add support for t-statistic images as valid targets in the ImageTransformer.

Tests:

  • Add tests to verify the transformation of t-statistic images in ImageTransformer.

@JulioAPeraza JulioAPeraza added enhancement New feature or request ibma Issues/PRs pertaining to image-based meta-analysis labels Aug 7, 2024
@JulioAPeraza JulioAPeraza requested a review from jdkent August 7, 2024 18:49
Copy link
Contributor

sourcery-ai bot commented Aug 7, 2024

Reviewer's Guide by Sourcery

This 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

Files Changes
nimare/tests/test_transforms.py
nimare/transforms.py
Added support for t-statistic images in ImageTransformer and included corresponding test cases.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a 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

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
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()
Copy link
Contributor

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.

Suggested change
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]
Copy link
Contributor

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.

Suggested change
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"

Copy link

codecov bot commented Aug 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.23%. Comparing base (1dd2a34) to head (5854655).
Report is 10 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

Copy link
Member

@jdkent jdkent left a comment

Choose a reason for hiding this comment

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

LGTM!

@jdkent jdkent merged commit 5b6e337 into neurostuff:main Aug 7, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ibma Issues/PRs pertaining to image-based meta-analysis
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants