def test_fetch_atlas_surf_destrieux(tmp_path, request_mocker, verbose=0): data_dir = str(tmp_path / 'destrieux_surface') os.mkdir(data_dir) # Create mock annots for hemi in ('left', 'right'): nibabel.freesurfer.write_annot( os.path.join(data_dir, '%s.aparc.a2009s.annot' % hemi), np.arange(4), np.zeros((4, 5)), 5 * ['a'],) bunch = atlas.fetch_atlas_surf_destrieux(data_dir=tmp_path, verbose=0) # Our mock annots have 4 labels assert len(bunch.labels) == 4 assert bunch.map_left.shape == (4, ) assert bunch.map_right.shape == (4, ) assert bunch.description != ''
def test_fetch_atlas_surf_destrieux(data_dir=tst.tmpdir, verbose=0): # Old nibabel versions does not support 'write_annot' if LooseVersion(nibabel.__version__) <= LooseVersion('1.2.0'): raise SkipTest data_dir = os.path.join(tst.tmpdir, 'destrieux_surface') os.mkdir(data_dir) # Create mock annots for hemi in ('left', 'right'): nibabel.freesurfer.write_annot( os.path.join(data_dir, '%s.aparc.a2009s.annot' % hemi), np.arange(4), np.zeros((4, 5)), 5 * ['a'], ) bunch = atlas.fetch_atlas_surf_destrieux(data_dir=tst.tmpdir, verbose=0) # Our mock annots have 4 labels assert_equal(len(bunch.labels), 4) assert_equal(bunch.map_left.shape, (4, )) assert_equal(bunch.map_right.shape, (4, )) assert_not_equal(bunch.description, '')