Skip to content

Commit 89e0449

Browse files
committed
refactor
1 parent b2cd9c2 commit 89e0449

File tree

2 files changed

+46
-45
lines changed

2 files changed

+46
-45
lines changed

src/utils/add_deformation_field.m

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
function sources = add_deformation_field(sources, bf, map, verbose, deformation_field_needed)
2+
% (C) Copyright 2021 spm_2_bids developers
3+
4+
deformation_field = 'TODO: add deformation field';
5+
6+
% TODO? grab all the anat suffixes from BIDS schema?
7+
covered_suffixes = {'T1w', ...
8+
'T2w', ...
9+
'PDw', ...
10+
'T2starw', ...
11+
'inplaneT1', ...
12+
'inplaneT2', ...
13+
'PD', ...
14+
'PDT2', ...
15+
'T2star', ...
16+
'FLASH', ...
17+
'T1map', ...
18+
'T2map', ...
19+
'T2starmap', ...
20+
'R1map', ...
21+
'R2map', ...
22+
'R2starmap', ...
23+
'PDmap', ...
24+
'UNIT1'};
25+
26+
if deformation_field_needed
27+
28+
% for anatomical data we assume that
29+
% the deformation field comes from the anatomical file itself
30+
if (~isempty(bf.modality) && ismember(bf.modality, {'anat'})) || ...
31+
(~isempty(bf.suffix) && ismember(bf.suffix, covered_suffixes))
32+
33+
bf.prefix = 'y_';
34+
bf = bf.update;
35+
new_filename = spm_2_bids(bf.filename, map, verbose);
36+
deformation_field = fullfile(bf.bids_path, new_filename);
37+
38+
% otherwise we can't guess it just from the file name
39+
else
40+
41+
end
42+
43+
sources{2, 1} = deformation_field;
44+
45+
end
46+
end

src/utils/identify_sources.m

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -136,48 +136,3 @@
136136

137137
end
138138

139-
function sources = add_deformation_field(sources, bf, map, verbose, deformation_field_needed)
140-
141-
deformation_field = 'TODO: add deformation field';
142-
143-
% TODO? grab all the anat suffixes from BIDS schema?
144-
covered_suffixes = {'T1w', ...
145-
'T2w', ...
146-
'PDw', ...
147-
'T2starw', ...
148-
'inplaneT1', ...
149-
'inplaneT2', ...
150-
'PD', ...
151-
'PDT2', ...
152-
'T2star', ...
153-
'FLASH', ...
154-
'T1map', ...
155-
'T2map', ...
156-
'T2starmap', ...
157-
'R1map', ...
158-
'R2map', ...
159-
'R2starmap', ...
160-
'PDmap', ...
161-
'UNIT1'};
162-
163-
if deformation_field_needed
164-
165-
% for anatomical data we assume that
166-
% the deformation field comes from the anatomical file itself
167-
if (~isempty(bf.modality) && ismember(bf.modality, {'anat'})) || ...
168-
(~isempty(bf.suffix) && ismember(bf.suffix, covered_suffixes))
169-
170-
bf.prefix = 'y_';
171-
bf = bf.update;
172-
new_filename = spm_2_bids(bf.filename, map, verbose);
173-
deformation_field = fullfile(bf.bids_path, new_filename);
174-
175-
% otherwise we can't guess it just from the file name
176-
else
177-
178-
end
179-
180-
sources{2, 1} = deformation_field;
181-
182-
end
183-
end

0 commit comments

Comments
 (0)