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


Python exposure.equalize_adapthist方法代码示例

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


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

示例1: readScan

# 需要导入模块: from skimage import exposure [as 别名]
# 或者: from skimage.exposure import equalize_adapthist [as 别名]
def readScan(scanNum, dirName):
    """ Reads a DICOM file from a directory

    Given a directory name and the number of the file containing the image to be read, reads in and returns a numpy representation of the image. Also normalizes the pixel values of the image.

    Args:
        scanNum: An integer containing the one-based index of the file to be read
        dirName: A string representation of the name of the directory to be opened. This directory should be a child of the working directory. Ex: "trainingImages"

    Returns: 
        A numpy array containing the pixel data for the image
    """

    for root, dir, files in os.walk("./" + dirName):
        scans = [file  for file in files if file != "desktop.ini"]
        print("Reading image " + scans[scanNum] + " from " + dirName)
        data = numpy.load("./" + dirName + "/" + scans[scanNum])
        #plt.imshow(data)
        #plt.show()
        data = exposure.equalize_adapthist(data)        
        #plt.imshow(data)
        #plt.show()
        return data
    print(dirName + " is not a valid directory")
    exit(-1) 
开发者ID:ben-heil,项目名称:DICOM-CNN,代码行数:27,代码来源:utilityFunctions.py

示例2: apply_clahe

# 需要导入模块: from skimage import exposure [as 别名]
# 或者: from skimage.exposure import equalize_adapthist [as 别名]
def apply_clahe(img): 
    img = img / 255. 
    img = exposure.equalize_adapthist(img) 
    img = img * 255. 
    return img 

# == AUGMENTATION == # 
开发者ID:i-pan,项目名称:kaggle-rsna18,代码行数:9,代码来源:TrainClassifierEnsemble.py

示例3: normReadAll

# 需要导入模块: from skimage import exposure [as 别名]
# 或者: from skimage.exposure import equalize_adapthist [as 别名]
def normReadAll():
    """ Reads all images in the training set

    Reads all images from the training set. Assumes that the working directory has subdirectories "PosTrain" and "NegTrain"

    Returns:
        A numpy array containing the pixel values for the batch of images. Also returns a numpy array containing whether each image has a positive or negative label
    """
    
    labels = []
    patientData = []
    
    posLen = imageCount("PosTrain")
    negLen = imageCount("NegTrain")

    for i in range(posLen):
        data = readScan(i, "PosTrain")
        labels.append(1)
        data = exposure.equalize_adapthist(data)        
        patientData.append(data)
    for i in range(negLen):
        data = readScan(i, "NegTrain")
        labels.append(0)
        data = exposure.equalize_adapthist(data)        
        patientData.append(data)
    
    patientData = numpy.stack(patientData).astype(float)
    return patientData, numpy.stack(labels) 
开发者ID:ben-heil,项目名称:DICOM-CNN,代码行数:30,代码来源:utilityFunctions.py

示例4: readTest

# 需要导入模块: from skimage import exposure [as 别名]
# 或者: from skimage.exposure import equalize_adapthist [as 别名]
def readTest():
    """ Reads all images in the test set

    Reads all images from the test set. Assumes that the working directory has subdirectories "PosTest" and "NegTest"

    Returns:
        A numpy array containing the pixel values for the batch of images. Also returns a numpy array containing whether each image has a positive or negative label
    """
    labels = []
    patientData = []
    
    posLen = imageCount("PosTest")
    negLen = imageCount("NegTest")

    for i in range(posLen):
        data = readScan(i, "PosTest")
        labels.append(1)
        data = exposure.equalize_adapthist(data)        
        patientData.append(data)
    for i in range(negLen):
        data = readScan(i, "NegTest")
        labels.append(0)
        data = exposure.equalize_adapthist(data)        
        patientData.append(data)
    
    patientData = numpy.stack(patientData).astype(float)
    return patientData, numpy.stack(labels) 
开发者ID:ben-heil,项目名称:DICOM-CNN,代码行数:29,代码来源:utilityFunctions.py

示例5: crop_and_resize_test

# 需要导入模块: from skimage import exposure [as 别名]
# 或者: from skimage.exposure import equalize_adapthist [as 别名]
def crop_and_resize_test(image, contrast = False):
    img_crop = np.zeros([image_size[0], image_size[1], 3], dtype = np.float)
    img_roi = image[-image_size[0]:, :, :]
    if contrast:
        img_adapteq = exposure.equalize_adapthist(img_roi, clip_limit=0.01)
    else:
        img_adapteq = img_roi / 255.0
    img_adapteq = img_adapteq * 255.0
    img_crop[:, 72:(72+3384), :] = img_adapteq
    return img_crop 
开发者ID:wwoody827,项目名称:cvpr-2018-autonomous-driving-autopilot-solution,代码行数:12,代码来源:predict-checkpoint.py

示例6: adaptive_equalize

# 需要导入模块: from skimage import exposure [as 别名]
# 或者: from skimage.exposure import equalize_adapthist [as 别名]
def adaptive_equalize(img):
    # Adaptive Equalization
    img = img_as_float(img)
    img_adapteq = exposure.equalize_adapthist(img, clip_limit=0.05)
    return img_as_ubyte(img_adapteq) 
开发者ID:921kiyo,项目名称:3d-dl,代码行数:7,代码来源:tf_eval.py


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