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

ENH+RF: Allow precomputed derivatives in T1w or T2w space #305

Merged
merged 19 commits into from
Aug 30, 2023

Conversation

mgxd
Copy link
Collaborator

@mgxd mgxd commented Aug 10, 2023

Closes #293

This PR alters how precomputed derivatives are handled by nibabies, and will make previously valid inputs invalid.

This allows the ingress of an anatomical mask and/or aseg in either T1w or T2w space. Derivatives are expected to use the space entity to signal which modality it was derived from, and more specifically, include a JSON sidecar with SpatialReference key pointing to the specific anatomical used to derive the file.

derivatives/precomputed/
├── README
├── dataset_description.json
└── sub-981854
    └── ses-1mo
        └── anat
            ├── sub-981854_ses-1mo_space-T1w_desc-aseg_dseg.json
            ├── sub-981854_ses-1mo_space-T1w_desc-aseg_dseg.nii.gz
            ├── sub-981854_ses-1mo_space-T1w_desc-brain_mask.json
            └── sub-981854_ses-1mo_space-T1w_desc-brain_mask.nii.gz

The sidecars are composed of:

{"SpatialReference": "sub-981854/ses-1mo/anat/sub-981854_ses-1mo_T1w.nii.gz"}

TODO:

  • Test the various combinations
  • Update the documentation (docstrings, RTD)
  • Add testing for the new Derivatives class
  • Update the testing data to reflect changes

@codecov
Copy link

codecov bot commented Aug 10, 2023

Codecov Report

Patch coverage: 50.40% and project coverage change: +1.03% 🎉

Comparison is base (86ab4ec) 32.25% compared to head (b6838ef) 33.28%.
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #305      +/-   ##
==========================================
+ Coverage   32.25%   33.28%   +1.03%     
==========================================
  Files          55       55              
  Lines        5048     5195     +147     
==========================================
+ Hits         1628     1729     +101     
- Misses       3420     3466      +46     
Files Changed Coverage Δ
nibabies/workflows/anatomical/preproc.py 23.52% <0.00%> (+5.67%) ⬆️
nibabies/workflows/anatomical/base.py 8.26% <5.45%> (-1.02%) ⬇️
nibabies/workflows/anatomical/template.py 10.76% <11.53%> (+0.76%) ⬆️
nibabies/workflows/anatomical/registration.py 12.72% <13.04%> (-4.42%) ⬇️
nibabies/workflows/base.py 26.21% <33.33%> (+0.43%) ⬆️
nibabies/utils/bids.py 42.85% <73.13%> (+14.49%) ⬆️
nibabies/utils/tests/test_bids.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mgxd mgxd marked this pull request as ready for review August 29, 2023 14:30
@mgxd
Copy link
Collaborator Author

mgxd commented Aug 29, 2023

@madisoth The latest patch should fix #309 - would you mind testing with the latest commit?

EDIT: Passed without error.

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

Successfully merging this pull request may close these issues.

Allow ingress of segmentations in different spaces through --derivatives flag
1 participant