예제 #1
0
def create_n5(array: Array5D, axiskeys: str = "xyztc", chunk_size: Optional[Shape5D] = None):
    data_slice = DataSourceSlice(ArrayDataSource.from_array5d(array))
    chunk_size = chunk_size or Shape5D.hypercube(10)
    path = Path(tempfile.mkstemp()[1] + ".n5/data")
    sink = N5DataSink(path=path, data_slice=data_slice, axiskeys=axiskeys, tile_shape=chunk_size)
    sink.process()
    return path.as_posix()
예제 #2
0
 def __init__(
         self,
         *,
         data: np.ndarray,
         axiskeys: str,
         tile_shape: Optional[Shape5D] = None,
         location: Point5D = Point5D.zero(),
 ):
     self._data = Array5D(data, axiskeys=axiskeys, location=location)
     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,
         axiskeys=axiskeys,
     )
예제 #3
0
 def __init__(
     self,
     url: str,
     *,
     tile_shape: Optional[Shape5D] = None,
     dtype: np.dtype,
     name: str = "",
     shape: Shape5D,
     location: Point5D = Point5D.zero(),
     axiskeys: str,
 ):
     self.url = url
     self.tile_shape = (tile_shape or Shape5D.hypercube(256)).to_slice_5d().clamped(shape.to_slice_5d()).shape
     self.dtype = dtype
     self.name = name or self.url.split("/")[-1]
     self.shape = shape
     self.roi = shape.to_slice_5d(offset=location)
     self.location = location
     self.axiskeys = axiskeys