Changeset 1096 for trunk/src/series.m
- Timestamp:
- Apr 2, 2021, 3:57:01 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r1095 r1096 627 627 empty_line(iline)= isempty(cell2mat(InputTable(iline,1:3))); 628 628 end 629 if ~isempty(find(empty_line ));629 if ~isempty(find(empty_line,1)) 630 630 InputTable(empty_line,:)=[]; % remove empty lines 631 631 set(handles.InputTable,'Data',InputTable) … … 743 743 744 744 %% enable other menus and uicontrols 745 % set(handles.MenuOpenCampaign,'Enable','on')746 % set(handles.MenuCampaign_1,'Enable','on')747 % set(handles.MenuCampaign_2,'Enable','on')748 % set(handles.MenuCampaign_3,'Enable','on')749 % set(handles.MenuCampaign_4,'Enable','on')750 % set(handles.MenuCampaign_5,'Enable','on')751 745 set(handles.RUN, 'Enable','On') 752 746 set(handles.RUN,'BackgroundColor',[1 0 0])% set RUN button to red … … 758 752 InputTable=get(handles.InputTable,'Data'); 759 753 SeriesData=get(handles.series,'UserData'); 754 760 755 if strcmp(iview,'append') % display the input data as a new line in the table 761 756 iview=size(InputTable,1)+1; % the next line in InputTable becomes the current line 762 % InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];763 757 elseif strcmp(iview,'one') % refresh the list of input file series 764 758 iview=1; % the first line in InputTable becomes the current line 765 759 InputTable={'','','','',''}; 766 % InputTable(iview,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];767 760 set(handles.TimeTable,'Data',[{''},{[]},{[]},{[]},{[]}]) 768 761 set(handles.MinIndex_i,'Data',[]) … … 860 853 SeriesData.Ref_j1=j1; 861 854 SeriesData.Ref_j2=j2; 855 856 %% define the path for the output files 857 [InputPath,Device,DeviceExt]=fileparts(InputTable{1,1}); 858 [InputPath,Experiment,ExperimentExt]=fileparts(InputPath); 859 [~,InputPath,InputPathExt]=fileparts(InputPath); 860 set(handles.Device,'String',[Device DeviceExt]) 861 set(handles.Experiment,'String',[Experiment ExperimentExt]) 862 if ~isempty(regexp(InputTable{1,1},'(^http://)|(^https://)')) 863 set(handles.OutputPathBrowse,'Value',1)% an output folder needs to be specified for OpenDAP data 864 end 865 866 %update the output path if needed 867 if ~(isfield(SeriesData,'InputPath') && strcmp(SeriesData.InputPath,InputPath)) 868 if get(handles.OutputPathBrowse,'Value')==1 % fix the output path in manual mode 869 OutputPathOld=get(handles.OutputPath,'String'); 870 OutputPath=uigetdir(OutputPathOld,'pick a root folder for output data'); 871 set(handles.OutputPath,'String',OutputPath) 872 else %reproduce the input path for output 873 set(handles.OutputPath,'String',InputPath) 874 end 875 SeriesData.InputPath=InputPath; 876 end 877 862 878 set(handles.series,'UserData',SeriesData) 863 879 … … 1029 1045 end 1030 1046 end 1031 1032 % if isfield(XmlData,'GeometryCalib')1033 % check_calib=1;1034 % if isfield(XmlData.GeometryCalib,'SliceCoord')1035 % siz=size(XmlData.GeometryCalib.SliceCoord);1036 % if ~isempty(NbSlice)&& ~isequal(size(1),NbSlice)1037 % msgbox_uvmat('WARNING','inconsistent numbers of Z indices between motor and calibration');1038 % else1039 % NbSlice=siz(1);1040 % end1041 % end1042 % end1043 1047 end 1044 1048 if ~isempty(NbSlice) … … 1050 1054 if ~isempty(VideoObject)% case of movies 1051 1055 imainfo=get(VideoObject); 1052 if isempty(j1_series) ;% frame index along i1056 if isempty(j1_series) % frame index along i 1053 1057 Time=zeros(imainfo.NumberOfFrames+1,2); 1054 1058 Time(:,2)=(0:1/imainfo.FrameRate:(imainfo.NumberOfFrames)/imainfo.FrameRate)'; … … 1069 1073 TimeLast=Time(last_i+1,last_j+1); 1070 1074 end 1071 if size(Time)>=[MaxIndex_i+1 MaxIndex_j+1] ;1075 if size(Time)>=[MaxIndex_i+1 MaxIndex_j+1] 1072 1076 TimeMax=Time(MaxIndex_i+1,MaxIndex_j+1); 1073 1077 end … … 1134 1138 j_max{iline}=max(pair_max,[],1); % max on j index 1135 1139 if ~isempty(j_max{iline}) 1136 MaxIndex_i(iline)= max(find(j_max{iline}))-1; % max ref index i1137 MinIndex_i(iline)= min(find(j_max{iline}))-1; % min ref index i1140 MaxIndex_i(iline)=find(j_max{iline}, 1, 'last' )-1; % max ref index i 1141 MinIndex_i(iline)=find(j_max{iline}, 1 )-1; % min ref index i 1138 1142 end 1139 1143 end … … 1149 1153 LineData=zeros(size(file_indices)); 1150 1154 file_select=file_indices(file_indices<=numel(j_max{iline})); 1151 ind_select=fi nd(file_indices<=numel(j_max{iline}));1155 ind_select=file_indices<=numel(j_max{iline}); 1152 1156 LineData(ind_select)=j_max{iline}(file_select)~=0; 1153 1157 CData(ind_y,:)=ones(size(ind_y'))*LineData; … … 1198 1202 1199 1203 %------------------------------------------------------------------------ 1204 %fill the menu of possible pairs as input 1200 1205 function displ_pair=update_listpair(i1_series,i2_series,j1_series,j2_series,mode,time,TimeUnit,ref_i,ref_j,TimeName,InputTable,FileInfo) 1201 1206 %------------------------------------------------------------------------ … … 1212 1217 max_diff=max(diff_i(diff_i>0)); 1213 1218 for ipair=min_diff:max_diff 1214 if numel(diff_i(diff_i==ipair))>01219 if ~isempty(find(diff_i==ipair,1))% if the considered difference exists as input 1215 1220 pair_string=['Di= ' num2str(-floor(ipair/2)) '|' num2str(ceil(ipair/2)) ]; 1216 if ~isempty(time)1221 if size(time,1)>=ref_i+ceil(ipair/2) 1217 1222 if ref_i<=floor(ipair/2) 1218 1223 ref_i=floor(ipair/2)+1; % shift ref_i to get the first pair … … 2137 2142 [status,result]=system(oar_command)% execute system command and show the result (ID number of the launched job) on the Matlab command window 2138 2143 filename_oarcommand=fullfile(DIR_CLUSTER,'0_cluster_command'); % keep track of the command in file '0-OAR/0_cluster_command' 2139 fid=fopen(filename_oarcommand,'w'); 2144 [fid,errormsg]=fopen(filename_oarcommand,'w'); 2145 if ~isempty(errormsg) 2146 msgbox_uvmat('ERROR',['cannot create ' filename_oarcommand ': ' errormsg]) 2147 return 2148 end 2140 2149 fprintf(fid,oar_command); % store the command 2141 2150 fprintf(fid,result); % store the result (job ID number) … … 2723 2732 set(handles.Experiment,'Visible','on') 2724 2733 set(handles.Experiment_title,'Visible','on') 2725 OutputPathOld=get(handles.OutputPath,'String')2726 if isempty(OutputPathOld)2727 if ~isempty(regexp(InputTable{1,1},'(^http://)|(^https://)'))2728 OutputPath=uigetdir(pwd,'pick a root folder for output data');2729 end2730 set(handles.OutputPath,'String',OutputPath)2731 end2732 2734 set(handles.Experiment_title,'Visible','on') 2733 2735 set(handles.OutputPath,'Visible','on') … … 2777 2779 set(handles.OutputDirExt,'Visible',OutputDirVisible) 2778 2780 set(handles.OutputSubDir,'Visible',OutputDirVisible) 2779 set(handles.OutputDir_title,'Visible',OutputDirVisible)2781 % set(handles.OutputDir_title,'Visible',OutputDirVisible) 2780 2782 SeriesData.ActionName=ActionName; % record ActionName for next use 2781 2783 … … 3951 3953 3952 3954 function OutputPath_Callback(hObject, eventdata, handles) 3953 % hObject handle to OutputPath (see GCBO)3954 % eventdata reserved - to be defined in a future version of MATLAB3955 % handles structure with handles and user data (see GUIDATA)3956 3957 % Hints: get(hObject,'String') returns contents of OutputPath as text3958 % str2double(get(hObject,'String')) returns contents of OutputPath as a doubl3959 3960 3955 3961 3956 3962 3957 function Experiment_Callback(hObject, eventdata, handles) 3963 % hObject handle to Experiment (see GCBO)3964 % eventdata reserved - to be defined in a future version of MATLAB3965 % handles structure with handles and user data (see GUIDATA)3966 3967 % Hints: get(hObject,'String') returns contents of Experiment as text3968 % str2double(get(hObject,'String')) returns contents of Experiment as a double3969 3958 3970 3959 3971 3960 function Device_Callback(hObject, eventdata, handles) 3972 % hObject handle to Device (see GCBO)3973 % eventdata reserved - to be defined in a future version of MATLAB3974 % handles structure with handles and user data (see GUIDATA)3975 3976 3961 3977 3962 3978 3963 % --- Executes on button press in OutputPathBrowse. 3979 3964 function OutputPathBrowse_Callback(hObject, eventdata, handles) 3965 CheckValue=get(handles.OutputPathBrowse,'Value'); 3966 if CheckValue 3980 3967 OutputPath=uigetdir(get(handles.OutputPath,'String')); 3981 3968 set(handles.OutputPath,'String',OutputPath) 3969 else 3970 InputTable=get(handles.InputTable,'Data'); 3971 set(handles.OutputPath,'String',InputTable{1,1}) 3972 end
Note: See TracChangeset
for help on using the changeset viewer.