本文整理汇总了Python中protoclass.data_management.DCEModality.is_read方法的典型用法代码示例。如果您正苦于以下问题:Python DCEModality.is_read方法的具体用法?Python DCEModality.is_read怎么用?Python DCEModality.is_read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类protoclass.data_management.DCEModality
的用法示例。
在下文中一共展示了DCEModality.is_read方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_dce_path_data_constructor
# 需要导入模块: from protoclass.data_management import DCEModality [as 别名]
# 或者: from protoclass.data_management.DCEModality import is_read [as 别名]
def test_dce_path_data_constructor():
""" Test if the dce function is working when passing the path data to the
constructor. """
# Load the data with only a single serie
currdir = os.path.dirname(os.path.abspath(__file__))
path_data = os.path.join(currdir, 'data', 'dce')
# Create an object to handle the data
dce_mod = DCEModality(path_data)
# Check that the data have not been read
assert_true(not dce_mod.is_read())
dce_mod.read_data_from_path()
# Check that the data have been read
assert_true(dce_mod.is_read())
# Check the type of the data
assert_equal(dce_mod.data_.dtype, np.float64)
# Check that the dimension are the one that we expect
assert_equal(dce_mod.data_.shape, (2, 368, 448, 5))
# We need to check that the minimum and maximum were proprely computed
assert_equal(dce_mod.min_series_, 0.)
assert_equal(dce_mod.max_series_, 616.)
# Check that the data are identical
data = np.load(os.path.join(currdir, 'data', 'data_dce_data.npy'))
assert_array_equal(dce_mod.data_, data)
# Check that bin is what we expect
data = np.load(os.path.join(currdir, 'data', 'bin_dce_data.npy'))
# Check that each array are the same
for exp, gt in zip(dce_mod.bin_series_, data):
assert_array_equal(exp, gt)
# Check that pdf is what we expect
data = np.load(os.path.join(currdir, 'data', 'pdf_dce_data.npy'))
# Check that each array are the same
for exp, gt in zip(dce_mod.pdf_series_, data):
assert_array_equal(exp, gt)
示例2: test_read_dce_data
# 需要导入模块: from protoclass.data_management import DCEModality [as 别名]
# 或者: from protoclass.data_management.DCEModality import is_read [as 别名]
def test_read_dce_data():
""" Test if we can read 2 dce series. """
# Load the data with only a single serie
currdir = os.path.dirname(os.path.abspath(__file__))
path_data = os.path.join(currdir, 'data', 'dce')
# Create an object to handle the data
dce_mod = DCEModality()
# Check that the data have not been read
assert_true(not dce_mod.is_read())
dce_mod.read_data_from_path(path_data)
# Check that the data have been read
assert_true(dce_mod.is_read())
# Check the type of the data
assert_equal(dce_mod.data_.dtype, np.float64)
# Check that the dimension are the one that we expect
assert_equal(dce_mod.data_.shape, (2, 368, 448, 5))
# Check that the data are identical
data = np.load(os.path.join(currdir, 'data', 'data_dce_data.npy'))
assert_array_equal(dce_mod.data_, data)
# We need to check that the minimum and maximum were proprely computed
assert_equal(dce_mod.min_series_, 0.)
assert_equal(dce_mod.max_series_, 616.)
# Check that bin is what we expect
data = np.load(os.path.join(currdir, 'data', 'bin_dce_data.npy'))
# Check that each array are the same
for exp, gt in zip(dce_mod.bin_series_, data):
assert_array_equal(exp, gt)
# Check that pdf is what we expect
data = np.load(os.path.join(currdir, 'data', 'pdf_dce_data.npy'))
# Check that each array are the same
for exp, gt in zip(dce_mod.pdf_series_, data):
assert_array_equal(exp, gt)
# Check the value present in the dictionary
assert_equal(dce_mod.metadata_['size'], (448, 368, 5))
assert_equal(dce_mod.metadata_['origin'], (-139.197998046875,
-125.99199676513672,
-6.814799785614014))
assert_equal(dce_mod.metadata_['direction'], (0.9999267096574318,
-1.3680395668288353e-08,
-0.012106829215863141,
0.0016226550415489812,
0.9909776862500729,
0.13401713452043554,
0.011997595770753412,
-0.1340269575662008,
0.9909050571781686))
assert_equal(dce_mod.metadata_['spacing'], (0.67633926868439,
0.67633926868439,
1.249927043914795))
assert_equal(dce_mod.metadata_['TR'], 2350.0)
assert_equal(dce_mod.metadata_['TE'], 101.0)
assert_equal(dce_mod.metadata_['flip-angle'], 140.0)
assert_array_equal(dce_mod.time_info_, np.array([0., 0.]))