コード例 #1
0
def test_image_contrast():
    """Test: increases the contrast in order to make possible fourier transforms smoother"""
    #inputs for functions
    image = Image.open('../data/protein_matrix_image.png')
    contrast_value = 2
    #function performance
    enhanced_image = preprocessing.image_contrast(image, contrast_value)
    #asserts and checks
    return enhanced_image
コード例 #2
0
def test_objectnumber():
    """Test: Gets the object number for the global and local thresholds"""
    #inputs for functions
    image = Image.open('../data/protein_matrix_image.png')
    desired_color = 'b'
    #processing
    split = preprocessing.color_split_image(image, desired_color)
    contrast_image = preprocessing.image_contrast(split, 2)
    block_size = 15
    #running the functions
    objects.objectnumber(contrast_image, block_size)
    #asserts and checks
    return
コード例 #3
0
def test_distance_histograms():
    """Test: obtaining 10-bin histograms of centroid distances"""
    #inputs for functions
    image = Image.open('../data/protein_matrix_image.png')
    desired_color = 'b'
    #processing
    split = preprocessing.color_split_image(image, desired_color)
    contrast_image = preprocessing.image_contrast(split, 2)
    block_size = 15
    #running the functions
    objects.distance_histograms(contrast_image, block_size)
    #asserts and checks
    return
コード例 #4
0
def test_objectcentroids():
    """Test: obtaining the object centroids"""
    #inputs for functions
    image = Image.open('../data/protein_matrix_image.png')
    desired_color = 'b'
    #processing
    split = preprocessing.color_split_image(image, desired_color)
    contrast_image = preprocessing.image_contrast(split, 2)
    block_size = 15
    #running the functions
    object_centroids, object_centroids_local = objects.objectcentroids(
        contrast_image, block_size)
    #asserts and checks
    return
コード例 #5
0
def test_stats():
    """Test: gets basic stats for whatever property input"""
    #inputs for functions
    image = Image.open('../data/protein_matrix_image.png')
    desired_color = 'b'
    #processing
    split = preprocessing.color_split_image(image, desired_color)
    image = preprocessing.image_contrast(split, 2)  #inputs for functions
    #labels
    otsu_global_labels = objects.global_labels(image)
    properties_global = measure.regionprops(otsu_global_labels)
    areas_global = [prop.bbox_area for prop in properties_global]
    #final inputs
    property = areas_global
    #running the functions
    objects.stats(property)
    #asserts and checks
    return
コード例 #6
0
def test_distancesarr():
    """Test: gets the distances between image and objects"""
    #inputs for functions
    image = Image.open('../data/protein_matrix_image.png')
    desired_color = 'b'
    #processing
    split = preprocessing.color_split_image(image, desired_color)
    image = preprocessing.image_contrast(split, 2)
    block_size = 15
    #final inputs
    otsu_global_labels = objects.global_labels(image)
    properties_global = measure.regionprops(otsu_global_labels)
    image_centroid = properties_global[0].centroid
    global_binarys = objects.global_binary(image)
    object_centroids = feature.blob_log(global_binarys)
    row = [3, 3]
    #running the functions
    distances = objects.distancesarr(image_centroid, object_centroids)
    #asserts and checks
    return