Skip to content
Snippets Groups Projects
Commit 26fa213f authored by MarieBofferding's avatar MarieBofferding
Browse files

//WIP added function for Brain Mask

parent b0067ed3
No related branches found
No related tags found
2 merge requests!3Regular merge of develop,!2Seeg algorithm
function [croppedImg] = expandBrainMask(mskdImg)
% expand the brain mask to threshold the image so we don't get artifacts
% from everything that it causing them outside of
% the brain, besides the electrode head candidates
......@@ -13,10 +15,11 @@ isosurface(expndBrainMask);
% compute the centroid of the CT to later map the electrode with the
% expanded brain Mask and get rid of the artefact far away from brain
stats_CT_post = regionprops(maskedImg);
stats_CT_post = regionprops(mskdImg);
centroid_CT_post = stats_CT_post.Centroid;
% compute the centroid of the expanded brain mask
stats_expndBrainMask = regionprops(expndBrainMask);
centroid_expndBrainMask = stats_expndBrainMask.Centroid;
end
\ No newline at end of file
......@@ -53,6 +53,9 @@ maskedImg = CT_post.img;
% brainMask = imerode(brainMask,structEle);
% maskedImg(~(brainMask)) = NaN;
% change accordingly
croppedImg = expandBrainMask(maskedImg);
cc = bwconncomp(maskedImg,26); % 26 for 3D images
disp([num2str(cc.NumObjects) ' potential metal components detected within brain.']);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment