Skip to content

Commit 8c6de6a

Browse files
committed
refactor and update copyright format
1 parent 8a9764b commit 8c6de6a

13 files changed

+92
-83
lines changed

src/Mapping.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
% - ``norm = ''``
2727
% - ``smooth = ''``
2828
%
29+
2930
% (C) Copyright 2021 spm_2_bids developers
3031

3132
properties

src/defaults/check_cfg.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
%
4949
%
5050
%
51+
5152
% (C) Copyright 2021 spm_2_bids developers
5253

5354
if nargin < 1

src/defaults/get_spm_prefix_list.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
% is not there.
77
%
88
%
9+
910
% (C) Copyright 2021 spm_2_bids developers
1011

1112
try

src/spm_2_bids.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
% adapting the ``cfg``.
2525
%
2626
%
27+
2728
% (C) Copyright 2021 spm_2_bids developers
2829

2930
if nargin < 2 || isempty(map)

src/utils/add_deformation_field.m

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
function sources = add_deformation_field(bf, sources, map, verbose)
2+
% (C) Copyright 2021 spm_2_bids developers
3+
if ~startsWith(bf.prefix, map.norm)
4+
return
5+
end
6+
7+
% for anatomical data we assume that
8+
% the deformation field comes from the anatomical file itself
9+
if (~isempty(bf.modality) && ismember(bf.modality, {'anat'})) || ...
10+
(~isempty(bf.suffix) && ~isempty(map.cfg.schema.find_suffix_group('anat', bf.suffix)))
11+
12+
bf.prefix = 'y_';
13+
bf = bf.update;
14+
new_filename = spm_2_bids(bf.filename, map, verbose);
15+
deformation_field = fullfile(bf.bids_path, new_filename);
16+
17+
% otherwise we can't guess it just from the file name
18+
else
19+
deformation_field = 'TODO: add deformation field';
20+
21+
end
22+
23+
sources{end + 1, 1} = deformation_field;
24+
25+
end

src/utils/check_dependencies.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ function check_dependencies()
88
% check_dependencies()
99
%
1010
%
11+
1112
% (C) Copyright 2019 spm_2_bids developers
1213

1314
fprintf('Checking dependencies\n');

src/utils/check_field_content.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
function status = check_field_content(struct_one, struct_two)
22
%
3+
34
% (C) Copyright 2021 spm_2_bids developers
45

56
status = true;

src/utils/get_version.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
%
1010
% :returns: :version_number: (string) Use semantic versioning format (like v0.1.0)
1111
%
12+
1213
% (C) Copyright 2020 spm_2_bids developers
1314

1415
try

src/utils/identify_rawsources.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
% :type verbose: boolean
1717
%
1818
%
19+
1920
% (C) Copyright 2021 spm_2_bids developers
2021

2122
% TODO mean may involve several files from the source (across runs

src/utils/identify_sources.m

Lines changed: 1 addition & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
% :param verbose: Defaults to ``true``
1717
% :type verbose: boolean
1818
%
19+
1920
% (C) Copyright 2021 spm_2_bids developers
2021

2122
% "r" could mean realigned or resliced...
@@ -117,89 +118,6 @@
117118

118119
end
119120

120-
function sources = add_deformation_field(bf, sources, map, verbose)
121-
122-
if ~startsWith(bf.prefix, map.norm)
123-
return
124-
end
125-
126-
% for anatomical data we assume that
127-
% the deformation field comes from the anatomical file itself
128-
if (~isempty(bf.modality) && ismember(bf.modality, {'anat'})) || ...
129-
(~isempty(bf.suffix) && ~isempty(map.cfg.schema.find_suffix_group('anat', bf.suffix)))
130-
131-
bf.prefix = 'y_';
132-
bf = bf.update;
133-
new_filename = spm_2_bids(bf.filename, map, verbose);
134-
deformation_field = fullfile(bf.bids_path, new_filename);
135-
136-
% otherwise we can't guess it just from the file name
137-
else
138-
deformation_field = 'TODO: add deformation field';
139-
140-
end
141-
142-
sources{end + 1, 1} = deformation_field;
143-
144-
end
145-
146-
function [status, bf] = update_prefix(bf, map)
147-
148-
status = 2;
149-
150-
if length(bf.prefix) < 2
151-
% TODO: files that have been realigned but not resliced have no
152-
% "prefix" so we may miss some transformation
153-
status = 0;
154-
return
155-
end
156-
157-
% remove the prefix of the last step
158-
if startsWith(bf.prefix, map.smooth)
159-
160-
% in case the prefix includes a number to denotate the FXHM used
161-
% for smoothing
162-
starts_with_fwhm = regexp(bf.prefix, '^s[0-9]*', 'match');
163-
if ~isempty(starts_with_fwhm)
164-
bf = shorten_prefix(bf, length(starts_with_fwhm{1}));
165-
else
166-
bf = shorten_prefix(bf, 1);
167-
end
168-
169-
elseif startsWith(bf.prefix, map.unwarp)
170-
bf = shorten_prefix(bf, 1);
171-
172-
elseif startsWith(bf.prefix, map.norm)
173-
bf = shorten_prefix(bf, 1);
174-
175-
elseif startsWith(bf.prefix, ['rp_' map.stc])
176-
bf = shorten_prefix(bf, 3);
177-
178-
elseif startsWith(bf.prefix, 'mean')
179-
% TODO mean may involve several files from the source (across runs
180-
% and sessions
181-
% prefixes = {
182-
% 'mean'
183-
% 'meanu'
184-
% 'meanua'
185-
% };
186-
status = 1;
187-
return
188-
189-
elseif ismember(bf.prefix(1:2), {'c1', 'c2', 'c3', 'c4', 'c5'})
190-
% bias corrected image
191-
status = 1;
192-
return
193-
194-
else
195-
% no idea
196-
status = 1;
197-
return
198-
199-
end
200-
201-
end
202-
203121
function bf = shorten_prefix(bf, len)
204122
bf.prefix = bf.prefix((len + 1):end);
205123
end

0 commit comments

Comments
 (0)