diff --git a/iohub/convert.py b/iohub/convert.py index ed2b182e..ce5d707d 100644 --- a/iohub/convert.py +++ b/iohub/convert.py @@ -394,7 +394,8 @@ def __call__(self) -> None: ): zarr_img = self.writer[zarr_pos_name]["0"] to_zarr(fov.xdata.data.rechunk(self.chunks), zarr_img) - self._convert_image_plane_metadata(fov, zarr_img.path) + # Skip image plane metadata conversion, throws error + # self._convet_image_plane_metadata(fov, zarr_img.path) self.writer.zgroup.attrs.update(self.metadata) self.writer.close() self.reader.close() diff --git a/iohub/mmstack.py b/iohub/mmstack.py index d19bb049..e3f484a0 100644 --- a/iohub/mmstack.py +++ b/iohub/mmstack.py @@ -140,6 +140,13 @@ def _parse_data(self): (axis, size) for axis, size in zip(series.get_axes(), series.get_shape()) ) + _rgb = False + if "S" in raw_dims and "C" not in raw_dims: + # Map samples "S" from RGB images to channels "C" + # in datasets that don't already have a channel dimension + _rgb = True + _channels = raw_dims.pop("S") + raw_dims["C"] = _channels axes = ("R", "T", "C", "Z", "Y", "X") dims = dict((ax, raw_dims.get(ax, 1)) for ax in axes) _logger.debug(f"Got dataset dimensions from tifffile: {dims}.") @@ -163,6 +170,9 @@ def _parse_data(self): xarr = img.expand_dims( [ax for ax in axes if ax not in img.dims] ).transpose(*axes) + # Rename RGB channels + if _rgb and self.channels == 3: + self.channel_names = ["Red", "Green", "Blue"] if self.channels > len(self.channel_names): for c in range(self.channels): if c >= len(self.channel_names):