Skip to content

🐛 Match EPI fmaps #2247

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

Open
wants to merge 63 commits into
base: develop
Choose a base branch
from
Open

🐛 Match EPI fmaps #2247

wants to merge 63 commits into from

Conversation

shnizzedy
Copy link
Member

@shnizzedy shnizzedy commented Jun 19, 2025

Fixes

Related to #2225 by @shnizzedy
Related to #2227 by @shnizzedy

Description

  • Decodes bytestring from fmap metadata
    epi_pedir: str | bytes = scan_params["PhaseEncodingDirection"]
    if isinstance(epi_pedir, bytes):
    epi_pedir = epi_pedir.decode("utf-8")
  • Refactors existing test
  • Adds test with bytestring metadata

Technical details

This PR is based on the #2230 branch and includes the changes from #2246.

Tests

@pytest.mark.parametrize("generate", [True, False])
def test_match_epi_fmaps(generate: bool, tmp_path: Path) -> None:
"""Test `~CPAC.utils.datasource.match_epi_fmaps`."""
wf, data = match_epi_fmaps_inputs(generate, tmp_path)
match_fmaps = pe.Node(
Function(
input_names=[
"bold_pedir",
"epi_fmap_one",
"epi_fmap_params_one",
"epi_fmap_two",
"epi_fmap_params_two",
],
output_names=["opposite_pe_epi", "same_pe_epi"],
function=match_epi_fmaps,
as_module=True,
),
name="match_epi_fmaps",
)
match_fmaps.inputs.bold_pedir = data.bold_pedir
match_fmaps.inputs.epi_fmap_one = data.epi_fmaps[0][0]
match_fmaps.inputs.epi_fmap_params_one = data.epi_fmaps[0][1]
match_fmaps.inputs.epi_fmap_two = data.epi_fmaps[1][0]
match_fmaps.inputs.epi_fmap_params_two = data.epi_fmaps[1][1]
wf.add_nodes([match_fmaps])
graph: DiGraph = wf.run()
result = list(graph.nodes)[-1].run()
assert Path(result.outputs.opposite_pe_epi).exists()
assert Path(result.outputs.same_pe_epi).exists()

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the develop branch of the repository.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added tests for the changes I made (if applicable).
  • I updated the changelog.
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

shnizzedy and others added 30 commits May 9, 2025 13:54
Co-authored-by: Elizabeth Kenneally <[email protected]>
[rebuild lite]
[rebuild standard]
@shnizzedy shnizzedy changed the base branch from main to develop June 19, 2025 02:52
@shnizzedy shnizzedy self-assigned this Jun 19, 2025
@shnizzedy shnizzedy added bug develop issue on `develop` branch labels Jun 19, 2025
@shnizzedy shnizzedy moved this to 👀 In review in C-PAC Development Jun 19, 2025
@shnizzedy shnizzedy added this to the 1.8.8 release milestone Jun 19, 2025
Copy link

codecov bot commented Jun 19, 2025

Codecov Report

Attention: Patch coverage is 67.63636% with 178 lines in your changes missing coverage. Please review.

Project coverage is 29.0%. Comparing base (a2c3d2f) to head (1156a21).
Report is 52 commits behind head on develop.

Files with missing lines Patch % Lines
CPAC/func_preproc/func_motion.py 62.8% 51 Missing and 10 partials ⚠️
CPAC/registration/registration.py 34.0% 32 Missing and 3 partials ⚠️
CPAC/pipeline/engine.py 28.6% 14 Missing and 1 partial ⚠️
CPAC/pipeline/cpac_pipeline.py 8.3% 10 Missing and 1 partial ⚠️
CPAC/utils/monitoring/monitoring.py 68.8% 6 Missing and 4 partials ⚠️
...PAC/func_preproc/tests/test_preproc_connections.py 0.0% 9 Missing ⚠️
CPAC/utils/datasource.py 53.8% 4 Missing and 2 partials ⚠️
CPAC/nuisance/nuisance.py 61.5% 5 Missing ⚠️
CPAC/utils/tests/osf.py 70.6% 3 Missing and 2 partials ⚠️
CPAC/qc/xcp.py 0.0% 4 Missing ⚠️
... and 10 more
Additional details and impacted files
@@            Coverage Diff            @@
##           develop   #2247     +/-   ##
=========================================
+ Coverage     28.4%   29.0%   +0.6%     
=========================================
  Files          230     230             
  Lines        26052   26227    +175     
  Branches      4092    4124     +32     
=========================================
+ Hits          7397    7615    +218     
+ Misses       18024   17955     -69     
- Partials       631     657     +26     
Files with missing lines Coverage Δ
CPAC/_entrypoints/run.py 9.0% <ø> (+0.1%) ⬆️
CPAC/func_preproc/__init__.py 100.0% <ø> (ø)
CPAC/network_centrality/network_centrality.py 88.7% <100.0%> (+4.5%) ⬆️
CPAC/nuisance/bandpass.py 42.7% <ø> (ø)
CPAC/nuisance/tests/test_bandpass.py 100.0% <100.0%> (ø)
CPAC/pipeline/nipype_pipeline_engine/engine.py 30.8% <100.0%> (ø)
CPAC/pipeline/nodeblock.py 97.4% <100.0%> (+0.3%) ⬆️
CPAC/pipeline/test/test_schema_validation.py 100.0% <100.0%> (ø)
CPAC/qc/pipeline.py 25.0% <ø> (ø)
...registration/tests/test_registration_connectors.py 100.0% <100.0%> (ø)
... and 25 more

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug develop issue on `develop` branch
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

1 participant