Changeset 624


Ignore:
Timestamp:
Apr 29, 2013, 11:28:23 PM (12 years ago)
Author:
sommeria
Message:

waitbar system for series improved to aloow use as stand alone fcts.

to add at the head of series fcts:
hseries=findobj(allchild(0),'Tag','series');
RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series
WaitbarHandle?=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series

call to waitbar:

update_waitbar(WaitbarHandle?,index/nbfield)
if ishandle(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction?'),'queue')

disp('program stopped by user')
break

end

Location:
trunk/src/series
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series/aver_stat.m

    r616 r624  
    6161
    6262%%%%%%%%%%%%  STANDARD PART  %%%%%%%%%%%%
    63 ParamOut=[];
     63ParamOut=[];%default output
    6464%% read input parameters from an xml file if input is a file name (batch mode)
    6565checkrun=1;
     
    6868    checkrun=0;
    6969end
    70 
    71 %% define the directory for result file
     70hseries=findobj(allchild(0),'Tag','series');
     71RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series
     72WaitbarHandle=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series
     73
     74%% define the directory for result file (with path=RootPath{1})
    7275OutputDir=[Param.OutputSubDir Param.OutputDirExt];
    7376   
     
    173176%%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%%
    174177for index=1:nbfield
    175 %for index=index_slice
    176       if checkrun
    177             stopstate=get(Param.RUNHandle,'BusyAction');
    178             update_waitbar(Param.WaitbarHandle,index/nbfield)
    179       else
    180             stopstate='queue';
    181       end
    182     if isequal(stopstate,'queue')% enable STOP command
    183 
     178    update_waitbar(WaitbarHandle,index/nbfield)
     179    if ishandle(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction'),'queue')
     180        disp('program stopped by user')
     181        break
     182    end
     183   
    184184    %%%%%%%%%%%%%%%% loop on views (input lines) %%%%%%%%%%%%%%%%
    185185    for iview=1:nbview
     
    194194        end
    195195    end
    196     else
    197         errormsg='stop';
    198     end
    199196    %%%%%%%%%%%%%%%% end loop on views (input lines) %%%%%%%%%%%%%%%%
    200197    %%%%%%%%%%%% END STANDARD PART  %%%%%%%%%%%%
    201198    % EDIT FROM HERE
    202 
     199   
    203200    if isempty(errormsg)
    204201        Field=Data{1}; % default input field structure
     
    224221            end
    225222        end
    226 
     223       
    227224        %% calculate tps coefficients if needed
    228225        if isfield(Param,'ProjObject')&&isfield(Param.ProjObject,'ProjMode')&& strcmp(Param.ProjObject.ProjMode,'interp_tps')
    229226            Field=tps_coeff_field(Field,check_proj_tps);
    230227        end
    231 
     228       
    232229        %field projection on an object
    233230        if Param.CheckObject
     
    239236        end
    240237        nbfiles=nbfiles+1;
    241 
     238       
    242239        %%%%%%%%%%%% MAIN RUNNING OPERATIONS  %%%%%%%%%%%%
    243240        %update sum
     
    288285    end
    289286else  % time from ImaDoc prevails if it exists
    290 %         j1=1;%default
    291 %         if ~isempty(j1_series{1})
    292 %             j1=j1_series{1};
    293 %         end
     287    %         j1=1;%default
     288    %         if ~isempty(j1_series{1})
     289    %             j1=j1_series{1};
     290    %         end
    294291    %DataOut.Time=time(1,i1_series{1}(1),j1);
    295292    %DataOut.Time_end=time(end,i1_series{end}(end),j1_series{end}(end));
     
    317314    end
    318315end  % end averaging  loop
    319 % end
    320 %%%%%%%%%%%%%%%% end loop on slices %%%%%%%%%%%%%%%%
    321316
    322317%% open the result file with uvmat (in RUN mode)
  • trunk/src/series/civ_input.m

    r609 r624  
    195195%check_letter=~isempty(regexp(NomTypeIma,'[ab|AB]$'));%detect pair label by letter
    196196%if  isequal(NomTypeNc,'_1-2')||isempty(MaxIndex_j)|| (MaxIndex_j==1)
    197 MaxIndex_i=Param.IndexRange.MaxIndex{1};
    198 MaxIndex_j=Param.IndexRange.MaxIndex{1,2};
    199 MinIndex_i=Param.IndexRange.MinIndex{1};
    200 MinIndex_j=Param.IndexRange.MinIndex{1,2};
     197MaxIndex_i=Param.IndexRange.MaxIndex_i{1};
     198MaxIndex_j=Param.IndexRange.MaxIndex_j{1};
     199MinIndex_i=Param.IndexRange.MinIndex_i{1};
     200MinIndex_j=Param.IndexRange.MinIndex_j{1};
    201201if ~isfield(Param.IndexRange,'first_j')
    202202    set(handles.ListPairMode,'Value',1)
  • trunk/src/series/civ_series.m

    r614 r624  
    7373    checkrun=0;
    7474end
     75hseries=findobj(allchild(0),'Tag','series');
     76RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series
     77WaitbarHandle=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series
    7578
    7679%% input files and indexing
     
    214217%%%%% MAIN LOOP %%%%%%
    215218for ifield=1:NbField
    216    
     219    update_waitbar(WaitbarHandle,index/nbfield)
     220    if ishandle(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction'),'queue')
     221        disp('program stopped by user')
     222        break
     223    end
    217224    %% Civ1
    218225    if isfield (Param.ActionInput,'Civ1')
  • trunk/src/series/ima_levels.m

    r606 r624  
    7575%%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%%
    7676%% read input parameters from an xml file if input is a file name (batch mode)
    77 ParamOut=[]
     77ParamOut=[];
    7878checkrun=1;
    7979if ischar(Param)
     
    8181    checkrun=0;
    8282end
     83hseries=findobj(allchild(0),'Tag','series');
     84RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series
     85WaitbarHandle=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series
     86
     87%% subdirectory for output files
     88SubdirOut=[Param.OutputSubDir Param.OutputDirExt];
    8389
    8490%% root input file names and nomenclature type (cell arrays with one element)
     
    8995FileExt=Param.InputTable(:,5);
    9096
    91 %% subdirectory for output files
    92 SubdirOut=[Param.OutputSubDir Param.OutputDirExt];
    9397
    9498%% get the set of input file names (cell array filecell), and file indices
     
    146150j1=[];%default
    147151for ifile=1:nbfield
    148     if checkrun
    149         stopstate=get(Param.RUNHandle,'BusyAction');
    150         update_waitbar(Param.WaitbarHandle,ifile/nbfield)
    151     else
    152         stopstate='queue';
     152            update_waitbar(WaitbarHandle,index/nbfield)
     153    if ishandle(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction'),'queue')
     154        disp('program stopped by user')
     155        return
    153156    end
    154157    if ~isequal(stopstate,'queue') % enable STOP command
  • trunk/src/series/merge_proj.m

    r614 r624  
    6464
    6565%%%%%%%%%%%% STANDARD PART (DO NOT EDIT) %%%%%%%%%%%%
     66ParamOut=[] %default output
    6667%% read input parameters from an xml file if input is a file name (batch mode)
    6768checkrun=1;
     
    7071    checkrun=0;
    7172end
    72 
    73 ParamOut=[] %default output
     73hseries=findobj(allchild(0),'Tag','series');
     74RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series
     75WaitbarHandle=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series
     76
     77%% define the directory for result file (with path=RootPath{1})
     78OutputDir=[Param.OutputSubDir Param.OutputDirExt];% subdirectory for output files
     79
    7480if ~isfield(Param,'InputFields')
    7581    Param.InputFields.FieldName='';
    7682end
    77 OutputDir=[Param.OutputSubDir Param.OutputDirExt];% subdirectory for output files
    7883
    7984%% root input file type
     
    184189    %%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%%
    185190for index=1:NbField
    186     if checkrun
    187         stopstate=get(Param.RUNHandle,'BusyAction');
    188         update_waitbar(Param.WaitbarHandle,index/NbField)
    189     else
    190         stopstate='queue';
    191     end
    192     if ~isequal(stopstate,'queue')% enable STOP command
     191        update_waitbar(WaitbarHandle,index/nbfield)
     192    if ishandle(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction'),'queue')
     193        disp('program stopped by user')
    193194        return
    194195    end
  • trunk/src/series/relabel_i_j.m

    r599 r624  
    6767    checkrun=0;
    6868end
     69hseries=findobj(allchild(0),'Tag','series');
     70RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series
     71WaitbarHandle=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series
    6972
    7073%% root input file(s) and type
     
    220223%% main loop on images
    221224%j1=[];%default
    222 nbfield2=size(XmlData.Time,2)
     225nbfield2=size(XmlData.Time,2);
    223226for ifile=1:nbfield
    224     if checkrun
    225         stopstate=get(Param.RUNHandle,'BusyAction');
    226         update_waitbar(Param.WaitbarHandle,ifile/nbfield)
    227     else
    228         stopstate='queue';
    229     end
    230     if ~isequal(stopstate,'queue')% enable STOP command
     227            update_waitbar(WaitbarHandle,ifile/nbfield)
     228    if ishandle(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction'),'queue')
     229        disp('program stopped by user')
    231230        break
    232231    end
  • trunk/src/series/sub_background.m

    r616 r624  
    187187    checkrun=0;
    188188end
    189 
     189hseries=findobj(allchild(0),'Tag','series');
     190RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series
     191WaitbarHandle=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series
    190192%% Input preparation
    191193nbaver_ima=Param.ActionInput.SlidingSequenceLength;
     
    364366if nbfield_i > nbaver_ima
    365367    for ifield = step*ceil(nbaver/2)+1:step:nbfield_i-step*floor(nbaver/2)
    366         if checkrun
    367             stopstate=get(Param.RUNHandle,'BusyAction');
    368             update_waitbar(Param.WaitbarHandle,ifield/nbfield_i)
    369         else
    370             stopstate='queue';
    371         end
    372         if isequal(stopstate,'queue')% enable STOP command
     368                update_waitbar(WaitbarHandle,ifield/nbfield_i)
     369    if ishandle(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction'),'queue')
     370        disp('program stopped by user')
     371        return
     372    end
     373%         if isequal(stopstate,'queue')% enable STOP command
    373374            Ak(:,:,1:nbaver_ima-step)=Ak(:,:,1+step:nbaver_ima);% shift the current image series by one burst (step)
    374375            %incorporate next burst in the current image series
     
    409410               
    410411            end
    411         else
    412             return
    413         end
     412%         else
     413%             return
     414%         end
    414415    end
    415416end
  • trunk/src/series/time_series.m

    r609 r624  
    6565
    6666%%%%%%%%%%%% STANDARD PART  %%%%%%%%%%%%
     67ParamOut=[]; %default output
    6768%% read input parameters from an xml file if input is a file name (batch mode)
    6869checkrun=1;
     
    7172    checkrun=0;
    7273end
    73 
    74 ParamOut=[]; %default output
     74hseries=findobj(allchild(0),'Tag','series');
     75RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series
     76WaitbarHandle=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series
     77
     78%% define the directory for result file (with path=RootPath{1})
    7579OutputDir=[Param.OutputSubDir Param.OutputDirExt];
    7680
     
    205209%%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%%
    206210for index=1:nbfield
    207     if checkrun
    208         stopstate=get(Param.RUNHandle,'BusyAction');
    209         update_waitbar(Param.WaitbarHandle,index/nbfield)
    210     else
    211         stopstate='queue';
    212     end
    213     if ~isequal(stopstate,'queue')% enable STOP command
    214         break
     211            update_waitbar(WaitbarHandle,index/nbfield)
     212    if ishandle(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction'),'queue')
     213        disp('program stopped by user')
     214        break % leave the loop if stop is ordered
    215215    end
    216216    Data=cell(1,nbview);%initiate the set Data;
Note: See TracChangeset for help on using the changeset viewer.