Пример #1
0
def test_braindata():
    vol = np.random.randn(*volshape)
    tf = tempfile.TemporaryFile(suffix='.png')
    mask = db.get_mask(subj, xfmname, "thick")

    data = dataset.Volume(vol, subj, xfmname, cmap='RdBu_r', vmin=0, vmax=1)
    # quickflat.make_png(tf, data)
    mdata = data.masked['thick']
    assert len(mdata.data) == mask.sum()
    assert np.allclose(mdata.volume[:, mask], mdata.data)
Пример #2
0
def test_braindata():
	vol = np.random.randn(31, 100, 100)
	tf = tempfile.TemporaryFile(suffix='.png')
	mask = db.get_mask(subj, xfmname, "thick")

	data = dataset.DataView((vol, subj, xfmname), cmap='RdBu_r', vmin=0, vmax=1)
	# quickflat.make_png(tf, data)
	mdata = data.copy(data.data.masked['thick'])
	assert len(mdata.data.data) == mask.sum()
	assert np.allclose(mdata.data.volume[mask], mdata.data.data)
Пример #3
0
def test_dataset():
    vol = np.random.randn(*volshape)
    stack = (np.ones(volshape[::-1])*np.linspace(0, 1, volshape[0])).T
    mask = db.get_mask(subj, xfmname, "thick")

    ds = dataset.Dataset(randvol=(vol, subj, xfmname), stack=(stack, subj, xfmname))
    ds.append(thickstack=ds.stack.masked['thick'])
    tf = tempfile.NamedTemporaryFile(suffix=".hdf")
    ds.save(tf.name)

    ds = dataset.Dataset.from_file(tf.name)
    assert len(ds['thickstack'].data) == mask.sum()
    assert np.allclose(ds['stack'].data[mask], ds['thickstack'].data)
    return ds
Пример #4
0
def test_dataset():
    vol = np.random.randn(*volshape)
    stack = (np.ones(volshape[::-1])*np.linspace(0, 1, volshape[0])).T
    mask = db.get_mask(subj, xfmname, "thick")

    ds = dataset.Dataset(randvol=(vol, subj, xfmname), stack=(stack, subj, xfmname))
    ds.append(thickstack=ds.stack.masked['thick'])
    tf = tempfile.NamedTemporaryFile(suffix=".hdf")
    ds.save(tf.name)

    ds = dataset.Dataset.from_file(tf.name)
    assert len(ds['thickstack'].data) == mask.sum()
    assert np.allclose(ds['stack'].data[mask], ds['thickstack'].data)
    return ds
Пример #5
0
def test_dataset():
	vol = np.random.randn(31, 100, 100)
	stack = (np.ones((100, 100, 31))*np.linspace(0, 1, 31)).T
	raw = (np.random.rand(10, 31, 100, 100, 3)*256).astype(np.uint8)
	mask = db.get_mask(subj, xfmname, "thick")

	ds = dataset.Dataset(randvol=(vol, subj, xfmname), stack=(stack, subj, xfmname))
	ds.append(thickstack=ds.stack.copy(ds.stack.data.masked['thick']))
	ds.append(raw=dataset.VolumeData(raw, subj, xfmname).masked['thin'])
	tf = tempfile.NamedTemporaryFile(suffix=".hdf")
	ds.save(tf.name)

	ds = dataset.Dataset.from_file(tf.name)
	assert len(ds['thickstack'].data.data) == mask.sum()
	assert np.allclose(ds['stack'].data.data[mask], ds['thickstack'].data.data)
	assert ds['raw'].data.volume.shape == (10, 31, 100, 100, 4)
	return ds
Пример #6
0
def test_findmask():
    vol = np.random.rand(10, *volshape)
    mask = db.get_mask(subj, xfmname, "thin")
    ds = dataset.Volume(vol[:, mask], subj, xfmname)
    assert np.allclose(ds.volume[:, mask], vol[:, mask])
    return ds
Пример #7
0
def test_findmask():
	vol = (np.random.rand(10, 31, 100, 100, 3)*256).astype(np.uint8)
	mask = db.get_mask(subj, xfmname, "thin")
	ds = dataset.VolumeData(vol[:, mask], subj, xfmname)
	assert np.allclose(ds.volume[:, mask, :3], vol[:, mask])
	return ds
Пример #8
0
def test_findmask():
    vol = np.random.rand(10, *volshape)
    mask = db.get_mask(subj, xfmname, "thin")
    ds = dataset.Volume(vol[:, mask], subj, xfmname)
    assert np.allclose(ds.volume[:, mask], vol[:, mask])
    return ds