#NEWLINE# def test_constrain_mask_to_landmarks_convex_hull( ) : #NEWLINE# #INDENT# img = MaskedImage . init_blank ( ( 10 , 10 ) ) #NEWLINE# img . landmarks [ 'box' ] = PointCloud ( np . array ( [ [ 0.0 , 0.0 ] , [ 5.0 , 0.0 ] , [ 5.0 , 5.0 ] , [ 0.0 , 5.0 ] ] ) ) #NEWLINE# img . constrain_mask_to_landmarks ( group = 'box' , point_in_pointcloud = 'convex_hull' ) #NEWLINE# example_mask = BooleanImage . init_blank ( ( 10 , 10 ) , fill = False ) #NEWLINE# example_mask . pixels [ 0 , : 6 , 1 : 6 ] = True #NEWLINE# assert ( img . mask . n_true ( ) == 30 ) #NEWLINE# assert_allclose ( example_mask . mask . pixels , example_mask . pixels )