이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
reference to non-existent field solidity
조회 수: 6 (최근 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 (한국어)