How to generate skull striped image for all slices ?

조회 수: 8 (최근 30일)
MMSAAH
MMSAAH 2018년 2월 13일
댓글: Image Analyst 2018년 2월 13일
Hello
I'm working on masking out the skull from original gray scale MR image for just one slice using the following code :
outputImage = grayImage; % Initialize
outputImage(binaryImage) = 0; % Mask out.
Now, I want to calculate it for all slices(slice 1 to slice 14 ), I've maked a loop for that but this doesn't work:
for j=1:14
outputImage(:,:,j) = grayImage(:,:,j); % Initialize
outputImage(binaryImage(:,:,j)) = 0; % Mask out
end
Could anyone help me please ?

채택된 답변

Image Analyst
Image Analyst 2018년 2월 13일
You need to do something like
[rows, columns, numSlices] = size(grayImage);
for k = 1 : numSlices
thisSlice = grayImage(:, :, k); % Extract one slice
skullStrippedImage = StripSkull(thisSlice); % Call function that strips skull off just one slice.
outputImage(:,:,k) = skullStrippedImage ;
end
  댓글 수: 2
MMSAAH
MMSAAH 2018년 2월 13일
편집: MMSAAH 2018년 2월 13일
Thank You for your response.
Actually, I've tried your code posted in this question.
This code works well for just one slice, now I want to run it for all MR slices using a loop. So I've not a function to call it that strips skull. Hope that you understand me ?
Image Analyst
Image Analyst 2018년 2월 13일
Then turn that code into a function called StripSkull
function skullStrippedImage = StripSkull(thisSlice)
% Code goes here....

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by