- Timestamp:
- Apr 14, 2013, 9:37:42 AM (12 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/find_file_series.m
r609 r610 249 249 NomType='*'; 250 250 else 251 i1_series=i1_series(:,2)*ones( 0,FileInfo.NumberOfFrames);251 i1_series=i1_series(:,2)*ones(1,FileInfo.NumberOfFrames); 252 252 i1_series=[i1_series(:,1) i1_series]; 253 253 j1_series=ones(size(i1_series,1),1)*(0:FileInfo.NumberOfFrames); -
trunk/src/read_image.m
r604 r610 16 16 function [A,ObjectOut]=read_image(FileName,FileType,VideoObject,num) 17 17 %----------------------------------------------------------------------- 18 if ~exist( FileType,'var')18 if ~exist('FileType','var') 19 19 FileType='image'; 20 20 end -
trunk/src/series.m
r609 r610 2473 2473 OutputSubDir=[Param.OutputSubDir Param.OutputDirExt];% subdirectory for output files 2474 2474 OutputDir=fullfile(RootPath,OutputSubDir); 2475 hfig=findobj(allchild(0),'name','series_status'); 2476 if isempty(hfig) 2477 ScreenSize=get(0,'ScreenSize'); 2478 hfig=figure('DeleteFcn',@stop_status,'Position',[ScreenSize(3)-600 ScreenSize(4)-640 560 600]); 2479 set(hfig,'MenuBar','none')% suppress the menu bar 2480 set(hfig,'NumberTitle','off')%suppress the fig number in the title 2481 set(hfig,'name','series_status') 2482 set(hfig,'tag','series_status') 2483 uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', @view_file,'tag','list','UserData',OutputDir); 2484 uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','titlebox','Max',2,'String',OutputDir); 2485 uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]); 2486 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@stop_status); 2487 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@refresh_GUI); 2488 %set(hrefresh,'UserData',StatusData) 2489 BarPosition=[0.05 0.81 0.01 0.05]; 2490 uicontrol('Style','frame','Units','normalized', 'Position',BarPosition ,'BackgroundColor',[1 0 0],'tag','waitbar'); 2491 drawnow 2492 end 2493 refresh_GUI(hfig) 2475 uigetfile_uvmat('status_display',OutputDir) 2476 2477 % hfig=findobj(allchild(0),'name','series_status'); 2478 % if isempty(hfig) 2479 % ScreenSize=get(0,'ScreenSize'); 2480 % hfig=figure('DeleteFcn',@stop_status,'Position',[ScreenSize(3)-600 ScreenSize(4)-640 560 600]); 2481 % set(hfig,'MenuBar','none')% suppress the menu bar 2482 % set(hfig,'NumberTitle','off')%suppress the fig number in the title 2483 % set(hfig,'name','series_status') 2484 % set(hfig,'tag','series_status') 2485 % uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', @view_file,'tag','list','UserData',OutputDir); 2486 % uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','titlebox','Max',2,'String',OutputDir); 2487 % uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]); 2488 % uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@stop_status); 2489 % uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@refresh_GUI); 2490 % %set(hrefresh,'UserData',StatusData) 2491 % BarPosition=[0.05 0.81 0.01 0.05]; 2492 % uicontrol('Style','frame','Units','normalized', 'Position',BarPosition ,'BackgroundColor',[1 0 0],'tag','waitbar'); 2493 % drawnow 2494 % end 2495 % refresh_GUI(hfig) 2494 2496 else 2495 2497 %% delete current display fig if selection is off -
trunk/src/series/civ_series.m
r609 r610 76 76 %% input files and indexing 77 77 NbField=1; 78 MaxIndex=cell2mat(Param.IndexRange.MaxIndex); 79 MinIndex=cell2mat(Param.IndexRange.MinIndex); 78 80 if isfield(Param,'InputTable') 79 RootPath=Param.InputTable{1,1};80 RootFile=Param.InputTable{1,3};81 SubDir=Param.InputTable{1,2};82 NomType=Param.InputTable{1,4};83 FileExt=Param.InputTable{1,5};84 PairCiv1=Param.ActionInput.PairIndices.ListPairCiv1;85 PairCiv2='';86 if isfield(Param.ActionInput.PairIndices,'ListPairCiv2')87 PairCiv2=Param.ActionInput.PairIndices.ListPairCiv2;88 end89 MaxIndex=cell2mat(Param.IndexRange.MaxIndex);90 MinIndex=cell2mat(Param.IndexRange.MinIndex);91 81 [filecell,i_series,tild,j_series]=get_file_series(Param); 92 [FileType_A,FileInfo,MovieObject_A]=get_file_type(filecell{1,1}); 93 if strcmp(FileType_A,'civdata')% a civdata file has been introduced as input. 94 [FileType_A,FileInfo,MovieObject_A]=get_file_type(filecell{2,1}); 95 end 96 [i1_series_Civ1,i2_series_Civ1,j1_series_Civ1,j2_series_Civ1,check_bounds,NomTypeNc]=... 97 find_pair_indices(PairCiv1,i_series{1},j_series{1},MinIndex,MaxIndex); 98 if ~isempty(PairCiv2) 99 [i1_series_Civ2,i2_series_Civ2,j1_series_Civ2,j2_series_Civ2,check_bounds_Civ2]=... 100 find_pair_indices(PairCiv2,i_series{1},j_series{1},MinIndex,MaxIndex); 101 check_bounds=check_bounds | check_bounds_Civ2; 102 end 103 i1_series_Civ1=i1_series_Civ1(~check_bounds); 104 i2_series_Civ1=i2_series_Civ1(~check_bounds); 105 j1_series_Civ1=j1_series_Civ1(~check_bounds); 106 j2_series_Civ1=j2_series_Civ1(~check_bounds); 107 if ~isempty(j1_series_Civ1) 108 FrameIndex_A_Civ1=j1_series_Civ1; 109 FrameIndex_B_Civ1=j2_series_Civ1; 82 if ~exist(filecell{1,1},'file') 83 displ('ERROR: the first input file does not exist') 84 return 110 85 else 111 FrameIndex_A_Civ1=i1_series_Civ1; 112 FrameIndex_B_Civ1=i2_series_Civ1; 113 end 114 if ~isempty(PairCiv2) 115 i1_series_Civ2=i1_series_Civ2(~check_bounds); 116 i2_series_Civ2=i2_series_Civ2(~check_bounds); 117 j1_series_Civ2=j1_series_Civ2(~check_bounds); 118 j2_series_Civ2=j2_series_Civ2(~check_bounds); 119 if ~isempty(j1_series_Civ2) 120 FrameIndex_A_Civ2=j1_series_Civ2; 121 FrameIndex_B_Civ2=j2_series_Civ2; 122 else 123 FrameIndex_A_Civ2=i1_series_Civ2; 124 FrameIndex_B_Civ2=i2_series_Civ2; 125 end 126 end 127 128 NbField=numel(i1_series_Civ1); 129 130 FileType_B=FileType_A; 131 MovieObject_B=MovieObject_A; 132 if size(filecell,1)>=2 && ~strcmp(filecell{1,1},filecell{2,1}) 133 [FileType_B,FileInfo,MovieObject_B]=get_file_type(filecell{2,1}); 134 end 135 end 136 86 FileType=get_file_type(filecell{1,1}); 87 iview_nc=0; 88 iview_A=0; 89 iview_B=0; 90 switch FileType 91 case 'civdata';% =1 for images 92 iview_nc=1; 93 if size(filecell,1)>=2 94 iview_A=2;iview_B=2; 95 if size(filecell,1)>=3 96 iview_B=3; 97 end 98 end 99 case {'image','multimage','mmreader','video'} 100 iview_A=1; 101 if size(filecell,1)>=2 102 iview_B=2; 103 end 104 end 105 end 106 if iview_A~=0 107 [FileType_A,FileInfo_A,VideoObject_A]=get_file_type(filecell{1,1}); 108 if isempty(strcmp(FileType_A,{'multimage','mmreader','video'})) 109 displ(['ERROR: the file line ' num2str(iview_A) ' must be an image']) 110 end 111 RootPath=Param.InputTable{1,1}; 112 RootFile=Param.InputTable{1,3}; 113 SubDir=Param.InputTable{1,2}; 114 NomType=Param.InputTable{1,4}; 115 FileExt=Param.InputTable{1,5}; 116 end 117 if iview_B==0 118 FileType_B=FileType_A; 119 VideoObject_B=VideoObject_A; 120 PairCiv1=Param.ActionInput.PairIndices.ListPairCiv1; 121 PairCiv2=''; 122 if isfield(Param.ActionInput.PairIndices,'ListPairCiv2') 123 PairCiv2=Param.ActionInput.PairIndices.ListPairCiv2; 124 end 125 [i1_series_Civ1,i2_series_Civ1,j1_series_Civ1,j2_series_Civ1,check_bounds,NomTypeNc]=... 126 find_pair_indices(PairCiv1,i_series{1},j_series{1},MinIndex,MaxIndex); 127 if ~isempty(PairCiv2) 128 [i1_series_Civ2,i2_series_Civ2,j1_series_Civ2,j2_series_Civ2,check_bounds_Civ2]=... 129 find_pair_indices(PairCiv2,i_series{1},j_series{1},MinIndex,MaxIndex); 130 check_bounds=check_bounds | check_bounds_Civ2; 131 end 132 i1_series_Civ1=i1_series_Civ1(~check_bounds); 133 i2_series_Civ1=i2_series_Civ1(~check_bounds); 134 j1_series_Civ1=j1_series_Civ1(~check_bounds); 135 j2_series_Civ1=j2_series_Civ1(~check_bounds); 136 if isempty(j_series{1}) 137 FrameIndex_A_Civ1=i1_series_Civ1; 138 FrameIndex_B_Civ1=i2_series_Civ1; 139 else 140 FrameIndex_A_Civ1=j1_series_Civ1; 141 FrameIndex_B_Civ1=j2_series_Civ1; 142 end 143 if ~isempty(PairCiv2) 144 i1_series_Civ2=i1_series_Civ2(~check_bounds); 145 i2_series_Civ2=i2_series_Civ2(~check_bounds); 146 j1_series_Civ2=j1_series_Civ2(~check_bounds); 147 j2_series_Civ2=j2_series_Civ2(~check_bounds); 148 if isempty(j_series{1}) 149 FrameIndex_A_Civ2=i1_series_Civ2; 150 FrameIndex_B_Civ2=i2_series_Civ2; 151 else 152 FrameIndex_A_Civ2=j1_series_Civ2; 153 FrameIndex_B_Civ2=j2_series_Civ2; 154 end 155 end 156 else 157 [FileType_B,FileInfo,VideoObject_B]=get_file_type(filecell{2,1}); 158 if isempty(strcmp(FileType_B,{'multimage','mmreader','video'})) 159 displ(['ERROR: the file line ' num2str(iview_B) ' must be an image']) 160 end 161 %TODO : introduce the second file series if relevant: case %displacement 162 end 163 end 164 NbField=numel(i1_series_Civ1); 137 165 138 166 %% Output directory … … 172 200 end 173 201 end 174 if strcmp(InputTable{iview,4},'*') 175 if ~isempty(VideoObject) 176 imainfo=get(VideoObject); 177 time=zeros(imainfo.NumberOfFrames+1,2); 178 time(:,2)=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate)'; 179 TimeSource='video'; 180 % set(han:dles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec 181 ColorType='truecolor'; 182 elseif ~isempty(imformats(regexprep(InputTable{iview,5},'^.',''))) || isequal(InputTable{iview,5},'.vol')%&& isequal(NomType,'*')% multi-frame image 183 if ~isempty(InputTable{iview,2}) 184 imainfo=imfinfo(fullfile(InputTable{iview,1},InputTable{iview,2},[InputTable{iview,3} InputTable{iview,5}])); 185 else 186 imainfo=imfinfo([FileBase InputTable{iview,5}]); 187 end 188 ColorType=imainfo.ColorType;%='truecolor' for color images 189 if length(imainfo) >1 %case of image with multiple frames 190 nbfield=length(imainfo); 191 nbfield_j=1; 192 end 193 end 194 end 195 196 %TODO: get time_A and time_B 197 198 if isempty(time) && (strcmp(FileType,'video') || strcmp(FileType,'mmreader')) 199 set(handles.ListPairMode,'Value',1); 200 dt=1/get(MovieObject,'FrameRate');%time interval between successive frames 201 if strcmp(NomTypeIma,'*') 202 set(handles.ListPairMode,'String',{'series(Di)'}) 203 MaxIndex_i=get(MovieObject,'NumberOfFrames'); 204 time=(dt*(0:MaxIndex_i-1))';%list of image times 205 else 206 set(handles.ListPairMode,'String',[{'series(Dj)'};{'series(Di)'}]) 207 MaxIndex_i=max(i1_series(i1_series>0)); 208 MaxIndex_j=get(MovieObject,'NumberOfFrames'); 209 time=ones(MaxIndex_i,1)*(dt*(0:MaxIndex_j-1));%list of image times 210 enable_j(handles,'on') 211 end 212 TimeUnit='s'; 213 end 202 if ~isempty(strcmp(FileType_A,{'mmreader','video'}))% case of video input 203 time=zeros(2,FileInfo_A.NumberOfFrames+1); 204 time(2,:)=(0:1/FileInfo_A.FrameRate:(FileInfo_A.NumberOfFrames)/FileInfo_A.FrameRate); 205 TimeSource='video'; 206 % set(han:dles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec 207 ColorType='truecolor'; 208 end 209 if length(FileInfo_A) >1 %case of image with multiple frames 210 nbfield=length(FileInfo_A); 211 nbfield_j=1; 212 end 213 214 214 %%%%% MAIN LOOP %%%%%% 215 216 MovieObject_A=[];217 215 for ifield=1:NbField 218 216 … … 232 230 else 233 231 ImageName_A=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i1_series_Civ1(ifield),[],j1_series_Civ1(ifield)); 234 [par_civ1.ImageA, MovieObject_A] = read_image(ImageName_A,FileType_A,MovieObject_A,FrameIndex_A_Civ1(ifield));232 [par_civ1.ImageA,VideoObject_A] = read_image(ImageName_A,FileType_A,VideoObject_A,FrameIndex_A_Civ1(ifield)); 235 233 ImageName_B=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i2_series_Civ1(ifield),[],j2_series_Civ1(ifield)); 236 [par_civ1.ImageB, MovieObject_B] = read_image(ImageName_B,FileType_B,MovieObject_B,FrameIndex_B_Civ1(ifield));234 [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B_Civ1(ifield)); 237 235 end 238 236 ncfile=fullfile_uvmat(RootPath,OutputDir,RootFile,'.nc',NomTypeNc,i1_series_Civ1(ifield),i2_series_Civ1(ifield),... 239 237 j1_series_Civ1(ifield),j2_series_Civ1(ifield)); 240 par_civ1.ImageWidth=FileInfo .Width;241 par_civ1.ImageHeight=FileInfo .Height;238 par_civ1.ImageWidth=FileInfo_A.Width; 239 par_civ1.ImageHeight=FileInfo_A.Height; 242 240 list_param=(fieldnames(Param.ActionInput.Civ1))'; 243 241 Civ1_param=regexprep(list_param,'^.+','Civ1_$0');% insert 'Civ1_' before each string in list_param … … 246 244 Data.Civ1_ImageA=ImageName_A; 247 245 Data.Civ1_ImageB=ImageName_B; 248 Data.Civ1_Time=((time(i2_civ1(ifile)+1,j2_civ1(j)+1)+time(i1_civ1(ifile)+1,j1_civ1(j)+1))/2); 249 Data.Civ1_Dt=(time(i2_civ1(ifile)+1,j2_civ1(j)+1)-time(i1_civ1(ifile)+1,j1_civ1(j)+1)); 246 i1=i1_series_Civ1(ifield); 247 i2=i1; 248 if ~isempty(i2_series_Civ1) 249 i2=i2_series_Civ1(ifield); 250 end 251 j1=1; 252 if ~isempty(j1_series_Civ1) 253 j1=j1_series_Civ1(ifield); 254 end 255 j2=j1; 256 if ~isempty(j2_series_Civ1) 257 j2=j2_series_Civ1(ifield); 258 end 259 Data.Civ1_Time=(time(j2+1,i2+1)+time(j1+1,i1+1))/2; 260 Data.Civ1_Dt=time(j2+1,i2+1)-time(j1+1,i1+1) 250 261 for ilist=1:length(list_param) 251 262 Data.(Civ1_param{4+ilist})=Param.ActionInput.Civ1.(list_param{ilist}); … … 385 396 par_civ2.ImageA=par_civ1.ImageA; 386 397 else 387 [par_civ2.ImageA, MovieObject_A] = read_image(ImageName_A,FileType_A,MovieObject_A,FrameIndex_A_Civ2);398 [par_civ2.ImageA,VideoObject_A] = read_image(ImageName_A,FileType_A,VideoObject_A,FrameIndex_A_Civ2); 388 399 end 389 400 ImageName_B_Civ2=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i2_series_Civ2(ifield),[],j2_series_Civ2(ifield)); … … 391 402 par_civ2.ImageB=par_civ1.ImageB; 392 403 else 393 [par_civ2.ImageB, MovieObject_B] = read_image(ImageName_B,FileType_B,MovieObject_B,FrameIndex_B_Civ2);404 [par_civ2.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B_Civ2); 394 405 end 395 406 … … 919 930 find_pair_indices(str_civ,i_series,j_series,MinIndex,MaxIndex) 920 931 %------------------------------------------------------------------------ 921 i1_series=i_series;% set of first image numbers932 i1_series=i_series;% set of first image indexes 922 933 i2_series=i_series; 923 934 j1_series=ones(size(i_series));% set of first image numbers 924 935 j2_series=ones(size(i_series)); 925 936 check_bounds=false(size(i_series)); 926 r=regexp(str_civ,'^\D(?<ind>[i|j])= 937 r=regexp(str_civ,'^\D(?<ind>[i|j])=( -| )(?<num1>\d+)\|(?<num2>\d+)','names'); 927 938 if ~isempty(r) 928 939 mode=['D' r.ind]; -
trunk/src/uigetfile_uvmat.m
r609 r610 12 12 function fileinput=uigetfile_uvmat(title,InputName) 13 13 fileinput=''; %default file selection 14 if strcmp(title,'status ')15 option='status ';14 if strcmp(title,'status_display') 15 option='status_display'; 16 16 else 17 17 option='browser'; 18 18 end 19 if exist(InputName,'file')||exist(InputName,'dir') 19 if exist(InputName,'dir') 20 InputDir=InputName; 21 InputFileName=''; 22 elseif exist(InputName,'file') 20 23 [InputDir,InputFileName,Ext]=fileparts(InputName); 21 InputFileName=[InputFileName Ext]; 24 if isempty(InputFileName)% if InputName is already the root 25 InputFileName=InputDir; 26 if ~isempty(strcmp (computer, {'PCWIN','PCWIN64'}))%case of Windows systems 27 InputDir=[InputDir '\'];% append '\' for a correct action of dir 28 InputFileName=[InputFileName '\']; 29 end 30 end 22 31 if isdir(InputName) 23 InputFileName=['+/' InputFileName ];32 InputFileName=['+/' InputFileName Ext]; 24 33 end 25 34 else … … 45 54 'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',12); 46 55 %set(hrefresh,'UserData',StatusData) 47 if strcmp(option,'status ') %put a run advancement display56 if strcmp(option,'status_display') %put a run advancement display 48 57 set(hfig,'DeleteFcn',@stop_status) 49 58 uicontrol('Style','frame','Units','normalized', 'Position',[0.05 0.81 0.01 0.05],'BackgroundColor',[1 0 0],'tag','waitbar'); … … 59 68 drawnow 60 69 end 61 refresh_GUI(findobj(hfig,'Tag','refresh'),InputFileName) 62 if ~strcmp(option,'status ')70 refresh_GUI(findobj(hfig,'Tag','refresh'),InputFileName)% refresh the list of content of the current dir 71 if ~strcmp(option,'status_display') 63 72 uiwait(hfig) 64 end 65 fileinput=get(hfig,'UserData');% retrieve the input file selection 66 delete(hfig) 73 fileinput=get(hfig,'UserData');% retrieve the input file selection 74 delete(hfig) 75 end 76 77 78 79 %------------------------------------------------------------------------ 80 % --- launched by refreshing the display figure 81 function refresh_GUI(hObject,InputFileName) 82 %------------------------------------------------------------------------ 83 if ~exist('InputFileName','var') 84 InputFileName=''; 85 end 86 hfig=get(hObject,'parent'); 87 DirName=get(hfig,'UserData'); 88 ListFiles=list_files(DirName);% list the directory content 89 hlist=findobj(hfig,'tag','list');% find the list object 90 set(hlist,'String',ListFiles) 91 Value=[]; 92 if ~isempty(InputFileName) 93 Value=find(strcmp(InputFileName,ListFiles)); 94 end 95 if isempty(Value) 96 Value=1; 97 end 98 set(hlist,'Value',Value) 99 100 if strcmp(get(hfig,'Tag'),'status_display') 101 102 hseries=findobj(allchild(0),'tag','series'); 103 hstatus=findobj(hseries,'tag','status_display'); 104 StatusData=get(hstatus,'UserData'); 105 TimeStart=0; 106 if isfield(StatusData,'TimeStart') 107 TimeStart=StatusData.TimeStart; 108 end 109 110 111 htitlebox=findobj(hfig,'tag','titlebox'); 112 hlist=findobj(hfig,'tag','list'); 113 OutputDir=get(hfig,'UserData'); 114 115 testrecent=0; 116 datnum=zeros(numel(ListDisplay),1); 117 for ilist=1:numel(ListDisplay) 118 ListDisplay{ilist}=ListFiles(ilist).name; 119 if ListFiles(ilist).isdir 120 ListDisplay{ilist}=['/' ListDisplay{ilist}]; 121 elseif isfield(ListFiles(ilist),'datenum') 122 datnum(ilist)=ListFiles(ilist).datenum;%only available in recent matlab versions 123 testrecent=1; 124 if datnum(ilist)<TimeStart 125 ListDisplay{ilist}=[ListDisplay{ilist} ' --OLD--']; 126 end 127 end 128 end 129 130 %% Look at date of creation 131 ListDisplay=ListDisplay(datnum~=0); 132 datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files 133 134 NbOutputFile=[]; 135 if isempty(datnum) 136 if testrecent 137 message='no result created yet'; 138 else 139 message=''; 140 end 141 else 142 [first,indfirst]=min(datnum); 143 [last,indlast]=max(datnum); 144 NbOutputFile_str='?'; 145 if isfield(StatusData,'NbOutputFile') 146 NbOutputFile=StatusData.NbOutputFile; 147 NbOutputFile_str=num2str(NbOutputFile); 148 end 149 message={[num2str(numel(datnum)) ' file(s) done over ' NbOutputFile_str] ;['oldest modification: ' ListDisplay{indfirst} ' : ' datestr(first)];... 150 ['latest modification: ' ListDisplay{indlast} ' : ' datestr(last)]}; 151 end 152 set(htitlebox,'String', [DirName{1};message]) 153 154 %% update the waitbar 155 hwaitbar=findobj(hfig,'tag','waitbar'); 156 if ~isempty(NbOutputFile) 157 BarPosition=get(hwaitbar,'Position'); 158 BarPosition(3)=0.9*numel(datnum)/NbOutputFile; 159 set(hwaitbar,'Position',BarPosition) 160 end 161 end 67 162 68 163 %------------------------------------------------------------------------ … … 118 213 set(hfig,'UserData',FullSelectName); 119 214 uiresume(hfig) 120 case 'status '215 case 'status_display' 121 216 uvmat(FullSelectName); 122 217 end 123 218 set(gcbo,'Value',1) 124 219 end 125 end126 127 %------------------------------------------------------------------------128 % --- launched by selecting home129 function home_dir(hObject,event)130 %------------------------------------------------------------------------131 DirName=pwd;132 ListFiles=list_files(DirName);% list the directory content133 hfig=get(hObject,'parent');134 set(hfig,'UserData',DirName)% record the new dir name135 htitlebox=findobj(hfig,'tag','titlebox'); % display the new dir name136 set(htitlebox,'String',DirName)137 hlist=findobj(hfig,'tag','list');% find the list object138 set(hlist,'String',ListFiles)139 %------------------------------------------------------------------------140 141 %------------------------------------------------------------------------142 % --- launched by pressing the backward (<--) button143 function backward(hObject,event)144 %------------------------------------------------------------------------145 PrevDir=get(hObject,'UserData');146 if ~isempty(PrevDir)147 hfig=get(hObject,'parent');148 set(hfig,'UserData',PrevDir)149 htitlebox=findobj(hfig,'tag','titlebox'); % display the new dir name150 set(htitlebox,'String',PrevDir)151 refresh_GUI(findobj(hfig,'Tag','refresh'))152 end153 154 %------------------------------------------------------------------------155 156 %------------------------------------------------------------------------157 % --- launched by refreshing the display figure158 function refresh_GUI(hObject,InputFileName)159 %------------------------------------------------------------------------160 if ~exist('InputFileName','var')161 InputFileName='';162 end163 hfig=get(hObject,'parent');164 DirName=get(hfig,'UserData');165 ListFiles=list_files(DirName);% list the directory content166 hlist=findobj(hfig,'tag','list');% find the list object167 set(hlist,'String',ListFiles)168 Value=[];169 if ~isempty(InputFileName)170 Value=find(strcmp(InputFileName,ListFiles));171 end172 if isempty(Value)173 Value=1;174 end175 set(hlist,'Value',Value)176 return177 178 %TODO adapt to series status179 hseries=findobj(allchild(0),'tag','series');180 hstatus=findobj(hseries,'tag','status');181 StatusData=get(hstatus,'UserData');182 TimeStart=0;183 if isfield(StatusData,'TimeStart')184 TimeStart=StatusData.TimeStart;185 end186 % testrecent=0;187 % datnum=zeros(numel(ListDisplay),1);188 % for ilist=1:numel(ListDisplay)189 % ListDisplay{ilist}=ListFiles(ilist).name;190 % if ListFiles(ilist).isdir191 % ListDisplay{ilist}=['/' ListDisplay{ilist}];192 % elseif isfield(ListFiles(ilist),'datenum')193 % datnum(ilist)=ListFiles(ilist).datenum;%only available in recent matlab versions194 % testrecent=1;195 % if datnum(ilist)<TimeStart196 % ListDisplay{ilist}=[ListDisplay{ilist} ' --OLD--'];197 % end198 % end199 % end200 201 202 %% Look at date of creation203 ListDisplay=ListDisplay(datnum~=0);204 datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files205 206 NbOutputFile=[];207 if isempty(datnum)208 if testrecent209 message='no result created yet';210 else211 message='';212 end213 else214 [first,indfirst]=min(datnum);215 [last,indlast]=max(datnum);216 NbOutputFile_str='?';217 if isfield(StatusData,'NbOutputFile')218 NbOutputFile=StatusData.NbOutputFile;219 NbOutputFile_str=num2str(NbOutputFile);220 end221 message={[num2str(numel(datnum)) ' file(s) done over ' NbOutputFile_str] ;['oldest modification: ' ListDisplay{indfirst} ' : ' datestr(first)];...222 ['latest modification: ' ListDisplay{indlast} ' : ' datestr(last)]};223 end224 set(htitlebox,'String', [DirName{1};message])225 226 %% update the waitbar227 hwaitbar=findobj(hfig,'tag','waitbar');228 if ~isempty(NbOutputFile)229 BarPosition=get(hwaitbar,'Position');230 BarPosition(3)=0.9*numel(datnum)/NbOutputFile;231 set(hwaitbar,'Position',BarPosition)232 220 end 233 221 … … 236 224 function ListFiles=list_files(DirName) 237 225 %------------------------------------------------------------------------- 238 ListStruct=dir(DirName); 226 ListStruct=dir(DirName);% get structure of the current directory 239 227 if numel(ListStruct)<1 240 228 ListFiles={}; … … 254 242 ListFiles=[{'+/..'} ListFiles(check_keep)]; 255 243 244 %------------------------------------------------------------------------ 245 % --- launched by selecting home 246 function home_dir(hObject,event) 247 %------------------------------------------------------------------------ 248 DirName=pwd; 249 ListFiles=list_files(DirName);% list the directory content 250 hfig=get(hObject,'parent'); 251 set(hfig,'UserData',DirName)% record the new dir name 252 htitlebox=findobj(hfig,'tag','titlebox'); % display the new dir name 253 set(htitlebox,'String',DirName) 254 hlist=findobj(hfig,'tag','list');% find the list object 255 set(hlist,'String',ListFiles) 256 %------------------------------------------------------------------------ 257 258 %------------------------------------------------------------------------ 259 % --- launched by pressing the backward (<--) button 260 function backward(hObject,event) 261 %------------------------------------------------------------------------ 262 PrevDir=get(hObject,'UserData'); 263 if ~isempty(PrevDir) 264 hfig=get(hObject,'parent'); 265 set(hfig,'UserData',PrevDir) 266 htitlebox=findobj(hfig,'tag','titlebox'); % display the new dir name 267 set(htitlebox,'String',PrevDir) 268 refresh_GUI(findobj(hfig,'Tag','refresh')) 269 end 270 256 271 %------------------------------------------------------------------------- 257 272 % launched by deleting the status figure (only used in mode series status') 258 273 function close(option,hObject, eventdata) 259 274 %------------------------------------------------------------------------- 260 if strcmp(option,'status ')275 if strcmp(option,'status_display') 261 276 hseries=findobj(allchild(0),'tag','series'); 262 hstatus=findobj(hfig,'Tag','status ');277 hstatus=findobj(hfig,'Tag','status_display'); 263 278 set(hhciv.status,'value',0) %reset the status uicontrol in the GUI civ 264 279 set(hhciv.status,'BackgroundColor',[0 1 0])
Note: See TracChangeset
for help on using the changeset viewer.