Skip to content

Commit 622deb8

Browse files
committed
add some default mapping for image that include slice time correction
1 parent f740246 commit 622deb8

File tree

5 files changed

+68
-45
lines changed

5 files changed

+68
-45
lines changed

CITATION.cff

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ keywords:
2626
- BIDS
2727
- brain imaging data structure
2828
- neuroimaging
29+
- converter
2930
- MRI
3031
- MATLAB
3132
- Octave

src/defaults/Mapping.m

Lines changed: 55 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -168,44 +168,61 @@
168168
% map = map.default;
169169
%
170170

171-
prfx_spec = {{ obj.bias_cor }, obj.cfg.segment.bias_corrected; ...
172-
{ 'c1' }, obj.cfg.segment.gm; ...
173-
{ 'c2' }, obj.cfg.segment.wm; ...
174-
{ 'c3' }, obj.cfg.segment.csf; ...
175-
{ 'iy_' }, obj.cfg.segment.deformation_field.from_mni; ...
176-
{ 'y_' }, obj.cfg.segment.deformation_field.to_mni; ...
177-
{ 'segparam_' }, obj.cfg.segment.param; ...
178-
{ obj.stc}, obj.cfg.stc; ...
179-
{ 'unwarpparam_' }, obj.cfg.realign_unwarp_param; ...
180-
{ obj.unwarp, [obj.unwarp, obj.stc] }, obj.cfg.realign_unwarp; ...
181-
{ 'rp_', ['rp_' obj.stc] }, obj.cfg.real_param; ...
182-
{ 'mean', ...
183-
['mean' obj.unwarp], ...
184-
['mean' obj.unwarp, obj.stc] }, obj.cfg.mean; ...
185-
{ obj.norm, ...
186-
[obj.norm, obj.bias_cor], ...
187-
[obj.norm, obj.unwarp, obj.stc], ...
188-
[obj.norm, obj.realign, obj.stc], ...
189-
[obj.norm, obj.unwarp], ...
190-
[obj.norm, obj.realign] }, obj.cfg.preproc_norm; ...
191-
{ [obj.norm, 'mean', obj.unwarp] }, obj.cfg.normalized_mean; ...
192-
{ [obj.norm, 'c1'] }, obj.cfg.segment.gm_norm; ...
193-
{ [obj.norm, 'c2'] }, obj.cfg.segment.wm_norm; ...
194-
{ [obj.norm, 'c3'] }, obj.cfg.segment.csf_norm; ...
195-
{[obj.smooth, obj.norm], ...
196-
[obj.smooth, obj.norm, obj.unwarp, obj.stc], ...
197-
[obj.smooth, obj.norm, obj.realign, obj.stc], ...
198-
[obj.smooth, obj.norm, obj.unwarp], ...
199-
[obj.smooth, obj.norm, obj.realign] }, obj.cfg.smooth_norm; ...
200-
{ obj.smooth, ...
201-
[obj.smooth, obj.unwarp, obj.stc], ...
202-
[obj.smooth, obj.realign, obj.stc], ...
203-
[obj.smooth, obj.unwarp], ...
204-
[obj.smooth, obj.realign]}, obj.cfg.smooth};
205-
206-
for i_map = 1:size(prfx_spec, 1)
207-
obj = obj.add_mapping('prefix', prfx_spec{i_map, 1}, ...
208-
'name_spec', prfx_spec{i_map, 2});
171+
spec = {
172+
{ obj.bias_cor }, obj.cfg.segment.bias_corrected; ...
173+
{ 'c1' }, obj.cfg.segment.gm; ...
174+
{ 'c2' }, obj.cfg.segment.wm; ...
175+
{ 'c3' }, obj.cfg.segment.csf; ...
176+
{ 'iy_' }, obj.cfg.segment.deformation_field.from_mni; ...
177+
{ 'y_' }, obj.cfg.segment.deformation_field.to_mni; ...
178+
{ 'segparam_' }, obj.cfg.segment.param; ...
179+
{ obj.stc, ...
180+
[obj.stc, obj.unwarp] }, obj.cfg.stc; ...
181+
{ 'unwarpparam_' }, obj.cfg.realign_unwarp_param; ...
182+
{ obj.unwarp, ...
183+
[obj.unwarp, obj.stc] }, obj.cfg.realign_unwarp; ...
184+
{ 'rp_', ...
185+
['rp_', obj.stc], ...
186+
['rp_', obj.stc, obj.unwarp] }, obj.cfg.real_param; ...
187+
{ 'mean', ...
188+
['mean' obj.unwarp], ...
189+
['mean' obj.unwarp, obj.stc], ...
190+
['mean' obj.stc, obj.unwarp] }, obj.cfg.mean; ...
191+
{[obj.norm, 'mean', obj.unwarp], ...
192+
[obj.norm, 'mean', obj.unwarp, obj.stc], ...
193+
[obj.norm, 'mean', obj.stc, obj.unwarp]}, obj.cfg.normalized_mean; ...
194+
{[obj.norm, 'c1'] }, obj.cfg.segment.gm_norm; ...
195+
{[obj.norm, 'c2'] }, obj.cfg.segment.wm_norm; ...
196+
{[obj.norm, 'c3'] }, obj.cfg.segment.csf_norm
197+
};
198+
199+
smooth = {{ obj.smooth, ...
200+
[obj.smooth, obj.unwarp, obj.stc], ...
201+
[obj.smooth, obj.stc, obj.unwarp], ...
202+
[obj.smooth, obj.realign, obj.stc], ...
203+
[obj.smooth, obj.unwarp], ...
204+
[obj.smooth, obj.realign] }, obj.cfg.smooth};
205+
206+
smooth_norm = {{[obj.smooth, obj.norm], ...
207+
[obj.smooth, obj.norm, obj.unwarp, obj.stc], ...
208+
[obj.smooth, obj.norm, obj.stc, obj.unwarp], ...
209+
[obj.smooth, obj.norm, obj.realign, obj.stc], ...
210+
[obj.smooth, obj.norm, obj.unwarp], ...
211+
[obj.smooth, obj.norm, obj.realign] }, obj.cfg.smooth_norm};
212+
213+
preproc_norm = {{obj.norm, ...
214+
[obj.norm, obj.bias_cor], ...
215+
[obj.norm, obj.stc, obj.unwarp], ...
216+
[obj.norm, obj.unwarp, obj.stc], ...
217+
[obj.norm, obj.realign, obj.stc], ...
218+
[obj.norm, obj.unwarp], ...
219+
[obj.norm, obj.realign] }, obj.cfg.preproc_norm};
220+
221+
spec = cat(1, spec, smooth, smooth_norm, preproc_norm);
222+
223+
for i_map = 1:size(spec, 1)
224+
obj = obj.add_mapping('prefix', spec{i_map, 1}, ...
225+
'name_spec', spec{i_map, 2});
209226
end
210227

211228
obj = flatten_mapping(obj);

src/utils/identify_sources.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,13 @@
5555

5656
if prefix_based
5757
if numel(bf.prefix) < 2
58+
5859
% needs at least 2 characters for this file to have some provenance in the
5960
% derivatives
61+
62+
% TODO: files that have been realigned but not resliced have no
63+
% "prefix" so we may miss some transformation
64+
6065
return
6166

6267
else

tests/test_mapping.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function test_find_mapping()
3939
map = map.default();
4040
idx = map.find_mapping('prefix', 'rp_');
4141

42-
assertEqual(find(idx), 12);
42+
assertEqual(find(idx), 13);
4343

4444
end
4545

tests/test_spm_2_bids.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,21 +225,21 @@ function test_spm_2_bids_func()
225225
func_file = 'sub-01_task-auditory_bold.nii';
226226

227227
prefix_and_output = { ...
228-
{'a'}, ...
228+
{'a', 'au'}, ...
229229
'sub-01_task-auditory_space-individual_desc-stc_bold.nii'; ...
230230
{'u', 'ua'}, ...
231231
'sub-01_task-auditory_space-individual_desc-realignUnwarp_bold.nii'; ...
232-
{'rp_', 'rp_a'}, ...
232+
{'rp_', 'rp_a', 'rp_au'}, ...
233233
'sub-01_task-auditory_motion.tsv'; ...
234-
{'mean', 'meanu', 'meanua'}, ...
234+
{'mean', 'meanu', 'meanua', 'meanau'}, ...
235235
'sub-01_task-auditory_space-individual_desc-mean_bold.nii'; ...
236236
{'w', 'wua', 'wu', 'wr', 'wra'}, ...
237237
'sub-01_task-auditory_space-IXI549Space_desc-preproc_bold.nii'; ...
238-
{'wmeanu'}, ...
238+
{'wmeanu', 'wmeanua', 'wmeanau'}, ...
239239
'sub-01_task-auditory_space-IXI549Space_desc-mean_bold.nii'; ...
240-
{'sw', 'swua', 'swu', 'swr', 'swra'}, ...
240+
{'sw', 'swua', 'swau', 'swu', 'swr', 'swra'}, ...
241241
'sub-01_task-auditory_space-IXI549Space_desc-smth_bold.nii'; ...
242-
{'s', 'sua', 'su', 'sr', 'sra'}, ...
242+
{'s', 'sua', 'su', 'sr', 'sra', 'sau'}, ...
243243
'sub-01_task-auditory_space-individual_desc-smth_bold.nii' ...
244244
};
245245

0 commit comments

Comments
 (0)