Python -- Extracting Features from Very Large TIFFs: Help!

Hello,
I have some very large TIFFs (the smallest is ~80000x80000 pixels) of scanned cytology slides, and my goal is the automated extraction of cytometric features. This project must scale eventually, and so cannot require manual manipulation of each slide.
My language of choice is Python, but so far I’ve had limited success with the libtiff and OpenCV libraries or with the tifffile module due to the size of the images.
Even with the Fiji GUI I cannot open these images despite selecting “use virtual stack” or “crop on import.” I receive a Java error saying the array size is too large.
I’m unsure of how to proceed efficiently – but some important questions I have regard the basic structure of the files (series vs. planes vs. channels, etc.), how to scan over the image to perform segmentation, and how to get it all into Python. Is FIJI the correct tool for me?

Thanks in advance!

Cellprofiler may be a good software choice; I haven’t used it, but it’s specifically meant for doing cellular analysis and feature extraction. It has ways of integrating with most software, including python and Fiji.

Fiji has a 2 gigapixel display limitation on images. It should be able to load the images into memory, but it won’t be able to put such large images into a window. That said, you should be able to open your 8000x8000 image without trouble, as it is only ~64 megapixels. Does that fail too?

It does fail – I see that I mistyped the resolution above. My smallest sample image looks like it has 5 “series” of the same image for the importer to choose from, and the largest resolution is ~80,000 x 80,000. The smaller series open with no problem, but I would eventually like to calculate features from the highest resolution version.
I’ll look into Cellprofiler!

QuPath is also a tool of choice for cytology/histology ie when working with large “full slide” images, and supports scripting languages (Groovy and probably jython…) like Fiji.

I haven’t used it neither but you can have a look in the dedicated forum section for more help :wink:

1 Like

If you want to use python, take a look at openslide, which allows you to (quickly) open the different resolutions of your image, or query arbitrary parts of the full-resolution image.

Maybe you can achieve what you want by viewing the low-resolution images, but analysing the whole image in “chunks”?

Failing that, QuPath is very good for a lot of “standard” analyses.

1 Like

Openslide is absolutely terrific. Within a few minutes I was sliding across my image with an arbitrary window size. Thank you!

1 Like