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: Add separate workflow to run with a single anatomical #316

Merged
merged 14 commits into from
Nov 10, 2023
Merged
1 change: 1 addition & 0 deletions .circleci/bcp_anat_outputs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_space-MNIInfant_cohort-1_dseg.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_space-MNIInfant_cohort-1_label-CSF_probseg.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_space-MNIInfant_cohort-1_label-GM_probseg.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_space-MNIInfant_cohort-1_label-WM_probseg.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_space-T1w_desc-preproc_T2w.json
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_space-T1w_desc-preproc_T2w.nii.gz
sub-01_ses-1mo.html
54 changes: 54 additions & 0 deletions .circleci/bcp_anat_t2only_outputs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
.bidsignore
dataset_description.json
desc-aparcaseg_dseg.tsv
desc-aseg_dseg.tsv
logs
logs/CITATION.bib
logs/CITATION.html
logs/CITATION.md
logs/CITATION.tex
sub-01
sub-01/ses-1mo
sub-01/ses-1mo/anat
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_desc-aparcaseg_dseg.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_desc-aseg_dseg.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_desc-brain_mask.json
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_desc-brain_mask.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_desc-preproc_T2w.json
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_desc-preproc_T2w.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_desc-ribbon_mask.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_dseg.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_from-MNIInfant+1_to-T2w_mode-image_xfm.h5
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_from-T2w_to-MNIInfant+1_mode-image_xfm.h5
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_from-T2w_to-fsnative_mode-image_xfm.txt
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_from-fsnative_to-T2w_mode-image_xfm.txt
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_hemi-L_curv.shape.gii
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_hemi-L_desc-reg_sphere.surf.gii
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_hemi-L_inflated.surf.gii
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_hemi-L_midthickness.surf.gii
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_hemi-L_pial.surf.gii
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_hemi-L_space-fsLR_desc-reg_sphere.surf.gii
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_hemi-L_sulc.shape.gii
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_hemi-L_thickness.shape.gii
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_hemi-L_white.surf.gii
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_hemi-R_curv.shape.gii
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_hemi-R_desc-reg_sphere.surf.gii
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_hemi-R_inflated.surf.gii
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_hemi-R_midthickness.surf.gii
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_hemi-R_pial.surf.gii
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_hemi-R_space-fsLR_desc-reg_sphere.surf.gii
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_hemi-R_sulc.shape.gii
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_hemi-R_thickness.shape.gii
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_hemi-R_white.surf.gii
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_label-CSF_probseg.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_label-GM_probseg.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_label-WM_probseg.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_space-MNIInfant_cohort-1_desc-brain_mask.json
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_space-MNIInfant_cohort-1_desc-brain_mask.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_space-MNIInfant_cohort-1_desc-preproc_T2w.json
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_space-MNIInfant_cohort-1_desc-preproc_T2w.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_space-MNIInfant_cohort-1_dseg.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_space-MNIInfant_cohort-1_label-CSF_probseg.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_space-MNIInfant_cohort-1_label-GM_probseg.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_space-MNIInfant_cohort-1_label-WM_probseg.nii.gz
sub-01_ses-1mo.html
1 change: 1 addition & 0 deletions .circleci/bcp_full_outputs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_space-MNIInfant_cohort-1_dseg.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_space-MNIInfant_cohort-1_label-CSF_probseg.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_space-MNIInfant_cohort-1_label-GM_probseg.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_space-MNIInfant_cohort-1_label-WM_probseg.nii.gz
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_space-T1w_desc-preproc_T2w.json
sub-01/ses-1mo/anat/sub-01_ses-1mo_run-001_space-T1w_desc-preproc_T2w.nii.gz
sub-01/ses-1mo/fmap
sub-01/ses-1mo/fmap/sub-01_ses-1mo_run-001_fmapid-auto00000_desc-coeff_fieldmap.nii.gz
Expand Down
44 changes: 44 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,50 @@ jobs:
pip install nibabel numpy nitransforms
python /tmp/src/nibabies/scripts/check_outputs.py /tmp/${DATASET}/derivatives/nibabies
exit $?
- run:
name: Create copy with only T2w data
command: |
mkdir -p /tmp/data/${DATASET}-t2only
cp /tmp/data/${DATASET}/dataset_description.json /tmp/data/${DATASET}-t2only
cp -r /tmp/data/${DATASET}/sub-01 /tmp/data/${DATASET}-t2only/sub-01
rm -f /tmp/data/${DATASET}-t2only/sub-01/ses-1mo/anat/*_T1w.*
tree /tmp/data/${DATASET}-t2only
mkdir -p /tmp/data/${DATASET}-t2only/derivatives
cp -r /tmp/data/${DATASET}/derivatives/precomputed /tmp/data/${DATASET}-t2only/derivatives
# rename the derivatives for now - this is only possible since they share the same space
sudo apt install rename
rename 's/space-T1w/space-T2w/' /tmp/data/${DATASET}-t2only/derivatives/precomputed/sub-01/ses-1mo/anat/*
sed -i 's/_T1w./_T2w./g' /tmp/data/${DATASET}-t2only/derivatives/precomputed/sub-01/ses-1mo/anat/*json
tree /tmp/data/${DATASET}-t2only/derivatives/precomputed

- run:
name: Run nibabies single anatomical workflow
no_output_timeout: 1h
command: |
mkdir -p /tmp/data/${DATASET}-t2only /tmp/${DATASET}/derivatives/nibabies-t2only /tmp/${DATASET}/work-t2only
nibabies-wrapper docker /tmp/data/${DATASET}-t2only /tmp/${DATASET}/derivatives/nibabies-t2only participant \
-i nipreps/nibabies:dev \
-e NIBABIES_DEV 1 --user $(id -u):$(id -g) \
--network none --notrack \
--config $PWD/nipype.cfg -w /tmp/${DATASET}/work-t2only \
--fs-subjects-dir /tmp/data/${DATASET}/derivatives/infant-freesurfer \
--skull-strip-template UNCInfant:cohort-1 \
--output-spaces MNIInfant:cohort-1 func \
--sloppy --write-graph --mem-mb 14000 \
--nthreads 4 -vv --age-months 2 --sloppy \
--derivatives /tmp/data/${DATASET}-t2only/derivatives/precomputed \
--output-layout bids --anat-only
- run:
name: Checking outputs of T2-only nibabies anat
command: |
mkdir -p /tmp/${DATASET}/test
CHECK_OUTPUTS_FILE="${DATASET}_anat_t2only_outputs.txt"
cd /tmp/${DATASET}/derivatives/nibabies-t2only && tree -I 'figures|log' -lifa --noreport | sed s+^\./++ | sed '1d' | sort > /tmp/${DATASET}/test/outputs.out
cat /tmp/${DATASET}/test/outputs.out
sort -o /tmp/${DATASET}/test/expected.out /tmp/src/nibabies/.circleci/${CHECK_OUTPUTS_FILE}
diff /tmp/${DATASET}/test/expected.out /tmp/${DATASET}/test/outputs.out
rm -rf /tmp/${DATASET}/test
exit $?
- store_artifacts:
path: /tmp/bcp/derivatives

Expand Down
6 changes: 6 additions & 0 deletions .pep8speaks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
scanner:
diff_only: True
linter: pycodestyle

pycodestyle:
max-line-length: 100
2 changes: 1 addition & 1 deletion nibabies/utils/bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def validate_input_dir(exec_env, bids_dir, participant_label):
"MISSING_TSV_COLUMN_EEG_ELECTRODES",
"MISSING_SESSION",
],
"error": ["NO_T1W"],
"error": [],
"ignoredFiles": ["/dataset_description.json", "/participants.tsv"],
}
# Limit validation only to data from requested participants
Expand Down
2 changes: 1 addition & 1 deletion nibabies/workflows/anatomical/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .base import init_infant_anat_wf
from .base import init_infant_anat_wf, init_infant_single_anat_wf
Loading