How to calculate features of benign images?

2 次查看(过去 30 天)
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!

回答(1 个)

Rohit
Rohit 2023-4-25
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.

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by