필터 지우기
필터 지우기

How to do Skull striping to a .dcm image in MATLAB

조회 수: 6 (최근 30일)
Suba Suba
Suba Suba 2016년 11월 4일
댓글: Image Analyst 2016년 11월 5일
I have tried this link to do skull striping. For .jpeg images, the answer is giving good solution. But when I tried that to .dcm image, I'm getting black image only.How can I do the skull striping to .dcm images without affecting it's internal parts. Please help me to do this

채택된 답변

Image Analyst
Image Analyst 2016년 11월 4일
That link looks like it finds a tumor. Why don't you try searching for the tag skull stripping. I know I've given code for precisely that in prior posts. http://www.mathworks.com/matlabcentral/answers/?term=tag%3A%22skull+stripping%22
  댓글 수: 8
Image Analyst
Image Analyst 2016년 11월 4일
The only image you attached was in your.zip file and it was already binarized. The skull was broken into tiny bits. Your code already removed it, though, like I said, it's not too robust. If you were talking about a different image, then let me know exactly (what exact comment, question, or answer) where you attached it to, because it's not in the .zip file you attached - that has only the binary image.
Suba Suba
Suba Suba 2016년 11월 5일
@Image Analyst Sorry for the late reply,here with this comment I'm again attaching my .dcm image. I just download the image from this link. Please help me to do this.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Walter Roberson
Walter Roberson 2016년 11월 4일
The code there assumes that the data is uint8 ,in the range 0 to 255. Data from dicom files is usually quite different ranges than that, with the range depending on the modality and instrument.
  댓글 수: 3
Suba Suba
Suba Suba 2016년 11월 4일
Is there any other method to do skull striping in .dcm images? Please help me to sort out this problem.
Image Analyst
Image Analyst 2016년 11월 4일
Attach your .dcm image with the paper clip icon.

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2016년 11월 5일
편집: Image Analyst 2016년 11월 5일
Actually you're not attaching it again. This is the first time you've attached the gray scale image. Here is my code:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 15;
%===============================================================================
% Get the name of the image the user wants to use.
baseFileName = 'IM-0001-0009.dcm';
% Get the full filename, with path prepended.
folder = pwd
fullFileName = fullfile(folder, baseFileName);
%===============================================================================
% Read in a demo image.
grayImage = dicomread(fullFileName);
% Get the dimensions of the image.
% numberOfColorBands should be = 1.
[rows, columns, numberOfColorChannels] = size(grayImage);
if numberOfColorChannels > 1
% It's not really gray scale like we expected - it's color.
% Convert it to gray scale by taking only the green channel.
grayImage = grayImage(:, :, 2); % Take green channel.
end
% Display the image.
subplot(2, 3, 1);
imshow(grayImage, []);
axis on;
caption = sprintf('Original Grayscale Image, %s', baseFileName);
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
drawnow;
hp = impixelinfo();
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Get rid of tool bar and pulldown menus that are along top of figure.
set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
% Display the histogram so we can see what gray level we need to threshold it at.
subplot(2, 3, 2:3);
histogram(grayImage);
grid on;
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
% Threshold the image to make a binary image.
binaryImage = grayImage > 250;
% Display the image.
subplot(2, 3, 4);
imshow(binaryImage, []);
axis on;
caption = sprintf('Initial Binary Image');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
% Extract the outer blob, which is the skull
labeledImage = bwlabel(binaryImage);
binaryImage = ismember(labeledImage, 1);
% Thicken it a little
binaryImage = imdilate(binaryImage, true(5));
% Display the final binary image.
subplot(2, 3, 5);
imshow(binaryImage, []);
axis on;
caption = sprintf('Final Binary Image of Skull Alone');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
% Mask out the skull from the original gray scale image.
outputImage = grayImage; % Initialize
outputImage(binaryImage) = 0; % Mask out.
% Display the image.
subplot(2, 3, 6);
imshow(outputImage, []);
axis on;
caption = sprintf('Skull-Stripped Gray Scale Image');
title(caption, 'FontSize', fontSize, 'Interpreter', 'None');
  댓글 수: 2
Suba Suba
Suba Suba 2016년 11월 5일
Thank you so much.You made my day
Image Analyst
Image Analyst 2016년 11월 5일
You're welcome. Thanks for accepting. I'm attaching a fancier demo where I find the tumor and then indicate it in the overlay in two ways, by a red outline and by a red solid patch in the overlay.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by