當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。