-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewResp.m
84 lines (71 loc) · 2.36 KB
/
viewResp.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
81
82
function cmdFs = viewResp(volResp,volAnat,volFile,volFileOpt)
global srcAfni srcFs
if ~exist('volFile','var'); volFile = {}; end
if ~iscell(volFile); volFile = {volFile}; end
if ~exist('volFileOpt','var'); volFileOpt = {}; end
if ~iscell(volFileOpt); volFileOpt = {volFileOpt}; end
cmdFs = {srcFs};
cmdFs{end+1} = 'freeview \';
cmdFs{end+1} = [volResp.base.fspec ':visible=1 \'];
cmdFs{end+1} = [volResp.tsOnBase.fspec ':visible=0 \'];
cmdFs{end+1} = [volResp.ts.fspec ':visible=0 \'];
cmdFs{end+1} = [volResp.F.fspec ':visible=1:colormap=turbo \'];
cmdFs{end+1} = [volResp.Fq.fspec ':visible=0'];
%% Add roi
if ~isempty(volAnat)
label = 'vesselCenters';
volRoi = volAnat.fun.roi.vesselCenter;
if isfield(volRoi,'mri') && isfield(volRoi.mri,'fspec')
dbstack; error('code that')
else
mri = volAnat.fun.mask.crop;
mri.fspec = [tempname '.nii.gz'];
mri.vol = any(volRoi.mri.vol,4);
end
MRIwrite(mri,mri.fspec);
cmdFs{end} = [cmdFs{end} ' \'];
cmdFs{end+1} = [mri.fspec ':visible=0:name=' label];
end
%% Add extra
if ~isempty(volFile)
cmdFs{end} = [cmdFs{end} ' \'];
for i = 1:length(volFile)
if isempty(volFileOpt)
cmdFs{end+1} = [volFile{i} ':visible=0'];
else
cmdFs{end+1} = [volFile{i} ':visible=0' volFileOpt{i}];
end
if i ~= length(volFile)
cmdFs{end} = [cmdFs{end} ' \'];
end
end
end
disp(strjoin(cmdFs,newline));
clipboard('copy',strjoin(cmdFs,newline))
%
%
% cmdFs = {srcAfni};
% cmdFs{end+1} = 'afni \';
% cmdFs{end+1} = [volResp.base.fspec ':visible=1 \'];
% cmdFs{end+1} = [volResp.tsOnBase.fspec ':visible=0 \'];
% cmdFs{end+1} = [volResp.ts.fspec ':visible=0 \'];
% cmdFs{end+1} = [volResp.F.fspec ':visible=1:colormap=turbo \'];
% cmdFs{end+1} = [volResp.Fq.fspec ':visible=0'];
%
% %% Add roi
% if ~isempty(volAnat)
% label = 'vesselCenters';
% volRoi = volAnat.fun.roi.vesselCenter;
% if isfield(volRoi,'mri') && isfield(volRoi.mri,'fspec')
% dbstack; error('code that')
% else
% mri = volAnat.fun.mask.crop;
% mri.fspec = [tempname '.nii.gz'];
% mri.vol = any(volRoi.mri.vol,4);
% end
% MRIwrite(mri,mri.fspec);
% cmdFs{end} = [cmdFs{end} ' \'];
% cmdFs{end+1} = [mri.fspec ':visible=0:name=' label];
% end
%
% disp(strjoin(cmdFs,newline));