Changeset 992
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/compile.m
r977 r992 25 25 26 26 function compile (FctName,SubfctPath) 27 hh=[]; % handles of message display window27 hh=[]; % handles of message display window 28 28 if isempty(which('mcc')) 29 29 msgbox_uvmat('ERROR','no Matlab compiler toolbox mcc installed') … … 41 41 end 42 42 if ~isempty(SubfctPath) 43 SubfctPath=['-I ' SubfctPath]; %string indicating the option of including the path SubfctPath43 SubfctPath=['-I ' SubfctPath]; % string indicating the option of including the path SubfctPath 44 44 end 45 45 [mcrmajor, mcrminor] = mcrversion; … … 47 47 FctNameVersion=[FctName,'_',MCRROOT]; 48 48 %hver=ver('MATLAB'); 49 %FctNameVersion=[FctName '_MCRROOT' regexprep(hver.Version,'\.','')]; %suppress the dot in version number49 %FctNameVersion=[FctName '_MCRROOT' regexprep(hver.Version,'\.','')]; % suppress the dot in version number 50 50 try 51 51 disp(['mcc -m -R -nojvm -R -nodisplay -R -singleCompThread ' SubfctPath ' ' FctName '.m']) 52 52 eval(['mcc -m -R -nojvm -R -nodisplay -R -singleCompThread ' SubfctPath ' ' FctName '.m'])% compile the source file [FctName .m], which produces a binary file FctName and a cmd file [run_' FctName '.sh] 53 system(['mv -f ' FctName ' bin/']); %move the binary file FctName to the subdir /bin54 system(['sed -e ''''s#/' FctName '#/bin/' FctName '#'''' run_' FctName '.sh > ' FctNameVersion '.sh']); %modify the cmd file and copy it to [FctName '.sh']55 system(['rm run_' FctName '.sh']); % remove the initial cmd file [run_' FctName '.sh]53 system(['mv -f ' FctName ' bin/']); % move the binary file FctName to the subdir /bin 54 system(['sed -e ''''s#/' FctName '#/bin/' FctName '#'''' run_' FctName '.sh > ' FctNameVersion '.sh']); % modify the cmd file and copy it to [FctName '.sh'] 55 system(['rm run_' FctName '.sh']); % remove the initial cmd file [run_' FctName '.sh] 56 56 system(['chmod +x ' FctNameVersion '.sh']); % set the cmd file to 'executable' 57 57 catch ME -
trunk/src/series.m
r991 r992 72 72 % position and size of the GUI at opening 73 73 set(0,'Unit','points') 74 ScreenSize=get(0,'ScreenSize'); %size of the current screen, in points (1/72 inch)75 Width=900; % prefered width of the GUI in points (1/72 inch)76 Height=624; % prefered height of the GUI in points (1/72 inch)74 ScreenSize=get(0,'ScreenSize'); % size of the current screen, in points (1/72 inch) 75 Width=900; % prefered width of the GUI in points (1/72 inch) 76 Height=624; % prefered height of the GUI in points (1/72 inch) 77 77 %adjust to screen size (reduced by a min margin) 78 78 RescaleFactor=min((ScreenSize(3)-80)/Width,(ScreenSize(4)-80)/Height); … … 82 82 Width=Width*RescaleFactor; 83 83 Height=Height*RescaleFactor; 84 LeftX=80*RescaleFactor; %position of the left fig side, in pixels (put to the left side, with some margin)84 LeftX=80*RescaleFactor; % position of the left fig side, in pixels (put to the left side, with some margin) 85 85 LowY=round(ScreenSize(4)/2-Height/2); % put at the middle height on the screen 86 86 set(hObject,'Units','points') … … 129 129 % check default input data 130 130 if ~exist('Param','var') 131 Param=[]; % default131 Param=[]; % default 132 132 end 133 133 134 134 %% list of builtin functions in the mebu ActionName 135 ActionList={'check_data_files';'aver_stat';'time_series';'civ_series';'merge_proj'}; % WARNING: fits with nb_builtin_ACTION=4 in ActionName_callback135 ActionList={'check_data_files';'aver_stat';'time_series';'civ_series';'merge_proj'}; % WARNING: fits with nb_builtin_ACTION=4 in ActionName_callback 136 136 NbBuiltinAction=numel(ActionList); 137 137 set(handles.Action,'UserData',NbBuiltinAction) 138 [path_series,name,ext]=fileparts(which('series')); % path to the GUI series139 path_series_fct=fullfile(path_series,'series'); %path of the functions in subdirectroy 'series'138 [path_series,name,ext]=fileparts(which('series')); % path to the GUI series 139 path_series_fct=fullfile(path_series,'series'); % path of the functions in subdirectroy 'series' 140 140 [code, message] = system... 141 141 ('LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | pyp "p.split('':'') |... [s for s in p if ''matlab'' not in s] | '':''.join(p)") python -c "import fluidimage"'); 142 142 if code==0 143 ActionExtList={'.m';'.sh';'.py (in dev.)'}; % default choice of extensions (Matlab fct .m or compiled version .sh143 ActionExtList={'.m';'.sh';'.py (in dev.)'}; % default choice of extensions (Matlab fct .m or compiled version .sh 144 144 else 145 145 ActionExtList={'.m';'.sh'}; % python options not installed 146 146 end 147 ActionPathList=cell(NbBuiltinAction,1); %initiate the cell matrix of Action fct paths148 ActionPathList(:)={path_series_fct}; % set the default path to series fcts to all list members149 RunModeList={'local';'background'}; % default choice of extensions (Matlab fct .m or compiled version .sh)150 [s,w]=system('oarstat'); % look for cluster system 'oar'147 ActionPathList=cell(NbBuiltinAction,1); % initiate the cell matrix of Action fct paths 148 ActionPathList(:)={path_series_fct}; % set the default path to series fcts to all list members 149 RunModeList={'local';'background'}; % default choice of extensions (Matlab fct .m or compiled version .sh) 150 [s,w]=system('oarstat'); % look for cluster system 'oar' 151 151 if isequal(s,0) 152 152 RunModeList=[RunModeList;{'cluster_oar'}]; … … 155 155 set(handles.CPUTime_txt,'Visible','on'); % make visible button for access to Monika 156 156 end 157 [s,w]=system('qstat -help'); % look for cluster system 'sge'157 [s,w]=system('qstat -help'); % look for cluster system 'sge' 158 158 if isequal(s,0) 159 159 if regexp(w,'^pbs') … … 168 168 169 169 %% list of builtin transform functions in the menu TransformName 170 TransformList={'';'sub_field';'phys';'phys_polar'}; % WARNING: must fit with the corresponding menu in uvmat and nb_builtin_transform=4 in TransformName_callback170 TransformList={'';'sub_field';'phys';'phys_polar'}; % WARNING: must fit with the corresponding menu in uvmat and nb_builtin_transform=4 in TransformName_callback 171 171 NbBuiltinTransform=numel(TransformList); 172 172 path_transform_fct=fullfile(path_series,'transform_field'); 173 TransformPathList=cell(NbBuiltinTransform,1); %initiate the cell matrix of Action fct paths174 TransformPathList(:)={path_transform_fct}; % set the default path to series fcts to all list members173 TransformPathList=cell(NbBuiltinTransform,1); % initiate the cell matrix of Action fct paths 174 TransformPathList(:)={path_transform_fct}; % set the default path to series fcts to all list members 175 175 176 176 %% get the user defined functions stored in the personal file uvmat_perso.mat … … 208 208 209 209 %% selection of the input Action fct 210 ActionCheckExist=true(size(ActionList)); %initiate the check of the path to the listed action fct210 ActionCheckExist=true(size(ActionList)); % initiate the check of the path to the listed action fct 211 211 for ilist=NbBuiltinAction+1:numel(ActionList)%check the validity of the path of the user defined Action fct 212 212 ActionCheckExist(ilist)=exist(fullfile(ActionPathList{ilist},[ActionList{ilist} '.m']),'file'); 213 213 end 214 ActionPathList=ActionPathList(ActionCheckExist,:); % suppress the menu options which are not valid anymore214 ActionPathList=ActionPathList(ActionCheckExist,:); % suppress the menu options which are not valid anymore 215 215 ActionList=ActionList(ActionCheckExist); 216 216 set(handles.ActionName,'String',[ActionList;{'more...'}]) … … 249 249 %% fields input initialisation 250 250 if isfield(Param,'list_fields')&& isfield(Param,'index_fields') &&~isempty(Param.list_fields) &&~isempty(Param.index_fields) 251 set(handles.FieldName,'String',Param.list_fields); % list menu fields252 set(handles.FieldName,'Value',Param.index_fields); % selected string index251 set(handles.FieldName,'String',Param.list_fields); % list menu fields 252 set(handles.FieldName,'Value',Param.index_fields); % selected string index 253 253 end 254 254 if isfield(Param,'Coordinates') … … 264 264 end 265 265 % if isfield(Param,'Coord_x_str') && ischar(Param.Coord_x_str) 266 % set(handles.Coord_x,'String',Param.Coord_x_str); % list menu fields266 % set(handles.Coord_x,'String',Param.Coord_x_str); % list menu fields 267 267 % end 268 268 % if isfield(Param,'Coord_y_str')&& ischar(Param.Coord_y_str) 269 % set(handles.Coord_y,'String',Param.Coord_y_str); % list menu fields269 % set(handles.Coord_y,'String',Param.Coord_y_str); % list menu fields 270 270 % end 271 271 … … 276 276 %% fill the list of file series 277 277 InputTable=[{Param.InputFile.RootPath},{Param.InputFile.SubDir},{Param.InputFile.RootFile},{Param.InputFile.NomType},{Param.InputFile.FileExt}]; 278 if isempty(find(cellfun('isempty',InputTable)==0)); % if there is no input file, do not introduce input info278 if isempty(find(cellfun('isempty',InputTable)==0)); % if there is no input file, do not introduce input info 279 279 set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color to indicate that input refresh is needed 280 280 return … … 295 295 i2=i1; 296 296 end 297 ref_i=floor((i1+i2)/2); % reference image number corresponding to the file297 ref_i=floor((i1+i2)/2); % reference image number corresponding to the file 298 298 % set(handles.num_ref_i,'String',num2str(ref_i)); 299 299 if isempty(j1) … … 303 303 j2=j1; 304 304 end 305 ref_j=floor((j1+j2)/2); % reference image number corresponding to the file305 ref_j=floor((j1+j2)/2); % reference image number corresponding to the file 306 306 SeriesData.ref_i=ref_i; 307 307 SeriesData.ref_j=ref_j; … … 444 444 {get(handles.MenuFile_3,'Label')};{get(handles.MenuFile_4,'Label')};{get(handles.MenuFile_5,'Label')}]; 445 445 str_find=strcmp(get(hObject,'Label'),MenuFile); 446 MenuFile(str_find)=[]; % suppress the input file to the list446 MenuFile(str_find)=[]; % suppress the input file to the list 447 447 for ifile=1:numel(MenuFile) 448 448 set(handles.(['MenuFile_' num2str(ifile)]),'Label',MenuFile{ifile}); … … 483 483 end 484 484 485 OutPut=browse_data(oldfile,'on','on'); % open the GUI browse_data to get select a campaign dir, experiment and device485 OutPut=browse_data(oldfile,'on','on'); % open the GUI browse_data to get select a campaign dir, experiment and device 486 486 NbLines=numel(OutPut.Experiment)*numel(OutPut.DataSeries); 487 487 icount=0; … … 524 524 % -------------------------------------------------------------------- 525 525 526 OutPut=browse_data(get(hObject,'Label'),'on','on'); % open the GUI browse_data to get select a campaign dir, experiment and device526 OutPut=browse_data(get(hObject,'Label'),'on','on'); % open the GUI browse_data to get select a campaign dir, experiment and device 527 527 if ~isfield(OutPut,'Campaign') 528 528 return … … 581 581 set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color to indicate that input refresh is needed 582 582 set(handles.OutputSubDir,'BackgroundColor',[1 0 1])% set edit box OutputSubDir to magenta color to indicate that refresh may be needed 583 xx=double(get(handles.series,'CurrentCharacter')); % get the keyboard character583 xx=double(get(handles.series,'CurrentCharacter')); % get the keyboard character 584 584 if ~isempty(xx) 585 585 switch xx … … 588 588 iline=str2double(get(handles.InputLine,'String')); 589 589 if isequal(iline,size(InputTable,1))% arrow downward 590 InputTable=[InputTable;InputTable(iline,:)]; % create a new line as a copy of the last one590 InputTable=[InputTable;InputTable(iline,:)]; % create a new line as a copy of the last one 591 591 set(handles.InputTable,'Data',InputTable); 592 592 end … … 609 609 end 610 610 if ~isempty(find(empty_line)); 611 InputTable(empty_line,:)=[]; %remove empty lines611 InputTable(empty_line,:)=[]; % remove empty lines 612 612 set(handles.InputTable,'Data',InputTable) 613 613 ListTable={'MinIndex_i','MaxIndex_i','MinIndex_j','MaxIndex_j','PairString','TimeTable'}; 614 614 for ilist=1:numel(ListTable) 615 615 Table=get(handles.(ListTable{ilist}),'Data'); 616 Table(empty_line,:)=[]; %remove empty lines616 Table(empty_line,:)=[]; % remove empty lines 617 617 set(handles.(ListTable{ilist}),'Data',Table); 618 618 end … … 644 644 645 645 %% update MinIndex_i and MaxIndex_i if the input table content has been reduced in line nbre 646 MinIndex_i_table=get(handles.MinIndex_i,'Data'); %retrieve the min indices in the table MinIndex646 MinIndex_i_table=get(handles.MinIndex_i,'Data'); % retrieve the min indices in the table MinIndex 647 647 set(handles.MinIndex_i,'Data',MinIndex_i_table(1:nbview,:)); 648 MinIndex_j_table=get(handles.MinIndex_j,'Data'); %retrieve the min indices in the table MinIndex648 MinIndex_j_table=get(handles.MinIndex_j,'Data'); % retrieve the min indices in the table MinIndex 649 649 set(handles.MinIndex_j,'Data',MinIndex_j_table(1:nbview,:)); 650 MaxIndex_i_table=get(handles.MaxIndex_i,'Data'); %retrieve the min indices in the table MinIndex650 MaxIndex_i_table=get(handles.MaxIndex_i,'Data'); % retrieve the min indices in the table MinIndex 651 651 652 652 set(handles.MaxIndex_i,'Data',MaxIndex_i_table(1:nbview,:)); 653 MaxIndex_j_table=get(handles.MaxIndex_j,'Data'); %retrieve the min indices in the table MinIndex653 MaxIndex_j_table=get(handles.MaxIndex_j,'Data'); % retrieve the min indices in the table MinIndex 654 654 set(handles.MaxIndex_j,'Data',MaxIndex_j_table(1:nbview,:)); 655 PairString=get(handles.PairString,'Data'); %retrieve the min indices in the table MinIndex655 PairString=get(handles.PairString,'Data'); % retrieve the min indices in the table MinIndex 656 656 set(handles.PairString,'Data',PairString(1:nbview,:)); 657 TimeTable=get(handles.TimeTable,'Data'); %retrieve the min indices in the table MinIndex657 TimeTable=get(handles.TimeTable,'Data'); % retrieve the min indices in the table MinIndex 658 658 set(handles.TimeTable,'Data',TimeTable(1:nbview,:)); 659 659 … … 680 680 set(handles.REFRESH,'BackgroundColor',[1 1 0])% set REFRESH button to yellow color (indicate activation) 681 681 drawnow 682 errormsg=''; %default682 errormsg=''; % default 683 683 if ischar(Param) 684 684 fileinput=Param; … … 741 741 SeriesData=get(handles.series,'UserData'); 742 742 if strcmp(iview,'append') % display the input data as a new line in the table 743 iview=size(InputTable,1)+1; % the next line in InputTable becomes the current line743 iview=size(InputTable,1)+1; % the next line in InputTable becomes the current line 744 744 % InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; 745 745 elseif strcmp(iview,'one') % refresh the list of input file series 746 iview=1; % the first line in InputTable becomes the current line746 iview=1; % the first line in InputTable becomes the current line 747 747 InputTable={'','','','',''}; 748 748 % InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; … … 753 753 set(handles.MaxIndex_j,'Data',[]) 754 754 set(handles.PairString,'Data',{''}) 755 SeriesData.CheckPair=0; %reset the list of input lines with pairs755 SeriesData.CheckPair=0; % reset the list of input lines with pairs 756 756 SeriesData.i1_series={}; 757 757 SeriesData.i2_series={}; … … 784 784 i2=i1; 785 785 end 786 ref_i=floor((i1+i2)/2); % reference image number corresponding to the file786 ref_i=floor((i1+i2)/2); % reference image number corresponding to the file 787 787 % set(handles.num_ref_i,'String',num2str(ref_i)); 788 788 if isempty(j1) … … 792 792 j2=j1; 793 793 end 794 ref_j=floor((j1+j2)/2); % reference image number corresponding to the file794 ref_j=floor((j1+j2)/2); % reference image number corresponding to the file 795 795 SeriesData.ref_i=ref_i; 796 796 SeriesData.ref_j=ref_j; … … 824 824 str_find=strcmp(fileinput,MenuFile); 825 825 if isempty(find(str_find,1)) 826 MenuFile=[{fileinput};MenuFile]; %insert the current file if not already in the list826 MenuFile=[{fileinput};MenuFile]; % insert the current file if not already in the list 827 827 end 828 828 for ifile=1:min(length(MenuFile),5) … … 832 832 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 833 833 if exist(profil_perso,'file') 834 save (profil_perso,'MenuFile','-append'); % store the file names for future opening of uvmat834 save (profil_perso,'MenuFile','-append'); % store the file names for future opening of uvmat 835 835 else 836 save (profil_perso,'MenuFile','-V6'); % store the file names for future opening of uvmat836 save (profil_perso,'MenuFile','-V6'); % store the file names for future opening of uvmat 837 837 end 838 838 % save the opened file to initiate future opening 839 SeriesData.RefFile{iview}=fileinput; % reference opening file for line iview839 SeriesData.RefFile{iview}=fileinput; % reference opening file for line iview 840 840 SeriesData.Ref_i1=i1; 841 841 SeriesData.Ref_i2=i2; … … 865 865 %% display the min and max indices for the whole file series 866 866 if size(i1_series,2)==2 && min(min(i1_series(:,1,:)))==0 867 MinIndex_j=1; % index j set to 1 by default867 MinIndex_j=1; % index j set to 1 by default 868 868 MaxIndex_j=1; 869 MinIndex_i=find(i1_series(1,2,:), 1 )-1; % min ref index i detected in the series (corresponding to the first non-zero value of i1_series, except for zero index)870 MaxIndex_i=find(i1_series(1,2,:),1,'last' )-1; %max ref index i detected in the series (corresponding to the last non-zero value of i1_series)869 MinIndex_i=find(i1_series(1,2,:), 1 )-1; % min ref index i detected in the series (corresponding to the first non-zero value of i1_series, except for zero index) 870 MaxIndex_i=find(i1_series(1,2,:),1,'last' )-1; % max ref index i detected in the series (corresponding to the last non-zero value of i1_series) 871 871 else 872 ref_i=squeeze(max(i1_series(1,:,:),[],2)); % select ref_j index for each ref_i873 ref_j=squeeze(max(j1_series(1,:,:),[],3)); % select ref_i index for each ref_j872 ref_i=squeeze(max(i1_series(1,:,:),[],2)); % select ref_j index for each ref_i 873 ref_j=squeeze(max(j1_series(1,:,:),[],3)); % select ref_i index for each ref_j 874 874 MinIndex_i=min(find(ref_i))-1; 875 875 MaxIndex_i=max(find(ref_i))-1; … … 891 891 MinIndex_j=0; 892 892 end 893 MinIndex_i_table=get(handles.MinIndex_i,'Data'); %retrieve the min indices in the table MinIndex894 MinIndex_j_table=get(handles.MinIndex_j,'Data'); %retrieve the min indices in the table MinIndex895 MaxIndex_i_table=get(handles.MaxIndex_i,'Data'); %retrieve the min indices in the table MinIndex896 MaxIndex_j_table=get(handles.MaxIndex_j,'Data'); %retrieve the min indices in the table MinIndex893 MinIndex_i_table=get(handles.MinIndex_i,'Data'); % retrieve the min indices in the table MinIndex 894 MinIndex_j_table=get(handles.MinIndex_j,'Data'); % retrieve the min indices in the table MinIndex 895 MaxIndex_i_table=get(handles.MaxIndex_i,'Data'); % retrieve the min indices in the table MinIndex 896 MaxIndex_j_table=get(handles.MaxIndex_j,'Data'); % retrieve the min indices in the table MinIndex 897 897 if ~isempty(MinIndex_i)&&~isempty(MaxIndex_i) 898 898 MinIndex_i_table(iview,1)=MinIndex_i; … … 911 911 %% adjust the first and last indices for the selected series, only if requested by the bounds 912 912 % i index, compare input to min index i 913 first_i=str2num(get(handles.num_first_i,'String')); %retrieve previous first i914 % ref_i=str2num(get(handles.num_ref_i,'String')); %index i given by the input field913 first_i=str2num(get(handles.num_first_i,'String')); % retrieve previous first i 914 % ref_i=str2num(get(handles.num_ref_i,'String')); % index i given by the input field 915 915 ref_i=1; 916 916 if isfield(SeriesData,'ref_i') … … 918 918 end 919 919 if isempty(first_i) 920 first_i=ref_i; % first_i updated by the input value920 first_i=ref_i; % first_i updated by the input value 921 921 elseif first_i < MinIndex_i 922 922 first_i=MinIndex_i; % first_i set to the min i index (restricted by oter input lines) 923 923 elseif first_i >MaxIndex_i 924 first_i=MaxIndex_i; % first_i set to the max i index (restricted by oter input lines)924 first_i=MaxIndex_i; % first_i set to the max i index (restricted by oter input lines) 925 925 end 926 926 % j index, compare input to min index j … … 931 931 end 932 932 if isempty(first_j) 933 first_j=ref_j; % first_j updated by the input value933 first_j=ref_j; % first_j updated by the input value 934 934 elseif first_j<MinIndex_j 935 935 first_j=MinIndex_j; % first_j set to the min j index (restricted by oter input lines) … … 961 961 962 962 %% number of slices set by default 963 NbSlice=[]; %default963 NbSlice=[]; % default 964 964 % read value set by the first series for the append mode (iwiew >1) 965 965 if iview>1 && strcmp(get(handles.num_NbSlice,'Visible'),'on') … … 974 974 end 975 975 TimeName=''; 976 Time=[]; %default976 Time=[]; % default 977 977 TimeMin=[]; 978 978 TimeFirst=[]; … … 994 994 TimeName='xml'; 995 995 % if XmlData.Time(1,:)==XmlData.Time(2,:)% case starting with index 1 996 % sizDti=size(XmlData.Time,1)-1; %size of the time vector explicitly defined in the xml file996 % sizDti=size(XmlData.Time,1)-1; % size of the time vector explicitly defined in the xml file 997 997 % ind_start=1; 998 998 % else 999 % sizDti=size(XmlData.Time,1); % case starting with index 0999 % sizDti=size(XmlData.Time,1); % case starting with index 0 1000 1000 % ind_start=0; 1001 1001 % end 1002 1002 % % complement the input if the whole time series is not defined 1003 1003 % if size(i1_series,3)>size(XmlData.Time,1)-ind_start %only the first time interval is defined, extrapolate to the whole series 1004 % Dti_total=XmlData.Time(end)-XmlData.Time(1); %total time interval covered by the time vector1005 % missing_indices=sizDti+1+ind_start:size(i1_series,3)+1; % remaining set of frame indices for which time needs to be found1006 % repeat_nbre=1+floor((missing_indices-sizDti-ind_start)/(sizDti-1)); % number of repetitions of Dti1004 % Dti_total=XmlData.Time(end)-XmlData.Time(1); % total time interval covered by the time vector 1005 % missing_indices=sizDti+1+ind_start:size(i1_series,3)+1; % remaining set of frame indices for which time needs to be found 1006 % repeat_nbre=1+floor((missing_indices-sizDti-ind_start)/(sizDti-1)); % number of repetitions of Dti 1007 1007 % time_indices=1+mod(missing_indices-sizDti-1,sizDti-1); 1008 1008 % for j=1:size(XmlData.Time,2) … … 1025 1025 % msgbox_uvmat('WARNING','inconsistent number of slices with the first field series'); 1026 1026 % end 1027 % NbSlice=XmlData.Camera.NbSlice; % Nbre of slices from camera1027 % NbSlice=XmlData.Camera.NbSlice; % Nbre of slices from camera 1028 1028 % end 1029 1029 if isfield(XmlData.Camera,'TimeUnit')&& ~isempty(XmlData.Camera.TimeUnit) … … 1064 1064 if ~isempty(VideoObject)% case of movies 1065 1065 imainfo=get(VideoObject); 1066 if isempty(j1_series); % frame index along i1066 if isempty(j1_series); % frame index along i 1067 1067 Time=zeros(imainfo.NumberOfFrames+1,2); 1068 1068 Time(:,2)=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate)'; … … 1123 1123 PairString{iview,1}=Menu{1}; 1124 1124 else 1125 PairString{iview,1}=''; %no pair for #iview1125 PairString{iview,1}=''; % no pair for #iview 1126 1126 end 1127 1127 set(handles.PairString,'Data',PairString) … … 1142 1142 nbview=numel(SeriesData.i1_series); 1143 1143 j_max=cell(1,nbview); 1144 MaxIndex_i=ones(1,nbview); %default1145 MinIndex_i=ones(1,nbview); %default1144 MaxIndex_i=ones(1,nbview); % default 1145 MinIndex_i=ones(1,nbview); % default 1146 1146 for iline=1:nbview 1147 pair_max=squeeze(max(SeriesData.i1_series{iline},[],1)); % max on pair index1148 j_max{iline}=max(pair_max,[],1); %max on j index1147 pair_max=squeeze(max(SeriesData.i1_series{iline},[],1)); % max on pair index 1148 j_max{iline}=max(pair_max,[],1); % max on j index 1149 1149 if ~isempty(j_max{iline}) 1150 MaxIndex_i(iline)=max(find(j_max{iline}))-1; % max ref index i1151 MinIndex_i(iline)=min(find(j_max{iline}))-1; % min ref index i1150 MaxIndex_i(iline)=max(find(j_max{iline}))-1; % max ref index i 1151 MinIndex_i(iline)=min(find(j_max{iline}))-1; % min ref index i 1152 1152 end 1153 1153 end … … 1158 1158 npx=floor(Position(3)); 1159 1159 file_indices=MinIndex_i+floor(((0.5:npx-0.5)/npx)*range_index)+1; 1160 CData=zeros(nbview*range_y,npx); % initiate the image representing the existing files1160 CData=zeros(nbview*range_y,npx); % initiate the image representing the existing files 1161 1161 for iline=1:nbview 1162 1162 ind_y=1+(iline-1)*range_y:iline*range_y; … … 1167 1167 CData(ind_y,:)=ones(size(ind_y'))*LineData; 1168 1168 end 1169 CData=cat(3,zeros(size(CData)),CData,zeros(size(CData))); %make color images r=0,g,b=01169 CData=cat(3,zeros(size(CData)),CData,zeros(size(CData))); % make color images r=0,g,b=0 1170 1170 set(handles.FileStatus,'CData',CData); 1171 1171 … … 1187 1187 end 1188 1188 else %existence of j pairs 1189 pair_max=squeeze(max(i1_series,[],1)); % max on pair index1189 pair_max=squeeze(max(i1_series,[],1)); % max on pair index 1190 1190 j_max=max(pair_max,[],1); 1191 MaxIndex_i=find(j_max, 1, 'last' )-1; % max ref index i1192 MinIndex_i=find(j_max, 1 )-1; % min ref index i1191 MaxIndex_i=find(j_max, 1, 'last' )-1; % max ref index i 1192 MinIndex_i=find(j_max, 1 )-1; % min ref index i 1193 1193 i_max=max(pair_max,[],2); 1194 MaxIndex_j=find(i_max, 1, 'last' )-1; % max ref index i1195 MinIndex_j=find(i_max, 1 )-1; % min ref index i1194 MaxIndex_j=find(i_max, 1, 'last' )-1; % max ref index i 1195 MinIndex_j=find(i_max, 1 )-1; % min ref index i 1196 1196 if MaxIndex_j==MinIndex_j 1197 1197 ModeValue=1; … … 1203 1203 ModeMenu={'bursts';'series(Dj)'}; 1204 1204 if (MaxIndex_j-MinIndex_j)>10 1205 ModeValue=2; %set mode to series(Dj) if more than 10 j values1205 ModeValue=2; % set mode to series(Dj) if more than 10 j values 1206 1206 else 1207 1207 ModeValue=1; … … 1230 1230 if ~isempty(time) 1231 1231 if ref_i<=floor(ipair/2) 1232 ref_i=floor(ipair/2)+1; % shift ref_i to get the first pair1232 ref_i=floor(ipair/2)+1; % shift ref_i to get the first pair 1233 1233 end 1234 1234 Dt=time(ref_i+ceil(ipair/2),ref_j)-time(ref_i-floor(ipair/2),ref_j); … … 1254 1254 if ~isempty(time) 1255 1255 if ref_j<=floor(ipair/2) 1256 ref_j=floor(ipair/2)+1; % shift ref_i to get the first pair1256 ref_j=floor(ipair/2)+1; % shift ref_i to get the first pair 1257 1257 end 1258 1258 Dt=time(ref_i,ref_j+ceil(ipair/2))-time(ref_i,ref_j-floor(ipair/2)); … … 1328 1328 function displ_time(handles) 1329 1329 %------------------------------------------------------------------------ 1330 SeriesData=get(handles.series,'UserData'); %1330 SeriesData=get(handles.series,'UserData'); % 1331 1331 if ~isfield(SeriesData,'Time') 1332 1332 return 1333 1333 end 1334 1334 PairString=get(handles.PairString,'Data'); 1335 ref_i_1=str2num(get(handles.num_first_i,'String')); %first reference index1336 ref_i_2=str2num(get(handles.num_last_i,'String')); %last reference index1335 ref_i_1=str2num(get(handles.num_first_i,'String')); % first reference index 1336 ref_i_2=str2num(get(handles.num_last_i,'String')); % last reference index 1337 1337 ref_j_1=[];ref_j_2=[]; 1338 1338 if strcmp(get(handles.num_first_j,'Visible'),'on') … … 1361 1361 time_last=(SeriesData.Time{iview}(i1_2+1,j1_2+1)+SeriesData.Time{iview}(i2_2+1,j2_1+1))/2; 1362 1362 end 1363 TimeTable{iview,3}=time_first; % TODO: take into account pairs1364 TimeTable{iview,4}=time_last; % TODO: take into account pairs1363 TimeTable{iview,3}=time_first; % TODO: take into account pairs 1364 TimeTable{iview,4}=time_last; % TODO: take into account pairs 1365 1365 end 1366 1366 end … … 1374 1374 if isempty(pos_first), pos_first=0; end 1375 1375 if isempty(pos_last), pos_last=1; end 1376 Position=get(handles.Waitbar,'Position'); % position of the waitbar:= [ x,y, width, height]1376 Position=get(handles.Waitbar,'Position'); % position of the waitbar:= [ x,y, width, height] 1377 1377 Position_status=get(handles.FileStatus,'Position'); 1378 1378 Position(1)=Position_status(1)+Position_status(3)*pos_first; 1379 Position(3)=max(Position_status(3)*(pos_last-pos_first),0.001); % width must remain positive1379 Position(3)=max(Position_status(3)*(pos_last-pos_first),0.001); % width must remain positive 1380 1380 set(handles.Waitbar,'Position',Position) 1381 1381 update_waitbar(handles.Waitbar,0) … … 1418 1418 1419 1419 %% settings of the button RUN 1420 set(handles.RUN,'BusyAction','queue'); % activation of STOP button will set BusyAction to 'cancel'1420 set(handles.RUN,'BusyAction','queue'); % activation of STOP button will set BusyAction to 'cancel' 1421 1421 set(handles.RUN, 'Enable','Off')% avoid further RUN action until the current one is finished 1422 1422 set(handles.RUN,'BackgroundColor',[1 1 0])%show activation of RUN by yellow color … … 1441 1441 %------------------------------------------------------------------------ 1442 1442 function errormsg=launch_action(handles) 1443 errormsg=''; %default1443 errormsg=''; % default 1444 1444 1445 1445 %% read the data on the GUI series 1446 Param=read_GUI_series(handles); %displayed parameters1447 SeriesData=get(handles.series,'UserData'); %hidden parameters1446 Param=read_GUI_series(handles); % displayed parameters 1447 SeriesData=get(handles.series,'UserData'); % hidden parameters 1448 1448 if isfield(SeriesData,'TransformInput') 1449 1449 Param.TransformInput=SeriesData.TransformInput; … … 1459 1459 1460 1460 %% select the Action mode, 'local', 'background' or 'cluster' (if available) 1461 RunMode='local'; %default (needed for first opening of the GUI series)1461 RunMode='local'; % default (needed for first opening of the GUI series) 1462 1462 if isfield(Param.Action,'RunMode') 1463 1463 RunMode=Param.Action.RunMode; 1464 Param.Action=rmfield(Param.Action,'RunMode'); %remove from the recorded xml file to avoid interference during ImportConfig1465 end 1466 ActionExt='.m'; %default1464 Param.Action=rmfield(Param.Action,'RunMode'); % remove from the recorded xml file to avoid interference during ImportConfig 1465 end 1466 ActionExt='.m'; % default 1467 1467 if isfield(Param.Action,'ActionExt') 1468 ActionExt=Param.Action.ActionExt; % '.m', '.sh' (compiled) or '.py' (Python)1469 Param.Action=rmfield(Param.Action,'ActionExt'); %remove from the recorded xml file to avoid interference during ImportConfig1468 ActionExt=Param.Action.ActionExt; % '.m', '.sh' (compiled) or '.py' (Python) 1469 Param.Action=rmfield(Param.Action,'ActionExt'); % remove from the recorded xml file to avoid interference during ImportConfig 1470 1470 end 1471 1471 ActionName=Param.Action.ActionName; … … 1492 1492 1493 1493 %% Get PARAM.xml (not used at this stage) 1494 errormsg=''; %default error message1494 errormsg=''; % default error message 1495 1495 xmlfile=fullfile(path_series,'PARAM.xml'); 1496 1496 if ~exist(xmlfile,'file') … … 1569 1569 switch RunMode 1570 1570 case {'local','background'} 1571 NbCore=1; % no need to split the calculation1571 NbCore=1; % no need to split the calculation 1572 1572 case 'cluster_oar' 1573 1573 %%%%% TEST A REMETTRE%%%%% 1574 1574 % if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled) 1575 % NbCore=1; % one core used only (limitation of Matlab licences)1575 % NbCore=1; % one core used only (limitation of Matlab licences) 1576 1576 % answer=msgbox_uvmat('INPUT_Y-N','Number of cores =1: select the compiled version .sh for multi-core processing. Proceed with the .m version?'); 1577 1577 % if ~strcmp(answer,'Yes') … … 1591 1591 case {'cluster_pbs', 'cluster_sge', 'cluster_qstat_unknown'} 1592 1592 if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled) 1593 NbCore=1; % one core used only (limitation of Matlab licences)1593 NbCore=1; % one core used only (limitation of Matlab licences) 1594 1594 answer=msgbox_uvmat('INPUT_Y-N','Number of cores =1: select the compiled version .sh for multi-core processing. Proceed with the .m version?'); 1595 1595 if ~strcmp(answer,'Yes') … … 1602 1602 NbCore=str2double(answer{1}); 1603 1603 qstat_Queue=answer{2}; 1604 %extra_oar=answer{2}; %TODO : fix this for LMFA cluster. Maybe1604 %extra_oar=answer{2}; % TODO : fix this for LMFA cluster. Maybe 1605 1605 %extrs_oar and extra_pbs are not the best names 1606 1606 end … … 1615 1615 SubDirOut=[get(handles.OutputSubDir,'String') Param.OutputDirExt]; 1616 1616 SubDirOutNew=SubDirOut; 1617 detect=exist(fullfile(Param.InputTable{1,1},SubDirOutNew),'dir'); % test if the dir already exist1618 check_create=1; % need to create the result directory by default1617 detect=exist(fullfile(Param.InputTable{1,1},SubDirOutNew),'dir'); % test if the dir already exist 1618 check_create=1; % need to create the result directory by default 1619 1619 CheckOverwrite=1; 1620 1620 if isfield(Param,'CheckOverwrite') … … 1634 1634 check_create=0; 1635 1635 else 1636 r=regexp(SubDirOutNew,'(?<root>.*\D)(?<num1>\d+)$','names'); %detect whether name ends by a number1636 r=regexp(SubDirOutNew,'(?<root>.*\D)(?<num1>\d+)$','names'); % detect whether name ends by a number 1637 1637 if isempty(r) 1638 1638 r(1).root=[SubDirOutNew '_']; 1639 1639 r(1).num1='0'; 1640 1640 end 1641 SubDirOutNew=[r(1).root num2str(str2num(r(1).num1)+1)]; %increment the index by 1 or put 11642 detect=exist(fullfile(Param.InputTable{1,1},SubDirOutNew),'dir'); % test if the dir already exists1641 SubDirOutNew=[r(1).root num2str(str2num(r(1).num1)+1)]; % increment the index by 1 or put 1 1642 detect=exist(fullfile(Param.InputTable{1,1},SubDirOutNew),'dir'); % test if the dir already exists 1643 1643 check_create=1; 1644 1644 end 1645 1645 end 1646 1646 Param.OutputDirExt=regexprep(SubDirOutNew,Param.OutputSubDir,''); 1647 Param.OutputRootFile=Param.InputTable{1,3}; % the first sorted RootFile taken for output1647 Param.OutputRootFile=Param.InputTable{1,3}; % the first sorted RootFile taken for output 1648 1648 set(handles.OutputDirExt,'String',Param.OutputDirExt) 1649 OutputDir=fullfile(Param.InputTable{1,1},[Param.OutputSubDir Param.OutputDirExt]); % full name (with path) of output directory1649 OutputDir=fullfile(Param.InputTable{1,1},[Param.OutputSubDir Param.OutputDirExt]); % full name (with path) of output directory 1650 1650 if check_create % create output directory if it does not exist 1651 1651 [tild,msg1]=mkdir(OutputDir); 1652 1652 if ~strcmp(msg1,'') 1653 errormsg=['cannot create ' OutputDir ': ' msg1]; %error message for directory creation1653 errormsg=['cannot create ' OutputDir ': ' msg1]; % error message for directory creation 1654 1654 return 1655 1655 end … … 1663 1663 [~,msg1]=mkdir(DirXml); 1664 1664 if ~strcmp(msg1,'') 1665 errormsg=['cannot create ' DirXml ': ' msg1]; %error message for directory creation1665 errormsg=['cannot create ' DirXml ': ' msg1]; % error message for directory creation 1666 1666 return 1667 1667 end 1668 1668 end 1669 OutputNomType=nomtype2pair(Param.InputTable{1,4}); % nomenclature for output files1669 OutputNomType=nomtype2pair(Param.InputTable{1,4}); % nomenclature for output files 1670 1670 1671 1671 %% get the set of reference input field indices 1672 first_i=1; % first i index to process1673 last_i=1; % last i index to process1674 incr_i=1; % increment step in i index1675 first_j=1; % first j index to process1676 last_j=1; % last j index to process1677 incr_j=1; % increment step in j index1672 first_i=1; % first i index to process 1673 last_i=1; % last i index to process 1674 incr_i=1; % increment step in i index 1675 first_j=1; % first j index to process 1676 last_j=1; % last j index to process 1677 incr_j=1; % increment step in j index 1678 1678 if isfield(Param.IndexRange,'first_i') 1679 1679 first_i=Param.IndexRange.first_i; … … 1720 1720 end 1721 1721 end 1722 CPUTime=1; % job time estimated at 1 min per iteration (on index i and j) by default1722 CPUTime=1; % job time estimated at 1 min per iteration (on index i and j) by default 1723 1723 if isfield(Param.Action, 'CPUTime') && ~isempty(Param.Action.CPUTime) 1724 CPUTime=Param.Action.CPUTime; %Note: CpUTime for one iteration ref_i has to be multiplied by the number of j indices nbfield_j1724 CPUTime=Param.Action.CPUTime; % Note: CpUTime for one iteration ref_i has to be multiplied by the number of j indices nbfield_j 1725 1725 end 1726 1726 nbfield_j=numel(ref_j); % number of j indices 1727 BlockLength=numel(ref_i); % by default, job involves the full set of i field indices1727 BlockLength=numel(ref_i); % by default, job involves the full set of i field indices 1728 1728 NbProcess=1; 1729 1729 switch RunMode 1730 1730 case {'cluster_oar','cluster_pbs','cluster_sge','cluster_qstat_unknown'} 1731 1731 if isempty(Param.IndexRange.NbSlice)% if NbSlice is not defined 1732 BlockLength= ceil(20/(CPUTime*nbfield_j)); % short iterations are grouped such that the minimum time of a process is 20 min.1733 BlockLength=max(BlockLength,ceil(numel(ref_i)/500)); % possibly increase the BlockLength to have less than 500 jobs1732 BlockLength= ceil(20/(CPUTime*nbfield_j)); % short iterations are grouped such that the minimum time of a process is 20 min. 1733 BlockLength=max(BlockLength,ceil(numel(ref_i)/500)); % possibly increase the BlockLength to have less than 500 jobs 1734 1734 NbProcess=ceil(numel(ref_i)/BlockLength) ; % nbre of processes sent to oar 1735 1735 else 1736 NbProcess=Param.IndexRange.NbSlice; % the parameter NbSlice sets the nbre of run processes1737 NbCore=min(NbCore,NbProcess); % reduces the number of cores if it exceeds the number of processes1736 NbProcess=Param.IndexRange.NbSlice; % the parameter NbSlice sets the nbre of run processes 1737 NbCore=min(NbCore,NbProcess); % reduces the number of cores if it exceeds the number of processes 1738 1738 end 1739 1739 otherwise 1740 1740 if ~isempty(Param.IndexRange.NbSlice) 1741 NbProcess=Param.IndexRange.NbSlice; % the parameter NbSlice sets the nbre of run processes1741 NbProcess=Param.IndexRange.NbSlice; % the parameter NbSlice sets the nbre of run processes 1742 1742 end 1743 1743 end … … 1772 1772 1773 1773 %% direct processing on the current Matlab session or creation of command files 1774 filexml=cell(1,NbProcess); % initialisation of the names of the files containing the processing parameters1774 filexml=cell(1,NbProcess); % initialisation of the names of the files containing the processing parameters 1775 1775 extxml=cell(1,NbProcess); % initialisation of the set of labels used for the files documenting each process 1776 1776 for iprocess=1:NbProcess … … 1785 1785 Param.IndexRange.first_i=first_i+(iprocess-1)*BlockLength*incr_i; 1786 1786 if Param.IndexRange.first_i>last_i 1787 NbProcess=iprocess-1; % leave the loop, we are at the end of the calculation1787 NbProcess=iprocess-1; % leave the loop, we are at the end of the calculation 1788 1788 break 1789 1789 end … … 1794 1794 end 1795 1795 for ilist=1:size(Param.InputTable,1) 1796 Param.InputTable{ilist,1}=regexprep(Param.InputTable{ilist,1},'\','/'); %correct path name for PCWIN system1796 Param.InputTable{ilist,1}=regexprep(Param.InputTable{ilist,1},'\','/'); % correct path name for PCWIN system 1797 1797 end 1798 1798 … … 1804 1804 filexml{iprocess}=fullfile(OutputDir,'0_XML',extxml{iprocess}); 1805 1805 try 1806 save(t, filexml{iprocess}); % save the xml file containing the processing parameters1806 save(t, filexml{iprocess}); % save the xml file containing the processing parameters 1807 1807 catch ME 1808 1808 if ~strcmp (RunMode,'local') … … 1815 1815 switch ActionExt 1816 1816 case '.m' 1817 h_fun(Param); % direct launching1817 h_fun(Param); % direct launching 1818 1818 1819 1819 case '.sh' 1820 1820 switch computer 1821 1821 case {'PCWIN','PCWIN64'} %Windows system 1822 filexml=regexprep(filexml,'\\','\\\\'); % add '\' so that '\' are left as characters1823 system([ActionFullName ' ' RunTime ' ' filexml{iprocess}]); % TODO: adapt to DOS system1822 filexml=regexprep(filexml,'\\','\\\\'); % add '\' so that '\' are left as characters 1823 system([ActionFullName ' ' RunTime ' ' filexml{iprocess}]); % TODO: adapt to DOS system 1824 1824 case {'GLNX86','GLNXA64','MACI64'}%Linux system 1825 1825 system([ActionFullName ' ' RunTime ' ' filexml{iprocess}]); … … 1831 1831 if ~strcmp (RunMode,'local') && ~strcmp(RunMode,'python') 1832 1832 %% processing on a different session of the same computer (background) or cluster, create executable files 1833 batch_file_list=cell(NbProcess,1); % initiate the list of executable files1834 DirExe=fullfile(OutputDir,'0_EXE'); %directory name for executable files1833 batch_file_list=cell(NbProcess,1); % initiate the list of executable files 1834 DirExe=fullfile(OutputDir,'0_EXE'); % directory name for executable files 1835 1835 switch computer 1836 1836 case {'PCWIN','PCWIN64'} %Windows system … … 1843 1843 [tild,msg1]=mkdir(DirExe); 1844 1844 if ~strcmp(msg1,'') 1845 errormsg=['cannot create ' DirExe ': ' msg1]; %error message for directory creation1845 errormsg=['cannot create ' DirExe ': ' msg1]; % error message for directory creation 1846 1846 return 1847 1847 end … … 1852 1852 [tild,msg1]=mkdir(DirLog); 1853 1853 if ~strcmp(msg1,'') 1854 errormsg=['cannot create ' DirLog ': ' msg1]; %error message for directory creation1854 errormsg=['cannot create ' DirLog ': ' msg1]; % error message for directory creation 1855 1855 return 1856 1856 end … … 1904 1904 end 1905 1905 cmd=[cmd 'exit \n' 'END_MATLAB \n']; 1906 fprintf(fid,cmd); %fill the executable file with the char string cmd1907 fclose(fid); % close the executable file1908 system(['chmod +x ' file_exe_global]); % set the file to executable1906 fprintf(fid,cmd); % fill the executable file with the char string cmd 1907 fclose(fid); % close the executable file 1908 system(['chmod +x ' file_exe_global]); % set the file to executable 1909 1909 case {'PCWIN','PCWIN64'} 1910 1910 cmd=['matlab -automation -logfile ' regexprep(filelog{iprocess},'\\','\\\\')... … … 1915 1915 end 1916 1916 cmd=[cmd ';exit"']; 1917 fprintf(fid,cmd); %fill the executable file with the char string cmd1918 fclose(fid); % close the executable file1917 fprintf(fid,cmd); % fill the executable file with the char string cmd 1918 fclose(fid); % close the executable file 1919 1919 end 1920 1920 system([file_exe_global ' &'])% directly execute the command file … … 1923 1923 switch computer 1924 1924 case {'GLNX86','GLNXA64','MACI64'} 1925 [fid,message]=fopen(batch_file_list{iprocess},'w'); % create the executable file1925 [fid,message]=fopen(batch_file_list{iprocess},'w'); % create the executable file 1926 1926 if isequal(fid,-1) 1927 1927 errormsg=['creation of .bat file: ' message]; … … 1932 1932 'hostname && date \n '... 1933 1933 'umask 002 \n'... 1934 ActionFullName ' ' RunTime ' ' filexml{iprocess}]; %allow writting access to created files for user group1935 fprintf(fid,cmd); %fill the executable file with the char string cmd1936 fclose(fid); % close the executable file1937 system(['chmod +x ' batch_file_list{iprocess}]); % set the file to executable1934 ActionFullName ' ' RunTime ' ' filexml{iprocess}]; % allow writting access to created files for user group 1935 fprintf(fid,cmd); % fill the executable file with the char string cmd 1936 fclose(fid); % close the executable file 1937 system(['chmod +x ' batch_file_list{iprocess}]); % set the file to executable 1938 1938 system([batch_file_list{iprocess} ' &'])% directly execute the command file 1939 1939 case {'PCWIN','PCWIN64'} … … 1948 1948 %create subdirectory for oar commands 1949 1949 for iprocess=1:NbProcess 1950 [fid,message]=fopen(batch_file_list{iprocess},'w'); % create the executable file1950 [fid,message]=fopen(batch_file_list{iprocess},'w'); % create the executable file 1951 1951 if isequal(fid,-1) 1952 1952 errormsg=['creation of .bat file: ' message]; … … 1958 1958 'hostname && date \n '... 1959 1959 'umask 002 \n'... 1960 ActionFullName ' ' RunTime ' ' filexml{iprocess}]; %allow writting access to created files for user group1960 ActionFullName ' ' RunTime ' ' filexml{iprocess}]; % allow writting access to created files for user group 1961 1961 else 1962 1962 matlab_ver = ver('MATLAB'); … … 1973 1973 'END_MATLAB \n']; 1974 1974 end 1975 fprintf(fid,cmd); %fill the executable file with the char string cmd1976 fclose(fid); % close the executable file1977 system(['chmod +x ' batch_file_list{iprocess}]); % set the file to executable1975 fprintf(fid,cmd); % fill the executable file with the char string cmd 1976 fclose(fid); % close the executable file 1977 system(['chmod +x ' batch_file_list{iprocess}]); % set the file to executable 1978 1978 end 1979 1979 DirOAR=fullfile(OutputDir,'0_OAR'); … … 1986 1986 [tild,msg1]=mkdir(DirOAR); 1987 1987 if ~strcmp(msg1,'') 1988 errormsg=['cannot create ' DirOAR ': ' msg1]; %error message for directory creation1988 errormsg=['cannot create ' DirOAR ': ' msg1]; % error message for directory creation 1989 1989 return 1990 1990 end 1991 1991 end 1992 1992 % create file containing the list of jobs 1993 filename_joblist=fullfile(DirOAR,'job_list.txt'); % name of the file containing the list of executables1994 fid=fopen(filename_joblist,'w'); %open it for writting1993 filename_joblist=fullfile(DirOAR,'job_list.txt'); % name of the file containing the list of executables 1994 fid=fopen(filename_joblist,'w'); % open it for writting 1995 1995 for iprocess=1:length(batch_file_list) 1996 fprintf(fid,[batch_file_list{iprocess} '\n']); % write list of exe files1996 fprintf(fid,[batch_file_list{iprocess} '\n']); % write list of exe files 1997 1997 end 1998 1998 fclose(fid); 1999 system(['chmod +x ' filename_joblist]); % set the file to executable1999 system(['chmod +x ' filename_joblist]); % set the file to executable 2000 2000 2001 filename_log=fullfile(DirLog,'job_list.stdout'); %file for output messages of the master oar process2002 filename_errors=fullfile(DirLog,'job_list.stderr'); %file for error messages of the master oar process2001 filename_log=fullfile(DirLog,'job_list.stdout'); % file for output messages of the master oar process 2002 filename_errors=fullfile(DirLog,'job_list.stderr'); % file for error messages of the master oar process 2003 2003 % the command job_list.txt contains the list of NbProcess independent individual jobs 2004 2004 % in which the total calculation has been split. Those are written as executable files .sh in the folder /O_EXE. … … 2008 2008 % shorter than the wall time: in the time interval 'checkpoint' (WallTimeOneJob) before the end of the allowed duration, 2009 2009 % the oar job restarts when an individual job ends. 2010 JobTime=CPUTime*BlockLength*nbfield_j; % estimated time for one individual job (in minutes)2010 JobTime=CPUTime*BlockLength*nbfield_j; % estimated time for one individual job (in minutes) 2011 2011 % wall time (in hours ) for each oar job, allowing 10 individual jobs, but limited to 23 h: 2012 2012 WallTimeTotal=min(23,4*JobTime/60); 2013 2013 %disp(['WallTimeTotal: ' num2str(WallTimeTotal) ' hours']) 2014 2014 % estimated time of an individual job (in min), with a margin of error 2015 WallTimeOneJob=min(4*JobTime+10,WallTimeTotal*60/2); % estimated max time of an individual job for checkpoint2015 WallTimeOneJob=min(4*JobTime+10,WallTimeTotal*60/2); % estimated max time of an individual job for checkpoint 2016 2016 disp(['WallTimeOneJob: ' num2str(WallTimeOneJob) ' minutes']) 2017 2017 oar_command=['oarsub -n UVmat_' ActionFullName ' '... … … 2026 2026 '-l ' filename_joblist '.log"']; 2027 2027 2028 fprintf(oar_command); % display system command on the Matlab command window2028 fprintf(oar_command); % display system command on the Matlab command window 2029 2029 [status,result]=system(oar_command)% execute system command and show the result (ID number of the launched job) on the Matlab command window 2030 filename_oarcommand=fullfile(DirOAR,'0_oar_command'); % keep track of the command in file '0-OAR/0_oar_command'2030 filename_oarcommand=fullfile(DirOAR,'0_oar_command'); % keep track of the command in file '0-OAR/0_oar_command' 2031 2031 fid=fopen(filename_oarcommand,'w'); 2032 2032 fprintf(fid,oar_command); % store the command 2033 fprintf(fid,result); % store the result (job ID number)2033 fprintf(fid,result); % store the result (job ID number) 2034 2034 fclose(fid); 2035 2035 msgbox_uvmat('CONFIRMATION',[ActionFullName ' launched as ' num2str(NbProcess) ' processes in cluster: press STATUS to see results']) … … 2037 2037 case 'cluster_pbs' % for LMFA Kepler machine 2038 2038 %create subdirectory for pbs command and log files 2039 DirPBS=fullfile(OutputDir,'0_PBS'); % todo : common name OAR/PBS2039 DirPBS=fullfile(OutputDir,'0_PBS'); % todo : common name OAR/PBS 2040 2040 if exist(DirPBS,'dir')% delete the content of the dir 0_LOG to allow new input 2041 2041 curdir=pwd; … … 2046 2046 [tild,msg1]=mkdir(DirPBS); 2047 2047 if ~strcmp(msg1,'') 2048 errormsg=['cannot create ' DirPBS ': ' msg1]; %error message for directory creation2048 errormsg=['cannot create ' DirPBS ': ' msg1]; % error message for directory creation 2049 2049 return 2050 2050 end … … 2052 2052 max_walltime=3600*20; % 20h max total calculation (cannot exceed 24 h) 2053 2053 walltime_onejob=1800; % seconds, max estimated time for asingle file index value 2054 filename_joblist=fullfile(DirPBS,'job_list.txt'); %create name of the global executable file2054 filename_joblist=fullfile(DirPBS,'job_list.txt'); % create name of the global executable file 2055 2055 fid=fopen(filename_joblist,'w'); 2056 2056 for iprocess=1:length(batch_file_list) 2057 fprintf(fid,[batch_file_list{iprocess} '\n']); % list of exe files2057 fprintf(fid,[batch_file_list{iprocess} '\n']); % list of exe files 2058 2058 end 2059 2059 fclose(fid); 2060 system(['chmod +x ' filename_joblist]); % set the file to executable2060 system(['chmod +x ' filename_joblist]); % set the file to executable 2061 2061 pbs_command=['qsub -n CIVX '... 2062 2062 '-t idempotent --checkpoint ' num2str(walltime_onejob+60) ' '... … … 2072 2072 fprintf(fid,pbs_command); 2073 2073 fclose(fid); 2074 fprintf(pbs_command); % display in command line2074 fprintf(pbs_command); % display in command line 2075 2075 %system(pbs_command); 2076 2076 msgbox_uvmat('CONFIRMATION',[ActionFullName ' command ready to be launched in cluster']) … … 2090 2090 [tild,msg1]=mkdir(DirSGE); 2091 2091 if ~strcmp(msg1,'') 2092 errormsg=['cannot create ' DirSGE ': ' msg1]; %error message for directory creation2092 errormsg=['cannot create ' DirSGE ': ' msg1]; % error message for directory creation 2093 2093 return 2094 2094 end … … 2122 2122 '-o ' fullfile([DirSGE '/job' num2str(currJobIndex) '.out']) ' '... 2123 2123 fullfile([DirSGE '/job' num2str(currJobIndex) '.sh'])]; 2124 fprintf(sge_command); % display in command line2124 fprintf(sge_command); % display in command line 2125 2125 [status, result] = system(sge_command); 2126 2126 fprintf(result); … … 2144 2144 [SUCCESS,MESSAGE,MESSAGEID] = fileattrib (OutputDir) 2145 2145 if MESSAGE.GroupWrite~=1 2146 [success,msg] = fileattrib(OutputDir,'+w','g','s'); % allow writing access for the group of users, recursively in the folder2146 [success,msg] = fileattrib(OutputDir,'+w','g','s'); % allow writing access for the group of users, recursively in the folder 2147 2147 if success==0 2148 msgbox_uvmat('WARNING',{['unable to set group write access to ' OutputDir ':']; msg}); %error message for directory creation2148 msgbox_uvmat('WARNING',{['unable to set group write access to ' OutputDir ':']; msg}); % error message for directory creation 2149 2149 end 2150 2150 end … … 2169 2169 %% clean the output structure by removing unused information 2170 2170 if isfield(Param,'Pairs') 2171 Param=rmfield(Param,'Pairs'); % info Pairs not needed for output2171 Param=rmfield(Param,'Pairs'); % info Pairs not needed for output 2172 2172 end 2173 2173 if isfield(Param,'InputLine') … … 2207 2207 2208 2208 %% get Action name and path 2209 NbBuiltinAction=get(handles.Action,'UserData'); % nbre of functions initially proposed in the menu ActionName (as defined in the Opening fct of series)2210 ActionList=get(handles.ActionName,'String'); % list menu fields2209 NbBuiltinAction=get(handles.Action,'UserData'); % nbre of functions initially proposed in the menu ActionName (as defined in the Opening fct of series) 2210 ActionList=get(handles.ActionName,'String'); % list menu fields 2211 2211 ActionIndex=get(handles.ActionName,'Value'); 2212 2212 if ~isequal(ActionIndex,1)% if we are not just opening series … … 2218 2218 end 2219 2219 ActionName= ActionList{get(handles.ActionName,'Value')}; % selected function name 2220 ActionPathList=get(handles.ActionName,'UserData'); %list of recorded paths to functions of the list ActionName2220 ActionPathList=get(handles.ActionName,'UserData'); % list of recorded paths to functions of the list ActionName 2221 2221 2222 2222 %% add a new function to the menu if 'more...' has been selected in the menu ActionName … … 2233 2233 2234 2234 % insert the choice in the menu ActionName 2235 ActionIndex=find(strcmp(ActionName,ActionList),1); % look for the selected function in the menu Action2235 ActionIndex=find(strcmp(ActionName,ActionList),1); % look for the selected function in the menu Action 2236 2236 PathName=regexprep(PathName,'/$',''); 2237 2237 if ~isempty(ActionIndex) && ~strcmp(ActionPathList{ActionIndex},PathName)%compare the path to the existing fct … … 2240 2240 if isempty(ActionIndex)%the qselected fct (with selected path) does not exist in the menu 2241 2241 ActionIndex= length(ActionList); 2242 ActionList=[ActionList(1:end-1);{ActionName};ActionList(end)]; % the selected function is appended in the menu, before the last item 'more...'2242 ActionList=[ActionList(1:end-1);{ActionName};ActionList(end)]; % the selected function is appended in the menu, before the last item 'more...' 2243 2243 ActionPathList=[ActionPathList; PathName]; 2244 2244 end … … 2252 2252 2253 2253 % remove old Action options in the menu (keeping a menu length <nb_builtin_ACTION+5) 2254 if length(ActionList)>NbBuiltinAction+5; % nb_builtin_ACTION=nbre of functions always remaining in the initial menu2254 if length(ActionList)>NbBuiltinAction+5; % nb_builtin_ACTION=nbre of functions always remaining in the initial menu 2255 2255 nbremove=length(ActionList)-NbBuiltinAction-5; 2256 2256 ActionList(NbBuiltinAction+1:end-5)=[]; … … 2284 2284 2285 2285 %% check the current ActionPath to the selected function 2286 ActionPath=ActionPathList{ActionIndex}; %current recorded path2287 set(handles.ActionPath,'String',ActionPath); % show the path to the senlected function2286 ActionPath=ActionPathList{ActionIndex}; % current recorded path 2287 set(handles.ActionPath,'String',ActionPath); % show the path to the senlected function 2288 2288 2289 2289 %% reinitialise the waitbar … … 2295 2295 return 2296 2296 end 2297 current_dir=pwd; %current working dir2297 current_dir=pwd; % current working dir 2298 2298 cd(ActionPath) 2299 2299 h_fun=str2func(ActionName); … … 2304 2304 % path_series=which('series'); 2305 2305 % %eval(['spath=which(''' ActionName ''');']) %spath = current path of the selected function ACTION 2306 % spath=fileparts(which(ActionName)); % spath = current path of the selected function ACTION2306 % spath=fileparts(which(ActionName)); % spath = current path of the selected function ACTION 2307 2307 % if ~exist(ActionPath,'dir') 2308 2308 % msgbox_uvmat('ERROR',['The prescribed function path ' ActionPath ' does not exist']); … … 2324 2324 2325 2325 %% Activate the Action fct to adapt the configuration of the GUI series and bring specific parameters in SeriesData 2326 Param=read_GUI_series(handles); % read the parameters from the GUI series2327 ParamOut=h_fun(Param); %run the selected Action function to get the relevant input2326 Param=read_GUI_series(handles); % read the parameters from the GUI series 2327 ParamOut=h_fun(Param); % run the selected Action function to get the relevant input 2328 2328 2329 2329 %% Put the first line of the selected Action fct as tooltip help … … 2337 2337 2338 2338 %% Visibility of VelType and VelType_1 menus asked by ActionName 2339 VelTypeRequest=1; %VelType requested by default2340 VelTypeRequest_1=1; %VelType requested by default2339 VelTypeRequest=1; % VelType requested by default 2340 VelTypeRequest_1=1; % VelType requested by default 2341 2341 if isfield(ParamOut,'VelType') 2342 2342 VelTypeRequest=ismember(ParamOut.VelType,{'on','one','two'}); … … 2351 2351 2352 2352 %% Detect the types of input files and set menus and default options in 'VelType' 2353 SeriesData=get(handles.series,'UserData'); % info on the input file series2353 SeriesData=get(handles.series,'UserData'); % info on the input file series 2354 2354 iview_civ=find(strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType)); 2355 iview_netcdf=find(strcmp('netcdf',SeriesData.FileType)|strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType)); % all nc files, icluding civ2356 FieldList=get(handles.FieldName,'String'); % previous list as default2355 iview_netcdf=find(strcmp('netcdf',SeriesData.FileType)|strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType)); % all nc files, icluding civ 2356 FieldList=get(handles.FieldName,'String'); % previous list as default 2357 2357 if ~iscell(FieldList),FieldList={FieldList};end 2358 FieldList_1=get(handles.FieldName_1,'String'); % previous list as default2358 FieldList_1=get(handles.FieldName_1,'String'); % previous list as default 2359 2359 if ~iscell(FieldList_1),FieldList_1={FieldList_1};end 2360 %CheckList=0; % indicate whether FieldName has been updated2361 CheckList_1=1; % indicate whether FieldName_1 has been updated2360 %CheckList=0; % indicate whether FieldName has been updated 2361 CheckList_1=1; % indicate whether FieldName_1 has been updated 2362 2362 handles_coord=[handles.Coord_x handles.Coord_y handles.Coord_z handles.Coord_x_title handles.Coord_y_title handles.Coord_z_title]; 2363 2363 if VelTypeRequest && numel(iview_civ)>=1 … … 2367 2367 set(handles.VelType,'Visible','on') 2368 2368 set(handles.VelType_title,'Visible','on') 2369 FieldList=[set_field_list('U','V');{'C'};{'get_field...'}]; %standard menu for civx data2369 FieldList=[set_field_list('U','V');{'C'};{'get_field...'}]; % standard menu for civx data 2370 2370 %CheckList=1; 2371 set(handles.FieldName,'Value',1); % velocity vector choice by default2371 set(handles.FieldName,'Value',1); % velocity vector choice by default 2372 2372 if VelTypeRequest_1 && numel(iview_civ)>=2 2373 2373 menu=set_veltype_display(SeriesData.FileInfo{iview_civ(2)}.CivStage,SeriesData.FileType{iview_civ(2)}); … … 2376 2376 set(handles.VelType_1,'Visible','on') 2377 2377 set(handles.VelType_title_1,'Visible','on') 2378 FieldList_1=[set_field_list('U','V');{'C'};{'get_field...'}]; %standard menu for civx data2378 FieldList_1=[set_field_list('U','V');{'C'};{'get_field...'}]; % standard menu for civx data 2379 2379 CheckList_1=1; 2380 set(handles.FieldName_1,'Value',1); % velocity vector choice by default2380 set(handles.FieldName_1,'Value',1); % velocity vector choice by default 2381 2381 else 2382 2382 set(handles.VelType_1,'Visible','off') … … 2394 2394 set(handles.FieldName,'Visible','on') 2395 2395 ListVarName=SeriesData.FileInfo{iview_netcdf(1)}.ListVarName; 2396 ind_var=get(handles.FieldName,'Value'); %indices of previously selected variables2396 ind_var=get(handles.FieldName,'Value'); % indices of previously selected variables 2397 2397 for ilist=1:numel(ind_var) 2398 2398 if isempty(find(strcmp(FieldList{ind_var(ilist)},ListVarName))) 2399 FieldList={}; % previous choice not consistent with new input field2399 FieldList={}; % previous choice not consistent with new input field 2400 2400 set(handles.FieldName,'Value',1) 2401 2401 break … … 2425 2425 if CheckList_1==0 % not civ input made 2426 2426 ListVarName=SeriesData.FileInfo{iview_netcdf(2)}.ListVarName; 2427 ind_var=get(handles.FieldName,'Value'); %indices of previously selected variables2427 ind_var=get(handles.FieldName,'Value'); % indices of previously selected variables 2428 2428 for ilist=1:numel(ind_var) 2429 2429 if isempty(find(strcmp(FieldList{ind_var(ilist)},ListVarName))) 2430 FieldList_1={}; % previous choice not consistent with new input field2430 FieldList_1={}; % previous choice not consistent with new input field 2431 2431 set(handles.FieldName_1,'Value',1) 2432 2432 break … … 2472 2472 %% Check whether alphabetical sorting of input Subdir is allowed by the Action fct (for multiples series entries) 2473 2473 if isfield(ParamOut,'AllowInputSort')&&isequal(ParamOut.AllowInputSort,'on')&& size(Param.InputTable,1)>1 2474 [tild,iview]=sort(InputTable(:,2)); % subdirectories sorted in alphabetical order2474 [tild,iview]=sort(InputTable(:,2)); % subdirectories sorted in alphabetical order 2475 2475 set(handles.InputTable,'Data',InputTable(iview,:)); 2476 2476 MinIndex_i=get(handles.MinIndex_i,'Data'); … … 2515 2515 2516 2516 %% enable or desable j index visibility 2517 status_j='on'; %default2517 status_j='on'; % default 2518 2518 if isfield(ParamOut,'Desable_j_index')&&isequal(ParamOut.Desable_j_index,'on') 2519 2519 status_j='off'; … … 2522 2522 status_j='off'; % no j index needed 2523 2523 elseif strcmp(get(handles.PairString,'Visible'),'on') 2524 check_burst=cellfun(@isempty,regexp(get(handles.PairString,'Data'),'^j')); %=0 for burst case, 1 otherwise2524 check_burst=cellfun(@isempty,regexp(get(handles.PairString,'Data'),'^j')); % =0 for burst case, 1 otherwise 2525 2525 if isempty(find(check_burst, 1))% if all pair string begins by j (burst) 2526 2526 status_j='off'; % no j index needed for bust case … … 2531 2531 2532 2532 %% NbSlice visibility 2533 %NbSliceVisible='off'; %default2533 %NbSliceVisible='off'; % default 2534 2534 if isfield(ParamOut,'NbSlice') && (strcmp(ParamOut.NbSlice,'on')||isnumeric(ParamOut.NbSlice)) 2535 2535 set(handles.num_NbSlice,'Visible','on') … … 2589 2589 %% definition of the directory containing the output files 2590 2590 if ~(isfield(SeriesData,'ActionName') && strcmp(ActionName,SeriesData.ActionName)) 2591 OutputDirExt='.series'; % default2591 OutputDirExt='.series'; % default 2592 2592 if isfield(ParamOut,'OutputDirExt')&&~isempty(ParamOut.OutputDirExt) 2593 2593 OutputDirExt=ParamOut.OutputDirExt; … … 2596 2596 end 2597 2597 OutputDirVisible='off'; 2598 OutputSubDirMode='auto'; %default2598 OutputSubDirMode='auto'; % default 2599 2599 SubDirOut=''; 2600 2600 if isfield(ParamOut,'OutputSubDirMode') … … 2602 2602 end 2603 2603 switch OutputSubDirMode 2604 case 'auto'; %default2604 case 'auto'; % default 2605 2605 OutputDirVisible='on'; 2606 SubDir=InputTable(1:end,2); % set of subdirectories2606 SubDir=InputTable(1:end,2); % set of subdirectories 2607 2607 SubDirOut=SubDir{1}; 2608 2608 if numel(SubDir)>1 … … 2613 2613 case 'one' 2614 2614 OutputDirVisible='on'; 2615 SubDirOut=InputTable{1,2}; % use the first subdir name (+OutputDirExt) as output subdirectory2615 SubDirOut=InputTable{1,2}; % use the first subdir name (+OutputDirExt) as output subdirectory 2616 2616 case 'two' 2617 2617 OutputDirVisible='on'; 2618 SubDir=InputTable(1:2,2); % set of subdirectories2618 SubDir=InputTable(1:2,2); % set of subdirectories 2619 2619 SubDirOut=SubDir{1}; 2620 2620 if numel(SubDir)>1 … … 2623 2623 case 'last' 2624 2624 OutputDirVisible='on'; 2625 SubDirOut=InputTable{end,2}; % use the last subdir name (+OutputDirExt) as output subdirectory2625 SubDirOut=InputTable{end,2}; % use the last subdir name (+OutputDirExt) as output subdirectory 2626 2626 end 2627 2627 set(handles.OutputSubDir,'String',SubDirOut) … … 2631 2631 %set(handles.CheckOverwrite,'Visible',OutputDirVisible) 2632 2632 set(handles.OutputDir_title,'Visible',OutputDirVisible) 2633 SeriesData.ActionName=ActionName; %record ActionName for next use2633 SeriesData.ActionName=ActionName; % record ActionName for next use 2634 2634 2635 2635 2636 2636 %% visibility of the run mode (local or background or cluster) 2637 2637 if strcmp(OutputSubDirMode,'none') 2638 RunModeVisible='off'; % only local mode available if no output file is produced2638 RunModeVisible='off'; % only local mode available if no output file is produced 2639 2639 else 2640 2640 RunModeVisible='on'; … … 2676 2676 SeriesData=get(handles.series,'UserData'); 2677 2677 % input line for which the field choice is relevant 2678 iview=find(ismember(SeriesData.FileType,{'netcdf','civx','civdata'})); % all nc files, icluding civ2678 iview=find(ismember(SeriesData.FileType,{'netcdf','civx','civdata'})); % all nc files, icluding civ 2679 2679 hget_field=findobj(allchild(0),'name','get_field'); 2680 2680 if ~isempty(hget_field) … … 2684 2684 InputTable=Param.InputTable(iview,:); 2685 2685 % check the existence of the first file in the series 2686 first_j=[];last_j=[];MinIndex_j=1;MaxIndex_j=1; %default setting for index j2687 if isfield(Param.IndexRange,'first_j'); % if index j is used2686 first_j=[];last_j=[];MinIndex_j=1;MaxIndex_j=1; % default setting for index j 2687 if isfield(Param.IndexRange,'first_j'); % if index j is used 2688 2688 first_j=Param.IndexRange.first_j; 2689 2689 last_j=Param.IndexRange.last_j; … … 2887 2887 function [ind_remove]=find_pairs(dirpair,ind_i,last_i) 2888 2888 indsel=ind_i; 2889 indiff=diff(ind_i); % test index increment to detect multiplets (several pairs with the same index ind_i) and holes in the series2890 indiff=[1 indiff last_i-ind_i(end)+1]; %for testing gaps with the imposed bounds2889 indiff=diff(ind_i); % test index increment to detect multiplets (several pairs with the same index ind_i) and holes in the series 2890 indiff=[1 indiff last_i-ind_i(end)+1]; % for testing gaps with the imposed bounds 2891 2891 if ~isempty(indiff) 2892 2892 indiff2=diff(indiff); 2893 2893 indiffp=[indiff2 1]; 2894 2894 indiffm=[1 indiff2]; 2895 ind_multi_m=find((indiff==0)&(indiffm<0))-1; %indices of first members of multiplets2896 ind_multi_p=find((indiff==0)&(indiffp>0)); %indices of last members of multiplets2895 ind_multi_m=find((indiff==0)&(indiffm<0))-1; % indices of first members of multiplets 2896 ind_multi_p=find((indiff==0)&(indiffp>0)); % indices of last members of multiplets 2897 2897 %for each multiplet, select the most recent file 2898 2898 ind_remove=[]; … … 2900 2900 ind_pairs=ind_multi_m(i):ind_multi_p(i); 2901 2901 for imulti=1:length(ind_pairs) 2902 datepair(imulti)=datenum(dirpair(ind_pairs(imulti)).date); %dates of creation2903 end 2904 [datenew,indsort2]=sort(datepair); % sort the multiplet by creation date2905 ind_s=indsort2(1:end-1); %2906 ind_remove=[ind_remove ind_pairs(ind_s)]; %remove these indices, leave the last one2902 datepair(imulti)=datenum(dirpair(ind_pairs(imulti)).date); % dates of creation 2903 end 2904 [datenew,indsort2]=sort(datepair); % sort the multiplet by creation date 2905 ind_s=indsort2(1:end-1); % 2906 ind_remove=[ind_remove ind_pairs(ind_s)]; % remove these indices, leave the last one 2907 2907 end 2908 2908 end … … 2912 2912 function [num_i1,num_i2,num_j1,num_j2,num_i_out,num_j_out]=find_file_indices(num_i,num_j,ind_shift,NomType,mode) 2913 2913 %------------------------------------------------------------------------ 2914 num_i1=num_i; % set of first image numbers by default2914 num_i1=num_i; % set of first image numbers by default 2915 2915 num_i2=num_i; 2916 2916 num_j1=num_j; … … 2920 2920 % if isequal (NomType,'_1-2_1') || isequal (NomType,'_1-2') 2921 2921 if isequal(mode,'series(Di)') 2922 num_i1_line=num_i+ind_shift(3); % set of first image numbers2922 num_i1_line=num_i+ind_shift(3); % set of first image numbers 2923 2923 num_i2_line=num_i+ind_shift(4); 2924 2924 % adjust the first and last field number … … 2936 2936 num_j2=ind_shift(2)*ones(size(num_i)); 2937 2937 else 2938 num_j1_col=num_j+ind_shift(1); % set of first image numbers2938 num_j1_col=num_j+ind_shift(1); % set of first image numbers 2939 2939 num_j2_col=num_j+ind_shift(2); 2940 2940 % adjust the first field number … … 2952 2952 function CheckObject_Callback(hObject, eventdata, handles) 2953 2953 %------------------------------------------------------------------------ 2954 hset_object=findobj(allchild(0),'tag','set_object'); %find the set_object interface handle2954 hset_object=findobj(allchild(0),'tag','set_object'); % find the set_object interface handle 2955 2955 if get(handles.CheckObject,'Value') 2956 2956 SeriesData=get(handles.series,'UserData'); … … 2983 2983 data.ProjMode='none'; 2984 2984 end 2985 hset_object=set_object(data); % call the set_object interface2985 hset_object=set_object(data); % call the set_object interface 2986 2986 set(hset_object,'Name','set_object_series')% name to distinguish from set_object used with uvmat 2987 2987 end 2988 2988 ProjObject=read_GUI(hset_object); 2989 set(handles.ProjObject,'String',ProjObject.Name); %display the object name2989 set(handles.ProjObject,'String',ProjObject.Name); % display the object name 2990 2990 SeriesData=get(handles.series,'UserData'); 2991 2991 SeriesData.ProjObject=ProjObject; … … 3063 3063 InputTable=get(handles.InputTable,'Data'); 3064 3064 nbview=size(InputTable,1); 3065 MaskTable=cell(nbview,1); %default3066 ListMask=cell(nbview,1); %default3065 MaskTable=cell(nbview,1); % default 3066 ListMask=cell(nbview,1); % default 3067 3067 MaskData=get(handles.MaskTable,'Data'); 3068 MaskData(size(MaskData,1):nbview,1)=cell(size(MaskData,1):nbview,1); %complement if undefined lines3068 MaskData(size(MaskData,1):nbview,1)=cell(size(MaskData,1):nbview,1); % complement if undefined lines 3069 3069 for iview=1:nbview 3070 3070 ListMask{iview,1}=num2str(iview); … … 3073 3073 if isempty(MaskData{iview}) 3074 3074 SubDir=InputTable{iview,2}; 3075 MaskPath=fullfile(RootPath,[regexprep(SubDir,'\..*','') '.mask']); %take the root part of SubDir, before the first dot '.'3075 MaskPath=fullfile(RootPath,[regexprep(SubDir,'\..*','') '.mask']); % take the root part of SubDir, before the first dot '.' 3076 3076 if exist(MaskPath,'dir') 3077 ListStruct=dir(MaskPath); %look for a mask file3078 ListCells=struct2cell(ListStruct); % transform dir struct to a cell arrray3079 check_dir=cell2mat(ListCells(4,:)); % =1 for directories, =0 for files3080 ListFiles=ListCells(1,:); %list of file and dri names3081 ListFiles=ListFiles(~check_dir); %list of file names (excluding dir)3077 ListStruct=dir(MaskPath); % look for a mask file 3078 ListCells=struct2cell(ListStruct); % transform dir struct to a cell arrray 3079 check_dir=cell2mat(ListCells(4,:)); % =1 for directories, =0 for files 3080 ListFiles=ListCells(1,:); % list of file and dri names 3081 ListFiles=ListFiles(~check_dir); % list of file names (excluding dir) 3082 3082 mdetect=0; 3083 3083 if ~isempty(ListFiles) … … 3089 3089 end 3090 3090 if ~strcmp(MaskFile{ifile},MaskFile{1}) 3091 mdetect=0; % cancel detection test in case of multiple masks, use the brower for selection3091 mdetect=0; % cancel detection test in case of multiple masks, use the brower for selection 3092 3092 break 3093 3093 end … … 3148 3148 3149 3149 3150 % path_to_uvmat=which ('uvmat'); % check the path of uvmat3150 % path_to_uvmat=which ('uvmat'); % check the path of uvmat 3151 3151 % pathelp=fileparts(path_to_uvmat); 3152 3152 % helpfile=fullfile(pathelp,'uvmat_doc','uvmat_doc.html'); … … 3171 3171 return %browser closed without choice 3172 3172 end 3173 [TransformPath,TransformName,TransformExt]=fileparts(FileName); % removes extension .m3173 [TransformPath,TransformName,TransformExt]=fileparts(FileName); % removes extension .m 3174 3174 if ~strcmp(TransformExt,'.m') 3175 3175 msgbox_uvmat('ERROR','a Matlab function .m must be introduced'); … … 3177 3177 end 3178 3178 % insert the choice in the menu 3179 TransformIndex=find(strcmp(TransformName,TransformList),1); % look for the selected function in the menu Action3179 TransformIndex=find(strcmp(TransformName,TransformList),1); % look for the selected function in the menu Action 3180 3180 if isempty(TransformIndex)%the input string does not exist in the menu 3181 3181 TransformIndex= length(TransformList); 3182 TransformList=[TransformList(1:end-1);{TransformName};TransformList(end)]; % the selected function is appended in the menu, before the last item 'more...'3182 TransformList=[TransformList(1:end-1);{TransformName};TransformList(end)]; % the selected function is appended in the menu, before the last item 'more...' 3183 3183 set(handles.TransformName,'String',TransformList) 3184 3184 TransformPathList=[TransformPathList;{TransformPath}]; 3185 3185 else% the input function already exist, we update its path (possibly new) 3186 TransformPathList{TransformIndex}=TransformPath; %3186 TransformPathList{TransformIndex}=TransformPath; % 3187 3187 set(handles.TransformName,'Value',TransformIndex) 3188 3188 end 3189 3189 % save the new menu in the personal file 'uvmat_perso.mat' 3190 dir_perso=prefdir; %personal Matalb directory3190 dir_perso=prefdir; % personal Matalb directory 3191 3191 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 3192 3192 if exist(profil_perso,'file') … … 3197 3197 TransformPathListUser=TransformPathListUser'; 3198 3198 TransformListUser=TransformListUser'; 3199 save (profil_perso,'TransformPathListUser','TransformListUser','-append'); % store the root name for future opening of uvmat3199 save (profil_perso,'TransformPathListUser','TransformListUser','-append'); % store the root name for future opening of uvmat 3200 3200 end 3201 3201 end 3202 3202 3203 3203 %display the current function path 3204 set(handles.TransformPath,'String',TransformPathList{TransformIndex}); % show the path to the senlected function3204 set(handles.TransformPath,'String',TransformPathList{TransformIndex}); % show the path to the senlected function 3205 3205 set(handles.TransformName,'UserData',TransformPathList); 3206 3206 … … 3211 3211 return 3212 3212 end 3213 current_dir=pwd; %current working dir3213 current_dir=pwd; % current working dir 3214 3214 cd(TransformPathList{TransformIndex}) 3215 3215 transform_handle=str2func(TransformName); 3216 3216 cd(current_dir) 3217 Field.Action.RUN=0; % indicate that the transform fct is called only to get input param3218 DataOut=feval(transform_handle,Field,[]); % execute the transform fct to get the required conditions3217 Field.Action.RUN=0; % indicate that the transform fct is called only to get input param 3218 DataOut=feval(transform_handle,Field,[]); % execute the transform fct to get the required conditions 3219 3219 if isfield(DataOut,'TransformInput')% used to add transform parameters at selection of the transform fct 3220 3220 SeriesData=get(handles.series,'UserData'); … … 3234 3234 display('current series config :') 3235 3235 evalin('base','Param') %display CurData in the workspace 3236 commandwindow; % brings the Matlab command window to the front3236 commandwindow; % brings the Matlab command window to the front 3237 3237 3238 3238 %------------------------------------------------------------------------ … … 3244 3244 %% use a browser to choose the xml file containing the processing config 3245 3245 InputTable=get(handles.InputTable,'Data'); 3246 oldfile=InputTable{1,1}; %current path in InputTable3246 oldfile=InputTable{1,1}; % current path in InputTable 3247 3247 if isempty(oldfile) 3248 3248 % use a file name stored in prefdir … … 3256 3256 end 3257 3257 end 3258 filexml=uigetfile_uvmat('pick a xml parameter file',oldfile,'.xml'); % get the xml file containing processing parameters3258 filexml=uigetfile_uvmat('pick a xml parameter file',oldfile,'.xml'); % get the xml file containing processing parameters 3259 3259 if isempty(filexml), return, end % quit function if an xml file has not been opened 3260 3260 3261 3261 %% fill the GUI series with the content of the xml file 3262 Param=xml2struct(filexml); % read the input xml file as a Matlab structure3262 Param=xml2struct(filexml); % read the input xml file as a Matlab structure 3263 3263 3264 3264 % ask to stop current Action if button RUN is in action (another process is already running) … … 3271 3271 end 3272 3272 end 3273 Param.Action.RUN=0; % desactivate the input RUN=13273 Param.Action.RUN=0; % desactivate the input RUN=1 3274 3274 3275 3275 fill_GUI(Param,handles.series)% fill the elements of the GUI series with the input parameters … … 3285 3285 set(handles.ActionInput,'Visible','on') 3286 3286 set(handles.ActionInput,'Value',0) 3287 Param.ActionInput.ConfigSource=filexml; % record the source of config for future info3287 Param.ActionInput.ConfigSource=filexml; % record the source of config for future info 3288 3288 SeriesData.ActionInput=Param.ActionInput; 3289 3289 end … … 3307 3307 set(handles.DeleteObject,'Visible','off') 3308 3308 end 3309 set(handles.REFRESH,'BackgroundColor',[1 0 1]); % paint REFRESH button in magenta to indicate that it should be activated3309 set(handles.REFRESH,'BackgroundColor',[1 0 1]); % paint REFRESH button in magenta to indicate that it should be activated 3310 3310 3311 3311 … … 3369 3369 return 3370 3370 end 3371 OutputSubDir=[Param.OutputSubDir Param.OutputDirExt]; % subdirectory for output files3371 OutputSubDir=[Param.OutputSubDir Param.OutputDirExt]; % subdirectory for output files 3372 3372 OutputDir=fullfile(RootPath,OutputSubDir); 3373 3373 if exist(OutputDir,'dir') … … 3446 3446 return 3447 3447 end 3448 ListFiles(1)=[]; %removes the first line ='.'3448 ListFiles(1)=[]; % removes the first line ='.' 3449 3449 ListDisplay=cell(numel(ListFiles),1); 3450 3450 testrecent=0; … … 3453 3453 ListDisplay{ilist}=ListFiles(ilist).name; 3454 3454 if ~ListFiles(ilist).isdir && isfield(ListFiles(ilist),'datenum') 3455 datnum(ilist)=ListFiles(ilist).datenum; %only available in recent matlab versions3455 datnum(ilist)=ListFiles(ilist).datenum; % only available in recent matlab versions 3456 3456 testrecent=1; 3457 3457 end … … 3461 3461 %% Look at date of creation 3462 3462 ListDisplay=ListDisplay(datnum~=0); 3463 datnum=datnum(datnum~=0); %keep the non zero values corresponding to existing files3463 datnum=datnum(datnum~=0); % keep the non zero values corresponding to existing files 3464 3464 NbOutputFile=[]; 3465 3465 if isempty(datnum) … … 3563 3563 %% create the GUI set_pairs 3564 3564 set(0,'Unit','points') 3565 ScreenSize=get(0,'ScreenSize'); % get the size of the screen, to put the fig on the upper right3566 Width=220; % fig width in points (1/72 inch)3565 ScreenSize=get(0,'ScreenSize'); % get the size of the screen, to put the fig on the upper right 3566 Width=220; % fig width in points (1/72 inch) 3567 3567 Height=min(0.8*ScreenSize(4),300); 3568 Left=ScreenSize(3)- Width-40; % right edge close to the right, with margin=403569 Bottom=ScreenSize(4)-Height-40; % put fig at top right3568 Left=ScreenSize(3)- Width-40; % right edge close to the right, with margin=40 3569 Bottom=ScreenSize(4)-Height-40; % put fig at top right 3570 3570 hfig=findobj(allchild(0),'Tag','set_slice'); 3571 if ~isempty(hfig),delete(hfig), end; % delete existing version of the GUI3571 if ~isempty(hfig),delete(hfig), end; % delete existing version of the GUI 3572 3572 hfig=figure('name','set_pairs','tag','set_pairs','MenuBar','none','NumberTitle','off','Unit','points','Position',[Left,Bottom,Width,Height]); 3573 3573 BackgroundColor=get(hfig,'Color'); … … 3575 3575 TimeUnit=get(handles.TimeUnit,'String'); 3576 3576 PairString=get(handles.PairString,'Data'); 3577 ListViewLines=find(cellfun('isempty',PairString)==0); %find list of non empty pairs3577 ListViewLines=find(cellfun('isempty',PairString)==0); % find list of non empty pairs 3578 3578 ListViewMenu=cell(numel(ListViewLines),1); 3579 3579 iview=get(handles.PairString,'Value'); … … 3582 3582 end 3583 3583 if isempty(iview) 3584 ListViewValue=numel(ListViewLines); % we work by default on the pair option for the last line which requires pairs3584 ListViewValue=numel(ListViewLines); % we work by default on the pair option for the last line which requires pairs 3585 3585 iview=ListViewLines(end); 3586 3586 else … … 3588 3588 end 3589 3589 ref_i=str2num(get(handles.num_first_i,'String')); 3590 ref_j=1; %default3590 ref_j=1; % default 3591 3591 if strcmp(get(handles.num_first_j,'String'),'Visible') 3592 3592 ref_j=str2num(get(handles.num_first_j,'String')); … … 3597 3597 % first raw of the GUI 3598 3598 uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.88 0.5 0.1],'BackgroundColor',BackgroundColor,... 3599 'String','row to edit #','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','right'); %title3599 'String','row to edit #','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','right'); % title 3600 3600 uicontrol('Style','popupmenu','Units','normalized', 'Position', [0.54 0.8 0.3 0.2],'BackgroundColor',[1 1 1],... 3601 3601 'Callback',@(hObject,eventdata)ListView_Callback(hObject,eventdata),'String',ListViewMenu,'Value',ListViewValue,'FontUnits','points','FontSize',12,'FontWeight','bold',... … … 3603 3603 % second raw of the GUI 3604 3604 uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.79 0.7 0.1],'BackgroundColor',BackgroundColor,... 3605 'String','mode of index pairing:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left'); %title3605 'String','mode of index pairing:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left'); % title 3606 3606 uicontrol('Style','popupmenu','Units','normalized', 'Position', [0.05 0.62 0.9 0.2],'BackgroundColor',[1 1 1],... 3607 3607 'Callback',@(hObject,eventdata)Mode_Callback(hObject,eventdata),'String',ModeMenu,'Value',ModeValue,'FontUnits','points','FontSize',12,'FontWeight','bold',... … … 3609 3609 % third raw 3610 3610 uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.6 0.7 0.1],'BackgroundColor',BackgroundColor,... 3611 'String','pair choice:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left'); %title3611 'String','pair choice:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left'); % title 3612 3612 uicontrol('Style','listbox','Units','normalized', 'Position', [0.05 0.42 0.9 0.2],'BackgroundColor',[1 1 1],... 3613 3613 'Callback',@(hObject,eventdata)ListPair_Callback(hObject,eventdata),'String',displ_pair,'Value',1,'FontUnits','points','FontSize',12,'FontWeight','bold',... 3614 3614 'Tag','ListPair','TooltipString','''ListPair'': menu for selecting the image pair'); 3615 3615 uicontrol('Style','text','Units','normalized', 'Position', [0.1 0.22 0.8 0.1],'BackgroundColor',BackgroundColor,... 3616 'String','ref_i ref_j','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center'); %title3616 'String','ref_i ref_j','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','center'); % title 3617 3617 uicontrol('Style','edit','Units','normalized', 'Position', [0.15 0.17 0.3 0.08],'BackgroundColor',[1 1 1],... 3618 3618 'Callback',@(hObject,eventdata)num_ref_i_Callback(hObject,eventdata),'String',num2str(ref_i),'FontUnits','points','FontSize',12,'FontWeight','bold',... … … 3636 3636 function Mode_Callback(hObject,eventdata) 3637 3637 %% get input info 3638 hseries=findobj(allchild(0),'tag','series'); %handles of the GUI series3639 hhseries=guidata(hseries); %handles of the elements in the GUI series3638 hseries=findobj(allchild(0),'tag','series'); % handles of the GUI series 3639 hhseries=guidata(hseries); % handles of the elements in the GUI series 3640 3640 TimeUnit=get(hhseries.TimeUnit,'String'); 3641 3641 SeriesData=get(hseries,'UserData'); … … 3650 3650 3651 3651 %% enable j index visibility after the new choice 3652 status_j='on'; %default3652 status_j='on'; % default 3653 3653 if isempty(find(~cellfun(@isempty,SeriesData.j1_series), 1)); % case of empty j indices 3654 3654 status_j='off'; % no j index needed 3655 3655 elseif strcmp(get(handles.PairString,'Visible'),'on') 3656 check_burst=cellfun(@isempty,regexp(PairString,'^j')); %=0 for burst case, 1 otherwise3656 check_burst=cellfun(@isempty,regexp(PairString,'^j')); % =0 for burst case, 1 otherwise 3657 3657 if isempty(find(check_burst, 1))% if all pair string begins by j (burst) 3658 3658 status_j='off'; % no j index needed for bust case … … 3685 3685 function ListPair_Callback(hObject,eventdata) 3686 3686 %------------------------------------------------------------ 3687 list_pair=get(hObject,'String'); %get the menu of image pairs3687 list_pair=get(hObject,'String'); % get the menu of image pairs 3688 3688 if isempty(list_pair) 3689 3689 string=''; 3690 3690 else 3691 3691 string=list_pair{get(hObject,'Value')}; 3692 % string=regexprep(string,',.*',''); %removes time indication (after ',')3692 % string=regexprep(string,',.*',''); % removes time indication (after ',') 3693 3693 end 3694 3694 hseries=findobj(allchild(0),'tag','series'); … … 3725 3725 iline=str2double(get(handles.InputLine,'String')); 3726 3726 if size(InputTable,1)>1 3727 InputTable(iline,:)=[]; % suppress the current line if not the first3727 InputTable(iline,:)=[]; % suppress the current line if not the first 3728 3728 set(handles.InputTable,'Data',InputTable); 3729 3729 end
Note: See TracChangeset
for help on using the changeset viewer.