Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
>>> img = AICSImage("s_1_t_1_c_10_z_20.ome.tiff")
... every_other = img.get_image_dask_data("CZYX", C=slice(0, -1, 2))
Notes
-----
* If a requested dimension is not present in the data the dimension is
added with a depth of 1.
See `aicsimageio.transforms.reshape_data` for more details.
"""
# If no out orientation, simply return current data as dask array
if out_orientation is None:
return self.dask_data
# Transform and return
return transforms.reshape_data(
data=self.dask_data,
given_dims=self.dims,
return_dims=out_orientation,
**kwargs,
)
>>> img = AICSImage("s_1_t_1_c_10_z_20.ome.tiff")
... every_other = img.get_image_dask_data("CZYX", C=slice(0, -1, 2))
Notes
-----
* If a requested dimension is not present in the data the dimension is
added with a depth of 1.
See `aicsimageio.transforms.reshape_data` for more details.
"""
# If no out orientation, simply return current data as dask array
if out_orientation is None:
return self.dask_data
# Transform and return
return transforms.reshape_data(
data=self.dask_data,
given_dims=self.dims,
return_dims=out_orientation,
**kwargs,
)
>>> img = Reader("s_1_t_1_c_10_z_20.ome.tiff")
... every_other = img.get_image_dask_data("CZYX", C=slice(0, -1, 2))
Notes
-----
* If a requested dimension is not present in the data the dimension is
added with a depth of 1.
See `aicsimageio.transforms.reshape_data` for more details.
"""
# If no out orientation, simply return current data as dask array
if out_orientation is None:
return self.dask_data
# Transform and return
return transforms.reshape_data(
data=self.dask_data,
given_dims=self.dims,
return_dims=out_orientation,
**kwargs,
)
def dask_data(self) -> da.core.Array:
"""
Returns a dask array with dimension ordering "STCZYX".
"""
# Construct dask array if never before constructed
if self._dask_data is None:
reader_data = self.reader.dask_data
# Read and reshape and handle delayed known dims reshape
self._dask_data = transforms.reshape_data(
data=reader_data,
given_dims=self._known_dims or self.reader.dims,
return_dims=self.dims,
)
return self._dask_data
def dask_data(self) -> da.core.Array:
"""
Returns a dask array with dimension ordering "STCZYX".
"""
# Construct dask array if never before constructed
if self._dask_data is None:
reader_data = self.reader.dask_data
# Read and reshape and handle delayed known dims reshape
self._dask_data = transforms.reshape_data(
data=reader_data,
given_dims=self._known_dims or self.reader.dims,
return_dims=self.dims,
)
return self._dask_data
def data(self) -> np.ndarray:
"""
Return the entire image as a numpy array with dimension ordering "STCZYX".
"""
if self._data is None:
self._data = transforms.reshape_data(
data=self.reader.data,
given_dims=self._known_dims or self.reader.dims,
return_dims=self.dims,
)
return self._data