MouseLand / cellpose

a generalist algorithm for cellular segmentation with human-in-the-loop capabilities
https://www.cellpose.org/
BSD 3-Clause "New" or "Revised" License
1.38k stars 393 forks source link

Use mcmicro platform to apply multiple membrane markers for cellpose segmentation #644

Closed nancyliy closed 1 year ago

nancyliy commented 1 year ago

Describe the bug I was using mcmicro platform to run cellpose segmentation on a multiplexed image and I supplied the following command hoping to apply 8 different membrane markers (channel 23 36 59 27 18 52 56 39) for cell segmentation : Command executed:

cellpose --channel_axis 0 --save_tif --savedir . --image_path pilot_2.ome.tiff --pretrained_model cyto --chan 1 --chan2 23 36 59 27 18 52 56 39 --save_png

Run log I experienced the following error:

cellpose: error: unrecognized arguments: 36 59 27 18 52 56 39

I assume I don't fully understand the usage of --chan and --chan2 yet. My current understanding is that for a multiplexed image (68 channels total in my case), I could specify which channel to use for nuclear segmentation (--chan) and which channels to use for membrane segmentation (--chan2). Please kindly advice the correct usage of command line arguments to achieve segmentation based on multiple channels. Thanks.

carsen-stringer commented 1 year ago

You need to run each channel one at a time, e.g. for nuclear:

python -m cellpose --channel_axis 0 --save_tif --savedir . --image_path pilot_2.ome.tiff --pretrained_model cyto --chan 1  --save_png

then for membrane, whatever channel you have for that (you can add the nuclear to help the segmentation, that's what the second chan2 is for)

python -m cellpose --channel_axis 0 --save_tif --savedir . --image_path pilot_2.ome.tiff --pretrained_model cyto --chan 23 --chan2 1 --save_png

if there's another channel you want to segment, you would do that next.

I'm not sure how the mcmicro platform works, but these are all commands to run in the command line in a conda environment