Hello,
I'm trying to batch process a set of patients' resting state scan, where I have the identical filename of the scan
"rsfMRIscan1.nii" in each subject's scan session subdirectory, as well as the skull-stripped, pre-aligned structural in native space, called "structural1_al.nii"
Working from a sample subject's directory, I opened FSL gui and melodic GUI, set everything and clicked SAVE to make a "design.fsf" file (it seems that melodic gives me errors if I try to call this design file something else.) I then put this design.fsf file into a central /scripts directory for this study.
Since the design.fsf file generates the entire path to the time-series scan to be analyzed, I tried changing the path simply to "./rsfMRIscan1.nii" to try to invoke the file in the active directory, and had my batch command script copy this common-invoked design file to each subject's directory, thus:
...
# High pass filter cutoff
set fmri(paradigm_hp) 100
# Total voxels
set fmri(totalVoxels) 211783680
# Number of lower-level copes feeding into higher-level analysis
set fmri(ncopeinputs) 0
# 4D AVW data or FEAT directory (1)
set feat_files(1) "./rsfMRIscan1.nii"
# Add confound EVs text file
set fmri(confoundevs) 0
# Subject's structural image for analysis 1
set highres_files(1) "./structural1_al.nii"
# Resampling resolution
set fmri(regstandard_res) 4
# Variance-normalise timecourses
set fmri(varnorm) 1
# Automatic dimensionality estimation
set fmri(dim_yn) 1
# Output components
set fmri(dim) 1
# 1 : Single-session ICA
# 2 : Multi-session temporal concatenation
# 3 : Multi-session tensor TICA
set fmri(icaopt) 1
# Threshold IC maps
set fmri(thresh_yn) 1
# Mixture model threshold
set fmri(mmthresh) 0.5
# Output full stats folder
set fmri(ostats) 0
...
and invoked this with this batch-processing script (truncated to only do a single subject as a testbed):
##################### Resting-state session 1 #########################
########################################################
# Controls scan 1
foreach subject ( 70003 )
cd ../controls-scan1/${subject}*
pwd
# Make an extra NIFTI file version of the MP-RAGE that will get invoked in MELODIC pre-processing
3dAFNItoNIFTI structural1_al+orig
#check to see if rsFMRI is in series_2
cd ./series_2
pwd
if ( ! -f "${subject}_WIP_rsfMRI_1_2_1.nii" ) then
echo "no resting-state file in series_2"
cd ..
else cp ${subject}_WIP_rsfMRI_1_2_1.nii rsfMRIscan1.nii
mv rsfMRIscan1.nii ..
cd ..
endif
#check to see if rsFMRI is in series_3
cd ./series_3
pwd
if ( ! -f "${subject}_WIP_rsfMRI_1_3_1.nii" ) then
echo "no resting-state file in series_3"
cd ..
else cp ${subject}_WIP_rsfMRI_1_3_1.nii rsfMRIscan1.nii
mv rsfMRIscan1.nii ..
cd ..
endif
#check to see if rsFMRI is in series_4
cd ./series_4
pwd
if ( ! -f "${subject}_WIP_rsfMRI_1_4_1.nii" ) then
echo "no resting-state file in series_4"
cd ..
else cp ${subject}_WIP_rsfMRI_1_4_1.nii rsfMRIscan1.nii
mv rsfMRIscan1.nii ..
cd ..
endif
# Make an extra NIFTI file version of the MP-RAGE that will get invoked in MELODIC pre-processing
if ( ! -f structural1_al.nii) then
3dAFNItoNIFTI structural1_al+orig
endif
#Now run the ICA analysis of resting state scan 2
#Using parameters that were set in the MELODIC GUI
rm -rf design.fsf
cp ../../scripts/design.fsf .
feat design.fsf
#clean up
#rm design.fsf
cd ../../scripts
end
#######
However, it all crashes in the MELODIC Log, supposedly because MELODIC can't find the file, even though it is operating in the subject's directory, and making the default analysis folder in it etc.
What am I doing wrong? Is there a smoother way to do this?
Jim
|