Esempio n. 1
0
 def test_uncrop_too_small_requested_shape(self,
                                           small_cont_1c: ImageContainer):
     crops = list(small_cont_1c.generate_equal_crops(size=13))
     with pytest.raises(ValueError, match=r"Requested final image shape"):
         ImageContainer.uncrop(crops,
                               shape=(small_cont_1c.shape[0] - 1,
                                      small_cont_1c.shape[1] - 1))
Esempio n. 2
0
    def test_uncrop_preserves_shape(self, small_cont_1c: ImageContainer):
        small_cont_1c.add_img(np.random.normal(size=(small_cont_1c.shape +
                                                     (4, ))),
                              channel_dim="foobar",
                              layer="baz")
        crops = list(small_cont_1c.generate_equal_crops(size=13))

        uncrop = ImageContainer.uncrop(crops)

        np.testing.assert_array_equal(small_cont_1c.shape, uncrop.shape)
        for key in small_cont_1c:
            np.testing.assert_array_equal(uncrop[key], small_cont_1c[key])