File tree Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 11function outputImage = renameNeuroSynth(inputImage )
22 %
3- % give a neurosynth map a name that is more bids friendly
3+ % rename a neurosynth map a name that is more bids friendly
44 %
55 % USAGE::
66 %
1818 %
1919 % (C) Copyright 2021 CPP ROI developers
2020
21- p.filename = spm_file(inputImage , ' filename' );
21+ basename = spm_file(inputImage , ' basename' );
22+ match = regexp(basename , ' .*_((association)|(uniformity))-test_z_FDR_0\.01.*' , ' match' );
23+ if isempty(match )
24+ err = struct(' identifier' , ' renameNeuroSynth:nonValidNeurosynthZmap' , ...
25+ ' message' , sprintf([' Not a valid neurosynth Z map name.\n ' ...
26+ ' Must be a of the shape: ".*_((association)|(uniformity))-test_z_FDR_0\\ .01.*"' ]));
27+ error(err );
28+ end
29+
2230 p.suffix = ' probseg' ;
31+
2332 p.ext = ' .nii' ;
2433 if strcmp(spm_file(inputImage , ' ext' ), ' gz' )
2534 p.ext = [p .ext ' .gz' ];
2635 end
36+
2737 % TODO: find the actual MNI space neurosynth images are in
2838 p.entities.space = ' MNI' ;
2939
30- basename = spm_file(inputImage , ' basename' );
3140 parts = strsplit(basename , ' _' );
41+
3242 p.entities.atlas = ' neurosynth' ;
43+
3344 p.entities.label = bids .internal .camel_case(parts{1 });
3445
3546 bidsFile = bids .File(p );
Original file line number Diff line number Diff line change 88 initTestSuite ;
99end
1010
11+ function test_renameNeuroSynth_error()
12+
13+ inputImage = fullfile(pwd , ' hMT.nii.gz' );
14+ system([' touch ' inputImage ]);
15+
16+ assertExceptionThrown(@()renameNeuroSynth(inputImage ), ...
17+ ' renameNeuroSynth:nonValidNeurosynthZmap' );
18+
19+ delete(inputImage );
20+
21+ end
22+
1123function test_renameNeuroSynth()
1224
1325 inputImage = fullfile(pwd , ' motion_association-test_z_FDR_0.01.nii.gz' );
You can’t perform that action at this time.
0 commit comments