-
Notifications
You must be signed in to change notification settings - Fork 2
/
preprocessing_ukbb1_20k.m
81 lines (55 loc) · 4.09 KB
/
preprocessing_ukbb1_20k.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
70
71
72
73
74
75
76
77
78
79
80
clear
addpath('/files')
path_out = ['ukbb_func_preprocess_output']
path_input = ['/project/rrg-jacquese/All_user_common_folder/RAW_DATA/UKBIOBANK-DATA/UKBIOBANK_IMAGING/UKB_MRI_unzip/UKB_unzip_Oct2018']
%% 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)
opt_grab.batch = '1'
files_in = ukbb_grabber(path_input,opt_grab);
%disp(files_in)
failed_one_slice_timing = {'sub1158317','sub1163395'}
failed_tilted_one = {'sub1698599','sub1126977','sub1407053', 'sub1961751'}
files_in = rmfield(files_in,failed_tilted_one)
files_in = rmfield(files_in,failed_one_slice_timing)
%didnt work
%opt.tune(9).subject = 'sub1698599';
%opt.tune(9).param.t1_preprocess.crop_neck = 0.1;
%didnt work
%opt.tune(8).subject = 'sub1407053';
%opt.tune(8).param.t1_preprocess.crop_neck = 0.4;
%didnt work
%opt.tune(7).subject = 'sub1863473';
%opt.tune(7).param.t1_preprocess.crop_neck = 0.3;
%didnt work
%opt.tune(9).subject = 'sub1504818';
%opt.tune(9).param.t1_preprocess.nu_correct.arg = '-distance 125';
unknown_one = {'sub1504818','sub1813622', 'sub1863473'}
files_in = rmfield(files_in,unknown_one)
opt.psom.max_queued = 32;
opt.flag_verbose = 0;
opt.psom.qsub_options ='--mem=8000M --account def-pbellec --time=00-48:00 --ntasks=1 --cpus-per-task=2'
opt.folder_out = path_out;
[pipeline,opt_pipe] = niak_pipeline_fmri_preprocess(files_in,opt);