% File: batch_run.m.  pipeline file containing all processing steps
% Reference for the code can be
%   1. Ze Wang, Geoffrey K. Aguirre, Hengyi Rao, Jiongjiong Wang, Maria A. Fernandez-Seara, Anna R. Childress, and John A. Detre, Epirical optimization of ASL data analysis using an ASL data processing toolbox:  ASLtbx, Magnetic Resonance Imaging, 2008, 26(2):261-9.
%   2. Ze Wang, Yin Li, Anna Rose Childress, John A Detre, Brain Entropy Mapping using fMRI, Plos One, 2014, 9(3): e89948.
	
batch_reset_orientation;   % resetting image origin to the center of the image volume. This step is required for late registration.
 
batch_nsegment;     % segmenting T1 images. The c1, c2, c3 images (grey matter, white matter, and CSF segments) are required in batch_coreg_t12EPI, batch_filtering
batch_slicetiming;  % correcting acquisition time difference between slices
                                 % You should change line 5 in batch_slicetiming.m to the correct number of slices for your data.
batch_realign;         % motion correction.  This code will be updated later to consider the global signal effects.
% batch_create_msk; % creating brain mask. You need fsl installed.  This file may not run in Windows. Then you can use the following substitue.
batch_create_msk2;   % Creating a skull-striped EPI using hard-thresholding.
batch_tstd;              % calculating tsnr and temporal variance image
batch_coreg_t12EPI;    % registering T1 to EPI image. This is to resample the c2 and c3 images into the BOLD image space to be used as ROIs for extracting white matter and CSF signal
batch_filtering;       % temporal nuisance filtering. A bandpass filter is used.
batch_smooth;        % smoothing the filtered images
batch_calc_BEN;   % calculating BEN maps
batch_coreg;           % coregistering EPI images and BEN map to T1
batch_norm_spm8; % normalization using spm8 nsegmentation
batch_smooth_BENmaps;   % smoothing BEN maps


