Effacer les filtres
Effacer les filtres

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

6 vues (au cours des 30 derniers jours)
Suba Suba
Suba Suba le 4 Nov 2016
Commenté : Image Analyst le 5 Nov 2016
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

Réponse acceptée

Image Analyst
Image Analyst le 4 Nov 2016
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 commentaires
Image Analyst
Image Analyst le 4 Nov 2016
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 le 5 Nov 2016
@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.

Connectez-vous pour commenter.

Plus de réponses (2)

Walter Roberson
Walter Roberson le 4 Nov 2016
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 commentaires
Suba Suba
Suba Suba le 4 Nov 2016
Is there any other method to do skull striping in .dcm images? Please help me to sort out this problem.
Image Analyst
Image Analyst le 4 Nov 2016
Attach your .dcm image with the paper clip icon.

Connectez-vous pour commenter.


Image Analyst
Image Analyst le 5 Nov 2016
Modifié(e) : Image Analyst le 5 Nov 2016
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 commentaires
Suba Suba
Suba Suba le 5 Nov 2016
Thank you so much.You made my day
Image Analyst
Image Analyst le 5 Nov 2016
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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Geometric Transformation and Image Registration dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by