Skip to content

Commit 2fcaa6e

Browse files
committed
update code
1 parent 022cb25 commit 2fcaa6e

File tree

8 files changed

+44
-30
lines changed

8 files changed

+44
-30
lines changed

init_env.m renamed to init_spm_2_bids.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function init_env
1+
function init_spm_2_bids
22
%
33
% 1 - Check if version requirements
44
% are satisfied and the packages are
@@ -18,7 +18,7 @@
1818
OCTAVE_VER = '4.0.3';
1919
MATLAB_VER = '8.6.0';
2020

21-
INSTALL_LIST = {'io', 'statistics', 'image'};
21+
INSTALL_LIST = {};
2222

2323
if is_octave
2424

miss_hit.cfg

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ line_length: 100
66
regex_function_name: "[a-z]+(_[a-z0-9]+)*"
77
regex_class_name: "[A-Z]{1}[a-z]+"
88
regex_script_name: "[a-z]+(_[a-z]+)*"
9-
regex_parameter_name: "[a-z]+(_[a-z0-9]+)*"
9+
10+
# suppress_rule: "naming_parameters"
11+
# regex_parameter_name: "[a-z]+(_[a-z0-9]+)*"
1012

1113
exclude_dir: "lib"
1214

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
miss_hit==0.9.26
1+
miss_hit==0.9.27
22
pre-commit
33
jupyterlab
44
octave_kernel

src/defaults/Mapping.m

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@
33
% Creates a mapping object that will contain the list how an spm file will be renamed
44
% into a bids derivatives.
55
%
6-
% Has the following attributes::
6+
% Has the following attributes:
77
%
8-
% - mapping : (n X 1) structure with the following fiels
8+
% - mapping, (n X 1) structure with the following fields:
99
%
10-
% - prefix
11-
% - suffix
12-
% - entities
13-
% - ext
14-
% - name_spec: structure that must resemble the output of bids.internal.parse_filename
10+
% - ``prefix``
11+
% - ``suffix``
12+
% - ``entities``
13+
% - ``ext``
14+
% - ``name_spec``: structure that must resemble the output of bids.File
1515
%
16-
% - cfg : describes the common properties to be used for several names in the output.
17-
% See ``check_cfg``
16+
% - cfg describes the common properties to be used for several names in the output.
17+
% (See ``check_cfg()``)
1818
%
19-
% - list of SPM prefixes from ``get_spm_prefix_list()``
19+
% - list of SPM prefixes from ``get_spm_prefix_list()``:
2020
%
21-
% - stc = ''
22-
% - realign = ''
23-
% - unwarp = ''
24-
% - coreg = ''
25-
% - bias_cor = ''
26-
% - norm = ''
27-
% - smooth = ''
21+
% - ``stc = ''``
22+
% - ``realign = ''``
23+
% - ``unwarp = ''``
24+
% - ``coreg = ''``
25+
% - ``bias_cor = ''``
26+
% - ``norm = ''``
27+
% - ``smooth = ''``
2828
%
2929
% (C) Copyright 2021 spm_2_bids developers
3030

@@ -91,7 +91,7 @@
9191
% map = add_mapping('prefix', prefix, 'suffix', 'entities', 'ext', 'name_spec')
9292
%
9393

94-
% TODO add possibility to pass "filter" arugment that is a structure
94+
% TODO add possibility to pass "filter" argument that is a structure
9595
% with shape (allows to chain the output from bids parsing)
9696
%
9797
% filter.prefix

src/defaults/check_cfg.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
%
66
% USAGE::
77
%
8-
% cfg = check_cfg(cfg)
8+
% cfg = check_cfg(cfg)
99
%
1010
% :param cfg: structure or json filename containing the spm_2_bids.anat.
1111
% :type cfg: structure

src/defaults/get_spm_prefix_list.m

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,18 @@
55
%
66
% (C) Copyright 2021 spm_2_bids developers
77

8-
spm_defaults = spm_get_defaults();
8+
try
9+
spm_defaults = spm_get_defaults();
10+
catch
11+
spm_defaults.slicetiming.prefix = 's';
12+
spm_defaults.realign.write.prefix = 'r';
13+
spm_defaults.unwarp.write.prefix = 'u';
14+
spm_defaults.coreg.write.prefix = 'r';
15+
spm_defaults.deformations.modulate.prefix = 'm';
16+
spm_defaults.normalise.write.prefix = 'w';
17+
spm_defaults.smooth.prefix = 's';
18+
end
19+
920
prefix_list.stc = spm_defaults.slicetiming.prefix;
1021
prefix_list.realign = spm_defaults.realign.write.prefix;
1122
prefix_list.unwarp = spm_defaults.unwarp.write.prefix;

src/spm_2_bids.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@
3939
% deal with suffixes modified by SPM
4040
% turns them into prefixes that can be handled by the default mapping
4141
if strfind(file, '_uw.mat') %#ok<*STRIFCND>
42-
file = spm_file(file, 'prefix', 'unwarpparam_');
42+
file = bids.internal.file_utils(file, 'prefix', 'unwarpparam_');
4343
file = strrep(file, '_uw.mat', '.mat');
4444
use_suffix_as_label = true;
4545
end
4646
if strfind(file, '_seg8.mat') %#ok<*STRIFCND>
47-
file = spm_file(file, 'prefix', 'segparam_');
47+
file = bids.internal.file_utils(file, 'prefix', 'segparam_');
4848
file = strrep(file, '_seg8.mat', '.mat');
4949
use_suffix_as_label = true;
5050
end
5151

52-
pth = spm_fileparts(file);
53-
new_filename = spm_file(file, 'filename');
52+
pth = fileparts(file);
53+
new_filename = bids.internal.file_utils(file, 'filename');
5454
json = [];
5555

5656
p = bids.internal.parse_filename(file);

tests/test_spm_2_bids.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
function test_spm_2_bids_suffix()
1212

1313
input_output = {
14-
'sub-01_T1w_seg8.mat', 'sub-01_label-T1w_segparam.mat'
15-
'sub-01_task-auditory_bold_uw.mat', 'sub-01_task-auditory_label-bold_unwarpparam.mat'};
14+
'sub-01_T1w_seg8.mat', 'sub-01_label-T1w_segparam.mat'; ...
15+
'sub-01_task-auditory_bold_uw.mat', ...
16+
'sub-01_task-auditory_label-bold_unwarpparam.mat'};
1617

1718
for i = 1:numel(size(input_output, 1))
1819

0 commit comments

Comments
 (0)