|
1 | | -function sources = identify_sources(derivatives, map, verbose) |
| 1 | +function sources = identify_sources(varargin) |
2 | 2 | % |
3 | 3 | % finds the most likely files in the detrivatives that was used to create |
4 | 4 | % this file |
5 | 5 | % |
6 | 6 | % USAGE:: |
7 | 7 | % |
8 | | - % sources = identify_sources(derivatives, verbose) |
| 8 | + % sources = identify_sources(derivatives, map, verbose) |
9 | 9 | % |
10 | 10 | % :param file: SPM preprocessed filename (can be fullpath); |
11 | 11 | % for example ``wmsub-01_ses-01_T1w.nii`` |
|
25 | 25 | % functional to anatomical coregistration |
26 | 26 | % anatomical to functional coregistration |
27 | 27 |
|
| 28 | + default_map = Mapping(); |
| 29 | + default_map = default_map.default(); |
| 30 | + |
28 | 31 | sources = ''; |
29 | 32 |
|
30 | 33 | prefix_based = true; |
|
52 | 55 | 'PDmap', ... |
53 | 56 | 'UNIT1'}; |
54 | 57 |
|
55 | | - if nargin < 1 || isempty(derivatives) |
56 | | - return |
57 | | - end |
| 58 | + args = inputParser; |
58 | 59 |
|
59 | | - if nargin < 2 || isempty(map) |
60 | | - map = Mapping(); |
61 | | - map = map.default(); |
62 | | - end |
| 60 | + addOptional(args, 'derivatives', pwd, @ischar); |
| 61 | + addOptional(args, 'map', default_map); |
| 62 | + addOptional(args, 'verbose', true, @islogical); |
63 | 63 |
|
64 | | - if nargin < 3 |
65 | | - verbose = true; |
| 64 | + parse(args, varargin{:}); |
| 65 | + |
| 66 | + derivatives = args.Results.derivatives; |
| 67 | + map = args.Results.map; |
| 68 | + verbose = args.Results.verbose; |
| 69 | + |
| 70 | + if isempty(derivatives) |
| 71 | + return |
66 | 72 | end |
67 | 73 |
|
68 | 74 | if endsWith(derivatives, '_seg8.mat') |
|
0 commit comments