reference to non-existent field solidity
1 次查看(过去 30 天)
显示 更早的评论
hi I have error message in matlab 2017
reference to non-existent field 'solidity'
Error in Tumor(line denisty={stats.solidity};
how can I add reference
what did i miss ?
采纳的回答
Walter Roberson
2019-4-17
If stats was created by calling regionprops, then the field name should be Solidity with a capital S.
13 个评论
Mohamed Nasr
2019-4-17
you mean I will edit
stats.solidity
to
stats.Solidity with Capital S Letter on all my code ?!
Mohamed Nasr
2019-4-17
编辑:Mohamed Nasr
2019-4-17
clear clc img=imread('brain1.jpg'); img1=rgb2gray(img); bw=imbinarize(img1 , 0.7); %Thresholding value if less than 0.7 color is black ,if morr than 0.7 color is white label=logical(bw); %area of tumor stats =regionprops(label,'Solidity','Area'); %healthy region denisty={stats.Solidity}; area={stats.Area}; high_dense_area = denisty>0.5 ; %Area of tumor max_area=max(area(high_dense_area)); %max area tumor_label=find(area==max_area); %place of tumor tumor = ismember(label,tumor_label); s=strel('square',5); tumor=imdilate(tumor,s); figure; subplot(1,3,1);imshow(img);title('Brain' ); subplot(1,3,2);imshow(tumor);title('Tumor alone' );
Walter Roberson
2019-4-17
I had to make some guesses about exactly where the line breaks are when I fixed the format of your code to make it readable.
Mohamed Nasr
2019-4-17
Solidity error was solved thanks alot but there still another error I copied all my code to see it This is the last error
Mohamed Nasr
2019-4-17
Undefined operator '>' for input arguments of type 'cell'.
Error in Tumor (line 10) high_dense_area = denisty > 0.5 ; %Area of tumor
Mohamed Nasr
2019-4-17
clear
clc
img=imread('brain1.jpg');
img1=rgb2gray(img);
bw=imbinarize(img1 , 0.7); %Thresholding value if less than 0.7 color is black ,if morr than 0.7 color is white
label=logical(bw); %area of tumor
stats =regionprops(label,'Solidity','Area'); %healthy region
denisty={stats.Solidity};
area={stats.Area};
high_dense_area = denisty > 0.5 ; %Area of tumor
max_area=max(area(high_dense_area)); %max area
tumor_label=find(area==max_area); %place of tumor
tumor = ismember(label,tumor_label);
s=strel('square',5);
tumor=imdilate(tumor,s);
figure;
subplot(1,3,1);imshow(img);title('Brain' );
subplot(1,3,2);imshow(tumor);title('Tumor alone' );
sorry I paste the code from mobile now this is the code as matlab
[stats.Area] and [stats.Solidity] are Capital Letters now but still have the next error
Undefined operator '>' for input arguments of type 'cell'.
Error in Tumor (line 10)
high_dense_area = denisty > 0.5 ; %Area of tumor
Walter Roberson
2019-4-17
You did not change the { } to [ ] in assigning to denisty and area
denisty = [stats.Solidity];
area = [stats.Area];
Mohamed Nasr
2019-4-17
thank you the code without any errors now but the result for processing this brain tumor image is a black image
更多回答(2 个)
Mohamed Nasr
2019-4-18
clear all
clc
close all
img=imread('brain2.jpg');
bw=imbinarize(img , 0.9); %Thresholding value if less than 0.7 color is black ,if morr than 0.7 color is white
label=logical(bw); %area of tumor
stats =regionprops(label,'Solidity','Area'); %healthy region
denisty=[stats.Solidity];
area=[stats.Area];
high_dense_area = denisty > 0.5 ; %Area of tumor
max_area=max(area(high_dense_area)); %max area
tumor_label=find(area==max_area); %place of tumor
tumor = ismember(label,tumor_label);
s=strel('square',4);
tumor=imdilate(tumor,s);
figure;
subplot(1,3,1);imshow(img,[ ]);title('Brain' );
subplot(1,3,2);imshow(tumor,[ ]);title('Tumor alone' );
[B,L]=bwboundaries(tumor,'noholes');
subplot(1,3,3);imshow(img,[])
hold on
for i=1:length(B)
Plot(B{i}(:,2),B{i}(:,1),'Y','lenewidth',1.45)
end
title('Detected image')
hold off
this is my code dosenot run correctly what i miss in this code and it is one of optimal image attach the vidio with it
https://www.youtube.com/watch?v=UeFRo7uALhM&fbclid=IwAR1JmjjnCB3rnLYSiWwIQ1inxVJPA8WpwVUCJ-ncEy5MpKzWBHHe9jEWVjs
13 个评论
Walter Roberson
2019-4-18
You have
label=logical(bw);
The maximum possible value for that array is 1, corresponding to true.
You calculate tumor_label as the indices of (all of) the areas that have (the same) maximum area. It will not usually be 1.
You have
tumor = ismember(label, tumor_label)
remember that label is a bunch of true and false values, so it is likely that none of them are going to equal the index(es) you found.
You should consider
label = bwlabel(logical(bw));
Mohamed Nasr
2019-4-20
I change label=ligical(bw); To label = bwlabel(logical(bw)); And i have this error message
Mohamed Nasr
2019-4-20
Expected input number 1, BW, to be two-dimensional.
Error in bwlabel (line 65)
validateattributes(BW, {'logical' 'numeric'}, {'real', '2d', 'nonsparse'}, ...
Error in tumor2 (line 6)
label = bwlabel(logical(bw)); %area of tumor
Mohamed Nasr
2019-4-20
its work on only one picture even after the last change to the code
bw=imbinarize(img,0.9); %Thresholding value if less than 0.7 color is black ,if morr than 0.7 color is white
if i change 0.9 to 0.7 or less or more it doesnt work at all on any picture
i didnt get clearly what you mean but i think you explain that logical value should be only one
of two values true or false 1 or 0 yes or no
and that make my ability to but values more than 1 is none
so how could i solve this mess on my code i have to explain this code with many other issues
in the university to my prof and many things depend on it when it work on my reseach
i realy want the code work correctly on all tumor photos and i want understand it
Mohamed Nasr
2019-4-20
this link contain all the original photos that was tested by the programer on the video
you should found
Mohamed Nasr
2019-4-20
bw=imbinarize(img,0.7); %Thresholding value if less than 0.7 color is black ,if morr than 0.7 color is white
I change (img,0.9) to (img,0.7)
and change denisty to 0.2
high_dense_area = denisty > 0.2 ; %Area of tumor
and i got the results for 4 photos work correctly
Mohamed Nasr
2019-4-20
Mohamed Nasr
2019-4-21
Yes I still dont know why this code didnt work with all brain tumor images 20 image only 6 work and other images when I run the code I got this error message
Mohamed Nasr
2019-4-21
Expected input number 1, BW, to be two-dimensional. Error in bwlabel (line 65) validateattributes(BW, {'logical' 'numeric'}, {'real', '2d', 'nonsparse'}, ... Error in tumor2 (line 6) label = bwlabel(logical(bw)); %area of tumor
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)