本文整理汇总了Python中protoclass.data_management.DCEModality.get_pdf_list方法的典型用法代码示例。如果您正苦于以下问题:Python DCEModality.get_pdf_list方法的具体用法?Python DCEModality.get_pdf_list怎么用?Python DCEModality.get_pdf_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类protoclass.data_management.DCEModality
的用法示例。
在下文中一共展示了DCEModality.get_pdf_list方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_dce_get_pdf_roi
# 需要导入模块: from protoclass.data_management import DCEModality [as 别名]
# 或者: from protoclass.data_management.DCEModality import get_pdf_list [as 别名]
def test_dce_get_pdf_roi():
"""Test the function to get a pdf from ROI."""
# Load the data with only a single serie
currdir = os.path.dirname(os.path.abspath(__file__))
path_data = os.path.join(currdir, 'data', 'dce_folders')
# Create the list of path
path_data_list = [os.path.join(path_data, 's_2'),
os.path.join(path_data, 's_1')]
# Create an object to handle the data
dce_mod = DCEModality()
dce_mod.read_data_from_path(path_data_list)
# Create ground truth array
pos = np.ones((368, 448), dtype=bool)
neg = np.zeros((368, 448), dtype=bool)
gt_index = np.rollaxis(np.array([neg, pos, pos, pos, neg]), 0, 3)
# Compute the histgram for the required data
pdf, bins = dce_mod.get_pdf_list(roi_data=(gt_index))
pdf_roi = np.load(os.path.join(currdir, 'data', 'pdf_roi.npy'))
bins_roi = np.load(os.path.join(currdir, 'data', 'bins_roi.npy'))
for pdf_s, bins_s, pdf_gt, bins_gt in zip(pdf, bins,
pdf_roi, bins_roi):
assert_array_equal(pdf_s, pdf_gt)
assert_array_equal(bins_s, bins_gt)
示例2: test_dce_get_pdf_wt_roi
# 需要导入模块: from protoclass.data_management import DCEModality [as 别名]
# 或者: from protoclass.data_management.DCEModality import get_pdf_list [as 别名]
def test_dce_get_pdf_wt_roi():
"""Test the function to get a pdf wihtout ROI."""
# Load the data with only a single serie
currdir = os.path.dirname(os.path.abspath(__file__))
path_data = os.path.join(currdir, 'data', 'dce_folders')
# Create the list of path
path_data_list = [os.path.join(path_data, 's_2'),
os.path.join(path_data, 's_1')]
# Create an object to handle the data
dce_mod = DCEModality()
dce_mod.read_data_from_path(path_data_list)
# Compute the histgram for the required data
pdf, bins = dce_mod.get_pdf_list()
for pdf_s, bins_s, pdf_gt, bins_gt in zip(pdf, bins,
dce_mod.pdf_series_,
dce_mod.bin_series_):
assert_array_equal(pdf_s, pdf_gt)
assert_array_equal(bins_s, bins_gt)