# 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)

minerr black white masked.tif (4.8 MB)

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

Best regards,

Romain

@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)

run(â€ś8-bitâ€ť);
run(â€śThresholdâ€¦â€ť);
setThreshold(0, 0);
setOption(â€śBlackBackgroundâ€ť, false);
run(â€śCloseâ€ť);
run(â€śInvertâ€ť);
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).

I had a question regarding pixel intensity in binary images versus grayscale images

I want to measure the pixel intensity of an image of a cell nucleus. The image was originally grayscale but I thresholded the image to get rid of background noise, so the image is now binary. Would it make a difference if I measure the pixel intensity in that binary image instead of measuring in grayscale?

HI @alibaseer ,

You might end up with a binary values then, in Fiji your nuclei will be 255.

Using the binary we usually get Regions Of Interest (ROIs) and use them to measure on the grayscale image.

You can have a look here and here to read more about the topic.

Best,

Romain