You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
Thanks for your work on BatchConvert, which is very useful and practical!
For my work in France-BioImaging, I need to convert several multichannel images into single-channel ome.tiff images - for each channel of the original images.
So I created this python code using your documentation; to convert here only the first channel of an example image).
ValueError: conflicting sizes for dimension 'C': length 1 on the data but length 3 on coordinate 'C'
The full error message below:
ValueError Traceback (most recent call last)/home/mypath Cell 6 line 6<a href='vscode-notebook-cell://home/mypath#X15sZmlsZQ%3D%3D?line=3'>4</a> img = AICSImage(ometiff_converted_demo)<a href='vscode-notebook-cell://home/mypath#X15sZmlsZQ%3D%3D?line=4'>5</a> # print(img.metadata)----> <a href='vscode-notebook-cell://home/mypath#X15sZmlsZQ%3D%3D?line=5'>6</a> print(img.dims)File ~/mambaforge/envs/environment/lib/python3.10/site-packages/aicsimageio/aics_image.py:574, in AICSImage.dims(self)566\"\"\"567Returns568-------569dims: dimensions.Dimensions570Object with the paired dimension names and their sizes.571\"\"\"572if self._dims is None:573self._dims = dimensions.Dimensions(--> 574 dims=self.xarray_dask_data.dims, shape=self.shape575)577return self._dimsFile ~/mambaforge/envs/environment/lib/python3.10/site-packages/aicsimageio/aics_image.py:438, in AICSImage.xarray_dask_data(self)423\"\"\"424Returns425-------(...)431If the image contains mosaic tiles, data is returned already stitched together.432\"\"\"433if self._xarray_dask_data is None:434if (435# Does the user want to get stitched mosaic436self._reconstruct_mosaic437# Does the data have a tile dim--> 438 and dimensions.DimensionNames.MosaicTile in self.reader.dims.order439):440try:441self._xarray_dask_data = (442self._transform_data_array_to_aics_image_standard(443self.reader.mosaic_xarray_dask_data444)445)File ~/mambaforge/envs/environment/lib/python3.10/site-packages/aicsimageio/readers/reader.py:532, in Reader.dims(self)525\"\"\"526Returns527-------528dims: Dimensions529Object with the paired dimension names and their sizes.530\"\"\"531if self._dims is None:--> 532 self._dims = Dimensions(dims=self.xarray_dask_data.dims, shape=self.shape)534return self._dimsFile ~/mambaforge/envs/environment/lib/python3.10/site-packages/aicsimageio/readers/reader.py:359, in Reader.xarray_dask_data(self)352\"\"\"353Returns354-------355xarray_dask_data: xr.DataArray356The delayed image and metadata as an annotated data array.357\"\"\"358if self._xarray_dask_data is None:--> 359 self._xarray_dask_data = self._read_delayed()361return self._xarray_dask_dataFile ~/mambaforge/envs/environment/lib/python3.10/site-packages/aicsimageio/readers/ome_tiff_reader.py:334, in OmeTiffReader._read_delayed(self)331# Create the delayed dask array332image_data = self._create_dask_array(tiff, strictly_read_dims)--> 334 return self._general_data_array_constructor(335image_data,336dims,337coords,338tiff_tags,339)File ~/mambaforge/envs/environment/lib/python3.10/site-packages/aicsimageio/readers/ome_tiff_reader.py:286, in OmeTiffReader._general_data_array_constructor(self, image_data, dims, coords, tiff_tags)283# Reset dims after transform284dims = [d for d in out_order]--> 286 return xr.DataArray(287image_data,288dims=dims,289coords=coords,290attrs={291constants.METADATA_UNPROCESSED: tiff_tags,292constants.METADATA_PROCESSED: self._ome,293},294)File ~/mambaforge/envs/environment/lib/python3.10/site-packages/xarray/core/dataarray.py:418, in DataArray.__init__(self, data, coords, dims, name, attrs, indexes, fastpath)416data = _check_data_shape(data, coords, dims)417data = as_compatible_data(data)--> 418 coords, dims = _infer_coords_and_dims(data.shape, coords, dims)419variable = Variable(dims, data, attrs, fastpath=True)420indexes, coords = _create_indexes_from_coords(coords)File ~/mambaforge/envs/environment/lib/python3.10/site-packages/xarray/core/dataarray.py:163, in _infer_coords_and_dims(shape, coords, dims)161for d, s in zip(v.dims, v.shape):162if s != sizes[d]:--> 163 raise ValueError(164f\"conflicting sizes for dimension {d!r}: \"165f\"length {sizes[d]} on the data but length {s} on \"166f\"coordinate {k!r}\"167)169if k in sizes and v.shape != (sizes[k],):170raise ValueError(171f\"coordinate {k!r} is a DataArray dimension, but \"172f\"it has shape {v.shape!r} rather than expected shape {sizes[k]!r} \"173\"matching the dimension size\"174)ValueError: conflicting sizes for dimension 'C': length 1 on the data but length 3 on coordinate 'C'"
Suprisingly, when using the BioformatReader, I can have access to the new monocanal image (but it takes much more time to open it).
Then I checked the ome-type xml metadata file and saw that the sizeC is indeed 1 but, in Pixels, the information for the 3 channels remains instead of just the first.
It therefore seems that there was an error at this level during the conversion.
Thank you for your positive feedback on BatchConvert and the detailed description of the issue. I can replicate the behaviour using several example images in different formats. The channel information of the original dataset is retained in the metadata of the extracted series.
It appears that the root cause lies within the Bio-Formats tools that are wrapped by BatchConvert for conversion.
I will investigate further to clarify if this behaviour of Bio-Formats is intentional or a potential bug. In the meanwhile I will also try to figure out a temporary fix in BatchConvert.
Hi @DorianKauffmann <https://github.com/DorianKauffmann> ,
Thank you for your positive feedback on BatchConvert and the detailed
description of the issue. I can replicate the behaviour using several
example images in different formats. The channel information of the
original dataset is retained in the metadata of the extracted series.
It appears that the root cause lies within the Bio-Formats tools that are
wrapped by BatchConvert for conversion.
I will investigate further to clarify if this behaviour of Bio-Formats is
intentional or a potential bug. In the meanwhile I will also try to figure
out a temporary fix in BatchConvert.
Cheers,
Bugra
—
Reply to this email directly, view it on GitHub
<#24 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AUGQ5D5YTLXSEHQAEQ3MXT3YN32E5AVCNFSM6AAAAABBTQLVRCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBVGY3DANRUHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
Hello,
Thanks for your work on BatchConvert, which is very useful and practical!
For my work in France-BioImaging, I need to convert several multichannel images into single-channel ome.tiff images - for each channel of the original images.
So I created this python code using your documentation; to convert here only the first channel of an example image).
<Dimensions [T: 1, C: 3, Z: 21, Y: 512, X: 512]>
But after running this code and converting my 3-channel images I got a Value error about channel sizes (idem with some imread)
ValueError: conflicting sizes for dimension 'C': length 1 on the data but length 3 on coordinate 'C'
The full error message below:
Suprisingly, when using the BioformatReader, I can have access to the new monocanal image (but it takes much more time to open it).
<Dimensions [T: 1, C: 1, Z: 21, Y: 512, X: 512]>
Then I checked the ome-type xml metadata file and saw that the sizeC is indeed 1 but, in Pixels, the information for the 3 channels remains instead of just the first.
It therefore seems that there was an error at this level during the conversion.
It therefore seems that there was an error at this level during the conversion.
The full xml file (as .txt) here : Info_HeLa_Mitotrack-647_BrField_Hoechst_sample-1_001_visit_1.txt
As I can't upload .dv and ome.tiff images on GIthub, don't hesitate to contact me if you want the input and output image.
Thank you for all,
Dorian
The text was updated successfully, but these errors were encountered: