how to find the area

4 views (last 30 days)
andhavarapu lokesh
andhavarapu lokesh on 30 Dec 2016
Commented: Star Strider on 30 Dec 2016
iam trying to find the area of circular ring which is short axis image of myocardial spect image where i want to find the volume of the white area can any one tell how to find the area what happens if we use bwarea command in matlab

Answers (3)

Image Analyst
Image Analyst on 30 Dec 2016
bwarea() does NOT give the same area as a simple count of pixels, like sum() and regionprops() give you. It weights the edge pixels according to their neighbors, so like an edge slanted at 45 degrees might give half a pixel instead of a full pixel. There are different weights for different edge orientations. The bwarea documentation explains it all.
bwarea estimates the area of all of the on pixels in an image by summing the areas of each pixel in the image. The area of an individual pixel is determined by looking at its 2-by-2 neighborhood. There are six different patterns, each representing a different area:
  • Patterns with zero on pixels (area = 0)
  • Patterns with one on pixel (area = 1/4)
  • Patterns with two adjacent on pixels (area = 1/2)
  • Patterns with two diagonal on pixels (area = 3/4)
  • Patterns with three on pixels (area = 7/8)
  • Patterns with all four on pixels (area = 1)
Keep in mind that each pixel is part of four different 2-by-2 neighborhoods. This means, for example, that a single on pixel surrounded by off pixels has a total area of 1.
You have to decide if you want that or if you want a simple count of pixels.
  1 Comment
andhavarapu lokesh
andhavarapu lokesh on 30 Dec 2016
i want to find the volume for that i need area means what should i use please tell iam not familiar

Sign in to comment.


John D'Errico
John D'Errico on 30 Dec 2016
Edited: John D'Errico on 30 Dec 2016
Why not apply common sense? Count the number of white pixels. If you have some tiny amount of white pixels that are not connected to the main region of interest, then remove them first.
Since this is a black and white image, then 1 is white, 0 is black.
sum(double(im(:)))
Since each pixel has an "area" of 1, then the sum is just the area you want.
  1 Comment
andhavarapu lokesh
andhavarapu lokesh on 30 Dec 2016
sir bwarea means sum of counts both are same or not

Sign in to comment.


Star Strider
Star Strider on 30 Dec 2016
Your ‘.png’ image may be ‘binarised’, but it contains 3 channels. Choose one of them to use with bwarea:
[Img,Map] = imread('andhavarapu lokesh Capture9.png');
MyocardArea = bwarea(Img(:,:,1));
figure(1)
for k1 = 1:3
subplot(1,3,k1)
imshow(Img(:,:,k1))
end
MyocardArea =
20899
  2 Comments
andhavarapu lokesh
andhavarapu lokesh on 30 Dec 2016
will the bwarea give the area of white pixels or total are including black pixels also
Star Strider
Star Strider on 30 Dec 2016
The bwarea function calculates the area of each pixel in a 2-by-2 neighborhood, according to the documentation.
If you just want the numbers of white and black pixels with a threshold of 1 for your image, see if this does what you want:
Imgv = reshape(Img(:,:,1), [], 1);
Black_pxl = sum(Imgv == 0)
White_pxl = numel(Imgv)-Black_pxl
MyocardArea = bwarea(Img(:,:,1))
Black_pxl =
106923
White_pxl =
20871
MyocardArea =
20899
This is a rather simple way of calculating it, but may give you what you want.

Sign in to comment.

Categories

Find more on Images in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!