コード例 #1
0
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)
コード例 #2
0
ファイル: test_shoebox.py プロジェクト: kek-pf-mx/dials
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)
コード例 #3
0
ファイル: tst_shoebox.py プロジェクト: cctbx-xfel/dials
    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'