def test_interpol(self): asm, imgshps = load_incisor() shape = imgshps[0].shape image = imgshps[0].image vecs, tck = shape.get_orthogonal_vectors(with_tck=True) plot_shape(shape, display=False, overlay_image=image) plot_vecs(vecs, shape.as_point_list(), display=False) plot_interpol(tck)
def test_plot_profile(self): print("Hello") asm, imgshps = load_incisor() imgshp = imgshps[0] image = imgshp.image point = imgshp.shape.as_point_list()[0] dir_vec = imgshp.shape.get_orthogonal_vectors()[0] hsz = 20 profiles = GrayLevelProfile.sliding_profiles(image, point, dir_vec, hsz) plot_profile(profiles)
def test_fit_to_image(self): asm, image_shapes = load_incisor(blur=False, sobel=False, incisor=Incisors.LOWER_INNER_LEFT) # Manually fit bottom_left = Point(1431, 992) top_right = Point(1544, 1274) initial_imgshp = ImageShape( image_shapes[4].image, asm.mean_shape.conform_to_rect(bottom_left, top_right), ) matched_image_shape = asm.fit_to_image(initial_imgshp) plot_image_shape(initial_imgshp, display=False, interpol=False, dots=False, vecs=False) plot_image_shape(matched_image_shape)
def test_propose_shape(self): # Arrange asm, image_shapes = load_incisor(blur=True, sobel=True) # Manually fit bottom_left = Point(1310, 745) top_right = Point(1410, 1000) original_imgshp = ImageShape( image_shapes[0].image, asm.mean_shape.conform_to_rect(bottom_left, top_right), ) # Act imageshape = original_imgshp for i in range(5): proposed_shape = asm.propose_shape(imageshape) matched_shape, *_ = asm.match_target(proposed_shape) # Assert plot_image_shape(imageshape, display=False) plot_shape([proposed_shape, matched_shape]) imageshape = ImageShape(imageshape.image, matched_shape)
def test_plot_image_shape(self): _, imgshps = load_incisor() plot_image_shape(imgshps[0])
def test_apply_procrustes(self): asm, image_shapes = load_incisor() shapes = [imgshp.shape for imgshp in image_shapes] Shape.apply_procrustes(shapes) # Shape.translate_all_to_origin(shapes) plot_shape(shapes, dots=False)