Apply cellpose to RGB images?

8 Ansichten (letzte 30 Tage)
Ashley
Ashley am 7 Jul. 2025
Bearbeitet: Cris LaPierre am 10 Jul. 2025
I'm trying to finetune cellpose for nuclear segmentation of histology images in MATLAB R2025a. I am able to train the model using RGB tiles and corresponding 2D mask images, but am unable to sample RGB images using segmentCells2D().
Training code:
trainCellpose(pthTraining, ...
OutFile,...
PreTrainedModel="nuclei", ...
MaxEpoch=100, ...
ImageSuffix="_im", ...
LabelSuffix="_mask", ...
GPUBatchSize=24);
% load the model
cell_size=17;
cp=cellpose(Model=OutFile);
For im = [256x256x3 uint8], this code succeeds:
labels=segmentCells2D(cp,rgb2gray(im),ImageCellDiameter=cell_size);
While this code returns an error:
labels=segmentCells2D(cp,im,ImageCellDiameter=cell_size);
Error using cellpose/segmentCells2D
labels=segmentCells2D(cp,im,ImageCellDiameter=cell_size);
^^
Invalid argument at position 2. Value must be a matrix."
Question: Can I segment RGB images with cellpose in Matlab? The color in histology images is important in distinguishing blue nuclei from non-nuclear round objects, such as shadows or red blood cells.

Akzeptierte Antwort

Cris LaPierre
Cris LaPierre am 7 Jul. 2025
Bearbeitet: Cris LaPierre am 10 Jul. 2025
It looks like segementCells2D only supports intensity images.
See the image input description here in the doc.
  1 Kommentar
Cris LaPierre
Cris LaPierre am 7 Jul. 2025
Also, from the Getting Started with Cellpose page: "Cellpose models expect a 2-D intensity image as input. If you have an RGB or multichannel image, you can convert it to a grayscale image by using the im2gray function, or extract a specific color channel by using the imsplit function."

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Cellpose for Microscopy Segmentation finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by