Did I find the right examples for you? yes no

All Samples(6)  |  Call(4)  |  Derive(0)  |  Import(2)

src/p/y/pypreprocess-HEAD/pypreprocess/external/nipy_labs/utils/tests/test_simul_multisubject_fmri_dataset.py   pypreprocess(Download)
from nibabel import Nifti1Image
 
from ..simul_multisubject_fmri_dataset import \
    surrogate_2d_dataset, surrogate_3d_dataset, surrogate_4d_dataset 
 
    write_path = path.join(mkdtemp(), 'img.nii') 
    shape = (5, 6, 7)
    data = surrogate_3d_dataset(shape=shape, out_image_file=write_path)
    assert_true(path.isfile(write_path))
 
    mask = np.random.rand(*shape) > 0.5
    mask_img = Nifti1Image(mask.astype(np.uint8), np.eye(4))
    img = surrogate_3d_dataset(mask=mask_img)
    mean_image  = img[mask].mean()
    assert_true((img[mask == 0] == 0).all())

src/n/i/nipy-0.3.0/nipy/labs/utils/tests/test_simul_multisubject_fmri_dataset.py   nipy(Download)
from nibabel import Nifti1Image
 
from ..simul_multisubject_fmri_dataset import \
    surrogate_2d_dataset, surrogate_3d_dataset, surrogate_4d_dataset 
 
    write_path = path.join(mkdtemp(), 'img.nii') 
    shape = (5, 6, 7)
    data = surrogate_3d_dataset(shape=shape, out_image_file=write_path)
    assert_true(path.isfile(write_path))
 
    mask = np.random.rand(*shape) > 0.5
    mask_img = Nifti1Image(mask.astype(np.uint8), np.eye(4))
    img = surrogate_3d_dataset(mask=mask_img)
    mean_image  = img[mask].mean()
    assert_true((img[mask == 0] == 0).all())