def test_is_bbox_within_image_volume(): isize = (1000, 1000) srange = (0, 100) shoebox = Shoebox((10, 20, 10, 20, 10, 20)) assert shoebox.is_bbox_within_image_volume(isize, srange) shoebox = Shoebox((-10, 20, 10, 20, 10, 20)) assert not shoebox.is_bbox_within_image_volume(isize, srange) shoebox = Shoebox((10, 20, -10, 20, 10, 20)) assert not shoebox.is_bbox_within_image_volume(isize, srange) shoebox = Shoebox((10, 20, 10, 20, -10, 20)) assert not shoebox.is_bbox_within_image_volume(isize, srange) shoebox = Shoebox((10, 1020, 10, 20, 10, 20)) assert not shoebox.is_bbox_within_image_volume(isize, srange) shoebox = Shoebox((10, 20, 10, 1020, 10, 20)) assert not shoebox.is_bbox_within_image_volume(isize, srange) shoebox = Shoebox((10, 20, 10, 20, 10, 1020)) assert not shoebox.is_bbox_within_image_volume(isize, srange)
def test_is_bbox_within_image_volume(): from dials.model.data import Shoebox isize = (1000, 1000) srange = (0, 100) shoebox = Shoebox((10, 20, 10, 20, 10, 20)) assert shoebox.is_bbox_within_image_volume(isize, srange) shoebox = Shoebox((-10, 20, 10, 20, 10, 20)) assert not shoebox.is_bbox_within_image_volume(isize, srange) shoebox = Shoebox((10, 20, -10, 20, 10, 20)) assert not shoebox.is_bbox_within_image_volume(isize, srange) shoebox = Shoebox((10, 20, 10, 20, -10, 20)) assert not shoebox.is_bbox_within_image_volume(isize, srange) shoebox = Shoebox((10, 1020, 10, 20, 10, 20)) assert not shoebox.is_bbox_within_image_volume(isize, srange) shoebox = Shoebox((10, 20, 10, 1020, 10, 20)) assert not shoebox.is_bbox_within_image_volume(isize, srange) shoebox = Shoebox((10, 20, 10, 20, 10, 1020)) assert not shoebox.is_bbox_within_image_volume(isize, srange)
def tst_is_bbox_within_image_volume(self): from dials.model.data import Shoebox isize = (1000, 1000) srange = (0, 100) shoebox = Shoebox((10, 20, 10, 20, 10, 20)) assert (shoebox.is_bbox_within_image_volume(isize, srange)) shoebox = Shoebox((-10, 20, 10, 20, 10, 20)) assert (not shoebox.is_bbox_within_image_volume(isize, srange)) shoebox = Shoebox((10, 20, -10, 20, 10, 20)) assert (not shoebox.is_bbox_within_image_volume(isize, srange)) shoebox = Shoebox((10, 20, 10, 20, -10, 20)) assert (not shoebox.is_bbox_within_image_volume(isize, srange)) shoebox = Shoebox((10, 1020, 10, 20, 10, 20)) assert (not shoebox.is_bbox_within_image_volume(isize, srange)) shoebox = Shoebox((10, 20, 10, 1020, 10, 20)) assert (not shoebox.is_bbox_within_image_volume(isize, srange)) shoebox = Shoebox((10, 20, 10, 20, 10, 1020)) assert (not shoebox.is_bbox_within_image_volume(isize, srange)) # Test passed print 'OK'