function result = clearBorders(image)

clean = image > 0.3;
N=1;
clean = imerode(clean, strel('disk', N));
clean = imdilate(clean, strel('disk', N));

border = clean;
border (1 ,:) = 1;
border (end ,:) = 1;
border (: ,1) = 1;
border (:, end) = 1;

border = 1 - border;
border = imfill(border); %, [1,1]);
result = (clean .* border); % .* image;
%result = imreconstruct(image, border);