function manual(SelImage)
global T INFO
X =SelImage;
b = max(SelImage);
b=max(b);
a = min(SelImage);
a=min(a);
X= X./b;
X1 = mat2gray(X);

% vector = linspace(a:b:b);
[counts2,positions2]=imhist(X);
     positions2(counts2==0)=[];
     counts2(counts2==0)=[];
     [Val2,Ind2]=max(counts2);
    fig3 = figure;
%     plot(positions2.*b,counts2,'LineWidth',1)
   bar(positions2.*b,counts2)
    title('Hisotgram - click on treshold, then press ENTER')
    disp ('Detekcia proteinov - Zadajte hodnotu')
   
   text(fig3,Ind2*b,Val2,...
     '\leftarrowBACKGROUND',...
     'FontSize',16)
   
 datacursormode on
   dcm_obj2 = datacursormode(fig3)
   set(dcm_obj2,'DisplayStyle','datatip',...
    'SnapToDataVertex','on','Enable','on')
   pause
   info_struct2 = getCursorInfo(dcm_obj2)
   threshold2 = positions2(info_struct2.DataIndex);
   threshold2 = positions2(info_struct2.Position(1));
   close(fig3);
   
   BIN2 = im2bw(X,threshold2);
   SE1 = strel('disk', 3);
   BIN2 = imopen (BIN2,SE1);

   HA = bwboundaries(BIN2);
aa=figure;
imshow(X)
hold on
for ii = 1:length(HA)
    hranice1 = HA{ii};
    plot(hranice1(:,2), hranice1(:,1), 'g', 'LineWidth', 1)
end
hold off
INFO.Tresh=treshold2;
