現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
how to identify high-intensity pixel ?
4 ビュー (過去 30 日間)
古いコメントを表示
marwa za
2017 年 10 月 4 日
Can anyone help me to identify high-intensity regions for segmenting the tumor( image of the brain as the following figure)
回答 (1 件)
Image Analyst
2017 年 10 月 4 日
編集済み: Image Analyst
2017 年 10 月 4 日
Try thresholding. See attached demo.
Also see my Image Segmentation Tutorial: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862&sort=downloads_desc
28 件のコメント
marwa za
2017 年 10 月 4 日
I tried with your code, but it shows me the following error: Undefined function 'bwareafilt' for input arguments of type 'double'. Error in bl2 (line 152) binaryTumorImage = bwareafilt(binaryImage, 1);
Image Analyst
2017 年 10 月 5 日
You have an old version of MATLAB. Just replace the line with something like
binaryTumorImage = bwareaopen(binaryImage, 100);
This will possibly get you multiple blobs though, instead of just one. However you can increase the second argument to make it big enough so that only your largest blob gets extracted.
marwa za
2017 年 10 月 12 日
thanks, please tell me what is called the method you used in the step of extracting the skull
Image Analyst
2017 年 10 月 12 日
You can call it "skull stripping" overall. It uses "thresholding" as one of the main steps of it.
marwa za
2017 年 10 月 15 日
please can you give me the the explanation of the part " find tumor boundaries ", really I want in my work.
Image Analyst
2017 年 10 月 15 日
At that point in the code, there is already a binary image that says where the tumor is and isn't. That part of the code simply calls bwboundaries() to get a list of (x,y) coordinates of the outer perimeter of the binary blob that indicates the tumor.
marwa za
2017 年 10 月 16 日
for the part (Threshold the image) , if we change the image we must also change the threshold value, can you give me a solution where we don't need to change each time the threshold value.
Image Analyst
2017 年 10 月 16 日
Sorry, no. If the image changes, you must compute a new threshold value, and you must come up with an algorithm for that, or you can do it interactively using my visual thresholding app: http://www.mathworks.com/matlabcentral/fileexchange/29372-thresholding-an-image
marwa za
2017 年 10 月 16 日
can you help me, which function allows to calculate the low and the high value of the threshold (histogram)
like the following histogram
Image Analyst
2017 年 10 月 16 日
Well one way might be to zero out the counts from 0 to 50 or so. Then find the highest peak. Then find the lowest point from that peak to the right side. Like
counts(1:50) = 0;
[maxValue, indexOfMax] = max(counts);
counts(1:indexOfMax) = maxValue;
[minValue, threshold] = min(counts);
Image Analyst
2017 年 10 月 17 日
編集済み: Image Analyst
2017 年 10 月 17 日
What is "exuction"?
DON'T name your function hist. There is a built in function by that name that you should not destroy.
Image Analyst
2017 年 10 月 18 日
Try this:
clc; % Clear command window.
clear; % Delete all variables.
close all; % Close all figure windows except those created by imtool.
imtool close all; % Close all figure windows created by imtool.
workspace; % Make sure the workspace panel is showing.
fontSize = 25;
grayImage=imread('2.jpg');
% Get the dimensions of the image.
% numberOfColorChannels should be = 1 for a gray scale image, and 3 for an RGB color image.
[rows, columns, numberOfColorChannels] = size(grayImage);
if numberOfColorChannels > 1
% It's not really gray scale like we expected - it's color.
% Use weighted sum of ALL channels to create a gray scale image.
grayImage = rgb2gray(grayImage);
% ALTERNATE METHOD: Convert it to gray scale by taking only the green channel,
% which in a typical snapshot will be the least noisy channel.
% grayImage = grayImage(:, :, 2); % Take green channel.
end
% Display the image.
subplot(2,2,1);
imshow(grayImage);
title('Original Gray Scale Image', 'FontSize', fontSize);
% Display the histogram so we can see what gray level we need to threshold it at.
subplot(2,2,3:4);
hObj = histogram(grayImage, 256)
grid on;
title('Histogram', 'FontSize', fontSize, 'Interpreter', 'None')
% Find threshold.
counts = hObj.Values;
counts(1:50) = 0;
[maxValue, indexOfMax] = max(counts);
counts(1:indexOfMax) = maxValue;
[minValue, threshold] = min(counts)
hold on;
line([threshold, threshold], ylim, 'Color', 'r', 'LineWidth', 2);
xticks(0:20:255);
% Binarize image
binaryImage = grayImage > threshold;
subplot(2,2,2);
imshow(binaryImage);
title('Binary Image', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0, 0.04, 1, 0.96]);
marwa za
2017 年 10 月 18 日
thank you, it displays the high and low threshold value, just it displays the following error: How to correct it please :
Undefined function or variable 'xticks'.
Error in newhist (line 36)
xticks(0:20:255);
Image Analyst
2017 年 10 月 18 日
Just remove that line completely, or else upgrade your MATLAB. It came along in a newer version of MATLAB than you have.
Image Analyst
2017 年 10 月 31 日
Threshold the skullFreeImage instead of the original gray scale image. Then use the mask to erase everything from the image except the tumor.
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures if you have the Image Processing Toolbox.
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
grayImage=imread('2.jpg');
[rows, columns, numberOfColorChannels] = size(grayImage);
if numberOfColorChannels > 1
grayImage = rgb2gray(grayImage);
end
%%%%%%%%%%
subplot(2,3,1);
imshow(grayImage);
title('Original Grayscale Image', 'FontSize', fontSize);
% Display the histogram so we can see what gray level we need to threshold it at.
subplot(2, 3, 2:3);
hObj = histogram(grayImage, 256)
grid on;
title('Histogram', 'FontSize', fontSize, 'Interpreter', 'None')
% Find threshold.
counts = hObj.Values;
counts(1:50) = 0;
[maxValue, indexOfMax] = max(counts);
counts(1:indexOfMax) = maxValue;
[minValue, threshold] = min(counts)
hold on;
line([threshold, threshold], ylim, 'Color', 'r', 'LineWidth', 2);
%xticks(0:20:255);
% Binarize image
binaryImage = grayImage > threshold;
subplot(2,3,4);
imshow(binaryImage);
title('Binary Image', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0, 0.04, 1, 0.96]);
%%%%%%%%%%%
% Extract the outer blob, which is the skull.
% The outermost blob will have a label number of 1.
labeledImage = bwlabel(binaryImage); % Assign label ID numbers to all blobs.
binaryImage = ismember(labeledImage, 1); % Use ismember() to extract blob #1.
% Thicken it a little with imdilate().
binaryImage = imdilate(binaryImage, true(5));
% Display the final binary image.
subplot(2, 3, 5);
imshow(binaryImage, []);
axis on;
caption = sprintf('Extraction Skull ');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
%%%%%%%%%%%
% Mask out the skull from the original gray scale image.
skullFreeImage = grayImage; % Initialize
skullFreeImage(binaryImage) = 0; % Mask out.
% Display the image.
subplot(2, 3, 6);
imshow(skullFreeImage, []);
axis on;
caption = sprintf('Gray Scale Image\nwith Skull Stripped Away');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
%%%%%%%%%%%
% Give user a chance to see the results on this figure, then offer to continue and find the tumor.
promptMessage = sprintf('Do you want to continue and find the tumor,\nor Quit?');
titleBarCaption = 'Continue?';
buttonText = questdlg(promptMessage, titleBarCaption, 'Continue', 'Quit', 'Continue');
if strcmpi(buttonText, 'Quit')
return;
end
% Now threshold to find the tumor
binaryImage = skullFreeImage > threshold;
% Display the image.
hFig2 = figure();
subplot(2, 2, 1);
imshow(binaryImage, []);
axis on;
caption = sprintf('Initial Binary Image\nThresholded at %d Gray Levels', threshold);
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
%%%%%%%%%%%
% Assume the tumor is the largest blob, so extract it
%binaryTumorImage = bwareafilt(binaryImage, 1);
binaryTumorImage = bwareaopen(binaryImage, 100);
% Display the image.
subplot(2, 2, 2);
imshow(binaryTumorImage, []);
axis on;
caption = sprintf('Tumor Alone (binary mask)');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
%%%%%%%%%%%
% Find tumor boundaries.
% bwboundaries() returns a cell array, where each cell contains the row/column coordinates for an object in the image.
% Plot the borders of the tumor over the original grayscale image using the coordinates returned by bwboundaries.
subplot(2, 2, 3);
imshow(grayImage, []);
axis on;
caption = sprintf('Tumor\nOutlined in red in the overlay');
title(caption, 'FontSize', fontSize,'Interpreter', 'None');
axis image; % Make sure image is not artificially stretched because of screen's aspect ratio.
hold on;
boundaries = bwboundaries(binaryTumorImage);
numberOfBoundaries = size(boundaries, 1);
for k = 1 : numberOfBoundaries
thisBoundary = boundaries{k};
% Note: since array is row, column not x,y to get the x you need to use the second column of thisBoundary.
plot(thisBoundary(:,2), thisBoundary(:,1), 'r', 'LineWidth', 2);
end
hold off;
% Extract the gray scale tumors alone
tumorOnlyImage = grayImage; % Initialize
% Erase everything except the tumors
tumorOnlyImage(~binaryTumorImage) = 0;
subplot(2, 2, 4);
imshow(tumorOnlyImage, []);
axis on;
caption = sprintf('Tumor only (gray scale image)');
title(caption, 'FontSize', fontSize,'Interpreter', 'None');
axis image; % Make sure image is not artificially stretched because of screen's aspect ratio.
marwa za
2017 年 11 月 22 日
please can you suggest me another example for the segmentation of brain lesions
Image Analyst
2017 年 11 月 22 日
marwa za
2017 年 11 月 22 日
thanks, I am looking for another method (uncomplicated) just to do a comparative study
Image Analyst
2017 年 11 月 22 日
Well good luck. It generally can't get any more uncomplicated than thresholding. Please take the time to understand each step and then it won't seem so complicated.
marwa za
2017 年 12 月 1 日
I applied the thresholding method on another image but it does not give a good result !! Can you help me
Image Analyst
2017 年 12 月 2 日
marwa za
2017 年 12 月 2 日
the thresholding is not complicated but unfortunately it does not give a good result with other images
Image Analyst
2017 年 12 月 2 日
That's why you need to use more sophisticated, and complicated, algorithms.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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 (한국어)