|
| 1 | +% (C) Copyright 2020 CPP ROI developers |
| 2 | + |
| 3 | +function test_suite = test_keepHemisphere %#ok<*STOUT> |
| 4 | + try % assignment of 'localfunctions' is necessary in Matlab >= 2016 |
| 5 | + test_functions = localfunctions(); %#ok<*NASGU> |
| 6 | + catch % no problem; early Matlab versions can use initTestSuite fine |
| 7 | + end |
| 8 | + initTestSuite; |
| 9 | +end |
| 10 | + |
| 11 | +function test_renameFile() |
| 12 | + |
| 13 | + inputDir = fullfile(fileparts(mfilename('fullpath')), '..', 'demos', 'roi'); |
| 14 | + |
| 15 | + gunzip(fullfile(inputDir, 'inputs', '*.gz')); |
| 16 | + zMap = fullfile(inputDir, 'inputs', 'visual motion_association-test_z_FDR_0.01.nii'); |
| 17 | + |
| 18 | + zMap = renameNeuroSynth(zMap); |
| 19 | + |
| 20 | + % keep only one hemisphere and appends a 'hemi-[hemisphere label]' |
| 21 | + leftRoiImage = keepHemisphere(zMap, 'L'); |
| 22 | + rightRoiImage = keepHemisphere(zMap, 'R'); |
| 23 | + |
| 24 | + assertEqual(exist(fullfile(inputDir, 'inputs', ... |
| 25 | + 'space-MNI_label-neurosynthVisualMotion_hemi-L_probseg.nii'), 'file'), 2); |
| 26 | + assertEqual(exist(fullfile(inputDir, 'inputs', ... |
| 27 | + 'space-MNI_label-neurosynthVisualMotion_hemi-R_probseg.nii'), 'file'), 2); |
| 28 | + |
| 29 | + % TODO check the data content |
| 30 | + |
| 31 | + delete(fullfile(inputDir, 'inputs', '*.nii')); |
| 32 | + |
| 33 | +end |
0 commit comments