Skip to content

Commit 20d0062

Browse files
committed
extract sub function in identify sources
1 parent 35595b6 commit 20d0062

File tree

3 files changed

+34
-27
lines changed

3 files changed

+34
-27
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.vscode
44

55
*.json
6+
mapping.md
67

78
env/
89

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 16
20+
metric "cyc": limit 15
2121
metric "parameters": limit 6

src/utils/identify_sources.m

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,7 @@
3232

3333
prefix_based = true;
3434

35-
add_deformation_field = false;
36-
deformation_field = 'TODO: add deformation field';
37-
38-
% TODO? grab all the anat suffixes from BIDS schema?
39-
covered_suffixes = {'T1w', ...
40-
'T2w', ...
41-
'PDw', ...
42-
'T2starw', ...
43-
'inplaneT1', ...
44-
'inplaneT2', ...
45-
'PD', ...
46-
'PDT2', ...
47-
'T2star', ...
48-
'FLASH', ...
49-
'T1map', ...
50-
'T2map', ...
51-
'T2starmap', ...
52-
'R1map', ...
53-
'R2map', ...
54-
'R2starmap', ...
55-
'PDmap', ...
56-
'UNIT1'};
35+
deformation_field_needed = false;
5736

5837
args = inputParser;
5938

@@ -118,12 +97,12 @@
11897

11998
bf.prefix = bf.prefix(2:end);
12099

121-
add_deformation_field = true;
100+
deformation_field_needed = true;
122101

123102
elseif bids.internal.starts_with(bf.prefix, 'w')
124103

125104
bf.prefix = bf.prefix(2:end);
126-
add_deformation_field = true;
105+
deformation_field_needed = true;
127106

128107
elseif bids.internal.starts_with(bf.prefix, 'rp_a')
129108

@@ -153,7 +132,35 @@
153132

154133
sources{1, 1} = fullfile(bf.bids_path, new_filename);
155134

156-
if add_deformation_field
135+
sources = add_deformation_field(sources, bf, map, verbose, deformation_field_needed);
136+
137+
end
138+
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
157164

158165
% for anatomical data we assume that
159166
% the deformation field comes from the anatomical file itself
@@ -173,5 +180,4 @@
173180
sources{2, 1} = deformation_field;
174181

175182
end
176-
177183
end

0 commit comments

Comments
 (0)