Clear Filters
Clear Filters

How can I calculate the area of white pixels of binary image in mm2

8 views (last 30 days)
I need to find the size of tumor,that is white pixels of a binary image.I used the following equation to calculate the number of white pixel in my image.
Number of white pixels= int2str(nnz(binarized_img));
Now i have the count of white pixels,how can i find out the size of white pixels using this count? I have already referred this link, but i didn't understand it properly.In my case,i have to find the size of tumor,how can I do it with the number of white pixels that I have now.

Accepted Answer

Walter Roberson
Walter Roberson on 13 Sep 2016
You need to find out how big one pixel is, in appropriate units, and then multiply by the number of pixels you have identified.
If you are working with a JPEG image, chances are that you will not have accurate information stored in the original file necessary to calculate the real-world size of the pixels. If you are using something designed specifically as a scientific instrument, then the information might be there in a JPEG image. Also, some models of high-end cameras store auto-focus distance and aperture information that can be used to estimate real-world sizes -- for example not even all Canon DSLRs will have that information.
Note: the "Resolution" EXIF information that is stored with JPEG images is more likely to be garbage than not.
If you are working with an image that was originally recorded directly as a TIFF or PNG file, the probability goes up that meaningful information is stored with the file.
If you are working with an image that was originally recorded as a DICOM image, then chances are quite good that the DICOM headers have the detailed information you need to calculate the pixel area.
  12 Comments
Walter Roberson
Walter Roberson on 1 Jan 2018
Revati shiudkar:
DICOM PixelSpacing related values are in mm (millimetres) so area would be in mm^2

Sign in to comment.

More Answers (1)

nehad mohamed
nehad mohamed on 7 Jan 2021
I want a tool like a ruler to measure distances in dicom images. In cm. using matlab

Categories

Find more on DICOM Format in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!