# Path: reservoir_nn/utils/image_operations.py
# class TileImage(preprocessing.TensorTransform):
# class TileImage3D(preprocessing.TensorTransform):
# class TileNoOverlap(preprocessing.TensorTransform):
# class MixRGBChannels(preprocessing.TensorTransform):
# class SelectChannels(preprocessing.TensorTransform):
# class PadRightBottom(preprocessing.TensorTransform):
# class ResizeImage(preprocessing.TensorTransform):
# class ResizeImageWithCropOrPad(preprocessing.TensorTransform):
# class ResizeLabel(preprocessing.TensorTransform):
# class ResizeLabelWithCropOrPad(preprocessing.TensorTransform):
# class Crop(preprocessing.TensorTransform):
# class EqualizeHistogram(preprocessing.TensorTransform):
# class PreserveTwoContrastiveLabels(preprocessing.TensorTransform):
# class PreserveSplitLabels(preprocessing.TensorTransform):
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def __attrs_post_init__(self):
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def __attrs_post_init__(self):
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
# def tile_image(image: np.ndarray, tile_size: int = 30) -> np.ndarray:
# def image_to_tiles(image: np.ndarray,
#                    tile_size: int,
#                    strides: Tuple[int, int],
#                    padding=True) -> np.ndarray:
# def pad_image_right_bottom(image: np.ndarray, tile_size: int,
#                            strides: Tuple[int, int]) -> np.ndarray:
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def check_class_labels(self, attribute, values):
#   def __attrs_post_init__(self):
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def check_all_class_label_values(self, attribute, values):
#   def check_class_labels(self, attribute, values):
#   def __attrs_post_init__(self):
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
# def merge_labels(label: types.TensorLike) -> tf.Tensor:
# def tiles_to_image(tiles: np.ndarray,
#                    image_shape: Tuple[int, int],
#                    strides: Tuple[int, int],
#                    padding=True) -> np.ndarray:
# def circular_mask(height: int,
#                   width: int,
#                   radius: float,
#                   dtype=np.bool_) -> np.ndarray:
# def gaussian_mask(height: int,
#                   width: int,
#                   radius: float,
#                   dtype=np.float32) -> np.ndarray:


from absl.testing import absltest
from absl.testing import parameterized
from reservoir_nn.utils import image_operations
import numpy as np
import tensorflow as tf
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for reservoir_nn.utils.image_operations."""



class TileImageTest(parameterized.TestCase):

  def test_tiles_have_correct_sizes(self):
    image = tf.reshape(tf.range(2004 * 1004), (2004, 1004))
    tile_sizes = (27, 53)

# Path: reservoir_nn/utils/image_operations.py
# class TileImage(preprocessing.TensorTransform):
# class TileImage3D(preprocessing.TensorTransform):
# class TileNoOverlap(preprocessing.TensorTransform):
# class MixRGBChannels(preprocessing.TensorTransform):
# class SelectChannels(preprocessing.TensorTransform):
# class PadRightBottom(preprocessing.TensorTransform):
# class ResizeImage(preprocessing.TensorTransform):
# class ResizeImageWithCropOrPad(preprocessing.TensorTransform):
# class ResizeLabel(preprocessing.TensorTransform):
# class ResizeLabelWithCropOrPad(preprocessing.TensorTransform):
# class Crop(preprocessing.TensorTransform):
# class EqualizeHistogram(preprocessing.TensorTransform):
# class PreserveTwoContrastiveLabels(preprocessing.TensorTransform):
# class PreserveSplitLabels(preprocessing.TensorTransform):
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def __attrs_post_init__(self):
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def __attrs_post_init__(self):
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
# def tile_image(image: np.ndarray, tile_size: int = 30) -> np.ndarray:
# def image_to_tiles(image: np.ndarray,
#                    tile_size: int,
#                    strides: Tuple[int, int],
#                    padding=True) -> np.ndarray:
# def pad_image_right_bottom(image: np.ndarray, tile_size: int,
#                            strides: Tuple[int, int]) -> np.ndarray:
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def check_class_labels(self, attribute, values):
#   def __attrs_post_init__(self):
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
#   def check_all_class_label_values(self, attribute, values):
#   def check_class_labels(self, attribute, values):
#   def __attrs_post_init__(self):
#   def call(self, input_: tf.Tensor) -> tf.Tensor:
# def merge_labels(label: types.TensorLike) -> tf.Tensor:
# def tiles_to_image(tiles: np.ndarray,
#                    image_shape: Tuple[int, int],
#                    strides: Tuple[int, int],
#                    padding=True) -> np.ndarray:
# def circular_mask(height: int,
#                   width: int,
#                   radius: float,
#                   dtype=np.bool_) -> np.ndarray:
# def gaussian_mask(height: int,
#                   width: int,
#                   radius: float,
#                   dtype=np.float32) -> np.ndarray:


# Path: reservoir_nn/utils/image_operations_test.py
from absl.testing import absltest
from absl.testing import parameterized
from reservoir_nn.utils import image_operations
import numpy as np
import tensorflow as tf

# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests for reservoir_nn.utils.image_operations."""



class TileImageTest(parameterized.TestCase):

  def test_tiles_have_correct_sizes(self):
    image = tf.reshape(tf.range(2004 * 1004), (2004, 1004))
    tile_sizes = (27, 53)

    transformation = image_operations.TileImage(