Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/scratch-core/src/mutations/spatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
the image while adjusting its spatial representation.
"""

from container_models.base import BinaryMask, DepthData
from container_models.base import BinaryMask
from computations.spatial import get_bounding_box
from container_models.scan_image import ScanImage
from exceptions import ImageShapeMismatchError
Expand All @@ -32,7 +32,6 @@
from loguru import logger
from pydantic import PositiveFloat
from skimage.transform import resize
from typing import cast


class CropToMask(ImageMutation):
Expand Down Expand Up @@ -97,7 +96,7 @@ def apply_on_image(self, scan_image: ScanImage) -> ScanImage:
f"Resampling image array to new size: {round(output_shape[0], 1)}/{round(output_shape[1], 1)}"
)
return ScanImage(
data=cast(DepthData, resampled_data).astype(scan_image.data.dtype),
data=np.asarray(resampled_data, dtype=scan_image.data.dtype),
scale_x=scan_image.scale_x * self.x_factor,
scale_y=scan_image.scale_y * self.y_factor,
)