如何划分左右隔室(半部分)的大脑分段切片?

时间:2018-05-09 15:43:20

标签: image matlab image-processing

我有一系列brain CT images。 目标是分割大脑,然后separating brain into left and right halves来计算每一半的大脑区域和血液区域。

我附加了一个从序列(not continuous slices just slices that may cover all types of slices)中选择的7个样本分段脑图像的zip文件。 Link for sample images

对于这个问题,I am trying to divide the brain into left and right compartments

我一直在用它来查找图像的左右开始索引以分成两半。但这并没有给出准确的结果,分成左右两半。

到目前为止我的方法:

img_dir = pwd;
fileList = dir(img_dir);
fileList = fileList(~ismember({fileList.name},{'.','..'}));
num_of_slices = length(fileList);
for idx = 1: num_of_slices
    fileName = fileList(idx).name;
    img_slice_path = fullfile(img_dir,fileName);
    imgs{idx} = imread(img_slice_path);
    figure(1), imshow(imgs{idx},[]);
    pause(0.5);
end
%%
% seperate left and right based on midpoint of left_idx and right_idx
[nrow, ncol] = size(imgs{1});
[leftBrain_imgs,rightBrain_imgs] = deal(cell(1,length(imgs)));
for val = 1: length(imgs)
    tempImg = imgs{val};
      columnsWithAllZeros = all(tempImg == 0);
      left_idx = find(~columnsWithAllZeros,1,'first');
      right_idx = find(~columnsWithAllZeros,1,'last');
      cent_idx = floor(mean([left_idx,right_idx]));
      rightImg_idxs = 1:cent_idx; % right side is shown left
      leftImg_idxs = cent_idx+1:ncol; % left side is shown right
      [leftBrain_img,rightBrain_img]  = deal(zeros(nrow, ncol));
      rightBrain_img(:,rightImg_idxs) = tempImg(:,rightImg_idxs);
      leftBrain_img(:,leftImg_idxs) = tempImg(:,leftImg_idxs);
      leftBrain_imgs{val} = leftBrain_img;
      rightBrain_imgs{val} = rightBrain_img;
      figure(2),
      subplot(121), imshow(rightBrain_imgs{val},[]), title('right brain');
      subplot(122), imshow(leftBrain_imgs{val},[]), title('left brain');
      pause(0.5)
end

Note: The brain may be slightly tilted slightly to the left or right

关于如何做到这一点的任何想法?

谢谢,Gopi

0 个答案:

没有答案