source: trunk/src/series/check_data_files.m @ 427

Last change on this file since 427 was 427, checked in by sommeria, 12 years ago

merge_proj corrected to project simulataneously velocity, vort, div...
Time reintroduced correctly
bug corrections for objects

File size: 8.0 KB
RevLine 
[330]1%'check_files': check the existence and status of the files selected by series.fig
2%------------------------------------------------------------------------
[374]3% function GUI_input=check_data_files(num_i1,num_i2,num_j1,num_j2,Series)
[330]4%
5%OUTPUT
6% GUI_input=list of options in the GUI series.fig needed for the function
7%
8%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
14%
[374]15function GUI_input=check_data_files(Param) %(filecell,filecell_1,num_i,num_j,vel_type,field,param);
[330]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
25
26%requests for the visibility of input windows in the GUI series  (activated directly by the selection in the menu ACTION)
[377]27if ~exist('Param','var')
[330]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)
33        '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
40               ''};
41    return %exit the function
42end
43
[374]44%% input parameters
45% read the xml file for batch case
46if ischar(Param) && ~isempty(find(regexp('Param','.xml$')))
47    Param=xml2struct(Param);
48else %  RUN case: parameters introduced as the input structure Param
49    hseries=guidata(Param.hseries);%handles of the GUI series
50    WaitbarPos=get(hseries.waitbar_frame,'Position');
51end
52[filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param);
[330]53
[374]54
[330]55%%%%%%%%%%%%%%%%%%%%%%%%
56
57% number of slices
[374]58NbSlice=Param.NbSlice;
59if isempty(NbSlice),NbSlice=1; end; %default
[330]60
[374]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);
[330]67% number of views
[374]68count=0; 
[377]69nbview=numel(RootFile);
[374]70
[330]71for iview=1:nbview
[377]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});
[330]82    nbfield=floor(nbfield/(nbfield2*NbSlice));%total number of i indexes (adjusted to an integer number of slices)
[377]83    if isequal(lower(FileExt{iview}),'.avi')
84        info=aviinfo([filebase FileExt{iview}]);
[330]85        message{1}=info.Filename;
86        message{2}=info.FileModDate;
87        message{3}=[num2str(info.FramesPerSecond) ' frames/s '];
88        message{4}=info.ImageType;
89        message{5}=['  compression' info.VideoCompression];
90        message{6}=[ 'quality ' num2str(info.Quality)];   
91        Tabchar=message;
92    else
93        datnum=zeros(1,nbfield);
94        Tabchar={};
95        %LOOP ON SLICES
96        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
[340]100            filefound={};
[330]101            for index=1:nbfield*nbfield2
102                stopstate=get(hseries.RUN,'BusyAction');
103                if isequal(stopstate,'queue')% enable STOP command
[340]104                    update_waitbar(hseries.waitbar_frame,WaitbarPos,index/(nbfield*nbfield2))
[330]105                    ifile=indselect(index);               
[377]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};
[330]109                    [Path,Name,ext]=fileparts(file);
110                    detect=exist(file,'file'); % check the existence of the file
111                    if detect==0
112                        count=count+1;
113                        lastfield='not found';
114                    else
115                        datfile=dir(file);
116                        if isfield(datfile,'datenum')
117                            datnum(ifile)=datfile.datenum;
118                        end
119                        filefound(ifile)={datfile.name};
120                        lastfield='';
[377]121                        [FileType,FileInfo,Object]=get_file_type(file);
122                        if strcmp(FileType,'civx')||strcmp(FileType,'civdata')
123                            if isfield(FileInfo,'CivStage')
124                            liststage={'civ1','fix1','patch1','civ2','fix2','patch2'};
125                            lastfield=liststage{FileInfo.CivStage};
126                            end
127                        end
128                        lastfield=[FileType ', ' lastfield];                   
[330]129                    end
130                    Tabchar(1,i_slice)={['slice #' num2str(i_slice)]};
[361]131                    Tabchar(index+1,i_slice)={[file '...' lastfield]};
[330]132                end
133            end
134        end
[340]135%         if isempty(datnum)||isempty(filefound)
136        if isempty(filefound)
[330]137            if NbSlice>1
138                message=['no set of ' num2str(NbSlice) ' (NbSlices) files found'];
139            else
140                 message='no file found';
141            end
142        else
143            datnum=datnum(find(datnum));%keep the non zero values corresponding to existing files
144            [first,ind]=min(datnum);
145            [last,indlast]=max(datnum);
146            message={['oldest modification:  ' cell2mat(filefound(ind)) ' : ' datestr(first)];...
147                ['latest modification:  ' cell2mat(filefound(indlast)) ' : ' datestr(last)]};
148        end
149        if ~isempty(Tabchar)
150          Tabchar=reshape(Tabchar,NbSlice*(nbfield*nbfield2+1),1);
151        end
152    end
153    hfig=figure(iview);
154    clf
155    if iview>1
156        pos=get(iview-1,'Position');
157        pos(1)=pos(1)+(iview-1)*pos(1)/nbview;
158        set(hfig,'Position',pos)
159    end
[427]160    set(hfig,'name',['check_data_files:view= ' num2str(iview)])
161    set(hfig,'MenuBar','none')% suppress the menu bar
162    set(hfig,'NumberTitle','off')%suppress the fig number in the title
[361]163    h=uicontrol('Style','listbox', 'Position', [20 20 500 300], 'String', Tabchar, 'Callback', {'open_uvmat'});
[330]164    hh=uicontrol('Style','listbox', 'Position', [20 340 500 40], 'String', message);
165end
Note: See TracBrowser for help on using the repository browser.