function EvalLayers(optimizer);
h=gcf;
ds=get(h,'UserData');

xf=round([ds.xf(:);ds.asxf(:)]);
yf=round([ds.yf(:);ds.asyf(:)]);
xb=round([ds.xb(:);ds.asxb(:)]);
yb=round([ds.yb(:);ds.asyb(:)]);
ind_f=find( (xf>0)&(yf>0)&(xf<=size(ds.im,2))&(yf<=size(ds.im,1))  );
xf=xf(ind_f);
yf=yf(ind_f);
ind_b=find( (xb>0)&(yb>0)&(xb<=size(ds.im,2))&(yb<=size(ds.im,1))  );
xb=xb(ind_b);
yb=yb(ind_b);

if (~exist('optimizer'))
  optimizer=1;
end
if (optimizer==1)
   for t=1:size(ds.im,3)
      ds.im(:,:,t)=sepRefItrLS(ds.oim(:,:,t),xf,yf,xb,yb,ds.im(:,:,t));
   end
end
if (optimizer==2)
   for t=1:size(ds.im,3)
      ds.im(:,:,t)=sepRefLOQO(ds.oim(:,:,t),xf,yf,xb,yb);
   end
end


set(h,'UserData',ds);
displayMarked(h,[1]);


