Raise error for non 2-D images
Fix perimeter test case