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

resources to osf repo #268

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 43 additions & 43 deletions hippunfold/config/snakebids.yml
Original file line number Diff line number Diff line change
Expand Up @@ -363,43 +363,43 @@ template: CITI168

template_files:
CITI168:
T1w: templates-3d/CITI168/T1w_head_700um.nii.gz
T2w: templates-3d/CITI168/T2w_head_700um.nii.gz
xfm_corobl: templates-3d/CITI168/CoronalOblique_rigid.txt
crop_ref: templates-3d/CITI168/T2w_300umCoronalOblique_hemi-{hemi}.nii.gz
crop_refT1w: templates-3d/CITI168/T1w_300umCoronalOblique_hemi-{hemi}.nii.gz
Mask_crop: templates-3d/CITI168/Mask_300umCoronalOblique_hemi-{hemi}.nii.gz
T1w: CITI168/T1w_head_700um.nii.gz
T2w: CITI168/T2w_head_700um.nii.gz
xfm_corobl: CITI168/CoronalOblique_rigid.txt
crop_ref: CITI168/T2w_300umCoronalOblique_hemi-{hemi}.nii.gz
crop_refT1w: CITI168/T1w_300umCoronalOblique_hemi-{hemi}.nii.gz
Mask_crop: CITI168/Mask_300umCoronalOblique_hemi-{hemi}.nii.gz
dHCP:
T1w: templates-3d/tpl-dHCP/cohort-1/tpl-dHCP_cohort-1_res-1_T1w.nii.gz
xfm_corobl: templates-3d/tpl-dHCP/cohort-1/tpl-dHCP_cohort-1_to-corobl_affine.txt
crop_ref: templates-3d/CITI168/T2w_300umCoronalOblique_hemi-{hemi}.nii.gz
crop_refT1w: templates-3d/CITI168/T1w_300umCoronalOblique_hemi-{hemi}.nii.gz
Mask_crop: templates-3d/CITI168/Mask_300umCoronalOblique_hemi-{hemi}.nii.gz
T1w: tpl-dHCP/cohort-1/tpl-dHCP_cohort-1_res-1_T1w.nii.gz
xfm_corobl: tpl-dHCP/cohort-1/tpl-dHCP_cohort-1_to-corobl_affine.txt
crop_ref: CITI168/T2w_300umCoronalOblique_hemi-{hemi}.nii.gz
crop_refT1w: CITI168/T1w_300umCoronalOblique_hemi-{hemi}.nii.gz
Mask_crop: CITI168/Mask_300umCoronalOblique_hemi-{hemi}.nii.gz
upenn:
dseg: templates-3d/tpl-upenn/tpl-upenn_desc-hipptissue_dseg.nii.gz
coords: templates-3d/tpl-upenn/tpl-upenn_dir-{dir}_label-{autotop}_coords.nii.gz
dseg: tpl-upenn/tpl-upenn_desc-hipptissue_dseg.nii.gz
coords: tpl-upenn/tpl-upenn_dir-{dir}_label-{autotop}_coords.nii.gz
MBMv2:
T1w: templates-3d/tpl-MBMv2/Template_sym_MTR_80um.nii.gz
T2w: templates-3d/tpl-MBMv2/Template_sym_T2_80um.nii.gz
xfm_corobl: templates-3d/tpl-MBMv2/tpl-MBMv2_from-native_to-corobl_type-itk_affine.txt
crop_ref: templates-3d/tpl-MBMv2/tpl-MBMv2_hemi-{hemi}_space-corobl_T2w.nii.gz
crop_refT1w: templates-3d/tpl-MBMv2/tpl-MBMv2_hemi-{hemi}_space-corobl_MTR.nii.gz
Mask_crop: templates-3d/tpl-MBMv2/tpl-MBMv2_hemi-{hemi}_space-corobl_desc-hipp_mask.nii.gz
dseg: templates-3d/tpl-MBMv2/tpl-MBMv2_hemi-R_space-corobl_desc-tissuemanual_dseg.nii.gz
coords: templates-3d/tpl-MBMv2/tpl-MBMv2_dir-{dir}_hemi-R_space-corobl_label-{autotop}_desc-laplace_coords.nii.gz
T1w: tpl-MBMv2/Template_sym_MTR_80um.nii.gz
T2w: tpl-MBMv2/Template_sym_T2_80um.nii.gz
xfm_corobl: tpl-MBMv2/tpl-MBMv2_from-native_to-corobl_type-itk_affine.txt
crop_ref: tpl-MBMv2/tpl-MBMv2_hemi-{hemi}_space-corobl_T2w.nii.gz
crop_refT1w: tpl-MBMv2/tpl-MBMv2_hemi-{hemi}_space-corobl_MTR.nii.gz
Mask_crop: tpl-MBMv2/tpl-MBMv2_hemi-{hemi}_space-corobl_desc-hipp_mask.nii.gz
dseg: tpl-MBMv2/tpl-MBMv2_hemi-R_space-corobl_desc-tissuemanual_dseg.nii.gz
coords: tpl-MBMv2/tpl-MBMv2_dir-{dir}_hemi-R_space-corobl_label-{autotop}_desc-laplace_coords.nii.gz
MBMv3:
T1w: templates-3d/tpl-MBMv3/tpl-MBMv3_T1w.nii.gz
T2w: templates-3d/tpl-MBMv3/tpl-MBMv3_T2w.nii.gz
xfm_corobl: templates-3d/tpl-MBMv3/tpl-MBMv3_from-native_to-corobl_type-itk_affine.txt
crop_ref: templates-3d/tpl-MBMv3/tpl-MBMv3_hemi-{hemi}_space-corobl_T2w.nii.gz
crop_refT1w: templates-3d/tpl-MBMv3/tpl-MBMv3_hemi-{hemi}_space-corobl_T1w.nii.gz
Mask_crop: templates-3d/tpl-MBMv3/tpl-MBMv3_hemi-{hemi}_space-corobl_desc-hipp_mask.nii.gz
dseg: templates-3d/tpl-MBMv3/tpl-MBMv3_hemi-R_space-corobl_desc-tissue_dseg.nii.gz
coords: templates-3d/tpl-MBMv3/tpl-MBMv3_dir-{dir}_hemi-R_space-corobl_label-{autotop}_desc-laplace_coords.nii.gz
T1w: tpl-MBMv3/tpl-MBMv3_T1w.nii.gz
T2w: tpl-MBMv3/tpl-MBMv3_T2w.nii.gz
xfm_corobl: tpl-MBMv3/tpl-MBMv3_from-native_to-corobl_type-itk_affine.txt
crop_ref: tpl-MBMv3/tpl-MBMv3_hemi-{hemi}_space-corobl_T2w.nii.gz
crop_refT1w: tpl-MBMv3/tpl-MBMv3_hemi-{hemi}_space-corobl_T1w.nii.gz
Mask_crop: tpl-MBMv3/tpl-MBMv3_hemi-{hemi}_space-corobl_desc-hipp_mask.nii.gz
dseg: tpl-MBMv3/tpl-MBMv3_hemi-R_space-corobl_desc-tissue_dseg.nii.gz
coords: tpl-MBMv3/tpl-MBMv3_dir-{dir}_hemi-R_space-corobl_label-{autotop}_desc-laplace_coords.nii.gz
upenn:
T1w: templates-3d/tpl-upenn/tpl-upenn_desc-hipptissue_dseg.nii.gz
dseg: templates-3d/tpl-upenn/tpl-upenn_desc-hipptissue_dseg.nii.gz
coords: templates-3d/tpl-upenn/tpl-upenn_dir-{dir}_label-{autotop}_coords.nii.gz
T1w: tpl-upenn/tpl-upenn_desc-hipptissue_dseg.nii.gz
dseg: tpl-upenn/tpl-upenn_desc-hipptissue_dseg.nii.gz
coords: tpl-upenn/tpl-upenn_dir-{dir}_label-{autotop}_coords.nii.gz



Expand All @@ -408,20 +408,20 @@ atlas:

atlas_files:
multihist7:
label_nii: atlases-unfolded/multihist7/sub-maxprob_label-hipp_desc-manualsubfieldsunfoldaligned_dseg.nii.gz
label_list: atlases-unfolded/multihist7/labellist.txt
thick: atlases-unfolded/multihist7/thickness.nii.gz
curv: atlases-unfolded/multihist7/curvature.nii.gz
gyr: atlases-unfolded/multihist7/gyrification.nii.gz
label_nii: multihist7/sub-maxprob_label-hipp_desc-manualsubfieldsunfoldaligned_dseg.nii.gz
label_list: multihist7/labellist.txt
thick: multihist7/thickness.nii.gz
curv: multihist7/curvature.nii.gz
gyr: multihist7/gyrification.nii.gz
bigbrain:
label_nii: atlases-unfolded/bigbrain/sub-bigbrain_hemi-{hemi}_label-hipp_desc-manualsubfields_dseg.nii.gz
label_list: atlases-unfolded/bigbrain/sub-bigbrain_labellist.txt
label_nii: bigbrain/sub-bigbrain_hemi-{hemi}_label-hipp_desc-manualsubfields_dseg.nii.gz
label_list: bigbrain/sub-bigbrain_labellist.txt
magdeburg:
label_nii: atlases-unfolded/magdeburg/sub-all_hemi-{hemi}_label-hipp_desc-manualsubfields_maxprob.nii.gz
label_list: atlases-unfolded/magdeburg/magdeburg_labellist.txt
label_nii: magdeburg/sub-all_hemi-{hemi}_label-hipp_desc-manualsubfields_maxprob.nii.gz
label_list: magdeburg/magdeburg_labellist.txt
freesurfer:
label_nii: atlases-unfolded/freesurfer/sub-all_hemi-{hemi}_space-unfold_label-hipp_desc-freesurfersubfields_dseg.nii.gz
label_list: atlases-unfolded/freesurfer/freesurfer_labellist.txt
label_nii: freesurfer/sub-all_hemi-{hemi}_space-unfold_label-hipp_desc-freesurfersubfields_dseg.nii.gz
label_list: freesurfer/freesurfer_labellist.txt


inject_template: upenn
Expand Down
58 changes: 42 additions & 16 deletions hippunfold/workflow/rules/downloads.smk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def get_model_tar():

return os.path.abspath(os.path.join(download_dir, local_tar.split("/")[-1]))


rule download_model:
params:
url=config["nnunet_model"][config["force_nnunet_model"]]
Expand All @@ -26,43 +25,70 @@ rule download_model:

rule download_atlas:
params:
url=config["atlas_files_osf"][config["atlas"]],
url=lambda wildcards: config["atlas_files_osf"][wildcards.atlas],
output:
model_zip=os.path.join(download_dir,"{atlas}"+'.zip')
container:
config["singularity"]["autotop"]
shell:
"wget https://{params.url} -O {output.model_zip}"

rule download_template:
params:
url=lambda wildcards: config["template_files_osf"][wildcards.atlas],
output:
model_zip=os.path.join(download_dir,config["atlas"]+'.zip')
model_zip=os.path.join(download_dir,"{template}"+'.zip')
container:
config["singularity"]["autotop"]
shell:
"wget https://{params.url} -O {output.model_zip}"


rule unzip_atlas:
def atlas_outs():
outs = []
for a in config["atlas"]:
for fn in config["atlas_files"][a]:
outs.append(os.path.join(download_dir,config["atlas_files"][a][fn]))
return outs

def template_outs():
outs = []
for fn in config["template_files"][config["template"]]:
outs.append(os.path.join(download_dir,config["template_files"][config["template"]][fn]))
return outs


rule unzip_template:
input:
model_zip=os.path.join(download_dir,config["atlas"]+'.zip'),
model_zip=os.path.join(download_dir,"{template}"+'.zip'),
params:
dir=download_dir,
output:
os.path.join(download_dir,config["atlas_files"][config["atlas"]]["label_nii"])
template_outs(),
shell:
"unzip {input.model_zip} -d {params.dir}"


rule download_template:
rule unzip_atlas:
input:
model_zip=os.path.join(download_dir,"{atlas}"+'.zip'),
params:
url=config["template_files_osf"][config["template"]],
dir=download_dir,
output:
model_zip=os.path.join(download_dir,config["template"]+'.zip')
container:
config["singularity"]["autotop"]
atlas_outs()
shell:
"wget https://{params.url} -O {output.model_zip}"
"unzip {input.model_zip} -d {params.dir}"


rule unzip_template:
rule unzip_template_shape:
input:
model_zip=os.path.join(download_dir,config["template"]+'.zip'),
model_zip=os.path.join(download_dir,config["inject_template"]+'.zip'),
params:
dir=download_dir,
output:
os.path.join(download_dir,config["template_files"][config["template"]]["T1w"])
template_seg=os.path.join(
download_dir,
config["template_files"][config["inject_template"]]["dseg"],
)
shell:
"unzip {input.model_zip} -d {params.dir}"

2 changes: 1 addition & 1 deletion hippunfold/workflow/rules/gifti.smk
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ rule resample_atlas_to_refvol:
"""this is just done in case the atlas has a different unfolded config than the current run"""
input:
atlas=lambda wildcards: os.path.join(
workflow.basedir, "..", config["atlas_files"][wildcards.atlas]["label_nii"]
download_dir, config["atlas_files"][wildcards.atlas]["label_nii"]
),
refvol=bids(
root=root,
Expand Down
2 changes: 1 addition & 1 deletion hippunfold/workflow/rules/nnunet.smk
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def get_f3d_ref(wildcards):
if config["modality"] == "T2w":
nii = (
os.path.join(
download_dir
download_dir,
config["template_files"][config["template"]]["crop_ref"],
),
)
Expand Down
6 changes: 2 additions & 4 deletions hippunfold/workflow/rules/shape_inject.smk
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ rule prep_segs_for_greedy:
rule import_template_shape:
input:
template_seg=os.path.join(
workflow.basedir,
"..",
download_dir,
config["template_files"][config["inject_template"]]["dseg"],
),
output:
Expand Down Expand Up @@ -278,8 +277,7 @@ rule template_shape_inject:
rule inject_init_laplace_coords:
input:
coords=os.path.join(
workflow.basedir,
"..",
download_dir,
config["template_files"][config["inject_template"]]["coords"],
),
subject_seg=get_input_for_shape_inject,
Expand Down
Loading