Closed CisnerosFernandez closed 2 years ago
Hi @CisnerosFernandez, sorry for the delay, I am not sure why this would be. It could have been an old bug that is since resolved. If you would like me to try it out, please post a link to a test volume or send it to kcutler@uw.edu.
Thank you very much, I send you a mail to kcutler@uw.edu with a test volume then.
Hi again,
I also upload the link to the folder in case my mail does not reach you. Thank you very much.
https://drive.google.com/file/d/1qLsh0Dwbffxvk5sXtaeBFlheQexRPBwd/view?usp=sharing
Hey @CisnerosFernandez, I have run the cyto2_omni
model on your data and it seems to be working well for me both in 2D and 3D. I also was getting no masks at first, but that was because my mask_threshold
value was too low (-5) causing under-segmentation and huge masks that were thrown out. The default of -1 works well for this model and your data.
I'll send you the notebook I used, but for everyone reading this in the future, here are the key lines of code:
import numpy as np
import tifffile
from cellpose import models, core
im = tifffile.imread('Source3D/Image3Original.tif')
diam_mean = 0 # 0 or 30 doesn't really matter here, as the nuclei really are close to 30 so rescaling does not do much
use_GPU = core.use_gpu()
print('>>> GPU activated? %d'%use_GPU)
model = models.CellposeModel(gpu=use_GPU, model_type='cyto2_omni', net_avg=False,
diam_mean=diam_mean)
model.pretrained_model,model.nclasses,model.diam_mean
slc_crop = (slice(None),)+tuple([slice(-300,-100)]*2) # cropped image for testing
# slc_crop = slice(None) # full image takes a while
imcrop = im[slc_crop]
mask_threshold = -1 ###this was critical
diam_threshold = 12
net_avg = 0
cluster = 0
verbose = 1
resample= 1
rescale = None
tile = 0
chans = [1,2] #cyto2_omni
# chans = [2,1] #cyto2
compute_masks = 1
omni=1
do_3D = True
masks, flows, styles = model.eval(imcrop,channels = chans,rescale=rescale,mask_threshold=mask_threshold,net_avg=net_avg,
transparency=True,flow_threshold=0.,omni=omni,resample=resample,verbose=verbose,
diam_threshold=diam_threshold,cluster=cluster,tile=tile,
compute_masks=compute_masks, do_3D=do_3D)
import napari
viewer = napari.view_image(imcrop[...,1], name='cells')
viewer.add_labels(np.flip(masks,axis=0), name='labels')
Hello,
I was trying to perform cellpose in 3d images (of muscle tissue undergoing regeneration) and I tried to use the cytoplasm2 Omnipose model. It seems that the flows would provide a very good estimate of the mononucleated cells however it returned an empty mask. Do you know why this may be happening.
I tried to perform the prediction with cytoplasm2 model and I could run the protocol until the end, however seeing the flows it seems that cytoplasm2 Omnipose may work better with my sample.
Thank you very much,
Andrés