diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/design_tem.fsf b/design_tem.fsf index 02563b7..9d0e3d7 100755 --- a/design_tem.fsf +++ b/design_tem.fsf @@ -36,7 +36,7 @@ set fmri(sscleanup_yn) 0 set fmri(outputdir) "" # TR(s) -set fmri(tr) 3.0000000000 +set fmri(tr) 2.0000000000 # Total volumes set fmri(npts) 80 @@ -268,7 +268,7 @@ set fmri(regstandard_nonlinear_yn) 0 set fmri(regstandard_nonlinear_warpres) 10 # High pass filter cutoff -set fmri(paradigm_hp) 60 +set fmri(paradigm_hp) 40 # Total voxels set fmri(totalVoxels) 39321600 @@ -321,10 +321,10 @@ set fmri(deriv_yn1) 1 set fmri(skip1) 0 # Off (EV 1) -set fmri(off1) 30 +set fmri(off1) 20 # On (EV 1) -set fmri(on1) 30 +set fmri(on1) 20 # Phase (EV 1) set fmri(phase1) 0 diff --git a/design_tem_1_5.fsf b/design_tem_1_5.fsf new file mode 100644 index 0000000..7fb0bfa --- /dev/null +++ b/design_tem_1_5.fsf @@ -0,0 +1,396 @@ + +# FEAT version number +set fmri(version) 6.00 + +# Are we in MELODIC? +set fmri(inmelodic) 0 + +# Analysis level +# 1 : First-level analysis +# 2 : Higher-level analysis +set fmri(level) 1 + +# Which stages to run +# 0 : No first-level analysis (registration and/or group stats only) +# 7 : Full first-level analysis +# 1 : Pre-Stats +# 3 : Pre-Stats + Stats +# 2 : Stats +# 6 : Stats + Post-stats +# 4 : Post-stats +set fmri(analysis) 7 + +# Use relative filenames +set fmri(relative_yn) 0 + +# Balloon help +set fmri(help_yn) 1 + +# Run Featwatcher +set fmri(featwatcher_yn) 1 + +# Cleanup first-level standard-space images +set fmri(sscleanup_yn) 0 + +# Output directory +set fmri(outputdir) "" + +# TR(s) +set fmri(tr) 3.0000000000 + +# Total volumes +set fmri(npts) 80 + +# Delete volumes +set fmri(ndelete) 0 + +# Perfusion tag/control order +set fmri(tagfirst) 1 + +# Number of first-level analyses +set fmri(multiple) 1 + +# Higher-level input type +# 1 : Inputs are lower-level FEAT directories +# 2 : Inputs are cope images from FEAT directories +set fmri(inputtype) 1 + +# Carry out pre-stats processing? +set fmri(filtering_yn) 1 + +# Brain/background threshold, % +set fmri(brain_thresh) 10 + +# Critical z for design efficiency calculation +set fmri(critical_z) 5.3 + +# Noise level +set fmri(noise) 0.66 + +# Noise AR(1) +set fmri(noisear) 0.34 + +# Post-stats-only directory copying +# 0 : Overwrite original post-stats results +# 1 : Copy original FEAT directory for new Contrasts, Thresholding, Rendering +set fmri(newdir_yn) 0 + +# Motion correction +# 0 : None +# 1 : MCFLIRT +set fmri(mc) 1 + +# Spin-history (currently obsolete) +set fmri(sh_yn) 0 + +# B0 fieldmap unwarping? +set fmri(regunwarp_yn) 0 + +# EPI dwell time (ms) +set fmri(dwell) 0.7 + +# EPI TE (ms) +set fmri(te) 35 + +# % Signal loss threshold +set fmri(signallossthresh) 10 + +# Unwarp direction +set fmri(unwarp_dir) y- + +# Slice timing correction +# 0 : None +# 1 : Regular up (0, 1, 2, 3, ...) +# 2 : Regular down +# 3 : Use slice order file +# 4 : Use slice timings file +# 5 : Interleaved (0, 2, 4 ... 1, 3, 5 ... ) +set fmri(st) 1 + +# Slice timings file +set fmri(st_file) "" + +# BET brain extraction +set fmri(bet_yn) 0 + +# Spatial smoothing FWHM (mm) +set fmri(smooth) 6.0 + +# Intensity normalization +set fmri(norm_yn) 0 + +# Perfusion subtraction +set fmri(perfsub_yn) 0 + +# Highpass temporal filtering +set fmri(temphp_yn) 1 + +# Lowpass temporal filtering +set fmri(templp_yn) 0 + +# MELODIC ICA data exploration +set fmri(melodic_yn) 0 + +# Carry out main stats? +set fmri(stats_yn) 1 + +# Carry out prewhitening? +set fmri(prewhiten_yn) 1 + +# Add motion parameters to model +# 0 : No +# 1 : Yes +set fmri(motionevs) 0 +set fmri(motionevsbeta) "" +set fmri(scriptevsbeta) "" + +# Robust outlier detection in FLAME? +set fmri(robust_yn) 0 + +# Higher-level modelling +# 3 : Fixed effects +# 0 : Mixed Effects: Simple OLS +# 2 : Mixed Effects: FLAME 1 +# 1 : Mixed Effects: FLAME 1+2 +set fmri(mixed_yn) 2 + +# Number of EVs +set fmri(evs_orig) 1 +set fmri(evs_real) 2 +set fmri(evs_vox) 0 + +# Number of contrasts +set fmri(ncon_orig) 1 +set fmri(ncon_real) 1 + +# Number of F-tests +set fmri(nftests_orig) 0 +set fmri(nftests_real) 0 + +# Add constant column to design matrix? (obsolete) +set fmri(constcol) 0 + +# Carry out post-stats steps? +set fmri(poststats_yn) 1 + +# Pre-threshold masking? +set fmri(threshmask) "" + +# Thresholding +# 0 : None +# 1 : Uncorrected +# 2 : Voxel +# 3 : Cluster +set fmri(thresh) 3 + +# P threshold +set fmri(prob_thresh) 0.05 + +# Z threshold +set fmri(z_thresh) 2.3 + +# Z min/max for colour rendering +# 0 : Use actual Z min/max +# 1 : Use preset Z min/max +set fmri(zdisplay) 0 + +# Z min in colour rendering +set fmri(zmin) 2 + +# Z max in colour rendering +set fmri(zmax) 8 + +# Colour rendering type +# 0 : Solid blobs +# 1 : Transparent blobs +set fmri(rendertype) 1 + +# Background image for higher-level stats overlays +# 1 : Mean highres +# 2 : First highres +# 3 : Mean functional +# 4 : First functional +# 5 : Standard space template +set fmri(bgimage) 1 + +# Create time series plots +set fmri(tsplot_yn) 1 + +# Registration? +set fmri(reg_yn) 1 + +# Registration to initial structural +set fmri(reginitial_highres_yn) 0 + +# Search space for registration to initial structural +# 0 : No search +# 90 : Normal search +# 180 : Full search +set fmri(reginitial_highres_search) 90 + +# Degrees of Freedom for registration to initial structural +set fmri(reginitial_highres_dof) 3 + +# Registration to main structural +set fmri(reghighres_yn) 1 + +# Search space for registration to main structural +# 0 : No search +# 90 : Normal search +# 180 : Full search +set fmri(reghighres_search) 90 + +# Degrees of Freedom for registration to main structural +set fmri(reghighres_dof) BBR + +# Registration to standard image? +set fmri(regstandard_yn) 1 + +# Use alternate reference images? +set fmri(alternateReference_yn) 0 + +# Standard image +set fmri(regstandard) "/usr/local/fsl/data/standard/MNI152_T1_2mm_brain" + +# Search space for registration to standard space +# 0 : No search +# 90 : Normal search +# 180 : Full search +set fmri(regstandard_search) 90 + +# Degrees of Freedom for registration to standard space +set fmri(regstandard_dof) 12 + +# Do nonlinear registration from structural to standard space? +set fmri(regstandard_nonlinear_yn) 0 + +# Control nonlinear warp field resolution +set fmri(regstandard_nonlinear_warpres) 10 + +# High pass filter cutoff +set fmri(paradigm_hp) 40 + +# Total voxels +set fmri(totalVoxels) 39321600 + + +# 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) pathf + +# Add confound EVs text file +set fmri(confoundevs) 0 + +# Subject's structural image for analysis 1 +set highres_files(1) paths + +# EV 1 title +set fmri(evtitle1) "" + +# Basic waveform shape (EV 1) +# 0 : Square +# 1 : Sinusoid +# 2 : Custom (1 entry per volume) +# 3 : Custom (3 column format) +# 4 : Interaction +# 10 : Empty (all zeros) +set fmri(shape1) 0 + +# Convolution (EV 1) +# 0 : None +# 1 : Gaussian +# 2 : Gamma +# 3 : Double-Gamma HRF +# 4 : Gamma basis functions +# 5 : Sine basis functions +# 6 : FIR basis functions +set fmri(convolve1) 2 + +# Convolve phase (EV 1) +set fmri(convolve_phase1) 0 + +# Apply temporal filtering (EV 1) +set fmri(tempfilt_yn1) 1 + +# Add temporal derivative (EV 1) +set fmri(deriv_yn1) 1 + +# Skip (EV 1) +set fmri(skip1) 0 + +# Off (EV 1) +set fmri(off1) 30 + +# On (EV 1) +set fmri(on1) 30 + +# Phase (EV 1) +set fmri(phase1) 0 + +# Stop (EV 1) +set fmri(stop1) -1 + +# Gamma sigma (EV 1) +set fmri(gammasigma1) 3 + +# Gamma delay (EV 1) +set fmri(gammadelay1) 6 + +# Orthogonalise EV 1 wrt EV 0 +set fmri(ortho1.0) 0 + +# Orthogonalise EV 1 wrt EV 1 +set fmri(ortho1.1) 0 + +# Contrast & F-tests mode +# real : control real EVs +# orig : control original EVs +set fmri(con_mode_old) orig +set fmri(con_mode) orig + +# Display images for contrast_real 1 +set fmri(conpic_real.1) 1 + +# Title for contrast_real 1 +set fmri(conname_real.1) "" + +# Real contrast_real vector 1 element 1 +set fmri(con_real1.1) 1 + +# Real contrast_real vector 1 element 2 +set fmri(con_real1.2) 0 + +# Display images for contrast_orig 1 +set fmri(conpic_orig.1) 1 + +# Title for contrast_orig 1 +set fmri(conname_orig.1) "" + +# Real contrast_orig vector 1 element 1 +set fmri(con_orig1.1) 1 + +# Contrast masking - use >0 instead of thresholding? +set fmri(conmask_zerothresh_yn) 0 + +# Do contrast masking at all? +set fmri(conmask1_1) 0 + +########################################################## +# Now options that don't appear in the GUI + +# Alternative (to BETting) mask image +set fmri(alternative_mask) "" + +# Initial structural space registration initialisation transform +set fmri(init_initial_highres) "" + +# Structural space registration initialisation transform +set fmri(init_highres) "" + +# Standard space registration initialisation transform +set fmri(init_standard) "" + +# For full FEAT analysis: overwrite existing .feat output dir? +set fmri(overwrite_yn) 0 diff --git a/design_tem_1_5_120.fsf b/design_tem_1_5_120.fsf new file mode 100644 index 0000000..038b029 --- /dev/null +++ b/design_tem_1_5_120.fsf @@ -0,0 +1,396 @@ + +# FEAT version number +set fmri(version) 6.00 + +# Are we in MELODIC? +set fmri(inmelodic) 0 + +# Analysis level +# 1 : First-level analysis +# 2 : Higher-level analysis +set fmri(level) 1 + +# Which stages to run +# 0 : No first-level analysis (registration and/or group stats only) +# 7 : Full first-level analysis +# 1 : Pre-Stats +# 3 : Pre-Stats + Stats +# 2 : Stats +# 6 : Stats + Post-stats +# 4 : Post-stats +set fmri(analysis) 7 + +# Use relative filenames +set fmri(relative_yn) 0 + +# Balloon help +set fmri(help_yn) 1 + +# Run Featwatcher +set fmri(featwatcher_yn) 1 + +# Cleanup first-level standard-space images +set fmri(sscleanup_yn) 0 + +# Output directory +set fmri(outputdir) "" + +# TR(s) +set fmri(tr) 3.0000000000 + +# Total volumes +set fmri(npts) 120 + +# Delete volumes +set fmri(ndelete) 0 + +# Perfusion tag/control order +set fmri(tagfirst) 1 + +# Number of first-level analyses +set fmri(multiple) 1 + +# Higher-level input type +# 1 : Inputs are lower-level FEAT directories +# 2 : Inputs are cope images from FEAT directories +set fmri(inputtype) 1 + +# Carry out pre-stats processing? +set fmri(filtering_yn) 1 + +# Brain/background threshold, % +set fmri(brain_thresh) 10 + +# Critical z for design efficiency calculation +set fmri(critical_z) 5.3 + +# Noise level +set fmri(noise) 0.66 + +# Noise AR(1) +set fmri(noisear) 0.34 + +# Post-stats-only directory copying +# 0 : Overwrite original post-stats results +# 1 : Copy original FEAT directory for new Contrasts, Thresholding, Rendering +set fmri(newdir_yn) 0 + +# Motion correction +# 0 : None +# 1 : MCFLIRT +set fmri(mc) 1 + +# Spin-history (currently obsolete) +set fmri(sh_yn) 0 + +# B0 fieldmap unwarping? +set fmri(regunwarp_yn) 0 + +# EPI dwell time (ms) +set fmri(dwell) 0.7 + +# EPI TE (ms) +set fmri(te) 35 + +# % Signal loss threshold +set fmri(signallossthresh) 10 + +# Unwarp direction +set fmri(unwarp_dir) y- + +# Slice timing correction +# 0 : None +# 1 : Regular up (0, 1, 2, 3, ...) +# 2 : Regular down +# 3 : Use slice order file +# 4 : Use slice timings file +# 5 : Interleaved (0, 2, 4 ... 1, 3, 5 ... ) +set fmri(st) 1 + +# Slice timings file +set fmri(st_file) "" + +# BET brain extraction +set fmri(bet_yn) 0 + +# Spatial smoothing FWHM (mm) +set fmri(smooth) 6.0 + +# Intensity normalization +set fmri(norm_yn) 0 + +# Perfusion subtraction +set fmri(perfsub_yn) 0 + +# Highpass temporal filtering +set fmri(temphp_yn) 1 + +# Lowpass temporal filtering +set fmri(templp_yn) 0 + +# MELODIC ICA data exploration +set fmri(melodic_yn) 0 + +# Carry out main stats? +set fmri(stats_yn) 1 + +# Carry out prewhitening? +set fmri(prewhiten_yn) 1 + +# Add motion parameters to model +# 0 : No +# 1 : Yes +set fmri(motionevs) 0 +set fmri(motionevsbeta) "" +set fmri(scriptevsbeta) "" + +# Robust outlier detection in FLAME? +set fmri(robust_yn) 0 + +# Higher-level modelling +# 3 : Fixed effects +# 0 : Mixed Effects: Simple OLS +# 2 : Mixed Effects: FLAME 1 +# 1 : Mixed Effects: FLAME 1+2 +set fmri(mixed_yn) 2 + +# Number of EVs +set fmri(evs_orig) 1 +set fmri(evs_real) 2 +set fmri(evs_vox) 0 + +# Number of contrasts +set fmri(ncon_orig) 1 +set fmri(ncon_real) 1 + +# Number of F-tests +set fmri(nftests_orig) 0 +set fmri(nftests_real) 0 + +# Add constant column to design matrix? (obsolete) +set fmri(constcol) 0 + +# Carry out post-stats steps? +set fmri(poststats_yn) 1 + +# Pre-threshold masking? +set fmri(threshmask) "" + +# Thresholding +# 0 : None +# 1 : Uncorrected +# 2 : Voxel +# 3 : Cluster +set fmri(thresh) 3 + +# P threshold +set fmri(prob_thresh) 0.05 + +# Z threshold +set fmri(z_thresh) 2.3 + +# Z min/max for colour rendering +# 0 : Use actual Z min/max +# 1 : Use preset Z min/max +set fmri(zdisplay) 0 + +# Z min in colour rendering +set fmri(zmin) 2 + +# Z max in colour rendering +set fmri(zmax) 8 + +# Colour rendering type +# 0 : Solid blobs +# 1 : Transparent blobs +set fmri(rendertype) 1 + +# Background image for higher-level stats overlays +# 1 : Mean highres +# 2 : First highres +# 3 : Mean functional +# 4 : First functional +# 5 : Standard space template +set fmri(bgimage) 1 + +# Create time series plots +set fmri(tsplot_yn) 1 + +# Registration? +set fmri(reg_yn) 1 + +# Registration to initial structural +set fmri(reginitial_highres_yn) 0 + +# Search space for registration to initial structural +# 0 : No search +# 90 : Normal search +# 180 : Full search +set fmri(reginitial_highres_search) 90 + +# Degrees of Freedom for registration to initial structural +set fmri(reginitial_highres_dof) 3 + +# Registration to main structural +set fmri(reghighres_yn) 1 + +# Search space for registration to main structural +# 0 : No search +# 90 : Normal search +# 180 : Full search +set fmri(reghighres_search) 90 + +# Degrees of Freedom for registration to main structural +set fmri(reghighres_dof) BBR + +# Registration to standard image? +set fmri(regstandard_yn) 1 + +# Use alternate reference images? +set fmri(alternateReference_yn) 0 + +# Standard image +set fmri(regstandard) "/usr/local/fsl/data/standard/MNI152_T1_2mm_brain" + +# Search space for registration to standard space +# 0 : No search +# 90 : Normal search +# 180 : Full search +set fmri(regstandard_search) 90 + +# Degrees of Freedom for registration to standard space +set fmri(regstandard_dof) 12 + +# Do nonlinear registration from structural to standard space? +set fmri(regstandard_nonlinear_yn) 0 + +# Control nonlinear warp field resolution +set fmri(regstandard_nonlinear_warpres) 10 + +# High pass filter cutoff +set fmri(paradigm_hp) 40 + +# Total voxels +set fmri(totalVoxels) 39321600 + + +# 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) pathf + +# Add confound EVs text file +set fmri(confoundevs) 0 + +# Subject's structural image for analysis 1 +set highres_files(1) paths + +# EV 1 title +set fmri(evtitle1) "" + +# Basic waveform shape (EV 1) +# 0 : Square +# 1 : Sinusoid +# 2 : Custom (1 entry per volume) +# 3 : Custom (3 column format) +# 4 : Interaction +# 10 : Empty (all zeros) +set fmri(shape1) 0 + +# Convolution (EV 1) +# 0 : None +# 1 : Gaussian +# 2 : Gamma +# 3 : Double-Gamma HRF +# 4 : Gamma basis functions +# 5 : Sine basis functions +# 6 : FIR basis functions +set fmri(convolve1) 2 + +# Convolve phase (EV 1) +set fmri(convolve_phase1) 0 + +# Apply temporal filtering (EV 1) +set fmri(tempfilt_yn1) 1 + +# Add temporal derivative (EV 1) +set fmri(deriv_yn1) 1 + +# Skip (EV 1) +set fmri(skip1) 0 + +# Off (EV 1) +set fmri(off1) 30 + +# On (EV 1) +set fmri(on1) 30 + +# Phase (EV 1) +set fmri(phase1) 0 + +# Stop (EV 1) +set fmri(stop1) -1 + +# Gamma sigma (EV 1) +set fmri(gammasigma1) 3 + +# Gamma delay (EV 1) +set fmri(gammadelay1) 6 + +# Orthogonalise EV 1 wrt EV 0 +set fmri(ortho1.0) 0 + +# Orthogonalise EV 1 wrt EV 1 +set fmri(ortho1.1) 0 + +# Contrast & F-tests mode +# real : control real EVs +# orig : control original EVs +set fmri(con_mode_old) orig +set fmri(con_mode) orig + +# Display images for contrast_real 1 +set fmri(conpic_real.1) 1 + +# Title for contrast_real 1 +set fmri(conname_real.1) "" + +# Real contrast_real vector 1 element 1 +set fmri(con_real1.1) 1 + +# Real contrast_real vector 1 element 2 +set fmri(con_real1.2) 0 + +# Display images for contrast_orig 1 +set fmri(conpic_orig.1) 1 + +# Title for contrast_orig 1 +set fmri(conname_orig.1) "" + +# Real contrast_orig vector 1 element 1 +set fmri(con_orig1.1) 1 + +# Contrast masking - use >0 instead of thresholding? +set fmri(conmask_zerothresh_yn) 0 + +# Do contrast masking at all? +set fmri(conmask1_1) 0 + +########################################################## +# Now options that don't appear in the GUI + +# Alternative (to BETting) mask image +set fmri(alternative_mask) "" + +# Initial structural space registration initialisation transform +set fmri(init_initial_highres) "" + +# Structural space registration initialisation transform +set fmri(init_highres) "" + +# Standard space registration initialisation transform +set fmri(init_standard) "" + +# For full FEAT analysis: overwrite existing .feat output dir? +set fmri(overwrite_yn) 0 diff --git a/design_tem_1_5_120_o.fsf b/design_tem_1_5_120_o.fsf new file mode 100644 index 0000000..28b6a11 --- /dev/null +++ b/design_tem_1_5_120_o.fsf @@ -0,0 +1,505 @@ + +# FEAT version number +set fmri(version) 6.00 + +# Are we in MELODIC? +set fmri(inmelodic) 0 + +# Analysis level +# 1 : First-level analysis +# 2 : Higher-level analysis +set fmri(level) 1 + +# Which stages to run +# 0 : No first-level analysis (registration and/or group stats only) +# 7 : Full first-level analysis +# 1 : Pre-Stats +# 3 : Pre-Stats + Stats +# 2 : Stats +# 6 : Stats + Post-stats +# 4 : Post-stats +set fmri(analysis) 7 + +# Use relative filenames +set fmri(relative_yn) 0 + +# Balloon help +set fmri(help_yn) 1 + +# Run Featwatcher +set fmri(featwatcher_yn) 1 + +# Cleanup first-level standard-space images +set fmri(sscleanup_yn) 0 + +# Output directory +set fmri(outputdir) "" + +# TR(s) +set fmri(tr) 3.0000000000 + +# Total volumes +set fmri(npts) 120 + +# Delete volumes +set fmri(ndelete) 0 + +# Perfusion tag/control order +set fmri(tagfirst) 1 + +# Number of first-level analyses +set fmri(multiple) 1 + +# Higher-level input type +# 1 : Inputs are lower-level FEAT directories +# 2 : Inputs are cope images from FEAT directories +set fmri(inputtype) 1 + +# Carry out pre-stats processing? +set fmri(filtering_yn) 1 + +# Brain/background threshold, % +set fmri(brain_thresh) 10 + +# Critical z for design efficiency calculation +set fmri(critical_z) 5.3 + +# Noise level +set fmri(noise) 0.66 + +# Noise AR(1) +set fmri(noisear) 0.34 + +# Post-stats-only directory copying +# 0 : Overwrite original post-stats results +# 1 : Copy original FEAT directory for new Contrasts, Thresholding, Rendering +set fmri(newdir_yn) 0 + +# Motion correction +# 0 : None +# 1 : MCFLIRT +set fmri(mc) 1 + +# Spin-history (currently obsolete) +set fmri(sh_yn) 0 + +# B0 fieldmap unwarping? +set fmri(regunwarp_yn) 0 + +# EPI dwell time (ms) +set fmri(dwell) 0.7 + +# EPI TE (ms) +set fmri(te) 35 + +# % Signal loss threshold +set fmri(signallossthresh) 10 + +# Unwarp direction +set fmri(unwarp_dir) y- + +# Slice timing correction +# 0 : None +# 1 : Regular up (0, 1, 2, 3, ...) +# 2 : Regular down +# 3 : Use slice order file +# 4 : Use slice timings file +# 5 : Interleaved (0, 2, 4 ... 1, 3, 5 ... ) +set fmri(st) 1 + +# Slice timings file +set fmri(st_file) "" + +# BET brain extraction +set fmri(bet_yn) 0 + +# Spatial smoothing FWHM (mm) +set fmri(smooth) 6.0 + +# Intensity normalization +set fmri(norm_yn) 0 + +# Perfusion subtraction +set fmri(perfsub_yn) 0 + +# Highpass temporal filtering +set fmri(temphp_yn) 1 + +# Lowpass temporal filtering +set fmri(templp_yn) 0 + +# MELODIC ICA data exploration +set fmri(melodic_yn) 0 + +# Carry out main stats? +set fmri(stats_yn) 1 + +# Carry out prewhitening? +set fmri(prewhiten_yn) 1 + +# Add motion parameters to model +# 0 : No +# 1 : Yes +set fmri(motionevs) 0 +set fmri(motionevsbeta) "" +set fmri(scriptevsbeta) "" + +# Robust outlier detection in FLAME? +set fmri(robust_yn) 0 + +# Higher-level modelling +# 3 : Fixed effects +# 0 : Mixed Effects: Simple OLS +# 2 : Mixed Effects: FLAME 1 +# 1 : Mixed Effects: FLAME 1+2 +set fmri(mixed_yn) 2 + +# Number of EVs +set fmri(evs_orig) 2 +set fmri(evs_real) 4 +set fmri(evs_vox) 0 + +# Number of contrasts +set fmri(ncon_orig) 2 +set fmri(ncon_real) 2 + +# Number of F-tests +set fmri(nftests_orig) 0 +set fmri(nftests_real) 0 + +# Add constant column to design matrix? (obsolete) +set fmri(constcol) 0 + +# Carry out post-stats steps? +set fmri(poststats_yn) 1 + +# Pre-threshold masking? +set fmri(threshmask) "" + +# Thresholding +# 0 : None +# 1 : Uncorrected +# 2 : Voxel +# 3 : Cluster +set fmri(thresh) 3 + +# P threshold +set fmri(prob_thresh) 0.05 + +# Z threshold +set fmri(z_thresh) 2.3 + +# Z min/max for colour rendering +# 0 : Use actual Z min/max +# 1 : Use preset Z min/max +set fmri(zdisplay) 0 + +# Z min in colour rendering +set fmri(zmin) 2 + +# Z max in colour rendering +set fmri(zmax) 8 + +# Colour rendering type +# 0 : Solid blobs +# 1 : Transparent blobs +set fmri(rendertype) 1 + +# Background image for higher-level stats overlays +# 1 : Mean highres +# 2 : First highres +# 3 : Mean functional +# 4 : First functional +# 5 : Standard space template +set fmri(bgimage) 1 + +# Create time series plots +set fmri(tsplot_yn) 1 + +# Registration? +set fmri(reg_yn) 1 + +# Registration to initial structural +set fmri(reginitial_highres_yn) 0 + +# Search space for registration to initial structural +# 0 : No search +# 90 : Normal search +# 180 : Full search +set fmri(reginitial_highres_search) 90 + +# Degrees of Freedom for registration to initial structural +set fmri(reginitial_highres_dof) 3 + +# Registration to main structural +set fmri(reghighres_yn) 1 + +# Search space for registration to main structural +# 0 : No search +# 90 : Normal search +# 180 : Full search +set fmri(reghighres_search) 90 + +# Degrees of Freedom for registration to main structural +set fmri(reghighres_dof) BBR + +# Registration to standard image? +set fmri(regstandard_yn) 1 + +# Use alternate reference images? +set fmri(alternateReference_yn) 0 + +# Standard image +set fmri(regstandard) "/usr/local/fsl/data/standard/MNI152_T1_2mm_brain" + +# Search space for registration to standard space +# 0 : No search +# 90 : Normal search +# 180 : Full search +set fmri(regstandard_search) 90 + +# Degrees of Freedom for registration to standard space +set fmri(regstandard_dof) 12 + +# Do nonlinear registration from structural to standard space? +set fmri(regstandard_nonlinear_yn) 0 + +# Control nonlinear warp field resolution +set fmri(regstandard_nonlinear_warpres) 10 + +# High pass filter cutoff +set fmri(paradigm_hp) 60 + +# Total voxels +set fmri(totalVoxels) 39321600 + + +# 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) pathf + +# Add confound EVs text file +set fmri(confoundevs) 0 + +# Subject's structural image for analysis 1 +set highres_files(1) paths + +# EV 1 title +set fmri(evtitle1) "i" + +# Basic waveform shape (EV 1) +# 0 : Square +# 1 : Sinusoid +# 2 : Custom (1 entry per volume) +# 3 : Custom (3 column format) +# 4 : Interaction +# 10 : Empty (all zeros) +set fmri(shape1) 0 + +# Convolution (EV 1) +# 0 : None +# 1 : Gaussian +# 2 : Gamma +# 3 : Double-Gamma HRF +# 4 : Gamma basis functions +# 5 : Sine basis functions +# 6 : FIR basis functions +set fmri(convolve1) 2 + +# Convolve phase (EV 1) +set fmri(convolve_phase1) 0 + +# Apply temporal filtering (EV 1) +set fmri(tempfilt_yn1) 1 + +# Add temporal derivative (EV 1) +set fmri(deriv_yn1) 1 + +# Skip (EV 1) +set fmri(skip1) 0 + +# Off (EV 1) +set fmri(off1) 30 + +# On (EV 1) +set fmri(on1) 30 + +# Phase (EV 1) +set fmri(phase1) 0 + +# Stop (EV 1) +set fmri(stop1) -1 + +# Gamma sigma (EV 1) +set fmri(gammasigma1) 3 + +# Gamma delay (EV 1) +set fmri(gammadelay1) 6 + +# Orthogonalise EV 1 wrt EV 0 +set fmri(ortho1.0) 0 + +# Orthogonalise EV 1 wrt EV 1 +set fmri(ortho1.1) 0 + +# Orthogonalise EV 1 wrt EV 2 +set fmri(ortho1.2) 0 + +# EV 2 title +set fmri(evtitle2) "d" + +# Basic waveform shape (EV 2) +# 0 : Square +# 1 : Sinusoid +# 2 : Custom (1 entry per volume) +# 3 : Custom (3 column format) +# 4 : Interaction +# 10 : Empty (all zeros) +set fmri(shape2) 0 + +# Convolution (EV 2) +# 0 : None +# 1 : Gaussian +# 2 : Gamma +# 3 : Double-Gamma HRF +# 4 : Gamma basis functions +# 5 : Sine basis functions +# 6 : FIR basis functions +set fmri(convolve2) 2 + +# Convolve phase (EV 2) +set fmri(convolve_phase2) 30 + +# Apply temporal filtering (EV 2) +set fmri(tempfilt_yn2) 1 + +# Add temporal derivative (EV 2) +set fmri(deriv_yn2) 1 + +# Skip (EV 2) +set fmri(skip2) 0 + +# Off (EV 2) +set fmri(off2) 30 + +# On (EV 2) +set fmri(on2) 30 + +# Phase (EV 2) +set fmri(phase2) 0 + +# Stop (EV 2) +set fmri(stop2) -1 + +# Gamma sigma (EV 2) +set fmri(gammasigma2) 3 + +# Gamma delay (EV 2) +set fmri(gammadelay2) 6 + +# Orthogonalise EV 2 wrt EV 0 +set fmri(ortho2.0) 0 + +# Orthogonalise EV 2 wrt EV 1 +set fmri(ortho2.1) 0 + +# Orthogonalise EV 2 wrt EV 2 +set fmri(ortho2.2) 0 + +# Contrast & F-tests mode +# real : control real EVs +# orig : control original EVs +set fmri(con_mode_old) orig +set fmri(con_mode) orig + +# Display images for contrast_real 1 +set fmri(conpic_real.1) 1 + +# Title for contrast_real 1 +set fmri(conname_real.1) "i" + +# Real contrast_real vector 1 element 1 +set fmri(con_real1.1) 1 + +# Real contrast_real vector 1 element 2 +set fmri(con_real1.2) 0 + +# Real contrast_real vector 1 element 3 +set fmri(con_real1.3) -1 + +# Real contrast_real vector 1 element 4 +set fmri(con_real1.4) 0 + +# Display images for contrast_real 2 +set fmri(conpic_real.2) 1 + +# Title for contrast_real 2 +set fmri(conname_real.2) "d" + +# Real contrast_real vector 2 element 1 +set fmri(con_real2.1) -1 + +# Real contrast_real vector 2 element 2 +set fmri(con_real2.2) 0 + +# Real contrast_real vector 2 element 3 +set fmri(con_real2.3) 1 + +# Real contrast_real vector 2 element 4 +set fmri(con_real2.4) 0 + +# Display images for contrast_orig 1 +set fmri(conpic_orig.1) 1 + +# Title for contrast_orig 1 +set fmri(conname_orig.1) "i" + +# Real contrast_orig vector 1 element 1 +set fmri(con_orig1.1) 1 + +# Real contrast_orig vector 1 element 2 +set fmri(con_orig1.2) -1 + +# Display images for contrast_orig 2 +set fmri(conpic_orig.2) 1 + +# Title for contrast_orig 2 +set fmri(conname_orig.2) "d" + +# Real contrast_orig vector 2 element 1 +set fmri(con_orig2.1) -1 + +# Real contrast_orig vector 2 element 2 +set fmri(con_orig2.2) 1 + +# Contrast masking - use >0 instead of thresholding? +set fmri(conmask_zerothresh_yn) 0 + +# Mask real contrast/F-test 1 with real contrast/F-test 2? +set fmri(conmask1_2) 0 + +# Mask real contrast/F-test 2 with real contrast/F-test 1? +set fmri(conmask2_1) 0 + +# Do contrast masking at all? +set fmri(conmask1_1) 0 + +########################################################## +# Now options that don't appear in the GUI + +# Alternative (to BETting) mask image +set fmri(alternative_mask) "" + +# Initial structural space registration initialisation transform +set fmri(init_initial_highres) "" + +# Structural space registration initialisation transform +set fmri(init_highres) "" + +# Standard space registration initialisation transform +set fmri(init_standard) "" + +# For full FEAT analysis: overwrite existing .feat output dir? +set fmri(overwrite_yn) 0 diff --git a/design_tem_1_5_o.fsf b/design_tem_1_5_o.fsf new file mode 100644 index 0000000..b06b1d1 --- /dev/null +++ b/design_tem_1_5_o.fsf @@ -0,0 +1,505 @@ + +# FEAT version number +set fmri(version) 6.00 + +# Are we in MELODIC? +set fmri(inmelodic) 0 + +# Analysis level +# 1 : First-level analysis +# 2 : Higher-level analysis +set fmri(level) 1 + +# Which stages to run +# 0 : No first-level analysis (registration and/or group stats only) +# 7 : Full first-level analysis +# 1 : Pre-Stats +# 3 : Pre-Stats + Stats +# 2 : Stats +# 6 : Stats + Post-stats +# 4 : Post-stats +set fmri(analysis) 7 + +# Use relative filenames +set fmri(relative_yn) 0 + +# Balloon help +set fmri(help_yn) 1 + +# Run Featwatcher +set fmri(featwatcher_yn) 1 + +# Cleanup first-level standard-space images +set fmri(sscleanup_yn) 0 + +# Output directory +set fmri(outputdir) "" + +# TR(s) +set fmri(tr) 3.0000000000 + +# Total volumes +set fmri(npts) 80 + +# Delete volumes +set fmri(ndelete) 0 + +# Perfusion tag/control order +set fmri(tagfirst) 1 + +# Number of first-level analyses +set fmri(multiple) 1 + +# Higher-level input type +# 1 : Inputs are lower-level FEAT directories +# 2 : Inputs are cope images from FEAT directories +set fmri(inputtype) 1 + +# Carry out pre-stats processing? +set fmri(filtering_yn) 1 + +# Brain/background threshold, % +set fmri(brain_thresh) 10 + +# Critical z for design efficiency calculation +set fmri(critical_z) 5.3 + +# Noise level +set fmri(noise) 0.66 + +# Noise AR(1) +set fmri(noisear) 0.34 + +# Post-stats-only directory copying +# 0 : Overwrite original post-stats results +# 1 : Copy original FEAT directory for new Contrasts, Thresholding, Rendering +set fmri(newdir_yn) 0 + +# Motion correction +# 0 : None +# 1 : MCFLIRT +set fmri(mc) 1 + +# Spin-history (currently obsolete) +set fmri(sh_yn) 0 + +# B0 fieldmap unwarping? +set fmri(regunwarp_yn) 0 + +# EPI dwell time (ms) +set fmri(dwell) 0.7 + +# EPI TE (ms) +set fmri(te) 35 + +# % Signal loss threshold +set fmri(signallossthresh) 10 + +# Unwarp direction +set fmri(unwarp_dir) y- + +# Slice timing correction +# 0 : None +# 1 : Regular up (0, 1, 2, 3, ...) +# 2 : Regular down +# 3 : Use slice order file +# 4 : Use slice timings file +# 5 : Interleaved (0, 2, 4 ... 1, 3, 5 ... ) +set fmri(st) 1 + +# Slice timings file +set fmri(st_file) "" + +# BET brain extraction +set fmri(bet_yn) 0 + +# Spatial smoothing FWHM (mm) +set fmri(smooth) 6.0 + +# Intensity normalization +set fmri(norm_yn) 0 + +# Perfusion subtraction +set fmri(perfsub_yn) 0 + +# Highpass temporal filtering +set fmri(temphp_yn) 1 + +# Lowpass temporal filtering +set fmri(templp_yn) 0 + +# MELODIC ICA data exploration +set fmri(melodic_yn) 0 + +# Carry out main stats? +set fmri(stats_yn) 1 + +# Carry out prewhitening? +set fmri(prewhiten_yn) 1 + +# Add motion parameters to model +# 0 : No +# 1 : Yes +set fmri(motionevs) 0 +set fmri(motionevsbeta) "" +set fmri(scriptevsbeta) "" + +# Robust outlier detection in FLAME? +set fmri(robust_yn) 0 + +# Higher-level modelling +# 3 : Fixed effects +# 0 : Mixed Effects: Simple OLS +# 2 : Mixed Effects: FLAME 1 +# 1 : Mixed Effects: FLAME 1+2 +set fmri(mixed_yn) 2 + +# Number of EVs +set fmri(evs_orig) 2 +set fmri(evs_real) 4 +set fmri(evs_vox) 0 + +# Number of contrasts +set fmri(ncon_orig) 2 +set fmri(ncon_real) 2 + +# Number of F-tests +set fmri(nftests_orig) 0 +set fmri(nftests_real) 0 + +# Add constant column to design matrix? (obsolete) +set fmri(constcol) 0 + +# Carry out post-stats steps? +set fmri(poststats_yn) 1 + +# Pre-threshold masking? +set fmri(threshmask) "" + +# Thresholding +# 0 : None +# 1 : Uncorrected +# 2 : Voxel +# 3 : Cluster +set fmri(thresh) 3 + +# P threshold +set fmri(prob_thresh) 0.05 + +# Z threshold +set fmri(z_thresh) 2.3 + +# Z min/max for colour rendering +# 0 : Use actual Z min/max +# 1 : Use preset Z min/max +set fmri(zdisplay) 0 + +# Z min in colour rendering +set fmri(zmin) 2 + +# Z max in colour rendering +set fmri(zmax) 8 + +# Colour rendering type +# 0 : Solid blobs +# 1 : Transparent blobs +set fmri(rendertype) 1 + +# Background image for higher-level stats overlays +# 1 : Mean highres +# 2 : First highres +# 3 : Mean functional +# 4 : First functional +# 5 : Standard space template +set fmri(bgimage) 1 + +# Create time series plots +set fmri(tsplot_yn) 1 + +# Registration? +set fmri(reg_yn) 1 + +# Registration to initial structural +set fmri(reginitial_highres_yn) 0 + +# Search space for registration to initial structural +# 0 : No search +# 90 : Normal search +# 180 : Full search +set fmri(reginitial_highres_search) 90 + +# Degrees of Freedom for registration to initial structural +set fmri(reginitial_highres_dof) 3 + +# Registration to main structural +set fmri(reghighres_yn) 1 + +# Search space for registration to main structural +# 0 : No search +# 90 : Normal search +# 180 : Full search +set fmri(reghighres_search) 90 + +# Degrees of Freedom for registration to main structural +set fmri(reghighres_dof) BBR + +# Registration to standard image? +set fmri(regstandard_yn) 1 + +# Use alternate reference images? +set fmri(alternateReference_yn) 0 + +# Standard image +set fmri(regstandard) "/usr/local/fsl/data/standard/MNI152_T1_2mm_brain" + +# Search space for registration to standard space +# 0 : No search +# 90 : Normal search +# 180 : Full search +set fmri(regstandard_search) 90 + +# Degrees of Freedom for registration to standard space +set fmri(regstandard_dof) 12 + +# Do nonlinear registration from structural to standard space? +set fmri(regstandard_nonlinear_yn) 0 + +# Control nonlinear warp field resolution +set fmri(regstandard_nonlinear_warpres) 10 + +# High pass filter cutoff +set fmri(paradigm_hp) 60 + +# Total voxels +set fmri(totalVoxels) 39321600 + + +# 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) pathf + +# Add confound EVs text file +set fmri(confoundevs) 0 + +# Subject's structural image for analysis 1 +set highres_files(1) paths + +# EV 1 title +set fmri(evtitle1) "i" + +# Basic waveform shape (EV 1) +# 0 : Square +# 1 : Sinusoid +# 2 : Custom (1 entry per volume) +# 3 : Custom (3 column format) +# 4 : Interaction +# 10 : Empty (all zeros) +set fmri(shape1) 0 + +# Convolution (EV 1) +# 0 : None +# 1 : Gaussian +# 2 : Gamma +# 3 : Double-Gamma HRF +# 4 : Gamma basis functions +# 5 : Sine basis functions +# 6 : FIR basis functions +set fmri(convolve1) 2 + +# Convolve phase (EV 1) +set fmri(convolve_phase1) 0 + +# Apply temporal filtering (EV 1) +set fmri(tempfilt_yn1) 1 + +# Add temporal derivative (EV 1) +set fmri(deriv_yn1) 1 + +# Skip (EV 1) +set fmri(skip1) 0 + +# Off (EV 1) +set fmri(off1) 20 + +# On (EV 1) +set fmri(on1) 20 + +# Phase (EV 1) +set fmri(phase1) 0 + +# Stop (EV 1) +set fmri(stop1) -1 + +# Gamma sigma (EV 1) +set fmri(gammasigma1) 3 + +# Gamma delay (EV 1) +set fmri(gammadelay1) 6 + +# Orthogonalise EV 1 wrt EV 0 +set fmri(ortho1.0) 0 + +# Orthogonalise EV 1 wrt EV 1 +set fmri(ortho1.1) 0 + +# Orthogonalise EV 1 wrt EV 2 +set fmri(ortho1.2) 0 + +# EV 2 title +set fmri(evtitle2) "d" + +# Basic waveform shape (EV 2) +# 0 : Square +# 1 : Sinusoid +# 2 : Custom (1 entry per volume) +# 3 : Custom (3 column format) +# 4 : Interaction +# 10 : Empty (all zeros) +set fmri(shape2) 0 + +# Convolution (EV 2) +# 0 : None +# 1 : Gaussian +# 2 : Gamma +# 3 : Double-Gamma HRF +# 4 : Gamma basis functions +# 5 : Sine basis functions +# 6 : FIR basis functions +set fmri(convolve2) 2 + +# Convolve phase (EV 2) +set fmri(convolve_phase2) 20 + +# Apply temporal filtering (EV 2) +set fmri(tempfilt_yn2) 1 + +# Add temporal derivative (EV 2) +set fmri(deriv_yn2) 1 + +# Skip (EV 2) +set fmri(skip2) 0 + +# Off (EV 2) +set fmri(off2) 20 + +# On (EV 2) +set fmri(on2) 20 + +# Phase (EV 2) +set fmri(phase2) 0 + +# Stop (EV 2) +set fmri(stop2) -1 + +# Gamma sigma (EV 2) +set fmri(gammasigma2) 3 + +# Gamma delay (EV 2) +set fmri(gammadelay2) 6 + +# Orthogonalise EV 2 wrt EV 0 +set fmri(ortho2.0) 0 + +# Orthogonalise EV 2 wrt EV 1 +set fmri(ortho2.1) 0 + +# Orthogonalise EV 2 wrt EV 2 +set fmri(ortho2.2) 0 + +# Contrast & F-tests mode +# real : control real EVs +# orig : control original EVs +set fmri(con_mode_old) orig +set fmri(con_mode) orig + +# Display images for contrast_real 1 +set fmri(conpic_real.1) 1 + +# Title for contrast_real 1 +set fmri(conname_real.1) "i" + +# Real contrast_real vector 1 element 1 +set fmri(con_real1.1) 1 + +# Real contrast_real vector 1 element 2 +set fmri(con_real1.2) 0 + +# Real contrast_real vector 1 element 3 +set fmri(con_real1.3) -1 + +# Real contrast_real vector 1 element 4 +set fmri(con_real1.4) 0 + +# Display images for contrast_real 2 +set fmri(conpic_real.2) 1 + +# Title for contrast_real 2 +set fmri(conname_real.2) "d" + +# Real contrast_real vector 2 element 1 +set fmri(con_real2.1) -1 + +# Real contrast_real vector 2 element 2 +set fmri(con_real2.2) 0 + +# Real contrast_real vector 2 element 3 +set fmri(con_real2.3) 1 + +# Real contrast_real vector 2 element 4 +set fmri(con_real2.4) 0 + +# Display images for contrast_orig 1 +set fmri(conpic_orig.1) 1 + +# Title for contrast_orig 1 +set fmri(conname_orig.1) "i" + +# Real contrast_orig vector 1 element 1 +set fmri(con_orig1.1) 1 + +# Real contrast_orig vector 1 element 2 +set fmri(con_orig1.2) -1 + +# Display images for contrast_orig 2 +set fmri(conpic_orig.2) 1 + +# Title for contrast_orig 2 +set fmri(conname_orig.2) "d" + +# Real contrast_orig vector 2 element 1 +set fmri(con_orig2.1) -1 + +# Real contrast_orig vector 2 element 2 +set fmri(con_orig2.2) 1 + +# Contrast masking - use >0 instead of thresholding? +set fmri(conmask_zerothresh_yn) 0 + +# Mask real contrast/F-test 1 with real contrast/F-test 2? +set fmri(conmask1_2) 0 + +# Mask real contrast/F-test 2 with real contrast/F-test 1? +set fmri(conmask2_1) 0 + +# Do contrast masking at all? +set fmri(conmask1_1) 0 + +########################################################## +# Now options that don't appear in the GUI + +# Alternative (to BETting) mask image +set fmri(alternative_mask) "" + +# Initial structural space registration initialisation transform +set fmri(init_initial_highres) "" + +# Structural space registration initialisation transform +set fmri(init_highres) "" + +# Standard space registration initialisation transform +set fmri(init_standard) "" + +# For full FEAT analysis: overwrite existing .feat output dir? +set fmri(overwrite_yn) 0 diff --git a/design_tem_o.fsf b/design_tem_o.fsf new file mode 100644 index 0000000..043c015 --- /dev/null +++ b/design_tem_o.fsf @@ -0,0 +1,505 @@ + +# FEAT version number +set fmri(version) 6.00 + +# Are we in MELODIC? +set fmri(inmelodic) 0 + +# Analysis level +# 1 : First-level analysis +# 2 : Higher-level analysis +set fmri(level) 1 + +# Which stages to run +# 0 : No first-level analysis (registration and/or group stats only) +# 7 : Full first-level analysis +# 1 : Pre-Stats +# 3 : Pre-Stats + Stats +# 2 : Stats +# 6 : Stats + Post-stats +# 4 : Post-stats +set fmri(analysis) 7 + +# Use relative filenames +set fmri(relative_yn) 0 + +# Balloon help +set fmri(help_yn) 1 + +# Run Featwatcher +set fmri(featwatcher_yn) 1 + +# Cleanup first-level standard-space images +set fmri(sscleanup_yn) 0 + +# Output directory +set fmri(outputdir) "" + +# TR(s) +set fmri(tr) 2.0000000000 + +# Total volumes +set fmri(npts) 120 + +# Delete volumes +set fmri(ndelete) 0 + +# Perfusion tag/control order +set fmri(tagfirst) 1 + +# Number of first-level analyses +set fmri(multiple) 1 + +# Higher-level input type +# 1 : Inputs are lower-level FEAT directories +# 2 : Inputs are cope images from FEAT directories +set fmri(inputtype) 1 + +# Carry out pre-stats processing? +set fmri(filtering_yn) 1 + +# Brain/background threshold, % +set fmri(brain_thresh) 10 + +# Critical z for design efficiency calculation +set fmri(critical_z) 5.3 + +# Noise level +set fmri(noise) 0.66 + +# Noise AR(1) +set fmri(noisear) 0.34 + +# Post-stats-only directory copying +# 0 : Overwrite original post-stats results +# 1 : Copy original FEAT directory for new Contrasts, Thresholding, Rendering +set fmri(newdir_yn) 0 + +# Motion correction +# 0 : None +# 1 : MCFLIRT +set fmri(mc) 1 + +# Spin-history (currently obsolete) +set fmri(sh_yn) 0 + +# B0 fieldmap unwarping? +set fmri(regunwarp_yn) 0 + +# EPI dwell time (ms) +set fmri(dwell) 0.7 + +# EPI TE (ms) +set fmri(te) 35 + +# % Signal loss threshold +set fmri(signallossthresh) 10 + +# Unwarp direction +set fmri(unwarp_dir) y- + +# Slice timing correction +# 0 : None +# 1 : Regular up (0, 1, 2, 3, ...) +# 2 : Regular down +# 3 : Use slice order file +# 4 : Use slice timings file +# 5 : Interleaved (0, 2, 4 ... 1, 3, 5 ... ) +set fmri(st) 1 + +# Slice timings file +set fmri(st_file) "" + +# BET brain extraction +set fmri(bet_yn) 0 + +# Spatial smoothing FWHM (mm) +set fmri(smooth) 6.0 + +# Intensity normalization +set fmri(norm_yn) 0 + +# Perfusion subtraction +set fmri(perfsub_yn) 0 + +# Highpass temporal filtering +set fmri(temphp_yn) 1 + +# Lowpass temporal filtering +set fmri(templp_yn) 0 + +# MELODIC ICA data exploration +set fmri(melodic_yn) 0 + +# Carry out main stats? +set fmri(stats_yn) 1 + +# Carry out prewhitening? +set fmri(prewhiten_yn) 1 + +# Add motion parameters to model +# 0 : No +# 1 : Yes +set fmri(motionevs) 0 +set fmri(motionevsbeta) "" +set fmri(scriptevsbeta) "" + +# Robust outlier detection in FLAME? +set fmri(robust_yn) 0 + +# Higher-level modelling +# 3 : Fixed effects +# 0 : Mixed Effects: Simple OLS +# 2 : Mixed Effects: FLAME 1 +# 1 : Mixed Effects: FLAME 1+2 +set fmri(mixed_yn) 2 + +# Number of EVs +set fmri(evs_orig) 2 +set fmri(evs_real) 4 +set fmri(evs_vox) 0 + +# Number of contrasts +set fmri(ncon_orig) 2 +set fmri(ncon_real) 2 + +# Number of F-tests +set fmri(nftests_orig) 0 +set fmri(nftests_real) 0 + +# Add constant column to design matrix? (obsolete) +set fmri(constcol) 0 + +# Carry out post-stats steps? +set fmri(poststats_yn) 1 + +# Pre-threshold masking? +set fmri(threshmask) "" + +# Thresholding +# 0 : None +# 1 : Uncorrected +# 2 : Voxel +# 3 : Cluster +set fmri(thresh) 3 + +# P threshold +set fmri(prob_thresh) 0.05 + +# Z threshold +set fmri(z_thresh) 2.3 + +# Z min/max for colour rendering +# 0 : Use actual Z min/max +# 1 : Use preset Z min/max +set fmri(zdisplay) 0 + +# Z min in colour rendering +set fmri(zmin) 2 + +# Z max in colour rendering +set fmri(zmax) 8 + +# Colour rendering type +# 0 : Solid blobs +# 1 : Transparent blobs +set fmri(rendertype) 1 + +# Background image for higher-level stats overlays +# 1 : Mean highres +# 2 : First highres +# 3 : Mean functional +# 4 : First functional +# 5 : Standard space template +set fmri(bgimage) 1 + +# Create time series plots +set fmri(tsplot_yn) 1 + +# Registration? +set fmri(reg_yn) 1 + +# Registration to initial structural +set fmri(reginitial_highres_yn) 0 + +# Search space for registration to initial structural +# 0 : No search +# 90 : Normal search +# 180 : Full search +set fmri(reginitial_highres_search) 90 + +# Degrees of Freedom for registration to initial structural +set fmri(reginitial_highres_dof) 3 + +# Registration to main structural +set fmri(reghighres_yn) 1 + +# Search space for registration to main structural +# 0 : No search +# 90 : Normal search +# 180 : Full search +set fmri(reghighres_search) 90 + +# Degrees of Freedom for registration to main structural +set fmri(reghighres_dof) BBR + +# Registration to standard image? +set fmri(regstandard_yn) 1 + +# Use alternate reference images? +set fmri(alternateReference_yn) 0 + +# Standard image +set fmri(regstandard) "/usr/local/fsl/data/standard/MNI152_T1_2mm_brain" + +# Search space for registration to standard space +# 0 : No search +# 90 : Normal search +# 180 : Full search +set fmri(regstandard_search) 90 + +# Degrees of Freedom for registration to standard space +set fmri(regstandard_dof) 12 + +# Do nonlinear registration from structural to standard space? +set fmri(regstandard_nonlinear_yn) 0 + +# Control nonlinear warp field resolution +set fmri(regstandard_nonlinear_warpres) 10 + +# High pass filter cutoff +set fmri(paradigm_hp) 60 + +# Total voxels +set fmri(totalVoxels) 39321600 + + +# 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) pathf + +# Add confound EVs text file +set fmri(confoundevs) 0 + +# Subject's structural image for analysis 1 +set highres_files(1) paths + +# EV 1 title +set fmri(evtitle1) "i" + +# Basic waveform shape (EV 1) +# 0 : Square +# 1 : Sinusoid +# 2 : Custom (1 entry per volume) +# 3 : Custom (3 column format) +# 4 : Interaction +# 10 : Empty (all zeros) +set fmri(shape1) 0 + +# Convolution (EV 1) +# 0 : None +# 1 : Gaussian +# 2 : Gamma +# 3 : Double-Gamma HRF +# 4 : Gamma basis functions +# 5 : Sine basis functions +# 6 : FIR basis functions +set fmri(convolve1) 2 + +# Convolve phase (EV 1) +set fmri(convolve_phase1) 0 + +# Apply temporal filtering (EV 1) +set fmri(tempfilt_yn1) 1 + +# Add temporal derivative (EV 1) +set fmri(deriv_yn1) 1 + +# Skip (EV 1) +set fmri(skip1) 0 + +# Off (EV 1) +set fmri(off1) 20 + +# On (EV 1) +set fmri(on1) 20 + +# Phase (EV 1) +set fmri(phase1) 0 + +# Stop (EV 1) +set fmri(stop1) -1 + +# Gamma sigma (EV 1) +set fmri(gammasigma1) 3 + +# Gamma delay (EV 1) +set fmri(gammadelay1) 6 + +# Orthogonalise EV 1 wrt EV 0 +set fmri(ortho1.0) 0 + +# Orthogonalise EV 1 wrt EV 1 +set fmri(ortho1.1) 0 + +# Orthogonalise EV 1 wrt EV 2 +set fmri(ortho1.2) 0 + +# EV 2 title +set fmri(evtitle2) "d" + +# Basic waveform shape (EV 2) +# 0 : Square +# 1 : Sinusoid +# 2 : Custom (1 entry per volume) +# 3 : Custom (3 column format) +# 4 : Interaction +# 10 : Empty (all zeros) +set fmri(shape2) 0 + +# Convolution (EV 2) +# 0 : None +# 1 : Gaussian +# 2 : Gamma +# 3 : Double-Gamma HRF +# 4 : Gamma basis functions +# 5 : Sine basis functions +# 6 : FIR basis functions +set fmri(convolve2) 2 + +# Convolve phase (EV 2) +set fmri(convolve_phase2) 20 + +# Apply temporal filtering (EV 2) +set fmri(tempfilt_yn2) 1 + +# Add temporal derivative (EV 2) +set fmri(deriv_yn2) 1 + +# Skip (EV 2) +set fmri(skip2) 0 + +# Off (EV 2) +set fmri(off2) 20 + +# On (EV 2) +set fmri(on2) 20 + +# Phase (EV 2) +set fmri(phase2) 0 + +# Stop (EV 2) +set fmri(stop2) -1 + +# Gamma sigma (EV 2) +set fmri(gammasigma2) 3 + +# Gamma delay (EV 2) +set fmri(gammadelay2) 6 + +# Orthogonalise EV 2 wrt EV 0 +set fmri(ortho2.0) 0 + +# Orthogonalise EV 2 wrt EV 1 +set fmri(ortho2.1) 0 + +# Orthogonalise EV 2 wrt EV 2 +set fmri(ortho2.2) 0 + +# Contrast & F-tests mode +# real : control real EVs +# orig : control original EVs +set fmri(con_mode_old) orig +set fmri(con_mode) orig + +# Display images for contrast_real 1 +set fmri(conpic_real.1) 1 + +# Title for contrast_real 1 +set fmri(conname_real.1) "i" + +# Real contrast_real vector 1 element 1 +set fmri(con_real1.1) 1 + +# Real contrast_real vector 1 element 2 +set fmri(con_real1.2) 0 + +# Real contrast_real vector 1 element 3 +set fmri(con_real1.3) -1 + +# Real contrast_real vector 1 element 4 +set fmri(con_real1.4) 0 + +# Display images for contrast_real 2 +set fmri(conpic_real.2) 1 + +# Title for contrast_real 2 +set fmri(conname_real.2) "d" + +# Real contrast_real vector 2 element 1 +set fmri(con_real2.1) -1 + +# Real contrast_real vector 2 element 2 +set fmri(con_real2.2) 0 + +# Real contrast_real vector 2 element 3 +set fmri(con_real2.3) 1 + +# Real contrast_real vector 2 element 4 +set fmri(con_real2.4) 0 + +# Display images for contrast_orig 1 +set fmri(conpic_orig.1) 1 + +# Title for contrast_orig 1 +set fmri(conname_orig.1) "i" + +# Real contrast_orig vector 1 element 1 +set fmri(con_orig1.1) 1 + +# Real contrast_orig vector 1 element 2 +set fmri(con_orig1.2) -1 + +# Display images for contrast_orig 2 +set fmri(conpic_orig.2) 1 + +# Title for contrast_orig 2 +set fmri(conname_orig.2) "d" + +# Real contrast_orig vector 2 element 1 +set fmri(con_orig2.1) -1 + +# Real contrast_orig vector 2 element 2 +set fmri(con_orig2.2) 1 + +# Contrast masking - use >0 instead of thresholding? +set fmri(conmask_zerothresh_yn) 0 + +# Mask real contrast/F-test 1 with real contrast/F-test 2? +set fmri(conmask1_2) 0 + +# Mask real contrast/F-test 2 with real contrast/F-test 1? +set fmri(conmask2_1) 0 + +# Do contrast masking at all? +set fmri(conmask1_1) 0 + +########################################################## +# Now options that don't appear in the GUI + +# Alternative (to BETting) mask image +set fmri(alternative_mask) "" + +# Initial structural space registration initialisation transform +set fmri(init_initial_highres) "" + +# Structural space registration initialisation transform +set fmri(init_highres) "" + +# Standard space registration initialisation transform +set fmri(init_standard) "" + +# For full FEAT analysis: overwrite existing .feat output dir? +set fmri(overwrite_yn) 0 diff --git a/rubyfmri1.5.rb b/rubyfmri1.5.rb new file mode 100755 index 0000000..5050f0f --- /dev/null +++ b/rubyfmri1.5.rb @@ -0,0 +1,174 @@ +#!/usr/bin/env ruby +# the Dicom folder has to have the number of volumes in the name ex: Hand_80 +# Modules required: +require 'rubygems' +require 'dcm2nii-ruby' +require 'fsl-ruby' +require 'narray' +require 'nifti' +require 'chunky_png' +require 'optparse' +require 'prawn' +require 'find' +require 'fileutils' + +options = {} +option_parser = OptionParser.new do |opts| + + opts.on("-f DICOMDIR", "The DICOM directory") do |dicomdir| + options[:dicomdir] = dicomdir + end + + #opts.on("-o OUTPUTDIR", "The output directory") do |outputdir| + # options[:outputdir] = outputdir + #end + + #opts.on("-z ZTHRESHOLD", 'The Z threshold for run feat') do |zthreshold| + # options[:zthreshold]=zthreshold + #end + + + opts.on("-b BETORMASK", 'SELECT BET OR BRAIN MASK') do |betormask| + options[:betormask]=betormask + end + + #opts.on("-s", "--studyInfo patfName,patlName,patId,studyDate, accessionNo", Array, "The study information for the report") do |study| + # options[:study] = study + #end + +end + +option_parser.parse! + +inidicom=options[:dicomdir] +betormask=options[:betormask] + +#zthreshold=options[:zthreshold] +nvolumes=80 +zthreshold=2.3 + + +# CAMBIAR EL NOMBRE DE LA CARPETA QUE CONTIENE LOS DICOMS +dirname= Dir.entries(inidicom).select {|entry| File.directory? File.join(inidicom,entry) and !(entry =='.' || entry == '..') } + +completepath="#{inidicom}/#{dirname[0]}" +newname="#{inidicom}/0DICOM" + +FileUtils.mv completepath, newname + +#CONVERT DICOM TO NIFTI +#SE CORRE EL COMANDO DE MCVERTER + +`mcverter -f fsl -x -d -n -o #{inidicom} #{inidicom}` + +dirnewname= Dir.entries(inidicom).select {|entry| File.directory? File.join(inidicom,entry) and !(entry =='.' || entry == '..') } + +dirniiname=dirnewname[1] + +dirniipath="#{inidicom}/#{dirniiname}" +dirniilist=Dir.entries(dirniipath).select {|entry| File.directory? File.join(dirniipath,entry) and !(entry =='.' || entry == '..') } + +volaxfolder=1 +flair=1 +dirniilist.each do |name| + + isvol=name.scan("VOL_AX") + + if isvol.empty? + else + volaxfolder=name + end + + isflair=name.scan("FLAIR") + + if isflair.empty? + else + flair=name + end +end + +puts volaxfolder +dirniilist.delete(volaxfolder) +dirniilist.delete(flair) + +volaxa=Dir["#{dirniipath}/#{volaxfolder}/*.nii"] +volaxf="#{dirniipath}/#{volaxfolder}" +volax=volaxa[0] +newvolax="#{dirniipath}/#{volaxfolder}/volax.nii" +FileUtils.mv volax, newvolax + + +flair=Dir["#{dirniipath}/#{flair}/*.nii"] +flairdir=Dir["#{dirniipath}/#{flair}"] +flair_reg="#{flairdir}/flair_reg.nii" +#### END METHODS #### + +beginning_time = Time.now + + + +if betormask=="1" + # PERFORM BRAIN EXTRACTION + puts "CON BET" + bet = FSL::BET.new(newvolax, volaxf, {fi_threshold: 0.45, v_gradient: 0}) + bet.command + bet_image = bet.get_result + +else + puts "CON MASK" + mask_image="#{dirniipath}/#{volaxfolder}/maskedvol.nii.gz" + + `standard_space_roi #{newvolax} #{mask_image} -b` + bet_image="#{dirniipath}/#{volaxfolder}/maskbetvol.nii.gz" + puts bet_image + `bet #{mask_image} #{bet_image} -f 0.15` +end + + +#FEAT command line + +dirniilist.each do |dn| + puts dn + +nifftifiled= Dir.glob("#{dirniipath}/#{dn}/*.nii") +nifftifile=nifftifiled[0]; +puts nifftifile + +isvol=nifftifile.scan("ORTOGONAL") + + +if isvol.empty? + puts "no ortogonal" + `cp /Users/catalinabustamante/Documents/codigo/rubyfmri/design_tem_1.5.fsf #{dirniipath}/#{dn}/design_tem_1.5.fsf` + else + puts "ortogonal" + `cp /Users/catalinabustamante/Documents/codigo/rubyfmri/design_tem_1.5_o.fsf #{dirniipath}/#{dn}/design_tem_1.5.fsf` +end + + +path="#{dirniipath}/#{dn}/design_tem_1.5.fsf" +puts path +design = File.read(path) +replace=design.gsub(/set fmri\(([npts)]+)\) 80/,"set fmri(npts) #{nvolumes}") +replace = replace.gsub(/set fmri\(([z_thresh)]+)\) 2.3/, "set fmri(z_thresh) #{zthreshold}") +replace = replace.gsub(/set feat_files\(([1)]+)\) pathf/, "set feat_files(1) \"#{nifftifile}\"") +replace = replace.gsub(/set highres_files\(([1)]+)\) paths/, "set highres_files(1) \"#{bet_image}\"") +File.open(path, "w") {|file| file.puts replace} +`feat #{path}` + +featpath=Dir.glob("#{dirniipath}/#{dn}/*.feat") +featpath=featpath[0] + puts featpath + +`/usr/local/fsl/bin/renderhighres #{featpath} standard highres 1 1 15` + +if dn==dirniilist[0] + matriz=Dir.glob("#{featpath}/reg/highres2standard.mat") + `flirt -in #{flair} -ref /usr/local/fsl/data/standard/MNI152_T1_2mm_brain -out #{flair_reg} -init #{matriz} -applyxfm` +end + + +end + +end_time = Time.now +puts "Time elapsed #{(end_time - beginning_time)} seconds" \ No newline at end of file diff --git a/rubyfmri1.5_120din.rb b/rubyfmri1.5_120din.rb new file mode 100755 index 0000000..01783a4 --- /dev/null +++ b/rubyfmri1.5_120din.rb @@ -0,0 +1,191 @@ +#!/usr/bin/env ruby +# the Dicom folder has to have the number of volumes in the name ex: Hand_80 +# Modules required: +require 'rubygems' +require 'dcm2nii-ruby' +require 'fsl-ruby' +require 'narray' +require 'nifti' +require 'optparse' +require 'find' +require 'fileutils' + +options = {} +option_parser = OptionParser.new do |opts| + + opts.on("-f DICOMDIR", "The DICOM directory") do |dicomdir| + options[:dicomdir] = dicomdir + end + + #opts.on("-o OUTPUTDIR", "The output directory") do |outputdir| + # options[:outputdir] = outputdir + #end + + #opts.on("-z ZTHRESHOLD", 'The Z threshold for run feat') do |zthreshold| + # options[:zthreshold]=zthreshold + #end + + + opts.on("-b BETORMASK", 'SELECT BET OR BRAIN MASK') do |betormask| + options[:betormask]=betormask + end + + #opts.on("-s", "--studyInfo patfName,patlName,patId,studyDate, accessionNo", Array, "The study information for the report") do |study| + # options[:study] = study + #end + +end + +option_parser.parse! + +inidicom=options[:dicomdir] +betormask=options[:betormask] + +#zthreshold=options[:zthreshold] +nvolumes=120 +zthreshold=2.3 +trvalue=3.0000000000 + + +# CAMBIAR EL NOMBRE DE LA CARPETA QUE CONTIENE LOS DICOMS +dirname= Dir.entries(inidicom).select {|entry| File.directory? File.join(inidicom,entry) and !(entry =='.' || entry == '..') } + +completepath="#{inidicom}/#{dirname[0]}" +newname="#{inidicom}/0DICOM" +niifile="#{inidicom}/NIFTI" + +FileUtils.mkdir niifile + +FileUtils.mv completepath, newname + +#CONVERT DICOM TO NIFTI +#SE CORRE EL COMANDO DE MCVERTER + +`mcverter -f fsl -x -d -n -o #{niifile} #{inidicom}` + +dirnewname= Dir.entries(inidicom).select {|entry| File.directory? File.join(inidicom,entry) and !(entry =='.' || entry == '..') } + +dirniiname=dirnewname[1] + +dirniipath="#{inidicom}/#{dirniiname}" + +puts dirniipath +dirniilist=Dir.entries(dirniipath).select {|entry| File.directory? File.join(dirniipath,entry) and !(entry =='.' || entry == '..') } + +volaxfolder=1 +flair=1 +dirniilist.each do |name| + + isvol=name.scan("VOL_AX") + + if isvol.empty? + else + puts "el volumetrico" + volaxfolder=name + end + + isflair=name.scan("FLAIR") + + if isflair.empty? + else + flair=name + end +end +puts "volaxial" +puts volaxfolder +dirniilist.delete(volaxfolder) +dirniilist.delete(flair) + +volaxa=Dir["#{dirniipath}/#{volaxfolder}/*.nii"] +volaxf="#{dirniipath}/#{volaxfolder}" +volax=volaxa[0] +newvolax="#{dirniipath}/#{volaxfolder}/volax.nii" +FileUtils.mv volax, newvolax + + + +flair=Dir["#{dirniipath}/#{flair}/*.nii"] +flairdir=Dir["#{dirniipath}/#{flair}"] +#### END METHODS #### + +beginning_time = Time.now + + + +if betormask=="1" + # PERFORM BRAIN EXTRACTION + puts "CON BET" + bet = FSL::BET.new(newvolax, volaxf, {fi_threshold: 0.45, v_gradient: 0}) + bet.command + bet_image = bet.get_result + +else + puts "CON MASK" + mask_image="#{dirniipath}/#{volaxfolder}/maskedvol.nii.gz" + + `standard_space_roi #{newvolax} #{mask_image} -b` + bet_image="#{dirniipath}/#{volaxfolder}/maskbetvol.nii.gz" + puts bet_image + `bet #{mask_image} #{bet_image} -f 0.15` +end + + +#FEAT command line + +dirniilist.each do |dn| + puts dn + +nifftifiled= Dir.glob("#{dirniipath}/#{dn}/*.nii") +nifftifile=nifftifiled[0]; +puts nifftifile + +isvol=nifftifile.scan("ORTO") + + +if isvol.empty? + puts "no ortogonal" + `cp /Users/investigacioniatm/Documents/codigo/rubyfmri/design_tem_1_5_120.fsf #{dirniipath}/#{dn}/design_tem_1_5_120.fsf` + else + puts "ortogonal" + `cp /Users/investigacioniatm/Documents/codigo/rubyfmri/design_tem_1_5_120_o.fsf #{dirniipath}/#{dn}/design_tem_1_5_120.fsf` +end + + +path="#{dirniipath}/#{dn}/design_tem_1_5_120.fsf" +puts path +design = File.read(path) +replace = design.gsub(/set fmri\(([npts)]+)\) 120/,"set fmri(npts) #{nvolumes}") +replace = replace.gsub(/set fmri\(([z_thresh)]+)\) 2.3/, "set fmri(z_thresh) #{zthreshold}") +replace = replace.gsub(/set feat_files\(([1)]+)\) pathf/, "set feat_files(1) \"#{nifftifile}\"") +replace = replace.gsub(/set highres_files\(([1)]+)\) paths/, "set highres_files(1) \"#{bet_image}\"") +File.open(path, "w") {|file| file.puts replace} +`feat #{path}` + +featpath=Dir.glob("#{dirniipath}/#{dn}/*.feat") +featpath=featpath[0] + puts featpath + +`/usr/local/fsl/bin/renderhighres #{featpath} standard highres 1 1 15` + +matriz= "#{featpath}/hr/background_reg.mat" + +`flirt -in #{featpath}/hr/background.nii.gz -ref #{bet_image} -out #{featpath}/hr/background_reg.nii.gz -omat #{matriz} -bins 256 -cost corratio -searchrx -90 90 -searchry -90 90 -searchrz -90 90 -dof 12 -interp trilinear` + +thpath=Dir.glob("#{featpath}/hr/thresh_zstat*.nii.gz") + + +thpath.each do |th| + puts th + threg=th.gsub('.nii.gz', '_reg.nii.gz') + puts threg + puts flairdir + puts matriz + `flirt -in #{th} -ref #{bet_image} -init #{matriz} -out #{threg} -applyxfm` +end + + +end + + +end_time = Time.now +puts "Time elapsed #{(end_time - beginning_time)} seconds" \ No newline at end of file diff --git a/rubyfmri1.5_lm.rb b/rubyfmri1.5_lm.rb new file mode 100755 index 0000000..334af5c --- /dev/null +++ b/rubyfmri1.5_lm.rb @@ -0,0 +1,177 @@ +#!/usr/bin/env ruby +# the Dicom folder has to have the number of volumes in the name ex: Hand_80 +# Modules required: +require 'rubygems' +require 'dcm2nii-ruby' +require 'fsl-ruby' +require 'narray' +require 'nifti' +require 'chunky_png' +require 'optparse' +require 'prawn' +require 'find' +require 'fileutils' + +options = {} +option_parser = OptionParser.new do |opts| + + opts.on("-f DICOMDIR", "The DICOM directory") do |dicomdir| + options[:dicomdir] = dicomdir + end + + #opts.on("-o OUTPUTDIR", "The output directory") do |outputdir| + # options[:outputdir] = outputdir + #end + + #opts.on("-z ZTHRESHOLD", 'The Z threshold for run feat') do |zthreshold| + # options[:zthreshold]=zthreshold + #end + + + opts.on("-b BETORMASK", 'SELECT BET OR BRAIN MASK') do |betormask| + options[:betormask]=betormask + end + + #opts.on("-s", "--studyInfo patfName,patlName,patId,studyDate, accessionNo", Array, "The study information for the report") do |study| + # options[:study] = study + #end + +end + +option_parser.parse! + +inidicom=options[:dicomdir] +betormask=options[:betormask] + +#zthreshold=options[:zthreshold] +nvolumes=80 +zthreshold=2.3 + + +# CAMBIAR EL NOMBRE DE LA CARPETA QUE CONTIENE LOS DICOMS +dirname= Dir.entries(inidicom).select {|entry| File.directory? File.join(inidicom,entry) and !(entry =='.' || entry == '..') } + +completepath="#{inidicom}/#{dirname[0]}" +newname="#{inidicom}/0DICOM" +niifile="#{inidicom}/NIFTI" +FileUtils.mkdir niifile + +FileUtils.mv completepath, newname + +#CONVERT DICOM TO NIFTI +#SE CORRE EL COMANDO DE MCVERTER + +`mcverter -f fsl -x -d -n -o #{niifile} #{inidicom}` + +dirnewname= Dir.entries(inidicom).select {|entry| File.directory? File.join(inidicom,entry) and !(entry =='.' || entry == '..') } + +dirniiname=dirnewname[1] + +dirniipath="#{inidicom}/#{dirniiname}" +dirniilist=Dir.entries(dirniipath).select {|entry| File.directory? File.join(dirniipath,entry) and !(entry =='.' || entry == '..') } + + +volaxfolder=1 +flair=1 +dirniilist.each do |name| + puts name + isvol=name.scan("VOL") + + if isvol.empty? + else + volaxfolder=name + end + + isflair=name.scan("FLAIR") + + if isflair.empty? + else + flair=name + end +end + +puts volaxfolder +dirniilist.delete(volaxfolder) +dirniilist.delete(flair) + +volaxa=Dir["#{dirniipath}/#{volaxfolder}/*.nii"] +volaxf="#{dirniipath}/#{volaxfolder}" +volax=volaxa[0] +newvolax="#{dirniipath}/#{volaxfolder}/volax.nii" +FileUtils.mv volax, newvolax + + +flair=Dir["#{dirniipath}/#{flair}/*.nii"] +flairdir=Dir["#{dirniipath}/#{flair}"] +flair_reg="#{flairdir}/flair_reg.nii" +#### END METHODS #### + +beginning_time = Time.now + + + +if betormask=="1" + # PERFORM BRAIN EXTRACTION + puts "CON BET" + bet = FSL::BET.new(newvolax, volaxf, {fi_threshold: 0.45, v_gradient: 0}) + bet.command + bet_image = bet.get_result + +else + puts "CON MASK" + mask_image="#{dirniipath}/#{volaxfolder}/maskedvol.nii.gz" + + `standard_space_roi #{newvolax} #{mask_image} -b` + bet_image="#{dirniipath}/#{volaxfolder}/maskbetvol.nii.gz" + puts bet_image + `bet #{mask_image} #{bet_image} -f 0.15` +end + + +#FEAT command line + +dirniilist.each do |dn| + puts dn + +nifftifiled= Dir.glob("#{dirniipath}/#{dn}/*.nii") +nifftifile=nifftifiled[0]; +puts nifftifile + +isvol=nifftifile.scan("ORTOGONAL") + + +if isvol.empty? + puts "no ortogonal" + `cp /Users/investigacioniatm/Documents/codigo/rubyfmri/design_tem_1_5.fsf #{dirniipath}/#{dn}/design_tem_1.5.fsf` + else + puts "ortogonal" + `cp /Users/investigacioniatm/Documents/codigo/rubyfmri/design_tem_1_5_o.fsf #{dirniipath}/#{dn}/design_tem_1.5.fsf` +end + + +path="#{dirniipath}/#{dn}/design_tem_1.5.fsf" +puts path +design = File.read(path) +replace=design.gsub(/set fmri\(([npts)]+)\) 80/,"set fmri(npts) #{nvolumes}") +replace = replace.gsub(/set fmri\(([z_thresh)]+)\) 2.3/, "set fmri(z_thresh) #{zthreshold}") +replace = replace.gsub(/set feat_files\(([1)]+)\) pathf/, "set feat_files(1) \"#{nifftifile}\"") +replace = replace.gsub(/set highres_files\(([1)]+)\) paths/, "set highres_files(1) \"#{bet_image}\"") +File.open(path, "w") {|file| file.puts replace} +`feat #{path}` + +featpath=Dir.glob("#{dirniipath}/#{dn}/*.feat") +featpath=featpath[0] + puts featpath + +`/usr/local/fsl/bin/renderhighres #{featpath} standard highres 1 1 15` + +if dn==dirniilist[0] + matriz=Dir.glob("#{featpath}/reg/highres2standard.mat") + `flirt -in #{flair} -ref /usr/local/fsl/data/standard/MNI152_T1_2mm_brain -out #{flair_reg} -init #{matriz} -applyxfm` +end + + +end + +end_time = Time.now +puts "Time elapsed #{(end_time - beginning_time)} seconds" \ No newline at end of file diff --git a/rubyfmri3T.rb b/rubyfmri3T.rb new file mode 100755 index 0000000..26ce3d6 --- /dev/null +++ b/rubyfmri3T.rb @@ -0,0 +1,191 @@ +#!/usr/bin/env ruby +# the Dicom folder has to have the number of volumes in the name ex: Hand_80 +# Modules required: +require 'rubygems' +require 'dcm2nii-ruby' +require 'fsl-ruby' +require 'narray' +require 'nifti' +require 'optparse' +require 'find' +require 'fileutils' + +options = {} +option_parser = OptionParser.new do |opts| + + opts.on("-f DICOMDIR", "The DICOM directory") do |dicomdir| + options[:dicomdir] = dicomdir + end + + #opts.on("-o OUTPUTDIR", "The output directory") do |outputdir| + # options[:outputdir] = outputdir + #end + + #opts.on("-z ZTHRESHOLD", 'The Z threshold for run feat') do |zthreshold| + # options[:zthreshold]=zthreshold + #end + + + opts.on("-b BETORMASK", 'SELECT BET OR BRAIN MASK') do |betormask| + options[:betormask]=betormask + end + + #opts.on("-s", "--studyInfo patfName,patlName,patId,studyDate, accessionNo", Array, "The study information for the report") do |study| + # options[:study] = study + #end + +end + +option_parser.parse! + +inidicom=options[:dicomdir] +betormask=options[:betormask] + +#zthreshold=options[:zthreshold] +nvolumes=120 +zthreshold=2.3 +trvalue=2.0000000000 + + +# CAMBIAR EL NOMBRE DE LA CARPETA QUE CONTIENE LOS DICOMS +dirname= Dir.entries(inidicom).select {|entry| File.directory? File.join(inidicom,entry) and !(entry =='.' || entry == '..') } + +completepath="#{inidicom}/#{dirname[0]}" +newname="#{inidicom}/0DICOM" +niifile="#{inidicom}/NIFTI" + +FileUtils.mkdir niifile + +FileUtils.mv completepath, newname + +#CONVERT DICOM TO NIFTI +#SE CORRE EL COMANDO DE MCVERTER + +`mcverter -f fsl -x -d -n -o #{niifile} #{inidicom}` + +dirnewname= Dir.entries(inidicom).select {|entry| File.directory? File.join(inidicom,entry) and !(entry =='.' || entry == '..') } + +dirniiname=dirnewname[1] + +dirniipath="#{inidicom}/#{dirniiname}" + +puts dirniipath +dirniilist=Dir.entries(dirniipath).select {|entry| File.directory? File.join(dirniipath,entry) and !(entry =='.' || entry == '..') } + +volaxfolder=1 +flair=1 +dirniilist.each do |name| + + isvol=name.scan("VOL_AX") + + if isvol.empty? + else + puts "el volumetrico" + volaxfolder=name + end + + isflair=name.scan("VISTA") + + if isflair.empty? + else + flair=name + end +end +puts "volaxial" +puts volaxfolder +dirniilist.delete(volaxfolder) +dirniilist.delete(flair) + +volaxa=Dir["#{dirniipath}/#{volaxfolder}/*.nii"] +volaxf="#{dirniipath}/#{volaxfolder}" +volax=volaxa[0] +newvolax="#{dirniipath}/#{volaxfolder}/volax.nii" +FileUtils.mv volax, newvolax + + + +flair=Dir["#{dirniipath}/#{flair}/*.nii"] +flairdir=Dir["#{dirniipath}/#{flair}"] +#### END METHODS #### + +beginning_time = Time.now + + + +if betormask=="1" + # PERFORM BRAIN EXTRACTION + puts "CON BET" + bet = FSL::BET.new(newvolax, volaxf, {fi_threshold: 0.45, v_gradient: 0}) + bet.command + bet_image = bet.get_result + +else + puts "CON MASK" + mask_image="#{dirniipath}/#{volaxfolder}/maskedvol.nii.gz" + + `standard_space_roi #{newvolax} #{mask_image} -b` + bet_image="#{dirniipath}/#{volaxfolder}/maskbetvol.nii.gz" + puts bet_image + `bet #{mask_image} #{bet_image} -f 0.15` +end + + +#FEAT command line + +dirniilist.each do |dn| + puts dn + +nifftifiled= Dir.glob("#{dirniipath}/#{dn}/*.nii") +nifftifile=nifftifiled[0]; +puts nifftifile + +isvol=nifftifile.scan("ORTO") + + +if isvol.empty? + puts "no ortogonal" + `cp /Users/investigacioniatm/Documents/codigo/rubyfmri/design_tem.fsf #{dirniipath}/#{dn}/design_tem.fsf` + else + puts "ortogonal" + `cp /Users/investigacioniatm/Documents/codigo/rubyfmri/design_tem_o.fsf #{dirniipath}/#{dn}/design_tem.fsf` +end + + +path="#{dirniipath}/#{dn}/design_tem.fsf" +puts path +design = File.read(path) +replace = design.gsub(/set fmri\(([npts)]+)\) 80/,"set fmri(npts) #{nvolumes}") +replace = replace.gsub(/set fmri\(([z_thresh)]+)\) 2.3/, "set fmri(z_thresh) #{zthreshold}") +replace = replace.gsub(/set feat_files\(([1)]+)\) pathf/, "set feat_files(1) \"#{nifftifile}\"") +replace = replace.gsub(/set highres_files\(([1)]+)\) paths/, "set highres_files(1) \"#{bet_image}\"") +File.open(path, "w") {|file| file.puts replace} +`feat #{path}` + +featpath=Dir.glob("#{dirniipath}/#{dn}/*.feat") +featpath=featpath[0] + puts featpath + +`/usr/local/fsl/bin/renderhighres #{featpath} standard highres 1 1 15` + +matriz= "#{featpath}/hr/background_reg.mat" + +`flirt -in #{featpath}/hr/background.nii.gz -ref #{bet_image} -out #{featpath}/hr/background_reg.nii.gz -omat #{matriz} -bins 256 -cost corratio -searchrx -90 90 -searchry -90 90 -searchrz -90 90 -dof 12 -interp trilinear` + +thpath=Dir.glob("#{featpath}/hr/thresh_zstat*.nii.gz") + + +thpath.each do |th| + puts th + threg=th.gsub('.nii.gz', '_reg.nii.gz') + puts threg + puts flairdir + puts matriz + `flirt -in #{th} -ref #{bet_image} -init #{matriz} -out #{threg} -applyxfm` +end + + +end + + +end_time = Time.now +puts "Time elapsed #{(end_time - beginning_time)} seconds" \ No newline at end of file diff --git a/rubyfmri3T80.rb b/rubyfmri3T80.rb new file mode 100755 index 0000000..9ce70e9 --- /dev/null +++ b/rubyfmri3T80.rb @@ -0,0 +1,178 @@ +#!/usr/bin/env ruby +# the Dicom folder has to have the number of volumes in the name ex: Hand_80 +# Modules required: +require 'rubygems' +require 'dcm2nii-ruby' +require 'fsl-ruby' +require 'nifti' +require 'optparse' +require 'find' +require 'fileutils' + +options = {} +option_parser = OptionParser.new do |opts| + + opts.on("-f DICOMDIR", "The DICOM directory") do |dicomdir| + options[:dicomdir] = dicomdir + end + + #opts.on("-o OUTPUTDIR", "The output directory") do |outputdir| + # options[:outputdir] = outputdir + #end + + #opts.on("-z ZTHRESHOLD", 'The Z threshold for run feat') do |zthreshold| + # options[:zthreshold]=zthreshold + #end + + + opts.on("-b BETORMASK", 'SELECT BET OR BRAIN MASK') do |betormask| + options[:betormask]=betormask + end + + #opts.on("-s", "--studyInfo patfName,patlName,patId,studyDate, accessionNo", Array, "The study information for the report") do |study| + # options[:study] = study + #end + +end + +option_parser.parse! + +inidicom=options[:dicomdir] +betormask=options[:betormask] + +#zthreshold=options[:zthreshold] +nvolumes=120 +zthreshold=2.3 + + +# CAMBIAR EL NOMBRE DE LA CARPETA QUE CONTIENE LOS DICOMS +dirname= Dir.entries(inidicom).select {|entry| File.directory? File.join(inidicom,entry) and !(entry =='.' || entry == '..') } + +completepath="#{inidicom}/#{dirname[0]}" +newname="#{inidicom}/0DICOM" + +FileUtils.mv completepath, newname + +#CONVERT DICOM TO NIFTI +#SE CORRE EL COMANDO DE MCVERTER + +`mcverter -f fsl -x -d -n -o #{inidicom} #{inidicom}` + +dirnewname= Dir.entries(inidicom).select {|entry| File.directory? File.join(inidicom,entry) and !(entry =='.' || entry == '..') } + +dirniiname=dirnewname[1] + +dirniipath="#{inidicom}/#{dirniiname}" + +puts dirniipath +dirniilist=Dir.entries(dirniipath).select {|entry| File.directory? File.join(dirniipath,entry) and !(entry =='.' || entry == '..') } + +volaxfolder=1 +flair=1 +dirniilist.each do |name| + + isvol=name.scan("MPRAGE") + + if isvol.empty? + else + volaxfolder=name + end + + isflair=name.scan("FL") + + if isflair.empty? + else + flair=name + end +end + +puts volaxfolder +dirniilist.delete(volaxfolder) +dirniilist.delete(flair) + +volaxa=Dir["#{dirniipath}/#{volaxfolder}/*.nii"] +volaxf="#{dirniipath}/#{volaxfolder}" +volax=volaxa[0] +newvolax="#{dirniipath}/#{volaxfolder}/volax.nii" +FileUtils.mv volax, newvolax + +puts "por aqui pase" + +flair=Dir["#{dirniipath}/#{flair}/*.nii"] +flairdir=Dir["#{dirniipath}/#{flair}"] +flair_reg="#{flairdir}/flair_reg.nii" +#### END METHODS #### + +beginning_time = Time.now + + + +if betormask=="1" + # PERFORM BRAIN EXTRACTION + puts "CON BET" + bet = FSL::BET.new(newvolax, volaxf, {fi_threshold: 0.45, v_gradient: 0}) + bet.command + bet_image = bet.get_result + +else + puts "CON MASK" + mask_image="#{dirniipath}/#{volaxfolder}/maskedvol.nii.gz" + + `standard_space_roi #{newvolax} #{mask_image} -b` + bet_image="#{dirniipath}/#{volaxfolder}/maskbetvol.nii.gz" + puts bet_image + `bet #{mask_image} #{bet_image} -f 0.15` +end + + +#FEAT command line + +dirniilist.each do |dn| + puts dn + +nifftifiled= Dir.glob("#{dirniipath}/#{dn}/*.nii") +nifftifile=nifftifiled[0]; +puts nifftifile + +isvol=nifftifile.scan("ORTO") + + +if isvol.empty? + puts "no ortogonal" + `cp /Users/investigacioniatm/Documents/codigo/rubyfmri/design_tem.fsf #{dirniipath}/#{dn}/design_tem.fsf` + else + puts "ortogonal" + `cp cp /Users/investigacioniatm/Documents/codigo/rubyfmri/design_tem_o.fsf #{dirniipath}/#{dn}/design_tem.fsf` +end + + +path="#{dirniipath}/#{dn}/design_tem.fsf" +puts path +design = File.read(path) +replace=design.gsub(/set fmri\(([npts)]+)\) 80/,"set fmri(npts) #{nvolumes}") +replace = replace.gsub(/set fmri\(([z_thresh)]+)\) 2.3/, "set fmri(z_thresh) #{zthreshold}") +replace = replace.gsub(/set feat_files\(([1)]+)\) pathf/, "set feat_files(1) \"#{nifftifile}\"") +replace = replace.gsub(/set highres_files\(([1)]+)\) paths/, "set highres_files(1) \"#{bet_image}\"") +File.open(path, "w") {|file| file.puts replace} +`feat #{path}` + +featpath=Dir.glob("#{dirniipath}/#{dn}/*.feat") +featpath=featpath[0] + puts featpath + +`/usr/local/fsl/bin/renderhighres #{featpath} standard highres 1 1 15` +thpath=Dir.glob("#{featpath}/hr/thresh_zstat1.nii.gz") +puts flair +puts thpath +thpath_reg=Dir.glob("#{featpath}/hr/thresh_zstat1_reg.nii.gz") +puts thpath_reg +matriz=Dir.glob("#{featpath}/reg/standard2highres.mat") +puts matriz + `flirt -in #{thpath} -ref #{flair} -out #{thpath_reg} -init #{matriz} -applyxfm` + + + +end + +end_time = Time.now +puts "Time elapsed #{(end_time - beginning_time)} seconds" \ No newline at end of file diff --git a/surfer.log b/surfer.log deleted file mode 100755 index 849d270..0000000 --- a/surfer.log +++ /dev/null @@ -1,7 +0,0 @@ - - -############################ -Wed Jan 9 09:27:03 COT 2013 -/Users/catalinabustamante/codigo/rubycampus -/Applications/freesurfer//tktools/tksurfer.bin P2 lh inflated -############################ diff --git a/threg.rb b/threg.rb new file mode 100644 index 0000000..10bb010 --- /dev/null +++ b/threg.rb @@ -0,0 +1,42 @@ +require 'rubygems' +require 'dcm2nii-ruby' +require 'fsl-ruby' +require 'narray' +require 'nifti' +require 'chunky_png' +require 'optparse' +require 'prawn' +require 'find' +require 'fileutils' + +options = {} +option_parser = OptionParser.new do |opts| + + opts.on("-f DICOMDIR", "The DICOM directory") do |dicomdir| + options[:dicomdir] = dicomdir + end +end + + option_parser.parse! + + inidicom=options[:dicomdir] + + dirname= Dir.entries(inidicom).select {|entry| File.directory? File.join(inidicom,entry) and !(entry =='.' || entry == '..') } + + +dirname.each do |dn| + thpathg= Dir.glob("#{inidicom}/#{dn}/*.feat/hr") + puts thpathg + thpath="#{thpathg[0]}/thresh_zstat1.nii.gz" + puts thpath + + thpath_reg="#{thpathg[0]}/thresh_zstat1_reg.nii.gz" + puts thpath_reg + matriz="/Users/catalinabustamante/Documents/PACIENTES/fMRI/Leshaw_Nicholas_Daniel/LESHAW_NICHOLAS_DANIEL/00040004926_1_1101_PIE_DER_20140515/LESHAW_NICHOLAS_DANIEL_20140515_00040004926_1_1101_PIE_DER_SENSE_PIE_DER.feat/hr/background_reg.mat" + puts matriz + + flair="/Users/catalinabustamante/Documents/PACIENTES/fMRI/Leshaw_Nicholas_Daniel/LESHAW_NICHOLAS_DANIEL/00040004926_1_401_FL_VISTA_20140515/LESHAW_NICHOLAS_DANIEL_20140515_00040004926_1_401_FL_VISTA_SENSE_FL_VISTA.nii" + + puts flair + `flirt -in #{thpath} -ref #{flair} -out #{thpath_reg} -init #{matriz} -applyxfm` +end \ No newline at end of file