コード例 #1
0
    def __init__(
        self,
        *,
        path: PurePosixPath,
        location: Point5D = Point5D.zero(),
        filesystem: JsonableFilesystem,
        tile_shape: Optional[Shape5D] = None,
        spatial_resolution: Optional[Tuple[int, int, int]] = None,
    ):
        raw_data: "np.ndarray[Any, Any]" = skimage.io.imread(filesystem.openbin(path.as_posix())) # type: ignore
        c_axiskeys_on_disk = "yxc"[: len(raw_data.shape)]
        self._data = Array5D(raw_data, axiskeys=c_axiskeys_on_disk, location=location)

        if tile_shape is None:
            tile_shape = Shape5D.hypercube(256).to_interval5d().clamped(self._data.shape).shape

        super().__init__(
            c_axiskeys_on_disk=c_axiskeys_on_disk,
            filesystem=filesystem,
            path=path,
            dtype=self._data.dtype,
            interval=self._data.interval,
            tile_shape=tile_shape,
            spatial_resolution=spatial_resolution,
        )
コード例 #2
0
 def __init__(
     self,
     *,
     data: Array5D,
     tile_shape: Optional[Shape5D] = None,
     spatial_resolution: Optional[Tuple[int, int, int]] = None,
 ):
     self._data = data
     if tile_shape is None:
         tile_shape = Shape5D.hypercube(256).to_interval5d().clamped(
             self._data.shape).shape
     super().__init__(
         dtype=self._data.dtype,
         tile_shape=tile_shape,
         interval=self._data.interval,
         spatial_resolution=spatial_resolution,
     )