ome/bioformats

bfconvert: Using channel option does not remove additional channel elements from OME-XML

Closed this issue · 1 comments

dgault commented

Issue was reported on forum thread https://forum.image.sc/t/extracting-a-single-channel-using-bfconvert/91632

The original error was reported when trying to read using AICSImage resulted in the error:

ValueError: conflicting sizes for dimension 'C': length 1 on the data but length 2 on coordinate 'C'

The issue can be reproduced with command line tools from BF 7.1.0 and using sample file from https://github.com/NEUBIAS/training-resources/blob/2145f31cd46b81fc24f31cad4de1ca30ccaf24f6/image_data/xyc_8bit__membranes_nuclei.tif

Running the below command then generates an OME-TIFF which contains 2 channel elements in the OME-XML:

bfconvert -channel 1 xyc_8bit__membranes_nuclei.tif xyc_8bit__membranes_nuclei.ome.tiff

Note that this is not apparent when using showinf -omexml but instead can be seen when using a tool such as tiffinfo to view the image description tag.

When viewed with showinf -omexml only a single channel element is seen:

   <Image ID="Image:0" Name="xyc_8bit__membranes_nuclei.tiff">
      <Description/>
      <Pixels BigEndian="true" DimensionOrder="XYCZT" ID="Pixels:0" Interleaved="false" SignificantBits="8" SizeC="1" SizeT="1" SizeX="475" SizeY="354" SizeZ="1" Type="uint8">
         <Channel ID="Channel:0:0" SamplesPerPixel="1">
            <LightPath/>
         </Channel>
         <TiffData FirstC="0" FirstT="0" FirstZ="0" IFD="0" PlaneCount="1">
            <UUID FileName="xyc_8bit__membranes_nuclei.ome.tiff">urn:uuid:26dd8113-b0f8-465d-b860-52ef2d031195</UUID>
         </TiffData>
      </Pixels>
   </Image>

When using tiffinfo you see 2 channel elements:

   <Image ID="Image:0" Name="xyc_8bit__membranes_nuclei.tiff">
       <Description/>
       <Pixels BigEndian="true" DimensionOrder="XYCZT" ID="Pixels:0" Interleaved="false" SignificantBits="8" SizeC="1" SizeT="1" SizeX="475" SizeY="354" SizeZ="1" Type="uint8">
           <Channel ID="Channel:0:0" SamplesPerPixel="1">
              <LightPath/>
           </Channel>
           <Channel ID="Channel:0:1" SamplesPerPixel="1"><LightPath/></Channel>
           <TiffData FirstC="0" FirstT="0" FirstZ="0" IFD="0" PlaneCount="1">
              <UUID FileName="xyc_8bit__membranes_nuclei.ome.tiff">urn:uuid:26dd8113-b0f8-465d-b860-52ef2d031195</UUID> 
           </TiffData>
       </Pixels>
   </Image>

This issue has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/extracting-a-single-channel-using-bfconvert/91632/4