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

✨Feature/update pixdim4 for the final *bold outputs #2154

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

Conversation

birajstha
Copy link
Contributor

@birajstha birajstha commented Sep 18, 2024

Fixes

Fixes/Related to #2139 by @sgiavasis

Description

Added a node at the very end just before data-sink to compare and update/match the pixdim4 of the CPAC processed output with the native raw source bold image, as in figure below.
image

Technical details

Tests

Run this branch and check the final CPAC outputs with following command
for file in *preproc_bold.nii.gz; do echo $file; fslinfo "$file"| grep pixdim4; done

For the outputs below, the value should be 0.8
sub-PA001_ses-V1W1_task-facesmatching_run-1_desc-preproc_bold.nii.gz
pixdim4 0.800000
sub-PA001_ses-V1W1_task-facesmatching_run-1_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
pixdim4 0.800000
sub-PA001_ses-V1W1_task-poke_run-1_desc-preproc_bold.nii.gz
pixdim4 0.800000
sub-PA001_ses-V1W1_task-poke_run-1_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
pixdim4 0.800000
sub-PA001_ses-V1W1_task-poke_run-2_desc-preproc_bold.nii.gz
pixdim4 0.800000
sub-PA001_ses-V1W1_task-poke_run-2_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
pixdim4 0.800000
sub-PA001_ses-V1W1_task-REST_run-1_desc-preproc_bold.nii.gz
pixdim4 0.800000
sub-PA001_ses-V1W1_task-REST_run-1_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
pixdim4 0.800000

Screenshots

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.

CPAC/pipeline/engine.py Outdated Show resolved Hide resolved
Comment on lines +152 to +154
error_message = f"Error in validating outputs: {e}"
IFLOGGER.error(error_message)
return output_bold
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to raise an exception here instead of (log an error message and return the path to the bold file)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I am not sure if we want to totally crash (by raising exception) CPAC here or if we only say following resources were not validated but still its here?

Copy link
Contributor Author

@birajstha birajstha Sep 18, 2024

Choose a reason for hiding this comment

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

or probably add a swtich to the config to allow choosing between

  • raising exception
  • continue

CPAC/pipeline/utils.py Outdated Show resolved Hide resolved


def update_pixdim4(file_path, new_pixdim4):
"""Update the pixdim4 value of a NIfTI file using 3drefit.
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure about this one. May be @sgiavasis could advise on this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason to use AFNI 3drefit instead of nibabel is to change the Time step in 3dinfo as well along with pixdim4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants