Ejemplo n.º 1
0
    def test_multichannel_pixel_tile_3(self):
        img_path = os.path.join(base_path, '../test_data/tiffconnector_1/im/')
        label_path = os.path.join(base_path,
                                  '../test_data/tiffconnector_1/labels/')
        c = TiffConnector(img_path, label_path)
        d = Dataset(c)

        img = 2
        pos_zxy = (0, 0, 0)
        size_zxy = (1, 4, 3)
        channels = [1]
        pd = (0, 2, 3)

        val = np.array([[[[73, 73, 43, 89, 89, 102, 81, 87, 78],
                          [82, 68, 78, 37, 102, 102, 102, 37, 68],
                          [161, 153, 78, 87, 81, 102, 89, 82, 78],
                          [180, 180, 107, 87, 87, 37, 82, 87, 87],
                          [143, 121, 121, 107, 78, 68, 78, 87, 87],
                          [111, 111, 121, 180, 125, 73, 73, 78, 82],
                          [121, 111, 143, 161, 106, 82, 73, 68, 43],
                          [121, 180, 147, 123, 106, 106, 125, 68, 78]]]])

        tile = d.multichannel_pixel_tile(img,
                                         pos_zxy,
                                         size_zxy,
                                         channels,
                                         pixel_padding=pd,
                                         augment_params={'rotation_angle': 45})

        self.assertTrue((tile == val).all())
Ejemplo n.º 2
0
    def test_multichannel_pixel_tile_1(self):
        img_path = os.path.join(base_path, '../test_data/tiffconnector_1/im/')
        label_path = os.path.join(base_path,
                                  '../test_data/tiffconnector_1/labels/')
        c = TiffConnector(img_path, label_path)
        d = Dataset(c)

        img = 2
        pos_zxy = (0, 0, 0)
        size_zxy = (1, 4, 3)
        channels = [1]

        val = np.array([[[[102, 89, 82], [81, 37, 43], [87, 78, 68],
                          [107, 153, 125]]]])

        tile = d.multichannel_pixel_tile(img, pos_zxy, size_zxy, channels)

        self.assertTrue((tile == val).all())