-
Notifications
You must be signed in to change notification settings - Fork 0
/
visualize_physio.m
67 lines (51 loc) · 1.86 KB
/
visualize_physio.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
% Script visualize_physio
% Use PhysIO to create contrasts and display them for fMRI data w/o task
% modeling
%
% visualize_physio
%
%
% See also
% Author: Lars Kasper
% Created: 2022-11-20
% Copyright (C) 2022
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Visualize Movie of fMRI data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
doVisualizeFmri4D = false;
if doVisualizeFmri4D
spm_check_registration('nifti/fmri.nii')
% compute time series minus mean (bit of a hack...)
% {1} means specify 4D data as matrix X (instead of i1, i2 etc.)
% spm_imcalc('nifti/fmri.nii', 'nifti/dfmri.nii', ...
% 'bsxfun(@minus, X, mean(X))', {1})
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Create contrasts for smoothed or unsmoothed GLM
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if hasStruct
fileStructural = 'nifti/mstruct.nii';
else
fileStructural = 'nifti/mmeanfmri.nii';
end
if doSmooth
fileSpm = 'glm_s3/SPM.mat';
else
fileSpm = 'glm/SPM.mat';
end
args = tapas_physio_report_contrasts(...
'fileReport', 'physio_out/physio.ps', ...
'fileSpm', fileSpm, ...
'filePhysIO', 'physio_out/physio.mat', ...
'fileStructural', fileStructural)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Compute tSNR gains from model (takes some time to compute residuals
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
doComputeTsnrGains = false;
if doComputeTsnrGains
indexContrastForSnrRatio = 0; % 0 = vs no noise modelin, 7 = vs motion
namesPhysContrasts = {'Cardiac', 'RespiratoryVolumePerTime'};
tapas_physio_compute_tsnr_gains('physio_out/physio.mat', fileSpm, ...
indexContrastForSnrRatio, ...
namesPhysContrasts);
end