function [ cellroisoutput ] = functionOneRoundWSBigObjects(cellROISoi,minsize,maxsize)

objectsframe0=(labelmatrix(cellROISoi)>0);

%We select the big obj
bwbig=bwareaopen(objectsframe0, maxsize);
objectsframe1=objectsframe0;
objectsframe1(bwbig)=0;



D = -bwdist(~bwbig);
Ld = watershed(D);
bw2 = bwbig;
bw2(Ld == 0) = 0; 
bwrightsize= xor(bwareaopen(bw2,minsize),bwareaopen(bw2,maxsize));
objectsframe1(bwrightsize)=1;
bwrightsize= bwareaopen(bw2,maxsize);
objectsframe1(bwrightsize)=1;




cellroisoutput=bwconncomp(objectsframe1); 

end

