MATLAB: Seperate Areas of nearly same intensity levels

brainImage Processing Toolboxlabelingmriseperate regions

At the moment i am trying to extract the brain from skull and other surrounding components. At first i removed the skull and background intensities which were of another intensity level as the brain itself. Unfortunately i still have some areas in the volume which have the same intensity as the brain region and are connected to the brain region. I tried to split them form the brain and use bwareaopen() to delete this regions but when applied i also lose some smaller brain areas. I also tried to use bwlabel(), but i get a different label in different images so they weren't useful.
Therefore i would like to create a volume of the brain which also connects this little areas of the brain and delete the smaller regions afterwards, can anybody explain me how to loose these last areas? It tried to use region props to delete the small areas (see code below), but my method didn't work.
if true
CC = bwconncomp(MRIsag);
F = regionprops(CC,'Area');
area = [F.Area];
Brainlabel = find(area>100);
Brain = ismember(CC,Brainlabel);
implay (brain);
end

Best Answer

I suggest trying to use imclose() to connect nearby blobs to your brain. Then you can keep your brain and get rid of distant blobs.