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

Modifications to generic fMRIVolume and fMRISurface pipelines to run on longitudinal sessions. #319

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
674d066
Longitudinal development - fMRIVOlumeProcessing pipeline in process
mmilch01 Nov 25, 2024
f18eefa
+Roll back changes in fMRIVolume.
Dec 5, 2024
d5a2fe4
+first pass of fMRIVolume longitudinal pipeline, with necessary chang…
mmilch01 Dec 16, 2024
31e8418
+function to create filewise symlinks at directory level
mmilch01 Dec 16, 2024
2699a6e
+longitudinal modificatin - in progress
mmilch01 Dec 18, 2024
05044b5
+sync with debug version
mmilch01 Dec 18, 2024
0298415
+ in process
Dec 18, 2024
20fd71b
Merge branch 'feature/longitudinal_fs' of https://github.com/Washingt…
Dec 18, 2024
67534ad
Merge branch 'feature/longitudinal_fs' of https://github.com/Washingt…
Dec 18, 2024
c0ec85a
+fix BiasField not being added in MNI space for longitudinal timepoints
mmilch01 Dec 23, 2024
96e33e8
+longitudinal modification/debug in process
Dec 23, 2024
2f63e81
Merge branch 'feature/longitudinal_fs' of https://github.com/Washingt…
Dec 23, 2024
cf25caa
+fMRIVolume longitudinal - stable version v. 0.1
Dec 26, 2024
53fdf69
+Remove filewise symlinking as unusable
Dec 28, 2024
0619cdc
+batch script to run fMRISurfaceProcessingPipeline on longitudinal se…
Dec 28, 2024
ffe0873
+fix cp -rf syntax
Dec 28, 2024
c8a2c88
+remove obsolete GenericfMRIVolumeProcessingPipeline-long.sh
Dec 29, 2024
9316d4a
+fix fMRI Distortion correction code that seems to have been duplicated
mmilch01 Dec 31, 2024
a0865f1
+remove test files
mmilch01 Dec 31, 2024
13f5b8d
+Removed error on multi-echo in longitudinal mode.
mmilch01 Jan 3, 2025
cb1faef
+address reviewer comments
mmilch01 Jan 6, 2025
592e411
Update fMRISurface/GenericfMRISurfaceProcessingPipeline.sh
mmilch01 Jan 15, 2025
841f4b6
+Addressing reviewer comments
Jan 15, 2025
1eb393f
Merge branch 'feature/longitudinal_fs' of https://github.com/Washingt…
Jan 15, 2025
503255a
Update fMRIVolume/scripts/DistortionCorrectionAndEPIToT1wReg_FLIRTBBR…
mmilch01 Jan 16, 2025
723df87
Update fMRIVolume/scripts/DistortionCorrectionAndEPIToT1wReg_FLIRTBBR…
mmilch01 Jan 16, 2025
53c153c
+per review, removed irrelevant comments
Jan 22, 2025
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
116 changes: 116 additions & 0 deletions Examples/Scripts/GenericfMRISurfaceProcessingPipelineBatch-long.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#!/bin/bash

StudyFolder="<MyStudyFolder>"
#The list of subject labels, space separated
Subjects=(HCA6002236)
PossibleVisits=(V1_MR V2_MR V3_MR)
ExcludeVisits=()
Templates=(HCA6002236_V1_V2_V3)

EnvironmentScript="<hcp-pipelines-folder>/scripts/SetUpHCPPipeline.sh" #Pipeline environment script

# Requirements for this script
# installed versions of: FSL, Connectome Workbench (wb_command)
# environment: HCPPIPEDIR, FSLDIR, CARET7DIR

#Set up pipeline environment variables and software
source "$EnvironmentScript"

# Log the originating call
echo "$@"

function identify_timepoints
{
local subject=$1
local tplist=""
local tp visit n

#build the list of timepoints
n=0
for visit in ${PossibleVisits[*]}; do
tp="${subject}_${visit}"
if [ -d "$StudyFolder/$tp" ] && ! [[ " ${ExcludeVisits[*]+${ExcludeVisits[*]}} " =~ [[:space:]]"$tp"[[:space:]] ]]; then
if (( n==0 )); then
tplist="$tp"
else
tplist="$tplist@$tp"
fi
fi
((n++))
done
echo $tplist
}

#NOTE: syntax for QUEUE has changed compared to earlier pipeline releases,
#DO NOT include "-q " at the beginning
#default to no queue, implying run local
QUEUE="long.q"
#QUEUE="hcp_priority.q"

########################################## INPUTS ##########################################

#Scripts called by this script do assume they run on the outputs of the FreeSurfer Pipeline

######################################### DO WORK ##########################################

TaskList=()
TaskList+=(rfMRI_REST1_AP)
TaskList+=(rfMRI_REST1_PA)
TaskList+=(rfMRI_REST2_AP)
TaskList+=(rfMRI_REST2_PA)
TaskList+=(tfMRI_FACENAME_PA)
TaskList+=(tfMRI_VISMOTOR_PA)
TaskList+=(tfMRI_CARIT_PA)

for i in "${!Subjects[@]}"; do
Subject="${Subjects[i]}"
TemplateLong="${Templates[i]}"
Timepoint_list_cross_at_separated=$(identify_timepoints "$Subject")
IFS=@ read -r -a Timepoint_list_cross <<< "${Timepoint_list_cross_at_separated}"
echo Subject: $Subject

for TimepointCross in "${Timepoint_list_cross[@]}"; do
TimepointLong=${TimepointCross}.long.${TemplateLong}
echo "TimepointLong: $TimepointLong"

for fMRIName in "${TaskList[@]}" ; do
echo " ${fMRIName}"
LowResMesh="32" #Needs to match what is in PostFreeSurfer, 32 is on average 2mm spacing between the vertices on the midthickness
FinalfMRIResolution="2" #Needs to match what is in fMRIVolume, i.e. 2mm for 3T HCP data and 1.6mm for 7T HCP data
SmoothingFWHM="2" #Recommended to be roughly the grayordinates spacing, i.e 2mm on HCP data
GrayordinatesResolution="2" #Needs to match what is in PostFreeSurfer. 2mm gives the HCP standard grayordinates space with 91282 grayordinates. Can be different from the FinalfMRIResolution (e.g. in the case of HCP 7T data at 1.6mm)
RegName="MSMSulc" #MSMSulc is recommended, if binary is not available use FS (FreeSurfer)

if [[ "${command_line_specified_run_local}" == "TRUE" || "$QUEUE" == "" ]] ; then
echo "About to locally run ${HCPPIPEDIR}/fMRISurface/GenericfMRISurfaceProcessingPipeline.sh"
queuing_command=("$HCPPIPEDIR"/global/scripts/captureoutput.sh)
else
echo "About to use fsl_sub to queue ${HCPPIPEDIR}/fMRISurface/GenericfMRISurfaceProcessingPipeline.sh"
queuing_command=("$FSLDIR/bin/fsl_sub" -q "$QUEUE")
fi

"${queuing_command[@]}" "$HCPPIPEDIR"/fMRISurface/GenericfMRISurfaceProcessingPipeline.sh \
--path="$StudyFolder" \
--session="$TimepointLong" \
--fmriname="$fMRIName" \
--lowresmesh="$LowResMesh" \
--fmrires="$FinalfMRIResolution" \
--smoothingFWHM="$SmoothingFWHM" \
--grayordinatesres="$GrayordinatesResolution" \
--regname="$RegName"

# The following lines are used for interactive debugging to set the positional parameters: $1 $2 $3 ...

echo "set -- --path=$StudyFolder \
--session=$TimepointLong \
--fmriname=$fMRIName \
--lowresmesh=$LowResMesh \
--fmrires=$FinalfMRIResolution \
--smoothingFWHM=$SmoothingFWHM \
--grayordinatesres=$GrayordinatesResolution \
--regname=$RegName"

echo ". ${EnvironmentScript}"
done
done
done
Loading