diff --git a/._.DS_Store b/._.DS_Store new file mode 100644 index 00000000..75fb90c5 Binary files /dev/null and b/._.DS_Store differ diff --git a/._micapipe b/._micapipe new file mode 100644 index 00000000..b801deaf Binary files /dev/null and b/._micapipe differ diff --git a/functions/._init.sh b/functions/._init.sh new file mode 100644 index 00000000..76e624c2 Binary files /dev/null and b/functions/._init.sh differ diff --git a/functions/02_proc-func.sh b/functions/02_proc-func.sh index d166e6b0..379e053c 100755 --- a/functions/02_proc-func.sh +++ b/functions/02_proc-func.sh @@ -6,7 +6,8 @@ # and incorporation to mica-pipe by Raul (August-September 2020) # and addition of a bunch of fancy flags by Jessica (October-November 2020) # and updated mapping by Jordan (March 2023) -# +# + # Resting state fMRI processing with bash: # # Preprocessing workflow for func. @@ -82,7 +83,8 @@ else BIDSanat="${idBIDS}" dir_anat="${proc_struct}" fi -subject_dir + + dir_volum="${subject_dir}/parc" T1_seg_subcortex="${dir_volum}/${BIDSanat}_space-nativepro_T1w_atlas-subcortical.nii.gz" T1_seg_cerebellum="${dir_volum}/${BIDSanat}_space-nativepro_T1w_atlas-cerebellum.nii.gz" @@ -454,19 +456,15 @@ if [[ ! -f "${func_volum}/${idBIDS}${func_lab}_preproc".nii.gz ]]; then tmp_t1w_brain_res="${tmp}/nativepro_brain_rescaled.nii.gz" tmp_affineStr="${tmp}/from-nativepro_to-mainScan01_" tmp_aff_mat="${tmp_affineStr}0GenericAffine.mat" + tmp_func_strip="${tmp}/mainScan01_mean_stripped.nii.gz" tmp_func_mask="${tmp}/mainScan01_mean_mask.nii.gz" - # Create a loose mask for tedana + # Create a tight mask for tedana fslmaths "${scans4tedana[0]}" -Tmean "${tmp_func_mean}" - voxels=$(mrinfo "${tmp_func_mean}" -spacing); voxels="${voxels// /,}" - Do_cmd flirt -applyisoxfm "${voxels}" -in "${T1nativepro_brain}" -ref "${T1nativepro_brain}" -out "${tmp_t1w_brain_res}" - # [fixedImage,movingImage,initializationFeature] - centeralign="[${tmp_func_mean},${tmp_t1w_brain_res},0]" - Do_cmd antsRegistrationSyNQuick.sh -d 3 -m "$tmp_t1w_brain_res" -f "$tmp_func_mean" -o "$tmp_affineStr" -t a -n "$threads" -p d -i ${centeralign} - Do_cmd antsApplyTransforms -d 3 -i "$T1nativepro_mask" -r "$tmp_func_mean" -t "$tmp_aff_mat" -o "${tmp_func_mask}" -u int + Do_cmd mri_synthstrip -i "${tmp_func_mean}" -o "${tmp_func_strip}" -m "${tmp_func_mask}" # Run tedana - tedana -d $(printf "%s " "${scans4tedana[@]}") -e $(printf "%s " "${EchoTime[@]}") --out-dir "${tedana_dir}" --mask "${tmp_func_mask}" + tedana -d $(printf "%s " "${scans4tedana[@]}") -e $(printf "%s " "${EchoTime[@]}") --out-dir "${tedana_dir}" --mask "${tmp_func_mask}" # Overwite the motion corrected to insert this into topup. ## TODO: func_topup should take proper input arguments instead of relying on architecture implemented in other functions. @@ -507,13 +505,18 @@ else Info "Subject ${id} has a brain masked from func"; ((Nsteps++)); ((N++)) fi -# High-pass filter - Remove all frequencies EXCEPT those in the range -if [[ ! -f "${func_volum}/${idBIDS}${func_lab}_tSNR.nii.gz" ]]; then ((N++)) - Info "High pass filter" - Do_cmd 3dTproject -input "${func_nii}" -prefix "$fmri_HP" -passband 0.01 666 - if [[ -f "${fmri_HP}" ]] ; then ((Nsteps++)); fi +# High-pass filter - Remove all frequencies in the range (only for single echo processing) +# retaining frequencies above 0.01Hz +if [[ ${acq} == "se" ]]; then + if [[ ! -f "${func_volum}/${idBIDS}${func_lab}_tSNR.nii.gz" ]]; then ((N++)) + Info "High pass filter" + Do_cmd 3dTproject -input "${func_nii}" -prefix "$fmri_HP" -stopband 0 0.0099 + if [[ -f "${fmri_HP}" ]] ; then ((Nsteps++)); fi + else + Info "Subject ${id} has Highpass filter"; ((Nsteps++)); ((N++)) + fi else - Info "Subject ${id} has High-pass filter"; ((Nsteps++)); ((N++)) + fmri_HP=${func_nii} # no need to filter post tedana fi #------------------------------------------------------------------------------# diff --git a/functions/init.sh b/functions/init.sh old mode 100755 new mode 100644 diff --git a/micapipe b/micapipe old mode 100755 new mode 100644