Converting multichannel fluorescence CZI images to DICOM whole slide imaging

Recently we had the following question from Max, one of the IDC users. I am replicating here the discussion with Melissa Linkert @melissalinkert who answered that question so that it can benefit other users of IDC.

has anybody some recommendations where to look at to find the corresponding documentation of the bioformats dicom conversion to convert fluorescene czi files with 5 channels and 16 bit per channel into dicom? I get an error that more than 8bit per pixel can not be encoded with JPEG, which also sounds reasonable to me

@melissalinkert responce:

For 16-bit data, I would expect that JPEG-2000 compression needs to be used. A command like this should work:

bfconvert -noflat -compression JPEG-2000 -tilex 512 -tiley 512 input.czi output.dcm

That will write 512x512 tiles, but you can adjust that if needed. If you still see errors when using JPEG-2000 compression, please let us know the complete text of the error, the exact command that was run, and the version of Bio-Formats (‘bfconvert -version’ will print this).

This page describes all of the different options available in bfconvert:

and this is the summary page for Bio-Formats’ DICOM support (admittedly, this probably needs some work to be useful):

Follow up question from Max:

thank you all for your answer. This question came up during the last NA-MIC project week, where we have tried to convert one of our Zeiss fluorescence files with the bioformats converter into tif or DICOM.

We have used the following command

./bfconvert -channel 1 -tilex 2240 -tiley 2240 -noflat -compression JPEG-2000 -option dicom.dual_personality true /2023_12_14_Ms191b.czi /test.tif

In QuPath the original file has 5 staining channels, which can be all selected. However, after the attempt to convert it, we only found 1 channel max. We have also tried to specify -channel 1, but were still not able to get a full output with 5 staining channels.
Unfortunately there is human tissue on that specific slide so we can not share that file. However, we are currently acquiring a sample from a mouse with the same stainings and the same scanner, which we could share with you, in case you are interested in such a file.

Response from @melissalinkert:

The “-channel” option for bfconvert selects a single channel to convert, so it’s expected that using “-channel 1” only outputs 1 channel (in that case, it would be index 1, which is the second channel).

Have you tried converting without the “-channel” option? If the original data has 5 channels, then omitting that option entirely should result in all 5 channels being converted.

One other thing to consider is the output file name. If you are intending to convert to DICOM, the output file name needs to end with “.dcm” (e.g. “test.dcm” instead of “test.tif”). If you’re intending to convert to TIFF with no DICOM metadata, then I strongly recommend converting to OME-TIFF using the “.ome.tif” or “.ome.tiff” file extension (“test.ome.tif” instead of “test.tif”). Using the plain “.tif” extension will cause a lot of information to be lost or poorly translated compared to converting to DICOM or OME-TIFF.

If neither of those suggestions helps, then it would be useful to have the mouse data so we can better understand what might be going wrong.