How to calculate features of benign images?

The provided code in 'GehtMitAllenMasks.m' works for images of type 'malignant' but not for images of type 'benign' (function 'calculateFeatures').
I tried doing it like this:
oImageData = ImageData('Path', 'benign')
glcmFeatures = GehtMitAllenMasks(oImageData)
Tfeatures = glcmFeatures.calculateFeatures
Then I get this error:
Unable to perform assignment because the size of the left side is
1-by-1 and the size of the right side is 0-by-0.
Error in GehtMitAllenMasks/calculateFeatures (line 44)
featureData(objIdx,14) = sP(1).Circularity;
Since this is for a schoolproject that's due in a few days I would appreciate fast answers.
Thanks in advance!

Answers (1)

Hi Kevin,
Upon investigating the code that you have shared, it seems that we can get features of images of type 'malignant' but in case of ‘benign’ images, there is some error.
The reason for this error is ‘regionprops’ function which finds features for 2-D images but there is an image in dataset whose mask is 3D and so some features like ‘Circularity’ are empty and thus gives error in assignment.
Some possible ways to solve this error can be:
  • Convert 3D mask to 2D by reshaping or grayscaling
  • Using regionprops3 to work with 3D Images
You can look up this MathWorks documentation links for more reference:
regionprops function:
image conversion to 2D:
For debugging your MATLAB code and see where exactly is error, you can try setting breakpoints.

Products

Release

R2022a

Asked:

on 19 Mar 2023

Answered:

on 25 Apr 2023

Community Treasure Hunt

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

Start Hunting!