Changeset 478 for trunk


Ignore:
Timestamp:
Jun 26, 2012, 8:41:27 AM (12 years ago)
Author:
sommeria
Message:

series fcts updated to fit with new waitbar fct and background run mode, and various bug repairs

Location:
trunk/src/series
Files:
7 edited

Legend:

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

    r474 r478  
    7171% RUN case: parameters introduced as the input structure Param
    7272else
    73     hseries=guidata(Param.hseries);%handles of the GUI series
    74     WaitbarPos=get(hseries.waitbar_frame,'Position');%position of the waitbar on the GUI series
    7573    if isfield(Param,'Specific')&& strcmp(Param.Specific,'?')
    7674        checkrun=1;% will only search interactive input parameters (preparation of BATCH mode)
     
    7876        checkrun=2; % indicate the RUN option is used
    7977    end
     78    hseries=guidata(Param.hseries);%handles of the GUI series
    8079end
    8180ParamOut=Param; %default output
     
    137136%% coordinate transform or other user defined transform
    138137transform_fct='';%default
    139 if isfield(Param,'FieldTransform')
     138if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName)
    140139    addpath(Param.FieldTransform.TransformPath)
    141140    transform_fct=str2func(Param.FieldTransform.TransformName);
     
    192191    for index=index_slice
    193192        if checkrun
    194             update_waitbar(hseries.waitbar_frame,WaitbarPos,index/(nbfield))
     193            update_waitbar(hseries.Waitbar,index/(nbfield))
    195194            stopstate=get(hseries.RUN,'BusyAction');
    196195        else
     
    229228           
    230229            % field calculation (vort, div...)
    231             if strcmp(FileType{1},'civx')||strcmp(FileType{1},'civ')
     230            if strcmp(FileType{1},'civx')||strcmp(FileType{1},'civdata')
    232231                Data{1}=calc_field(InputFields{1}.FieldName,Data{1});%calculate field (vort..)
    233232            end
  • trunk/src/series/check_data_files.m

    r470 r478  
    4949end
    5050
    51 %% get input parameters, file names and indices
     51%%%%%%%%%%%%  STANDARD PART  %%%%%%%%%%%%
     52%% select different modes,  RUN, parameter input, BATCH
    5253% BATCH  case: read the xml file for batch case
     54if ischar(Param)
     55        Param=xml2struct(Param);
     56        checkrun=0;
     57% RUN case: parameters introduced as the input structure Param
     58else
     59    if isfield(Param,'Specific')&& strcmp(Param.Specific,'?')
     60        checkrun=1;% will only search interactive input parameters (preparation of BATCH mode)
     61    else
     62        checkrun=2; % indicate the RUN option is used
     63    end
     64    hseries=guidata(Param.hseries);%handles of the GUI series
     65end
    5366ParamOut=Param; %default output
    54 if ischar(Param) && ~isempty(find(regexp('Param','.xml$')))
    55     Param=xml2struct(Param);
    56     checkrun=0;
    57 % RUN case: parameters introduced as the input structure Param 
    58 else
    59     hseries=guidata(Param.hseries);%handles of the GUI series
    60     WaitbarPos=get(hseries.waitbar_frame,'Position');%position of the waitbar on the GUI series
    61     checkrun=1; % indicate the RUN option is used
    62 end
    63 % get the set of input file names (cell array filecell), and the lists of
    64 % input file or frame indices i1_series,i2_series,j1_series,j2_series
    65 [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param);
    66 % filecell{iview,fileindex}: cell array representing the list of file names
    67 %        iview: line in the table corresponding to a given file series
    68 %        fileindex: file index within  the file series,
    69 % i1_series(iview,ref_j,ref_i)... are the corresponding arrays of indices i1,i2,j1,j2, depending on the input line iview and the two reference indices ref_i,ref_j
    70 % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices
    71 % set of frame indices used for movie or multimage input
    72 if ~isempty(j1_series)
    73     frame_index=j1_series;
    74 else
    75     frame_index=i1_series;
    76 end
    77 
     67%OutputDir=[Param.OutputSubDir Param.OutputDirExt];NO OUTPUT FILE
     68   
    7869%% root input file(s) and type
    7970RootPath=Param.InputTable(:,1);
     
    8273NomType=Param.InputTable(:,4);
    8374FileExt=Param.InputTable(:,5);
    84 
    85 % numbers of slices and file indices
     75[filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param);
     76%%%%%%%%%%%%
     77% The cell array filecell is the list of input file names, while
     78% filecell{iview,fileindex}:
     79%        iview: line in the table corresponding to a given file series
     80%        fileindex: file index within  the file series,
     81% i1_series(iview,ref_j,ref_i)... are the corresponding arrays of indices i1,i2,j1,j2, depending on the input line iview and the two reference indices ref_i,ref_j
     82% i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices
     83%%%%%%%%%%%%
    8684NbSlice=1;%default
    87 if isfield(Param.IndexRange,'NbSlice')
     85if isfield(Param.IndexRange,'NbSlice')&&~isempty(Param.IndexRange.NbSlice)
    8886    NbSlice=Param.IndexRange.NbSlice;
    8987end
    9088nbview=numel(i1_series);%number of input file series (lines in InputTable)
    91 nbfield_j=size(i1_series{1},1); %nb of consecutive fields at each level(burst
    92 nbfield=nbfield_j*size(i1_series{1},2); %total number of files or frames
    93 nbfield_i=floor(nbfield/NbSlice);%total number of i indexes (adjusted to an integer number of slices)
    94 nbfield=nbfield_i*nbfield_j; %total number of fields after adjustement
     89nbfield_j=size(i1_series{1},1); %nb of fields for the j index (bursts or volume slices)
     90nbfield_i=size(i1_series{1},2); %nb of fields for the i index
     91nbfield=nbfield_j*nbfield_i; %total number of fields
     92nbfield_i=floor(nbfield/NbSlice);%total number of  indexes in a slice (adjusted to an integer number of slices)
     93nbfield=nbfield_i*NbSlice; %total number of fields after adjustement
    9594
    9695%determine the file type on each line from the first input file
     
    123122                stopstate=get(hseries.RUN,'BusyAction');
    124123                if isequal(stopstate,'queue')% enable STOP command
    125                     update_waitbar(hseries.waitbar_frame,WaitbarPos,ifile/nbfield_i)         
     124                    update_waitbar(hseries.Waitbar,ifile/nbfield_i)         
    126125                    file=filecell{iview,index_slice(ifile)};
    127126                    [Path,Name,ext]=fileparts(file);
  • trunk/src/series/ima_levels.m

    r457 r478  
    7070else
    7171    hseries=guidata(Param.hseries);%handles of the GUI series
    72     WaitbarPos=get(hseries.waitbar_frame,'Position');%position of the waitbar on the GUI series
    7372    checkrun=2; % indicate the RUN option is used
    7473end
     
    155154for ifile=1:nbfield
    156155    if checkrun
    157         update_waitbar(hseries.waitbar_frame,WaitbarPos,ifile/nbfield)
     156        update_waitbar(hseries.Waitbar,ifile/nbfield)
    158157        stopstate=get(hseries.RUN,'BusyAction');
    159158    else
  • trunk/src/series/merge_proj.m

    r474 r478  
    7373else
    7474    hseries=guidata(Param.hseries);%handles of the GUI series
    75     WaitbarPos=get(hseries.waitbar_frame,'Position');%position of the waitbar on the GUI series
    7675    if isfield(Param,'Specific')&& strcmp(Param.Specific,'?')
    7776        checkrun=1;% will only search interactive input parameters (preparation of BATCH mode)
     
    139138%% coordinate transform or other user defined transform
    140139transform_fct='';%default
    141 if isfield(Param,'FieldTransform')
     140if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName)
    142141    addpath(Param.FieldTransform.TransformPath)
    143142    transform_fct=str2func(Param.FieldTransform.TransformName);
     
    183182 
    184183        if checkrun
    185             update_waitbar(hseries.waitbar_frame,WaitbarPos,index/(nbfield))
     184            update_waitbar(hseries.Waitbar,index/(nbfield))
    186185            stopstate=get(hseries.RUN,'BusyAction');
    187186        else
     
    213212            end
    214213            % field calculation (vort, div...)
    215             if strcmp(FileType{iview},'civx')||strcmp(FileType{iview},'civ')
     214            if strcmp(FileType{iview},'civx')||strcmp(FileType{iview},'civdata')
    216215                Data{iview}=calc_field(Param.InputFields.FieldName,Data{iview});%calculate field (vort..)
    217216            end
  • trunk/src/series/relabel_i_j.m

    r462 r478  
    7373else
    7474    hseries=guidata(Param.hseries);%handles of the GUI series
    75     WaitbarPos=get(hseries.waitbar_frame,'Position');%position of the waitbar on the GUI series
    7675    if isfield(Param,'Specific')&& strcmp(Param.Specific,'?')
    7776        checkrun=1;% will only search interactive input parameters (preparation of BATCH mode)
     
    322321for ifile=1:nbfield
    323322    if checkrun
    324         update_waitbar(hseries.waitbar_frame,WaitbarPos,ifile/nbfield)
     323        update_waitbar(hseries.Waitbar,ifile/nbfield)
    325324        stopstate=get(hseries.RUN,'BusyAction');
    326325    else
  • trunk/src/series/sub_background.m

    r474 r478  
    8080else
    8181    hseries=guidata(Param.hseries);%handles of the GUI series
    82     WaitbarPos=get(hseries.waitbar_frame,'Position');%position of the waitbar on the GUI series
    8382    if isfield(Param,'Specific')&& strcmp(Param.Specific,'?')
    8483        checkrun=1;% will search input parameters (preparation of BATCH mode)
     
    179178    prompt = {'volume scan mode (Yes/No)';'Number of images for the sliding background (MUST FIT IN COMPUTER MEMORY)';...
    180179        'the luminosity rank chosen to define the background (0.1=for dense particle seeding, 0.5 (median) for sparse particles'};
    181     dlg_title = ['get (slice by slice) a sliding background and substract to each image, result in subdir ' Param.OutputDir];
     180    dlg_title = ['get (slice by slice) a sliding background and substract to each image, result in subdir ' OutputDir];
    182181    num_lines= 3;
    183182    def     = { 'No';num2str(nbaver_init);'0.1'};
     
    361360            if checkrun
    362361                stopstate=get(hseries.RUN,'BusyAction');
    363                 update_waitbar(hseries.waitbar_frame,WaitbarPos,(ifield+(islice-1)*nbfield_i)/(nbfield_i*NbSlice))
     362                update_waitbar(hseries.Waitbar,(ifield+(islice-1)*nbfield_i)/(nbfield_i*NbSlice))
    364363            else
    365364                stopstate='queue';
     
    440439end
    441440
    442 %finish the waitbar
    443 if checkrun
    444     update_waitbar(hseries.waitbar,WaitbarPos,1)
    445 end
    446    
    447441
    448442function C=levels(A)
  • trunk/src/series/time_series.m

    r474 r478  
    7272else
    7373    hseries=guidata(Param.hseries);%handles of the GUI series
    74     WaitbarPos=get(hseries.waitbar_frame,'Position');%position of the waitbar on the GUI series
    7574    if isfield(Param,'Specific')&& strcmp(Param.Specific,'?')
    7675        checkrun=1;% will only search interactive input parameters (preparation of BATCH mode)
     
    140139%% coordinate transform or other user defined transform
    141140transform_fct='';%default
    142 if isfield(Param,'FieldTransform')
     141if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName)
    143142    addpath(Param.FieldTransform.TransformPath)
    144143    transform_fct=str2func(Param.FieldTransform.TransformName);
     
    169168%     end
    170169% end
     170if checkrun==1
     171    return % stop here for input checks
     172end
    171173
    172174%% Set field names and velocity types
     
    242244for i_slice=1:NbSlice
    243245    index_slice=i_slice:NbSlice:nbfield;% select file indices of the slice
    244     nbfiles=0;
     246    nbfile=0;
    245247    nbmissing=0;
    246248   
     
    248250    for index=index_slice       
    249251        if checkrun
    250             update_waitbar(hseries.waitbar_frame,WaitbarPos,index/(nbfield))
     252            update_waitbar(hseries.Waitbar,index/(nbfield))
    251253            stopstate=get(hseries.RUN,'BusyAction');
    252254        else
     
    255257       
    256258        %%%%%%%%%%%%%%%% loop on views (input lines) %%%%%%%%%%%%%%%%
    257         Data=cell(1,nbview);%initiate the set Data
    258         nbtime=0;
    259         dt=[];
    260259        if isequal(stopstate,'queue')% enable STOP command
     260            Data=cell(1,nbview);%initiate the set Data
     261            nbtime=0;
     262            dt=[];
    261263            % loop on views (in case of multiple input series)
    262264            for iview=1:nbview
     
    277279                end
    278280            end
     281           
    279282            % coordinate transform (or other user defined transform)
    280283            if ~isempty(transform_fct)
     
    288291                end
    289292            end
     293           
     294            % field calculation (vort, div...)
     295            if strcmp(FileType{1},'civx')||strcmp(FileType{1},'civdata')
     296                Data{1}=calc_field(InputFields{1}.FieldName,Data{1});%calculate field (vort..)
     297            end
     298           
     299            % field substration (for two input file series)
    290300            if length(Data)==2
    291301                [Field,errormsg]=sub_field(Data{1},Data{2}); %substract the two fields
     
    296306                [Field,errormsg]=proj_field(Field,Param.ProjObject);
    297307            end
    298             nbtime=nbtime+1;
     308            nbfile=nbfile+1;
    299309           
    300310            % initiate the time series at the first iteration
    301             if nbtime==1
     311            if nbfile==1
    302312                % stop program if the first field reading is in error
    303313                if ~isempty(errormsg)
     
    356366                        if isequal(Param.ProjObject.ProjMode,'inside')% take the average in the domain for 'inside' mode
    357367                            if isempty(VarVal)
    358                                 displ_uvmat('ERROR',['empty result at frame index ' num2str(i1_series{iview}(ifile))],checkrun)
     368                                displ_uvmat('ERROR',['empty result at frame index ' num2str(i1_series{iview}(index))],checkrun)
    359369                                return
    360370                            end
     
    378388            if isempty(time)% time read in ncfiles
    379389                if isfield(Field,'Time')
    380                     DataOut.Time(filecounter,1)=Field.Time;
     390                    DataOut.Time(nbfile,1)=Field.Time;
    381391                else
    382                     DataOut.Time(filecounter,1)=ifile;%default
     392                    DataOut.Time(nbfile,1)=index;%default
    383393                end
    384394            else % time from ImaDoc prevails  TODO: correct
    385                 %  DataOut.Time(filecounter,1)=time{1}(i1_series{1})(ifile),j1_series{1}(ifile))+time(end,i2_series{end}(ifile),j2_series{end}(ifile)))/2;
    386                 DataOut.Time(filecounter,1)=i1_series{1}(ifile);% TODO : generalise
     395                DataOut.Time(nbtime,1)=i1_series{1}(index);% TODO : generalise
    387396            end
    388397           
     
    390399            if ~isempty(errormsg)
    391400                nbmissing=nbmissing+1;
    392                 display(['ifile=' num2str(ifile) ':' errormsg])
     401                display(['index=' num2str(index) ':' errormsg])
    393402            end
    394403        end
     
    452461
    453462%% plot the time series (the last one in case of multislices)
    454 figure
    455 haxes=axes;
    456463if checkrun
    457 plot_field(DataOut,haxes)
    458 end
    459 
    460 %% display the result file using the GUI get_field
    461 hget_field=findobj(allchild(0),'name','get_field');
    462 if ~isempty(hget_field)
    463     delete(hget_field)
    464 end
    465 get_field(OutputFile,DataOut)
    466    
    467 
    468 
     464    figure
     465    haxes=axes;
     466    plot_field(DataOut,haxes)
     467       
     468    %% display the result file using the GUI get_field
     469    hget_field=findobj(allchild(0),'name','get_field');
     470    if ~isempty(hget_field)
     471        delete(hget_field)
     472    end
     473    get_field(OutputFile,DataOut)
     474end
     475
     476
Note: See TracChangeset for help on using the changeset viewer.