Skull Stripping Matlab
Skull Stripping Matlab
format long g;
format compact;
fontSize = 24;
if ~hasIPT
message = sprintf('Sorry, but you do not seem to have the Image Processing Toolbox.\nDo you
want to try to continue anyway?');
if strcmpi(reply, 'No')
return;
end
end
%===============================================================================
baseFileName = 'Jones-54-1-jan10-f3.jpg';
% File doesn't exist -- didn't find it there. Check the search path for it.
if ~exist(fullFileNameOnSearchPath, 'file')
errorMessage = sprintf('Error: %s does not exist in the search path folders.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end
grayImage = imread(fullFileName);
% numberOfColorBands should be = 1.
if numberOfColorBands > 1
end
subplot(2, 3, 1);
imshow(grayImage, []);
axis on;
subplot(2, 3, 2);
bar(grayLevels, pixelCount);
grid on;
subplot(2, 3, 3);
imshow(binaryImage, []);
axis on;
% Seal off the bottom of the head - make the last row white.
binaryImage(end,:) = true;
subplot(2, 3, 4);
imshow(binaryImage, []);
axis on;
subplot(2, 3, 5);
imshow(binaryImage, []);
axis on;
finalImage(~binaryImage) = 0;
subplot(2, 3, 6);
imshow(finalImage, []);
axis on;