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

6 次查看(过去 30 天)
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-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 个评论
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