-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathsetBatchSelectAnat.m
More file actions
50 lines (45 loc) · 1.46 KB
/
setBatchSelectAnat.m
File metadata and controls
50 lines (45 loc) · 1.46 KB
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
function matlabbatch = setBatchSelectAnat(matlabbatch, BIDS, opt, subLabel)
%
% Creates a batch to set an anatomical image
%
% USAGE::
%
% matlabbatch = setBatchSelectAnat(matlabbatch, BIDS, opt, subLabel)
%
% :param matlabbatch: list of SPM batches
% :type matlabbatch: structure
%
% :type BIDS: structure
% :param BIDS: dataset layout.
% See also: bids.layout, getData.
%
% :param opt: Options chosen for the analysis.
% See checkOptions.
% :type opt: structure
%
% :param subLabel: subject label
% :type subLabel: char
%
% :returns: :matlabbatch: (structure)
%
% matlabbatch = setBatchSelectAnat(matlabbatch, BIDS, opt, subLabel)
%
% - image type = opt.bidsFilterFiler.t1w.suffix (default = T1w)
% - session to select the anat from = opt.bidsFilterFiler.t1w.ses (default = 1)
%
% We assume that the first anat of that type is the "correct" one
%
% (C) Copyright 2020 bidspm developers
printBatchName('selecting anatomical image', opt);
nbImgToReturn = 1;
if opt.anatOnly
nbImgToReturn = Inf;
end
[anatImage, anatDataDir] = getAnatFilename(BIDS, opt, subLabel, nbImgToReturn);
matlabbatch{end + 1}.cfg_basicio.cfg_named_file.name = 'Anatomical';
if ischar(anatImage)
matlabbatch{end}.cfg_basicio.cfg_named_file.files = { {fullfile(anatDataDir, anatImage)} };
else
matlabbatch{end}.cfg_basicio.cfg_named_file.files = { fullfile(anatDataDir, anatImage) };
end
end