-
Notifications
You must be signed in to change notification settings - Fork 2
/
preprocessing_ukbb4_40k.m
70 lines (43 loc) · 3.63 KB
/
preprocessing_ukbb4_40k.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
clear
addpath('/files')
opt_grab.batch = '4'
path_out = ['ukbb_func_preprocess_output_batch' opt_grab.batch]
path_input = ['/project/rrg-jacquese/All_user_common_folder/RAW_DATA/UKBIOBANK-DATA/UKBIOBANK_IMAGING/UKB_MRI_download/UKB_New40k_download_feb2020/UKB_40k_release_T1w_rfMRI_BIDS/']
%% General
opt.size_output = 'quality_control'; % The amount of outputs that are generated by the pipeline. 'all' will keep intermediate outputs, 'quality_control' will only keep the quality control outputs.
opt.slice_timing.flag_skip = 1;% Skip the slice timing (0: don't skip, 1 : skip). Note that only the slice timing corretion portion is skipped, not all other effects such as FLAG_CENTER or FLAG_NU_CORRECT
%% Motion estimation (niak_pipeline_motion)
%opt.motion.session_ref = 'BL00';
%% resampling in stereotaxic space
opt.resample_vol.interpolation = 'trilinear'; % The resampling scheme. The fastest and most robust method is trilinear.
opt.resample_vol.voxel_size = [3 3 3]; % The voxel size to use in the stereotaxic space
opt.resample_vol.flag_skip = 0; % Skip resampling (data will stay in native functional space after slice timing/motion correction) (0: don't skip, 1 : skip)
%% Linear and non-linear fit of the anatomical image in the stereotaxic
% space (niak_brick_t1_preprocess)
opt.t1_preprocess.nu_correct.arg = '-distance 75'; % Parameter for non-uniformity correction. 200 is a suggested value for 1.5T images, 75 for 3T images. If you find that this stage did not work well, this parameter is usually critical to improve the results.
%% Temporal filtering (niak_brick_time_filter)
opt.time_filter.hp = 0.01; % Cut-off frequency for high-pass filtering, or removal of low frequencies (in Hz). A cut-off of -Inf will result in no high-pass filtering.
opt.time_filter.lp = Inf; % Cut-off frequency for low-pass filtering, or removal of high frequencies (in Hz). A cut-off of Inf will result in no low-pass filtering.
%% Regression of confounds and scrubbing (niak_brick_regress_confounds)
opt.regress_confounds.flag_wm = true; % Turn on/off the regression of the average white matter signal (true: apply / false : don't apply)
opt.regress_confounds.flag_vent = true; % Turn on/off the regression of the average of the ventricles (true: apply / false : don't apply)
opt.regress_confounds.flag_motion_params = true; % Turn on/off the regression of the motion parameters (true: apply / false : don't apply)
opt.regress_confounds.flag_gsc = false; % Turn on/off the regression of the PCA-based estimation of the global signal (true: apply / false : don't apply)
opt.regress_confounds.flag_scrubbing = true; % Turn on/off the scrubbing of time frames with excessive motion (true: apply / false : don't apply)
opt.regress_confounds.thre_fd = 0.5; % The threshold on frame displacement that is used to determine frames with excessive motion in the scrubbing procedure
%% Spatial smoothing (niak_brick_smooth_vol)
opt.smooth_vol.fwhm = 6; % Full-width at maximum (FWHM) of the Gaussian blurring kernel, in mm.
opt.smooth_vol.flag_skip = 0; % Skip spatial smoothing (0: don't skip, 1 : skip)
files_in = ukbb_grabber(path_input,opt_grab);
opt.psom.max_queued = 5;
opt.flag_verbose = 0;
opt.psom.qsub_options ='--mem=8000M --account def-pbellec --time=00-100:00 --ntasks=1 --cpus-per-task=2'
opt.folder_out = path_out;
path = 'failed_subjects/fail_csv_batch4.csv';
csv_file = csv2cell(path);
failed_subjects = csv_file(2:end);
for j = 1: numel(failed_subjects)
file = failed_subjects{j};
files_in = rmfield(files_in,file)
end
[pipeline,opt_pipe] = niak_pipeline_fmri_preprocess(files_in,opt);