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


Python skimage.__version__方法代码示例

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


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

示例1: resize

# 需要导入模块: import skimage [as 别名]
# 或者: from skimage import __version__ [as 别名]
def resize(image, output_shape, order=1, mode='constant', cval=0, clip=True,
           preserve_range=False, anti_aliasing=False, anti_aliasing_sigma=None):
    '''A wrapper for Scikit-Image resize().
    Scikit-Image generates warnings on every call to resize() if it doesn't
    receive the right parameters. The right parameters depend on the version
    of skimage. This solves the problem by using different parameters per
    version. And it provides a central place to control resizing defaults.
    '''
    if LooseVersion(skimage.__version__) >= LooseVersion('0.14'):
        # New in 0.14: anti_aliasing. Default it to False for backward
        # compatibility with skimage 0.13.
        return skresize(
            image, output_shape,
            order=order, mode=mode, cval=cval, clip=clip,
            preserve_range=preserve_range, anti_aliasing=anti_aliasing,
            anti_aliasing_sigma=anti_aliasing_sigma)
    else:
        return skresize(
            image, output_shape,
            order=order, mode=mode, cval=cval, clip=clip,
            preserve_range=preserve_range) 
开发者ID:nearthlab,项目名称:image-segmentation,代码行数:23,代码来源:utils.py

示例2: get_config_values

# 需要导入模块: import skimage [as 别名]
# 或者: from skimage import __version__ [as 别名]
def get_config_values():
    """
    Read the package versions into a dictionary.
    """
    output = OrderedDict()

    output["MONAI"] = monai.__version__
    output["Python"] = sys.version.replace("\n", " ")
    output["Numpy"] = np.version.full_version
    output["Pytorch"] = torch.__version__

    return output 
开发者ID:Project-MONAI,项目名称:MONAI,代码行数:14,代码来源:deviceconfig.py

示例3: get_torch_version_tuple

# 需要导入模块: import skimage [as 别名]
# 或者: from skimage import __version__ [as 别名]
def get_torch_version_tuple():
    """
    Returns:
        tuple of ints represents the pytorch major/minor version.
    """
    return tuple([int(x) for x in torch.__version__.split(".")[:2]]) 
开发者ID:Project-MONAI,项目名称:MONAI,代码行数:8,代码来源:deviceconfig.py

示例4: main

# 需要导入模块: import skimage [as 别名]
# 或者: from skimage import __version__ [as 别名]
def main(path_out='', nb_runs=5):
    """ the main entry point

    :param str path_out: path to export the report and save temporal images
    :param int nb_runs: number of trails to have an robust average value
    """
    logging.info('Running the computer benchmark.')
    skimage_version = skimage.__version__.split('.')
    skimage_version = tuple(map(int, skimage_version))
    if skimage_version < SKIMAGE_VERSION:
        logging.warning('You are using older version of scikit-image then we expect.'
                        ' Please upadte by `pip install -U --user scikit-image>=%s`',
                        '.'.join(map(str, SKIMAGE_VERSION)))

    hasher = hashlib.sha256()
    hasher.update(open(__file__, 'rb').read())
    report = {
        'computer': computer_info(),
        'created': str(datetime.datetime.now()),
        'file': hasher.hexdigest(),
        'number runs': nb_runs,
        'python-version': platform.python_version(),
        'skimage-version': skimage.__version__,
    }
    report.update(measure_registration_single(path_out, nb_iter=nb_runs))
    nb_runs_ = max(1, int(nb_runs / 2.))
    report.update(measure_registration_parallel(path_out, nb_iter=nb_runs_))

    path_json = os.path.join(path_out, NAME_REPORT)
    logging.info('exporting report: %s', path_json)
    with open(path_json, 'w') as fp:
        json.dump(report, fp)
    logging.info('\n\t '.join('%s: \t %r' % (k, report[k]) for k in report)) 
开发者ID:Borda,项目名称:BIRL,代码行数:35,代码来源:bm_comp_perform.py

示例5: write_index

# 需要导入模块: import skimage [as 别名]
# 或者: from skimage import __version__ [as 别名]
def write_index():
    """This is to write the docs for the index automatically."""

    here = os.path.dirname(__file__)
    filename = os.path.join(here, '_generated', 'version_text.txt')

    try:
        os.makedirs(os.path.dirname(filename))
    except FileExistsError:
        pass

    text = text_version if '+' not in oggm.__version__ else text_dev

    with open(filename, 'w') as f:
        f.write(text) 
开发者ID:OGGM,项目名称:oggm,代码行数:17,代码来源:conf.py

示例6: get_tile_image

# 需要导入模块: import skimage [as 别名]
# 或者: from skimage import __version__ [as 别名]
def get_tile_image(imgs, tile_shape=None, result_img=None, margin_color=None):
    """Concatenate images whose sizes are different.

    @param imgs: image list which should be concatenated
    @param tile_shape: shape for which images should be concatenated
    @param result_img: numpy array to put result image
    """
    def resize(*args, **kwargs):
        # anti_aliasing arg cannot be passed to skimage<0.14
        # use LooseVersion to allow 0.14dev.
        if LooseVersion(skimage.__version__) < LooseVersion('0.14'):
            kwargs.pop('anti_aliasing', None)
        return skimage.transform.resize(*args, **kwargs)

    def get_tile_shape(img_num):
        x_num = 0
        y_num = int(math.sqrt(img_num))
        while x_num * y_num < img_num:
            x_num += 1
        return y_num, x_num

    if tile_shape is None:
        tile_shape = get_tile_shape(len(imgs))

    # get max tile size to which each image should be resized
    max_height, max_width = np.inf, np.inf
    for img in imgs:
        max_height = min([max_height, img.shape[0]])
        max_width = min([max_width, img.shape[1]])

    # resize and concatenate images
    for i, img in enumerate(imgs):
        h, w = img.shape[:2]
        dtype = img.dtype
        h_scale, w_scale = max_height / h, max_width / w
        scale = min([h_scale, w_scale])
        h, w = int(scale * h), int(scale * w)
        img = resize(
            image=img,
            output_shape=(h, w),
            mode='reflect',
            preserve_range=True,
            anti_aliasing=True,
        ).astype(dtype)
        if len(img.shape) == 3:
            img = centerize(img, (max_height, max_width, 3), margin_color)
        else:
            img = centerize(img, (max_height, max_width), margin_color)
        imgs[i] = img
    return _tile_images(imgs, tile_shape, result_img) 
开发者ID:wkentaro,项目名称:fcn,代码行数:52,代码来源:utils.py

示例7: LSTClustering

# 需要导入模块: import skimage [as 别名]
# 或者: from skimage import __version__ [as 别名]
def LSTClustering(self):
        # 参考“Segmenting the picture of greek coins in regions”方法,Author: Gael Varoquaux <gael.varoquaux@normalesup.org>, Brian Cheung
        # License: BSD 3 clause
        orig_coins=self.LST
        # these were introduced in skimage-0.14
        if LooseVersion(skimage.__version__) >= '0.14':
            rescale_params = {'anti_aliasing': False, 'multichannel': False}
        else:
            rescale_params = {}
        smoothened_coins = gaussian_filter(orig_coins, sigma=2)
        rescaled_coins = rescale(smoothened_coins, 0.2, mode="reflect",**rescale_params)        
        # Convert the image into a graph with the value of the gradient on the
        # edges.
        graph = image.img_to_graph(rescaled_coins)        
        # Take a decreasing function of the gradient: an exponential
        # The smaller beta is, the more independent the segmentation is of the
        # actual image. For beta=1, the segmentation is close to a voronoi
        beta = 10
        eps = 1e-6
        graph.data = np.exp(-beta * graph.data / graph.data.std()) + eps        
        # Apply spectral clustering (this step goes much faster if you have pyamg
        # installed)
        N_REGIONS = 200        
        for assign_labels in ('discretize',):
#        for assign_labels in ('kmeans', 'discretize'):
            t0 = time.time()
            labels = spectral_clustering(graph, n_clusters=N_REGIONS,assign_labels=assign_labels, random_state=42)
            t1 = time.time()
            labels = labels.reshape(rescaled_coins.shape)
        
            plt.figure(figsize=(5*3, 5*3))
            plt.imshow(rescaled_coins, cmap=plt.cm.gray)
            for l in range(N_REGIONS):
                plt.contour(labels == l,
                            colors=[plt.cm.nipy_spectral(l / float(N_REGIONS))])
            plt.xticks(())
            plt.yticks(())
            title = 'Spectral clustering: %s, %.2fs' % (assign_labels, (t1 - t0))
            print(title)
            plt.title(title)
        plt.show()

##基于卷积温度梯度变化界定冷区和热区的空间分布结构 
开发者ID:richieBao,项目名称:python-urbanPlanning,代码行数:45,代码来源:LST.py


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