in ez_wsi_dicomweb/gcs_image.py [0:0]
def _resize(self):
"""Resizes image to resize_dims if provided."""
resize_dims = self._image_resize_dims
if resize_dims is None or self._image_bytes is None:
return
height, width = self._image_bytes.shape[:2]
if width == resize_dims.width_px and height == resize_dims.height_px:
return
if resize_dims.width_px > width or resize_dims.height_px > height:
resize_method = cv2.INTER_CUBIC
else:
resize_method = cv2.INTER_AREA
self._are_image_bytes_resized = True
self._width = resize_dims.width_px
self._height = resize_dims.height_px
self._image_bytes = cv2.resize(
self._image_bytes, (self._width, self._height), resize_method
)