How to automatically identify abnormal regions and highlight boundaries in a different color

1 view (last 30 days)
I have a set of images for classification.
For this I have already extracted features from which the images have been already segmented and divided into four quadrants.
Now I want to use this feature values to idenifty the quadrants with the specified value ranges given below.
Here is my code;
% Read in the images.
I= imread ('nhimg-*.jpg';
% Segmentation of the ROI.
[S] = LungMask (I);
% Dividing Segmented ROI into quadrants.
[RUQ, LUQ, RLQ, LLQ] = crop(S);
% Extracting Features from each quadrant of the segmented images.
[Stats1, MaxProb1, Entropy1] = Prop(RUQ)
[Stats2, MaxProb2, Entropy2] = Prop(LUQ)
[Stats3, MaxProb3, Entropy3] = Prop(RLQ)
[Stats4, MaxProb4, Entropy4] = Prop(LLQ)
.
.
.
.
Now for this program I need to add the below feature ranges for each qaudrant to check whether the qaudrant features are in the defined range and if so mark the border of the respective quadrant in red color and create a label as "Abnormal".
These are the feature ranges;
Feature RUQ LUQ RLQ LLQ
Contrast 18-150 50-70 7-157 21-179
Correlation 0.97-0.99 0.97-0.99 0.98-1.00 0.97-0.99
Energy 0.30-0.54 0.32-0.48 - -
Etropy 2.79-3.76 2.85-3.94 - -
Max.Prob 0.58- 0.84 - - -
When the images are processed with this I need a final output like this image attached.
Can you help me to automize this existing code to get the output I need? Thanks in advance.
  5 Comments

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 27 Mar 2020
You have to help us first. You forgot to attach 'nhimg-*.jpg' plus you forgot to attach the code for your LungMask(), crop(), and Prop() functions. What can we do without all those? Anyway, did you try subplot()M title(), and xlabel()?
subplot(2, 2, 1);
imshow(RUQ);
title('RUQ', 'FontSize', 15);
if IsAbnormal(RUQ) % You need to write this function
xlabel('Abnormal', 'FontSize', 15)
end
subplot(2, 2, 2);
imshow(LUQ);
title('LUQ', 'FontSize', 15);
if IsAbnormal(LUQ) % You need to write this function
xlabel('Abnormal', 'FontSize', 15)
end
subplot(2, 2, 3);
imshow(RLQ);
title('RLQ', 'FontSize', 15);
if IsAbnormal(RLQ) % You need to write this function
xlabel('Abnormal', 'FontSize', 15)
end
subplot(2, 2, 4);
imshow(LLQ);
title('LLQ', 'FontSize', 15);
if IsAbnormal(LLQ) % You need to write this function
xlabel('Abnormal', 'FontSize', 15)
end
  13 Comments
Image Analyst
Image Analyst on 30 Mar 2020
No. Why would you want it to do that? First of all, the <= or >= evaluate to 0 or 1, so that means you'd be constructing a vector going from the first value to the second value in steps of 1. See what happens when you do that:
>> 0:0
ans =
0
>> 0:1
ans =
0 1
>> 1:0
ans =
1×0 empty double row vector
>> 1:1
ans =
1
It just does not make sense to do it.
Nileema Abedeera
Nileema Abedeera on 30 Mar 2020
Yes now I understand.
I was thinking as this 18 and 146 defines the range of values I need to consider and that's why I was worrying if it works.
Thank you so much for the explanation.

Sign in to comment.

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing 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!