Ignore:
Timestamp:
Jun 11, 2012, 9:35:38 AM (12 years ago)
Author:
sommeria
Message:

aver_stat modified in the new rationalized form.
OTHER series FCTS NOT OPERATIONAL

File:
1 edited

Legend:

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

    r427 r447  
    1 %'check_files': check the existence and status of the files selected by series.fig
     1%%'check_files': check the existence, type and status of the files selected by series.fig
    22%------------------------------------------------------------------------
    3 % function GUI_input=check_data_files(num_i1,num_i2,num_j1,num_j2,Series)
     3% function GUI_input=check_data_files(Param)
    44%
     5%%%%%%%%%%% GENERAL TO ALL SERIES ACTION FCTS %%%%%%%%%%%%%%%%%%%%%%%%%%%
    56%OUTPUT
    67% GUI_input=list of options in the GUI series.fig needed for the function
    78%
    89%INPUT:
    9 %num_i1: series of first indices i (given from the series interface as first_i:incr_i:last_i, mode and list_pair_civ)
    10 %num_i2: series of second indices i (given from the series interface as first_i:incr_i:last_i, mode and list_pair_civ)
    11 %num_j1: series of first indices j (given from the series interface as first_j:incr_j:last_j, mode and list_pair_civ )
    12 %num_j2: series of second indices j (given from the series interface as first_j:incr_j:last_j, mode and list_pair_civ)
    13 %Series: Matlab structure containing information set by the series interface
     10% In run mode, the input parameters are given as a Matlab structure Param copied from the GUI series.
     11% In batch mode, Param is the name of the corresponding xml file containing the same information
     12% In the absence of input (as activated when the current Action is selected
     13% in series), the function ouput GUI_input set the activation of the needed GUI elements
    1414%
    15 function GUI_input=check_data_files(Param) %(filecell,filecell_1,num_i,num_j,vel_type,field,param);
    16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    17  %detect the chosen series of files and check their date of modification:
    18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    19 %INPUT:
    20 %num_i1: series of first indices i (given from the series interface as first_i:incr_i:last_i, mode and list_pair_civ)
    21 %num_i2: series of second indices i (given from the series interface as first_i:incr_i:last_i, mode and list_pair_civ)
    22 %num_j1: series of first indices j (given from the series interface as first_j:incr_j:last_j, mode and list_pair_civ )
    23 %num_j2: series of second indices j (given from the series interface as first_j:incr_j:last_j, mode and list_pair_civ)
    24 %OTHER INPUTS given by the structure Series
     15% Param contains the elements:(use the menu bar command 'export/GUI config' in series to see the current structure Param)
     16%    .InputTable: cell of input file names, (several lines for multiple input)
     17%                      each line decomposed as {RootPath,SubDir,Rootfile,NomType,Extension}
     18%    .OutputSubDir: name of the subdirectory for data outputs
     19%    .OutputDir: directory for data outputs, including path
     20%    .Action: .ActionName: name of the current activated function
     21%             .ActionPath:   path of the current activated function
     22%    .IndexRange: set the file or frame indices on which the action must be performed
     23%    .FieldTransform: .TransformName: name of the selected transform function
     24%                     .TransformPath:   path  of the selected transform function
     25%                     .TransformHandle: corresponding function handle
     26%    .InputFields: sub structure describing the input fields withfields
     27%              .FieldName: name of the field
     28%              .VelType: velocity type
     29%              .FieldName_1: name of the second field in case of two input series
     30%              .VelType_1: velocity type of the second field in case of two input series
     31%    .ProjObject: %sub structure describing a projection object (read from ancillary GUI set_object)
     32%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    2533
    26 %requests for the visibility of input windows in the GUI series  (activated directly by the selection in the menu ACTION)
    27 if ~exist('Param','var')
    28     GUI_input={'RootPath';'many';...%nbre of possible input series (options 'on'/'two'/'many', default:'one')
    29         'SubDir';'on';... % subdirectory of derived files (PIV fields), ('on' by default)
    30         'RootFile';'on';... %root input file name ('on' by default)
    31         'FileExt';'on';... %input file extension ('on' by default)
    32         'NomType';'on';...%type of file indexing ('on' by default)
     34function GUI_input=check_data_files(Param)
     35
     36%% set the input elements needed on the GUI series when the action is selected in the menu ActionName
     37if ~exist('Param','var') % case with no input parameter
     38    GUI_input={'NbViewMax';'';...% max nbre of input file series (default='' , no limitation)
     39        'AllowInputSort';'off';...% allow alphabetic sorting of the list of input files (options 'off'/'on', 'off' by default)
    3340        'NbSlice';'on'; ...%nbre of slices ('off' by default)
    34         %'VelTypeMenu';'on';...% menu for selecting the velocity type (civ1,..) 'off' by default)
    35         %'FieldMenu';'on';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
    36         %'CoordType';'on'...%can use a transform function 'off' by default
    37         %'GetObject';'on'...%can use projection object ,'off' by default
    38         %'GetMask';'on'...%can use mask option   ,'off' by default
    39         %'PARAMETER'; options: name of the user defined parameter',repeat a line for each parameter
     41        'VelType';'off';...% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default)
     42        'FieldName';'off';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)
     43        'FieldTransform'; 'off';...%can use a transform function
     44        'ProjObject';'off';...%can use projection object(option 'off'/'on',
     45        'Mask';'off';...%can use mask option   (option 'off'/'on', 'off' by default)
     46        'OutputDirExt';'';...%set the output dir extension
    4047               ''};
    41     return %exit the function
     48        return
    4249end
    4350
    44 %% input parameters
    45 % read the xml file for batch case
     51%% get input parameters, file names and indices
     52% BATCH  case: read the xml file for batch case
    4653if ischar(Param) && ~isempty(find(regexp('Param','.xml$')))
    4754    Param=xml2struct(Param);
    48 else %  RUN case: parameters introduced as the input structure Param
     55    checkrun=0;
     56% RUN case: parameters introduced as the input structure Param 
     57else
    4958    hseries=guidata(Param.hseries);%handles of the GUI series
    50     WaitbarPos=get(hseries.waitbar_frame,'Position');
     59    WaitbarPos=get(hseries.waitbar_frame,'Position');%position of the waitbar on the GUI series
     60    checkrun=1; % indicate the RUN option is used
    5161end
     62% get the set of input file names (cell array filecell), and the lists of
     63% input file or frame indices i1_series,i2_series,j1_series,j2_series
    5264[filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param);
     65% filecell{iview,fileindex}: cell array representing the list of file names
     66%        iview: line in the table corresponding to a given file series
     67%        fileindex: file index within  the file series,
     68% 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
     69% i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices
     70% set of frame indices used for movie or multimage input
     71if ~isempty(j1_series)
     72    frame_index=j1_series;
     73else
     74    frame_index=i1_series;
     75end
    5376
     77%% root input file(s) and type
     78RootPath=Param.InputTable(:,1);
     79RootFile=Param.InputTable(:,3);
     80SubDir=Param.InputTable(:,2);
     81NomType=Param.InputTable(:,4);
     82FileExt=Param.InputTable(:,5);
    5483
    55 %%%%%%%%%%%%%%%%%%%%%%%%
     84% numbers of slices and file indices
     85NbSlice=1;%default
     86if isfield(Param.IndexRange,'NbSlice')
     87    NbSlice=Param.IndexRange.NbSlice;
     88end
     89nbview=size(i1_series,1);%number of input file series (lines in InputTable)
     90nbfield_j=size(i1_series,2); %nb of consecutive fields at each level(burst
     91nbfield=nbfield_j*size(i1_series,3); %total number of files or frames
     92nbfield_i=floor(nbfield/NbSlice);%total number of i indexes (adjusted to an integer number of slices)
     93nbfield=nbfield_i*nbfield_j; %total number of fields after adjustement
    5694
    57 % number of slices
    58 NbSlice=Param.NbSlice;
    59 if isempty(NbSlice),NbSlice=1; end; %default
     95%determine the file type on each line from the first input file
     96ImageTypeOptions={'image','multimage','mmreader','video'};
     97NcTypeOptions={'netcdf','civx','civdata'};
     98for iview=1:nbview
     99    [FileType{iview},FileInfo{iview},Object{iview}]=get_file_type(filecell{iview,1});
     100    CheckImage{iview}=~isempty(find(strcmp(FileType{iview},ImageTypeOptions)));% =1 for images
     101    CheckNc{iview}=~isempty(find(strcmp(FileType{iview},NcTypeOptions)));% =1 for netcdf files
     102end
    60103
    61 %% root input file and type
    62     RootPath=Param.InputTable(:,1);
    63     RootFile=Param.InputTable(:,3);
    64     SubDir=Param.InputTable(:,2);
    65     NomType=Param.InputTable(:,4);
    66     FileExt=Param.InputTable(:,5);
    67 % number of views
    68 count=0; 
    69 nbview=numel(RootFile);
    70 
     104%% MAIN LOOP ON VIEWS (INPUT LINES)
    71105for iview=1:nbview
    72     filebase=fullfile(RootPath{iview},RootFile{iview});%root file name
    73 %     if testcell
    74 %         num_i1=num_i1_cell{iview}; num_i2=num_i2_cell{iview}; num_j1=num_j1_cell{iview}; num_j2=num_j2_cell{iview};
    75 %     else
    76 %         num_i1=num_i1_cell; num_i2=num_i2_cell; num_j1=num_j1_cell; num_j2=num_j2_cell;
    77 %     end
    78 %     siz=size(num_i1);
    79     nbfield=size(i1_series{iview},1);
    80     nbfield2=size(i1_series{iview},2); %nb of consecutive fields at each level(burst
    81     nbfield=numel(i1_series{iview});
    82     nbfield=floor(nbfield/(nbfield2*NbSlice));%total number of i indexes (adjusted to an integer number of slices)
    83     if isequal(lower(FileExt{iview}),'.avi')
    84         info=aviinfo([filebase FileExt{iview}]);
     106    if isequal(FileType{iview},'mmreader')||isequal(FileType{iview},'video')
     107        info=aviinfo(filecell{iview,1});
    85108        message{1}=info.Filename;
    86109        message{2}=info.FileModDate;
     
    95118        %LOOP ON SLICES
    96119        for i_slice=1:NbSlice
    97             for ifield=1:nbfield
    98                 indselect(:,ifield)=((ifield-1)*NbSlice+(i_slice-1))*nbfield2+[1:nbfield2]';%selected indices on the list of files of a slice
    99             end
     120            index_slice=i_slice:NbSlice:nbfield;
    100121            filefound={};
    101             for index=1:nbfield*nbfield2
     122            for ifile=1:nbfield_i
     123%                 index(ifile)=index_slice(ifile);
    102124                stopstate=get(hseries.RUN,'BusyAction');
    103125                if isequal(stopstate,'queue')% enable STOP command
    104                     update_waitbar(hseries.waitbar_frame,WaitbarPos,index/(nbfield*nbfield2))
    105                     ifile=indselect(index);               
    106 %                     file=...
    107 %                        name_generator(filebase,num_i1(ifile),num_j1(ifile),FileExt{iview},NomType{iview},1,num_i2(ifile),num_j2(ifile),SubDir{iview});               
    108                     file=filecell{iview,ifile};
     126                    update_waitbar(hseries.waitbar_frame,WaitbarPos,ifile/nbfield_i)         
     127                    file=filecell{iview,index_slice(ifile)};
    109128                    [Path,Name,ext]=fileparts(file);
    110129                    detect=exist(file,'file'); % check the existence of the file
     
    129148                    end
    130149                    Tabchar(1,i_slice)={['slice #' num2str(i_slice)]};
    131                     Tabchar(index+1,i_slice)={[file '...' lastfield]};
     150                    Tabchar(ifile+1,i_slice)={[file '...' lastfield]};
    132151                end
    133152            end
     
    148167        end
    149168        if ~isempty(Tabchar)
    150           Tabchar=reshape(Tabchar,NbSlice*(nbfield*nbfield2+1),1);
     169          Tabchar=reshape(Tabchar,NbSlice*(nbfield_i+1),1);
    151170        end
    152171    end
Note: See TracChangeset for help on using the changeset viewer.