CZI to BigTiff with Python vs CZI to BigTiff with Zen Software

Hello Everyone,

I am working on converting CZI RGB images into BigTiff. To do so, I wrote a script that utilizes the czifile Python package written by Christoph Gohlke.

However, when visually comparing the converted Python BigTiff image vs an exported BigTiff image from the ZEN Software, the Python BigTiff appears darker than the ZEN BigTiff. To confirm my observation, I have compared the corresponding pixel values for the Python and ZEN BigTiff and they are indeed different. Since I cannot find any obvious parameters czifile that could be changing the image during the CZI to BigTiff Python conversion, I will assume that the czifile package reads the raw CZI image and converts directly into BigTiff.

I would like to know if there is some common image processing pipeline that ZEN is applying to enhance the image for viewing and exporting. I understand that it might be impossible to know exactly what ZEN is doing but I would appreciate any advice or tips on applying common image processing tricks on geological samples.

I would thank you in advance for your time.

-Frank

Note: We are using Python to convert CZI to BigTiff because the ZEN software is awfully slow. Unfortunately, I cannot share this images.

Zen has a checkbox setting inthe conversion dialog where it will write the big tiff with the current display settings of the image. That may be why it is brighter. czifile just dumps the raw pixel intensities.

2 Likes

Hi @frank-ceballos,

sorry to hear that you think ZEN is awfully slow … :thinking: . Could you please explain, what part of the ZEN works slow for you. Because in general this is not the feedback we get, but there are always things to improve :-).

While I am not sure that BigTIFF solves any problem with speed directly, you might want to check out this workflow.

Otherwise I can only recommend using aicspylibczi (based on our libCZI C++ library), which allows you to read also mosaic CZIs very efficiently.

sebi (from ZEISS)

2 Likes

Hello @sebi06,

I am talking particularly about exporting a CZI file as a BigTiff. I have to admit I have little experience using the ZEN software but I have been told that when performing this task for +30GB images this could take an hour or more for some images. I would have to follow up with the lab technician to verify my statement.

Using the czifile package, I have seen that converting a 30GB CZI image into BigTiff can take about 3-5 minutes. Of course this depends on the resources available in your workstation.

I will take a look at your workflow and very much appreciate your response. This community is great and I have been digging around posts quite a lot lately.

Regards,
-Frank

1 Like

Hello @nheathpatterson ,

Thank you for confirming my suspicion. I will follow up with lab technician.

Kind Regards,
-Frank

I can confirm that TIFF export from ZEN is awfully slow, although it seems to have gotten better over the years. This was one reason for developing the czifile conversion script for our lab.
Maybe you could share some information about your files, e.g. from the ZEN info tab? Are the files using compression, Airy scanning, scenes, or multi-resolution?
I haven’t worked on the czifile package for some years. There are some known issues with multi-resolution, multi-scene files. It’s probably better not to use czifile for converting those files.

1 Like

I will try what I can find out why writing BigTIFF in ZEN might be slow. (it is not really what I am working on…)

More important is the question why there is the to convert the CZI. Maybe three alternative solutions. I use aicspylibCZI heavily to read CZI directly.

In case I sounded harsh, I actually think favorably of ZEN software. And the concise CZI specification made it relatively easy to access information in the files (as compared to other file formats) even before libCZI. For our lab, LibCZI came too late and the GPL license does not allow to distribute binaries with BSD or closed source software. Last time I used libCZI, it did not allow to access FCS data without solid understanding of C++ and the CZI format.

All fine, I know that Tiff export is probably not the core strength of our software :unamused:.

But 5min vs 1-2 hours sounds not OK to me.

Sidenote: What other license do you think libCZI should have?

To be useful in the scientific Python ecosystem, it would need to be BSD, MIT, or Apache. MPL-2 (Mozilla Public License) is probably the most restrictive license that is still acceptable. Personally I’m a big fan of the terms, which roughly summarise as: “If you modify the libCZI code, you need to make those modifications public. If you use libCZI or distribute it, only the libCZI bits need to be open.” This is in contrast to BSD/MIT/Apache which allow downstream libraries to do pretty much whatever (including making private modifications) as long as they acknowledge libCZI and don’t hold Zeiss responsible for any damages.

2 Likes