@@ -444,31 +444,6 @@ if RUN_FLAIR:
444444 --output {output.warped}
445445 """
446446
447- # Add new rule for DWI metrics to MNI space
448- if RUN_DWI :
449- rule apply_warp_dwi_to_mni :
450- input :
451- moving = lambda wildcards : f"{ OUT_DIR } /{ SUBJECT } /{ SESSION } /dwi/{ SUBJECT } _{ SESSION } _DWI-space_{ wildcards .metric } .nii.gz" ,
452- affine_mni = rules .registration_mni152 .output .fwd_affine ,
453- warp_mni = rules .registration_mni152 .output .fwd_field ,
454- affine_dwi = rules .dwi_registration .output .fwd_affine ,
455- warp_dwi = rules .dwi_registration .output .fwd_field ,
456- secondary_warp_dwi = rules .dwi_registration .output .fwd_field_secondary ,
457- reference = ATLAS
458- output :
459- warped = f"{ OUT_DIR } /{ SUBJECT } /{ SESSION } /dwi/{ SUBJECT } _{ SESSION } _MNI152-space_{{metric}}.nii.gz"
460- threads : LIGHT_THREADS
461- wildcard_constraints :
462- metric = "FA|MD"
463- shell :
464- """
465- micaflow apply_warp \
466- --moving {input.moving} \
467- --reference {input.reference} \
468- --transforms {input.warp_mni} {input.affine_mni} {input.secondary_warp_dwi} {input.warp_dwi} {input.affine_dwi} \
469- --output {output.warped}
470- """
471-
472447rule run_texture_native :
473448 input :
474449 image = f"{ OUT_DIR } /{ SUBJECT } /{ SESSION } /anat/{ SUBJECT } _{ SESSION } _T1w-space_{{modality}}.nii.gz" ,
@@ -1103,6 +1078,31 @@ rule transform_mask_to_mni:
11031078 --warp {input.warp}
11041079 """
11051080
1081+ # Add new rule for DWI metrics to MNI space
1082+ if RUN_DWI :
1083+ rule apply_warp_dwi_to_mni :
1084+ input :
1085+ moving = lambda wildcards : f"{ OUT_DIR } /{ SUBJECT } /{ SESSION } /dwi/{ SUBJECT } _{ SESSION } _DWI-space_{ wildcards .metric } .nii.gz" ,
1086+ affine_mni = rules .registration_mni152 .output .fwd_affine ,
1087+ warp_mni = rules .registration_mni152 .output .fwd_field ,
1088+ affine_dwi = rules .dwi_registration .output .fwd_affine ,
1089+ warp_dwi = rules .dwi_registration .output .fwd_field ,
1090+ secondary_warp_dwi = rules .dwi_registration .output .fwd_field_secondary ,
1091+ reference = ATLAS
1092+ output :
1093+ warped = f"{ OUT_DIR } /{ SUBJECT } /{ SESSION } /dwi/{ SUBJECT } _{ SESSION } _MNI152-space_{{metric}}.nii.gz"
1094+ threads : LIGHT_THREADS
1095+ wildcard_constraints :
1096+ metric = "FA|MD"
1097+ shell :
1098+ """
1099+ micaflow apply_warp \
1100+ --moving {input.moving} \
1101+ --reference {input.reference} \
1102+ --transforms {input.warp_mni} {input.affine_mni} {input.secondary_warp_dwi} {input.warp_dwi} {input.affine_dwi} \
1103+ --output {output.warped}
1104+ """
1105+
11061106if EXTRACT_BRAIN :
11071107 # Remove the separate directory creation rule and handle directory creation within each rule
11081108
0 commit comments