from nipype.interfaces.base import traits mlab.MatlabCommand.set_default_matlab_cmd(os.getenv("MATLABCMD", "matlab")) def test_scan_for_fnames(create_files_in_directory): filelist, outdir = create_files_in_directory names = spm.scans_for_fnames(filelist, keep4d=True) assert names[0] == filelist[0] assert names[1] == filelist[1] save_time = False if not save_time: @pytest.mark.skipif(no_spm(), reason="spm is not installed") def test_spm_path(): spm_path = spm.Info.path() if spm_path is not None: assert isinstance(spm_path, (str, bytes)) assert "spm" in spm_path.lower() def test_use_mfile(): class TestClass(spm.SPMCommand): input_spec = spm.SPMCommandInputSpec dc = TestClass() # dc = derived_class assert dc.inputs.mfile
def test_normalize12(): assert spm.Normalize12._jobtype == 'spatial' assert spm.Normalize12._jobname == 'normalise' assert spm.Normalize12().inputs.jobtype == 'estwrite' def test_normalize12_list_outputs(create_files_in_directory): filelist, outdir = create_files_in_directory norm12 = spm.Normalize12(image_to_align=filelist[0]) assert norm12._list_outputs()['normalized_image'][0].startswith('w') norm12 = spm.Normalize12( image_to_align=filelist[0], apply_to_files=filelist[1]) assert norm12._list_outputs()['normalized_files'][0].startswith('w') @pytest.mark.skipif(no_spm(), reason="spm is not installed") def test_segment(): if spm.Info.name() == "SPM12": assert spm.Segment()._jobtype == 'tools' assert spm.Segment()._jobname == 'oldseg' else: assert spm.Segment()._jobtype == 'spatial' assert spm.Segment()._jobname == 'preproc' @pytest.mark.skipif(no_spm(), reason="spm is not installed") def test_newsegment(): if spm.Info.name() == "SPM12": assert spm.NewSegment()._jobtype == 'spatial' assert spm.NewSegment()._jobname == 'preproc' else: