Is it possible to the number of pixels in a binary image?

I have color cell image (red is cytokleton and black is bckground) which I make it to binary then skletonize and mask it.
I was wondering if I can measure the pixel number of the image? I need to find how many red pixels I have in a cell. No. of pixels per cell surface area.
I attached the original and skletonized image.
Original image:

Skletonized image:
minerr black white.tif (4.8 MB)

then masked image:

minerr black white masked.tif (4.8 MB)

Hi @Zeynab_Mousavi ,

If you want to measure the area of the cell, you can try to threshold and use analyze particles
Here you can find an example.

By the way, if you are interested in the area, I didn’t get why you use skeletonize :sweat_smile:

Best regards,


@romainGuiet No I dont want the area. I want the pixel intensity. In the first image that I added, the reds are cell cytoskleton and blacks are backgorund (blacks are not part of cell). I want to count the number of pixels of reds.

If you just want the number of red pixels then go with the way @romainGuiet suggested. Pixel-Intensity means a different thing.

  1. Convert to grayscale

  2. Set a threshold of 0, 0 to include everything that isn’t total black

  3. Invert

  4. Analyze Particles

  5. Select largest particle from the results table (you can do this with excel etc. also)

    setThreshold(0, 0);
    setOption(“BlackBackground”, false);
    run(“Convert to Mask”);
    run(“Analyze Particles…”, " show=Outlines display exclude clear");

1 Like

@cripcate what does pixel intensity mean? and what does pixel number mean?

Veteran image analysts please correct me there if im wrong.:

Pixel intensity is usually a variable of color or brightness. In grayscale images more intense pixels are whiter ones. In your image more intense pixels are “redder” ones (brighter, more saturated). So when you say you want to get the pixel intensity you would rather mean the distribution of intensities, which is a Histogram (Analyze -> Histogram).

What i understand you want is to get the number of red pixels, which would mean the area of the cytoskeleton. The workflow to achieve this is generally generating a binary image (Pixels you want to analyze (cytoskeleton) are white, background is black). For that you can threshold or segment the image in another way (weka segmentation for example). In this binary image you use Measure -> Analyze Particles to get Area, Perimeter, Width, Length, whatever you want (Use Analyze -> Set measurements to determine which parameters to measure).