Ejemplo n.º 1
0
def test_black_white_conversion_2x3dshape():
    lung = ami.load_images(image_path,
                           convert_to_grey=True,
                           image_size=30,
                           keep_3d_shape=True)[0]
    assert lung.shape == (30, 30, 1)
    lung = conv.to_blackwhite([lung], keep_3d_shape=True, threshold=200)
    assert lung[0].shape == (30, 30, 1)
Ejemplo n.º 2
0
def test_black_white_conversion_double_arrays():
    image_list = ami.load_images(image_path)
    test_list = list()
    for img in image_list:
        test_list.append(img / 255)
    ls = conv.to_blackwhite(np.array(test_list))
    pixel_value = ls[0][0][0]
    assert pixel_value == 0 or pixel_value == 1
Ejemplo n.º 3
0
def test_black_white_conversion_3dshape():
    image_list = ami.load_images(image_path)
    ls = conv.to_blackwhite(image_list, keep_3d_shape=True)
    pixel_value = ls[0][0][0]
    assert pixel_value == 0 or pixel_value == 1
    assert len(ls[0].shape) == 3
Ejemplo n.º 4
0
def test_crop_image():
    image = ami.load_images(image_path, max_images=1, image_size=50)[0]
    crop = conv.crop(image, 10, 20, 20, 10)
    assert crop.shape == (10, 20, 3)
Ejemplo n.º 5
0
def test_load_images_extensions():
    image_list = ami.load_images(image_path, valid_extensions=['.gif'])

    assert len(image_list) == 0
Ejemplo n.º 6
0
def test_load_images_grey():
    image_list = ami.load_images(image_path, image_size=40, max_images=1, convert_to_grey=True)

    assert image_list[0].shape == (40, 40)
    assert len(image_list) == 1
Ejemplo n.º 7
0
def test_load_images_grey_dont_keep_shape():
    image_list = ami.load_images(image_path, image_size=40, max_images=1, convert_to_grey=True, keep_3d_shape=False)

    assert image_list[0].shape == (40, 40)
    assert len(image_list) == 1
Ejemplo n.º 8
0
def test_load_images_max_number():
    image_list = ami.load_images(image_path, max_images=4)

    assert len(image_list) == 4
Ejemplo n.º 9
0
def test_load_images_resize_tuple():
    image_list = ami.load_images(image_path, image_size=(40, 30), max_images=1)

    assert len(image_list) == 1
    assert image_list[0].shape == (40, 30, 3)
Ejemplo n.º 10
0
def test_load_images_defaults():
    image_list = ami.load_images(image_path)

    assert len(image_list) == 11
Ejemplo n.º 11
0
def test_show_3d_shape_image():
    lungs = imgio.load_images(image_path_1, convert_to_grey=True, keep_3d_shape=True)
#X = conversion.to_blackwhite(X, keep_3d_shape=True, threshold=200)
    exp.show_image(lungs[1])
Ejemplo n.º 12
0
def test_visualize_oneset_images():
    lungs = imgio.load_images(image_path_1)

    exp.visualize({'lungs': lungs}, image_count = 6, randomize=True)
Ejemplo n.º 13
0
def test_visualize_3d_shape_images():
    lungs = imgio.load_images(image_path_1, convert_to_grey=True, keep_3d_shape=True)
    masks = imgio.load_images(image_path_2, convert_to_grey=True, keep_3d_shape=True)

    exp.visualize({'lungs': lungs, 'masks': masks}, image_count = 6, randomize=True)
Ejemplo n.º 14
0
def test_visualize_first_images():
    lungs = imgio.load_images(image_path_1)
    masks = imgio.load_images(image_path_2)

    exp.visualize({'lungs': lungs, 'masks': masks}, image_count = 6, randomize=False)