Skip to content

Commit 63a2a68

Browse files
committed
refactor
1 parent cba8893 commit 63a2a68

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

miss_hit.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ copyright_entity: "spm_2_bids developers"
1717
# metric for code quality
1818
metric "cnest": limit 5
1919
metric "file_length": limit 500
20-
metric "cyc": limit 20
20+
metric "cyc": limit 16
2121
metric "parameters": limit 6

src/utils/identify_sources.m

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
function sources = identify_sources(derivatives, map, verbose)
1+
function sources = identify_sources(varargin)
22
%
33
% finds the most likely files in the detrivatives that was used to create
44
% this file
55
%
66
% USAGE::
77
%
8-
% sources = identify_sources(derivatives, verbose)
8+
% sources = identify_sources(derivatives, map, verbose)
99
%
1010
% :param file: SPM preprocessed filename (can be fullpath);
1111
% for example ``wmsub-01_ses-01_T1w.nii``
@@ -25,6 +25,9 @@
2525
% functional to anatomical coregistration
2626
% anatomical to functional coregistration
2727

28+
default_map = Mapping();
29+
default_map = default_map.default();
30+
2831
sources = '';
2932

3033
prefix_based = true;
@@ -52,17 +55,20 @@
5255
'PDmap', ...
5356
'UNIT1'};
5457

55-
if nargin < 1 || isempty(derivatives)
56-
return
57-
end
58+
args = inputParser;
5859

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);
6363

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
6672
end
6773

6874
if endsWith(derivatives, '_seg8.mat')

0 commit comments

Comments
 (0)