Skip to content

Commit af9770c

Browse files
committed
add description SPM space and refactor
1 parent 63a2a68 commit af9770c

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
.vscode
44

5-
*.m~
6-
*octave-workspace
5+
*.json
76

87
env/
98

src/spm_2_bids.m

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,27 @@
139139

140140
new_filename = bf.filename;
141141

142+
%% metadata
143+
json = set_metadata(file, map, verbose, bf);
144+
145+
end
146+
147+
function json = set_metadata(file, map, verbose, bf)
148+
142149
json = bids.derivatives_json(bf.filename);
143150

144-
json.content.RawSources = identify_rawsources(file, verbose);
145-
json.content.Sources = identify_sources(file, map, verbose);
151+
content = json.content;
152+
content.RawSources = identify_rawsources(file, verbose);
153+
content.Sources = identify_sources(file, map, verbose);
154+
155+
if isfield(bf.entities, 'space') && strcmp(bf.entities.space, 'IXI549Space')
156+
content.SpatialReference = struct('IXI549Space', ...
157+
['Reference space defined by the average ', ...
158+
'of the ''549 subjects from the IXI dataset'' ', ...
159+
'linearly transformed to ICBM MNI 452.']);
160+
end
161+
162+
json.content = content;
146163

147164
end
148165

tests/test_spm_2_bids_metadata.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function test_spm_2_bids_metadata_anat()
2121
assertEqual(json.content.Sources{2}, ...
2222
'sub-01/sub-01_from-T1w_to-IXI549Space_mode-image_xfm.nii');
2323

24-
% bids.util.jsonencode(json.filename, json.content);
24+
bids.util.jsonencode(json.filename, json.content);
2525

2626
end
2727

@@ -37,6 +37,6 @@ function test_spm_2_bids_metadata_func()
3737
'sub-01/sub-01_task-foo_space-individual_desc-realignUnwarp_bold.nii');
3838
assertEqual(json.content.Sources{2}, 'TODO: add deformation field');
3939

40-
% bids.util.jsonencode(json.filename, json.content);
40+
bids.util.jsonencode(json.filename, json.content);
4141

4242
end

0 commit comments

Comments
 (0)