    function [contrast_limits]=set_contrast1(intensity_vector)
    % returns estimated intensity value limits for visualization
        intensity_vector=double(intensity_vector);
        mean_iv=mean(intensity_vector); % compute mean of image intensity values
        std_iv=std(intensity_vector); % compute standard deviation of image intensity values
        intensity_vector(or(intensity_vector<(mean_iv-3*std_iv),intensity_vector>(mean_iv+3*std_iv)))=[]; % remove outliers
        mean_iv2=mean(intensity_vector); % compute mean of image intensity values
        std_iv2=std(intensity_vector); % compute standard deviation of image intensity values
        contrast_limits=[0 mean_iv2+std_iv2]; % set initial contrast (without upper outliers)
        if contrast_limits(2)==0 contrast_limits(2)=mean_iv+std_iv;end % for cases when output contrast_limits are [0 0] which causes error in browser
    end