Changeset 1184 for trunk/src/series.m
- Timestamp:
- Nov 6, 2025, 7:03:02 PM (4 weeks ago)
- File:
-
- 1 edited
-
trunk/src/series.m (modified) (31 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r1183 r1184 134 134 %% Read the parameter file series.xml, or created from series.xml.default if it does not exist 135 135 SeriesData=[]; 136 [path_series,name,ext]=fileparts(which('series'));% path to the GUI series136 path_series=fileparts(which('series'));% path to the GUI series 137 137 xmlfile=fullfile(path_series,'series.xml'); 138 138 if ~exist(xmlfile,'file') … … 157 157 NbBuiltinAction=numel(ActionList); 158 158 set(handles.Action,'UserData',NbBuiltinAction) 159 path_series_fct=fullfile(path_series,'series');%path of the functions in subdirectroy 'series'160 [path_series ,name,ext]=fileparts(which('series')); % path to the GUI series159 %path_series_fct=fullfile(path_series,'series');%path of the functions in subdirectroy 'series' 160 [path_series]=fileparts(which('series')); % path to the GUI series 161 161 path_series_fct=fullfile(path_series,'series'); % path of the functions in subdirectroy 'series' 162 162 ActionExtList={'.m';'.sh';'fluidimage'}; % default choice of extensions (Matlab fct .m or compiled version .sh … … 166 166 if isfield(SeriesData.ClusterParam, 'ExistenceTest') 167 167 oarcommand=SeriesData.ClusterParam.ExistenceTest; 168 [s,w]=system(oarcommand); % look for cluster system presence168 s=system(oarcommand); % look for cluster system presence 169 169 if isequal(s,0)% cluster detected 170 170 RunModeList=[RunModeList;{'cluster'}]; … … 275 275 %% fill the list of input file series 276 276 InputTable=[{Param.InputFile.RootPath},{Param.InputFile.SubDir},{Param.InputFile.RootFile},{Param.InputFile.NomType},{Param.InputFile.FileExt}]; 277 if isempty(find(cellfun('isempty',InputTable)==0 )) % if there is no input file, do not introduce input info277 if isempty(find(cellfun('isempty',InputTable)==0,1)) % if there is no input file, do not introduce input info 278 278 set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color to indicate that input refresh is needed 279 279 return 280 280 end 281 TimeTable=[{Param.InputFile.TimeName},{[]},{[]},{[]},{[]}];281 % TimeTable=[{Param.InputFile.TimeName},{[]},{[]},{[]},{[]}]; 282 282 if isfield(Param.InputFile,'RootPath_1') 283 283 InputTable=[InputTable;[{Param.InputFile.RootPath_1},{Param.InputFile.SubDir_1},{Param.InputFile.RootFile_1},{Param.InputFile.NomType_1},{Param.InputFile.FileExt_1}]]; 284 TimeTable=[TimeTable; [{Param.InputFile.TimeName_1},{[]},{[]},{[]},{[]}]];284 % TimeTable=[TimeTable; [{Param.InputFile.TimeName_1},{[]},{[]},{[]},{[]}]]; 285 285 end 286 286 set(handles.InputTable,'Data',InputTable) … … 291 291 set(handles.Device,'String',[Device DeviceExt]) 292 292 set(handles.Experiment,'String',[Experiment ExperimentExt]) 293 if ~isempty(regexp(InputTable{1,1},'(^http://)|(^https://)' ))293 if ~isempty(regexp(InputTable{1,1},'(^http://)|(^https://)','once')) 294 294 set(handles.OutputPathBrowse,'Value',1)% an output folder needs to be specified for OpenDAP data 295 295 end … … 308 308 %% determine the selected reference field indices for pair display 309 309 310 [tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(Param.InputFile.FileIndex); 311 if isempty(i1) 312 i1=1; 313 end 314 if isempty(i2) 315 i2=i1; 316 end 310 % [~,~,~,i1,i2,j1,j2]=fileparts_uvmat(Param.InputFile.FileIndex); 311 i1=1;j1=1;%default 312 if isfield(Param,'i1') 313 i1=Param.i1; 314 end 315 if isfield(Param,'j1') 316 j1=Param.j1; 317 end 318 if isfield(Param,'i2') 319 i2=Param.i2; 320 end 321 if isfield(Param,'j2') 322 j2=Param.j2; 323 end 324 317 325 ref_i=floor((i1+i2)/2); % reference image number corresponding to the file 318 326 % set(handles.num_ref_i,'String',num2str(ref_i)); … … 609 617 %% update MinIndex_i and MaxIndex_i if the input table content has been reduced in line nbre 610 618 MinIndex_i_table=get(handles.MinIndex_i,'Data'); % retrieve the min indices in the table MinIndex 611 if ~isempty(MinIndex_i_table)612 619 set(handles.MinIndex_i,'Data',MinIndex_i_table(1:nbview,:)); 613 end614 620 MinIndex_j_table=get(handles.MinIndex_j,'Data'); % retrieve the min indices in the table MinIndex 615 if ~isempty(MinIndex_j_table)616 621 set(handles.MinIndex_j,'Data',MinIndex_j_table(1:nbview,:)); 617 end618 622 MaxIndex_i_table=get(handles.MaxIndex_i,'Data'); % retrieve the min indices in the table MinIndex 619 if ~isempty(MaxIndex_i_table) 623 620 624 set(handles.MaxIndex_i,'Data',MaxIndex_i_table(1:nbview,:)); 621 end622 625 MaxIndex_j_table=get(handles.MaxIndex_j,'Data'); % retrieve the min indices in the table MinIndex 623 if ~isempty(MaxIndex_j_table)624 626 set(handles.MaxIndex_j,'Data',MaxIndex_j_table(1:nbview,:)); 625 end626 627 PairString=get(handles.PairString,'Data'); % retrieve the min indices in the table MinIndex 627 if ~isempty(PairString)628 628 set(handles.PairString,'Data',PairString(1:nbview,:)); 629 end630 629 TimeTable=get(handles.TimeTable,'Data'); % retrieve the min indices in the table MinIndex 631 if ~isempty(TimeTable)632 630 set(handles.TimeTable,'Data',TimeTable(1:nbview,:)); 633 end634 631 635 632 %% set length of waitbar … … 861 858 862 859 %% display the min and max indices for the whole file series 863 if size(i1_series,2)==2 && min(min(i1_series(:,1,:)))==0 860 if isempty(i1_series) 861 MinIndex_j=1;MaxIndex_j=1;MinIndex_i=1;MaxIndex_i=1; 862 elseif size(i1_series,2)==2 && min(min(i1_series(:,1,:)))==0 864 863 MinIndex_j=1; % index j set to 1 by default 865 864 MaxIndex_j=1; … … 988 987 XmlData=[]; 989 988 check_calib=0; 990 991 989 XmlFileName=find_imadoc(InputTable{iview,1},InputTable{iview,2}); 992 990 if ~isempty(XmlFileName) … … 996 994 end 997 995 % read time if available 998 if isfield(XmlData,'Time') && strcmp(FileInfo.FieldType,'image')996 if isfield(XmlData,'Time') 999 997 Time=XmlData.Time; 1000 998 TimeName='xml'; … … 1310 1308 end 1311 1309 PairString=get(handles.PairString,'Data'); 1312 ref_i_1=str2num(get(handles.num_first_i,'String')); % first reference index 1313 ref_i_2=str2num(get(handles.num_last_i,'String')); % last reference index 1314 ref_j_1=[];ref_j_2=[]; 1310 ref_i_1=str2double(get(handles.num_first_i,'String')); % first reference index 1311 if isnan(ref_i_1) 1312 ref_i_1=1; 1313 end 1314 ref_i_2=str2double(get(handles.num_last_i,'String')); % last reference index 1315 if isnan(ref_i_2) 1316 ref_i_2=1; 1317 end 1318 ref_j_1=NaN;ref_j_2=NaN; 1315 1319 if strcmp(get(handles.num_first_j,'Visible'),'on') 1316 ref_j_1=str2num(get(handles.num_first_j,'String'));1317 ref_j_2=str2num(get(handles.num_last_j,'String'));1320 ref_j_1=str2double(get(handles.num_first_j,'String')); 1321 ref_j_2=str2double(get(handles.num_last_j,'String')); 1318 1322 end 1319 1323 [i1_1,i2_1,j1_1,j2_1] = get_file_index(ref_i_1,ref_j_1,PairString); … … 1429 1433 1430 1434 function errormsg=launch_action(handles) 1431 errormsg=''; % default1435 %errormsg=''; % default 1432 1436 1433 1437 %% read the data on the GUI series … … 1637 1641 end 1638 1642 end 1639 [ xx,ExpName]=fileparts(Param.InputTable{1,1});1640 Param.IndexRange.first_i=str2 num(get(handles.num_first_i,'String'));%reset the firrst_i and last_i for multiple experiments, modified by the splitting into NbProcess1641 Param.IndexRange.last_i=str2 num(get(handles.num_last_i,'String'));1643 [~,ExpName]=fileparts(Param.InputTable{1,1}); 1644 Param.IndexRange.first_i=str2double(get(handles.num_first_i,'String'));%reset the firrst_i and last_i for multiple experiments, modified by the splitting into NbProcess 1645 Param.IndexRange.last_i=str2double(get(handles.num_last_i,'String')); 1642 1646 1643 1647 %% create the output data directory if needed, after checking its existence … … 1655 1659 else 1656 1660 PathExpOut=fullfile(PathOut,get(handles.Experiment,'String')); 1657 PathExpDeviceOut=fullfile(PathExpOut,get(handles.Device,'String')) 1661 PathExpDeviceOut=fullfile(PathExpOut,get(handles.Device,'String')); 1658 1662 end 1659 1663 if ~exist(PathExpOut,'dir') 1660 [ tild,msg1]=mkdir(PathExpOut);1664 [~,msg1]=mkdir(PathExpOut); 1661 1665 if ~strcmp(msg1,'') 1662 1666 errormsg=['cannot create ' PathExpOut ': ' msg1]; % error message for directory creation … … 1665 1669 end 1666 1670 if ~exist(PathExpDeviceOut,'dir') 1667 [ tild,msg1]=mkdir(PathExpDeviceOut);1671 [~,msg1]=mkdir(PathExpDeviceOut); 1668 1672 if ~strcmp(msg1,'') 1669 1673 errormsg=['cannot create ' PathExpDeviceOut ': ' msg1]; % error message for directory creation … … 1710 1714 OutputDir=fullfile(PathExpDeviceOut,[Param.OutputSubDir Param.OutputDirExt]); % full name (with path) of output directory 1711 1715 if check_create % create output directory if it does not exist 1712 [ tild,msg1]=mkdir(OutputDir);1716 [~,msg1]=mkdir(OutputDir); 1713 1717 if ~strcmp(msg1,'') 1714 1718 errormsg=['cannot create ' OutputDir ': ' msg1]; % error message for directory creation … … 1784 1788 else 1785 1789 ref_j=first_j:incr_j:last_j; 1786 [ tild,ref_i]=find(squeeze(SeriesData.i1_series{1}(1,:,:)));1790 [~,ref_i]=find(squeeze(SeriesData.i1_series{1}(1,:,:))); 1787 1791 ref_i=ref_i-1; 1788 1792 ref_i=ref_i(ref_i>=first_i & ref_i<=last_i); … … 1792 1796 ref_i=first_i:incr_i:last_i; 1793 1797 if isempty(incr_j)% automatic finding of the existing j indices 1794 [ref_j,tild]=find(squeeze(SeriesData.i1_series{1}(1,:,:)));1798 ref_j=find(squeeze(SeriesData.i1_series{1}(1,:,:))); 1795 1799 ref_j=ref_j-1; 1796 1800 ref_j=ref_j(ref_j>=first_j & ref_j<=last_j); … … 1809 1813 else 1810 1814 answer=msgbox_uvmat('INPUT_TXT','estimate the CPU time(in minutes) for each value of index i:' ,''); 1811 CPUTime=str2 num(answer);1815 CPUTime=str2double(answer); 1812 1816 set(handles.num_CPUTime,'String',answer) 1813 1817 Param.Action.CPUTime=CPUTime; … … 2091 2095 cd(curdir) 2092 2096 else 2093 [ tild,msg1]=mkdir(DIR_CLUSTER);2097 [~,msg1]=mkdir(DIR_CLUSTER); 2094 2098 if ~strcmp(msg1,'') 2095 2099 errormsg=['cannot create ' DIR_CLUSTER ': ' msg1]; % error message for directory creation … … 2186 2190 cd(curdir) 2187 2191 else 2188 [ tild,msg1]=mkdir(DirSGE);2192 [~,msg1]=mkdir(DirSGE); 2189 2193 if ~strcmp(msg1,'') 2190 2194 errormsg=['cannot create ' DirSGE ': ' msg1]; % error message for directory creation … … 2211 2215 cmd=[cmd ActionFullName ' /softs/matlab ' filexml{imgsInJob(ii)} '\n']; 2212 2216 end 2213 [fid, message]= fopen([DirSGE '/job' num2str(currJobIndex) '.sh'], 'w');2217 fid = fopen([DirSGE '/job' num2str(currJobIndex) '.sh'], 'w'); 2214 2218 fprintf(fid, cmd); 2215 2219 fclose(fid); … … 2221 2225 fullfile([DirSGE '/job' num2str(currJobIndex) '.sh'])]; 2222 2226 fprintf(sge_command); % display in command line 2223 [ status, result] = system(sge_command);2227 [~, result] = system(sge_command); 2224 2228 fprintf(result); 2225 2229 currJobIndex = currJobIndex + 1; … … 2235 2239 command = ['python -m fluidimage.run_from_xml ' filexml{iprocess}]; 2236 2240 fprintf(['command:\n' command '\n\n']) 2237 [status, result] = call_command_clean(command);2241 % [status, result] = call_command_clean(command); 2238 2242 end 2239 2243 if exist(OutputDir,'dir') 2240 [ SUCCESS,MESSAGE,MESSAGEID] = fileattrib (OutputDir);2244 [~,MESSAGE] = fileattrib (OutputDir); 2241 2245 if MESSAGE.GroupWrite~=1 2242 2246 [success,msg] = fileattrib(OutputDir,'+w','g','s'); % allow writing access for the group of users, recursively in the folder … … 2393 2397 %% Put the first line of the selected Action fct as tooltip help 2394 2398 try 2395 [fid,errormsg]=fopen([fullfile(ActionPath,ActionName) '.m']);2399 fid=fopen([fullfile(ActionPath,ActionName) '.m']); 2396 2400 InputText=textscan(fid,'%s',1,'delimiter','\n'); 2397 2401 fclose(fid); … … 2877 2881 set(handles.FieldName,'String',[FieldListInit; FieldList; {'add_field...'}]); 2878 2882 if ~strcmp(GetFieldData.FieldOption,'civdata...') 2879 if ~isempty(regexp(FieldList{1},'^vec' ))2883 if ~isempty(regexp(FieldList{1},'^vec', 'once')) 2880 2884 set(handles.FieldName,'Value',1) 2881 2885 else … … 3031 3035 datepair(imulti)=datenum(dirpair(ind_pairs(imulti)).date); % dates of creation 3032 3036 end 3033 [ datenew,indsort2]=sort(datepair); % sort the multiplet by creation date3037 [~,indsort2]=sort(datepair); % sort the multiplet by creation date 3034 3038 ind_s=indsort2(1:end-1); % 3035 3039 ind_remove=[ind_remove ind_pairs(ind_s)]; % remove these indices, leave the last one … … 3058 3062 num_j1=meshgrid(num_j,ones(size(num_i1_line))); 3059 3063 num_j2=meshgrid(num_j,ones(size(num_i1_line))); 3060 [ xx,num_i1]=meshgrid(num_j,num_i1_line);3061 [ xx,num_i2]=meshgrid(num_j,num_i2_line);3064 [~,num_i1]=meshgrid(num_j,num_i1_line); 3065 [~,num_i2]=meshgrid(num_j,num_i2_line); 3062 3066 elseif isequal (mode,'series(Dj)')||isequal (mode,'bursts') 3063 3067 if isequal(mode,'bursts') %case of bursts (png_old or png_2D) … … 3200 3204 MaskTable=cell(NbView,2); 3201 3205 3202 RootPath=Param.InputTable{1,1};3206 %RootPath=Param.InputTable{1,1}; 3203 3207 first_j=[];% note that the function will propose to cover the whole range of indices 3204 3208 if isfield(Param.IndexRange,'first_j'); first_j=Param.IndexRange.first_j; end 3205 last_j=[];3209 %last_j=[]; 3206 3210 if isfield(Param.IndexRange,'last_j'); last_j=Param.IndexRange.last_j; end 3207 3211 PairString=''; … … 3214 3218 Param.InputTable{iview,5},Param.InputTable{iview,4},i1,i2,j1,j2); 3215 3219 3216 [FileInfo,VideoObject]=get_file_info(FirstFileName);3220 % [FileInfo,VideoObject]=get_file_info(FirstFileName); 3217 3221 3218 3222 … … 3422 3426 %% use a browser to choose the xml file containing the processing config 3423 3427 InputTable=get(handles.InputTable,'Data'); 3424 oldfile='';3425 if isempty(InputTable)3426 oldfile='';3427 else3428 3428 oldfile=InputTable{1,1}; % current path in InputTable 3429 end3430 3429 if isempty(oldfile) 3431 3430 % use a file name stored in prefdir
Note: See TracChangeset
for help on using the changeset viewer.
