function display_QC( hMainFig )
%
% Function to refresh QC statistic panel
%
% Input
% -----
% hGUI ............... Handel to the user interface
%
% Output
% ------
% $Id$

% Retrieve named application data
% -------------------------------
tsg    = getappdata( hMainFig, 'tsg_data');

% get panel handle
% ----------------
hdlPanel = findobj(hMainFig, 'tag', 'TAG_QC_DISPLAY_PANEL');

% get list of keys from hashtable tsg.qc.hash, defined inside
% tsg_initialisation.m
% -----------------------------------------------------------
qc_list = keys(tsg.qc.hash);

% iterate (loop) on each key store inside hastable
% ------------------------------------------------
for key = qc_list

  % get some values in hashtable
  % ------------------------------------
  code = tsg.qc.hash.(key).code;

  % get the uicontrol handle from tag construct with key
  % ----------------------------------------------------
  hdlText = findobj(hMainFig, 'tag', ['TAG_QC_TEXT_' char(key)]);

  % find number of sample flag with this QC code
  % --------------------------------------------
  ind = find(tsg.SSPS_QC == code);

  % if index empty, no data with this flag, set field to zero (char)
  % ----------------------------------------------------------------
  if isempty(ind)
    set(hdlText, 'String', '0');
  else
    set(hdlText, 'String', num2str(numel(ind)));
  end
  
end

drawnow

