cellpose icon indicating copy to clipboard operation
cellpose copied to clipboard

cellpose on large .tif images (1GB-10GB)

Open Nespresso2000 opened this issue 10 months ago • 4 comments

Hi,

I want to use cellpose on some rather large .tif files of sizes ranging from 1GB-10GB. They are 2-d RGB images. I have a Tesla T4 GPU and 32GB RAM. Following #356 and #244 I first used openslide to convert my image and write them on my disk as zarr arrays; so now, I have a folder of zarr arrays corresponding to _one _ image. To be honest, I am not able to understand exactly whats going on in this new piece of code and would appreciate a small explanation of the following points:

  1. Does this even work for 2d images? or only 3d? If not, is there anything I can do to process such large 2d images? Before finding this, I saw https://forum.image.sc/t/loading-whole-slide-image-and-running-cellpose-in-python/69992/7 according to which I'd need an obscene amount of RAM which is not possible.
  2. What does the block_size parameter mean in distributed_eval?
  3. How do I access / see what the segmented image looks like after? I could do that following the docs when I was saving a .npy file but I'm not able to find similar documentation

Apologies in advance if the questions are obvious but any help is appreciated!

Nespresso2000 avatar Apr 16 '24 09:04 Nespresso2000

  1. I don't suppose there is any difference between 3D and 2D. Take a look at this link on how to use Cellpose on Dask arrays.

  2. I don't know exactly what you mean by block_size or distributed_eval.

  3. The method mentioned in the above link results in a dask array of labels. You can view separate segmentation chunk results by iterating through them and computing them.

zsamadi avatar May 09 '24 19:05 zsamadi

Hello! @Nespresso2000 we just released a package for large-scale segmentation with cellpose (2D/3D images). Still in development but it'd be nice if you give it a shot. Unfortunately, you'd have to convert your data to OMEZarr.

camilolaiton avatar May 20 '24 23:05 camilolaiton

Hello! @Nespresso2000 we just released a package for large-scale segmentation with cellpose (2D/3D images). Still in development but it'd be nice if you give it a shot. Unfortunately, you'd have to convert your data to OMEZarr.

Hi @camilolaiton I am interested in trying this out! How would I go about testing this? I have large datasets for Cellpose segmentation saved as zarr arrays. Do you have a tutorial on how to run your package in python? Thank you.

Eddymorphling avatar Jun 05 '24 23:06 Eddymorphling

Hi @Eddymorphling, not yet. I'll include a notebook with examples this week. In the meantime, you could take a look at this function main. We are using the OME-NGFF convention for the zarr (OME-Zarr) to get the image metadata (e.g., resolution).

Please, let me know if you have following questions. Make sure to properly set the parameters for the machine you're using.

camilolaiton avatar Jun 09 '24 18:06 camilolaiton