当前位置: 首页>>代码示例>>Python>>正文


Python DCEModality.update_histogram方法代码示例

本文整理汇总了Python中protoclass.data_management.DCEModality.update_histogram方法的典型用法代码示例。如果您正苦于以下问题:Python DCEModality.update_histogram方法的具体用法?Python DCEModality.update_histogram怎么用?Python DCEModality.update_histogram使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在protoclass.data_management.DCEModality的用法示例。


在下文中一共展示了DCEModality.update_histogram方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_update_histogram_fix_bins

# 需要导入模块: from protoclass.data_management import DCEModality [as 别名]
# 或者: from protoclass.data_management.DCEModality import update_histogram [as 别名]
def test_update_histogram_fix_bins():
    """ Test that the function properly update the value of the histogram
    and fixing the number of bins. """

    # Load the data and then call the function independently
    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()

    dce_mod.read_data_from_path(path_data)

    # Change something in the data to check that the computation
    # is working
    dce_mod.data_[0, 20:40, :, :] = 1000.
    nb_bins = [100, 100]
    dce_mod.update_histogram(nb_bins=nb_bins)

    # 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_, 1000.)

    # Check that bin is what we expect
    data = np.load(os.path.join(currdir, 'data',
                                'bin_dce_data_update_100_bins.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_update_100_bins.npy'))
    # Check that each array are the same
    for exp, gt in zip(dce_mod.pdf_series_, data):
        assert_array_equal(exp, gt)
开发者ID:glemaitre,项目名称:protoclass,代码行数:37,代码来源:test_dce_modality.py

示例2: test_build_heatmap_roi

# 需要导入模块: from protoclass.data_management import DCEModality [as 别名]
# 或者: from protoclass.data_management.DCEModality import update_histogram [as 别名]
def test_build_heatmap_roi():
    """ Test if the heatmap is built properly when providing a 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')
    # Create an object to handle the data
    dce_mod = DCEModality()

    # Read the data
    dce_mod.read_data_from_path(path_data)
    dce_mod.data_ /= 2.
    dce_mod.update_histogram()

    # Create some ground-truth
    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)

    # Build the heatmap
    heatmap, bins_heatmap = dce_mod.build_heatmap(roi_data=(gt_index))

    # Check that heatmap is what we expect
    data = np.load(os.path.join(currdir, 'data', 'heatmap_roi_mod.npy'))
    assert_array_equal(heatmap, data)
    data = np.load(os.path.join(currdir, 'data', 'bins_heatmap_roi_mod.npy'))
    assert_array_equal(bins_heatmap, data)
开发者ID:glemaitre,项目名称:protoclass,代码行数:29,代码来源:test_dce_modality.py

示例3: GTModality

# 需要导入模块: from protoclass.data_management import DCEModality [as 别名]
# 或者: from protoclass.data_management.DCEModality import update_histogram [as 别名]
    # Read the GT
    print 'Read GT images'
    gt_mod = GTModality()
    gt_mod.read_data_from_path(label_gt, p_gt)

    # Load the approproate normalization object
    filename_norm = (pat.lower().replace(' ', '_') +
                     '_norm.p')
    dce_norm = StandardTimeNormalization.load_from_pickles(
        os.path.join(path_norm, filename_norm))

    dce_mod = dce_norm.normalize(dce_mod)

    for idx in range(dce_mod.data_.shape[0]):
        dce_mod.data_[idx, :] += shift[idx]

    dce_mod.update_histogram()

    # Fit the parameters for Brix
    print 'Extract Brix'
    brix_ext.fit(dce_mod, ground_truth=gt_mod, cat=label_gt[0])

    # Extract the matrix
    print 'Extract the feature matrix'
    data = brix_ext.transform(dce_mod, ground_truth=gt_mod, cat=label_gt[0])

    pat_chg = pat.lower().replace(' ', '_') + '_brix.npy'
    filename = os.path.join(path_store, pat_chg)
    np.save(filename, data)
开发者ID:I2Cvb,项目名称:lemaitre-2016-nov,代码行数:31,代码来源:pipeline_brix_extraction_normalized.py


注:本文中的protoclass.data_management.DCEModality.update_histogram方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。