Changeset 360 for trunk/src/uvmat.m


Ignore:
Timestamp:
Jan 9, 2012, 1:16:35 AM (12 years ago)
Author:
sommeria
Message:

civ: bugs corrected. Iintroduction of an xm file for parameters read using the new fct fill_GUI (to test and improve)
cleaning in uvmat. Possibility of using blank increment added (go to the next available file)
fullfile_uvmat: case of two equal indices in a pair, bug repair.
find_fileseries: improved speed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r354 r360  
    469469function display_file_name(hObject, eventdata, handles,fileinput,index)
    470470%------------------------------------------------------------------------
    471 %% analyse the input file
     471%% look for the input file existence
    472472if ~exist(fileinput,'file')
    473473    msgbox_uvmat('ERROR',['input file ' fileinput  ' does not exist'])
     
    475475end
    476476
    477 %% have a unique function for fileinput (index=1) and fileinput_1 (index=2)
     477%% set the mouse pointer to 'watch'
     478set(handles.uvmat,'Pointer','watch')
     479set(handles.RootPath,'BackgroundColor',[1 1 0])
     480drawnow
     481
     482%% define the relevant handles for the first fiel series (index=1) or the second file series (index=2)
    478483if ~exist('index','var')
    479484    index=1;
     
    502507    set(handles.NomType_1,'Visible','on');
    503508end
    504 % detect root name, nomenclature and indices in the input file name:
     509
     510%% detect root name, nomenclature and indices in the input file name:
    505511[tild,SubDir,tild,i1,i2,j1,j2,FileExt]=fileparts_uvmat(fileinput);
    506512% detect the file type, get the movie object if relevant, and look for the corresponding file series:
     
    512518    j2=[];
    513519end 
    514 % open the file or fill the GUI uvmat according to the detected file type
     520
     521%% open the file or fill the GUI uvmat according to the detected file type
    515522switch FileType
    516523    case ''
     
    536543        set(handles_FileExt,'String',FileExt);
    537544        if index==1
    538             % fill file index counters
     545            % fill file index counters if the first file series is opened
    539546            set(handles.i1,'String',num2str(i1));
    540547            set(handles.i2,'String',num2str(i2));
    541548            set(handles.j1,'String',num2stra(j1,NomType));
    542549            set(handles.j2,'String',num2stra(j2,NomType));
    543         else %read the current field index
     550        else %read the current field index if the second file series is opened
    544551            i1=str2num(get(handles.i1,'String'));
    545552            i2=str2num(get(handles.i2,'String'));
     
    547554            j2=stra2num(get(handles.j2,'String'));
    548555        end
     556       
    549557        % synchronise indices of the second  input file if it exists
    550558        if get(handles.SubField,'Value')==1% if the subfield button is activated, update the field numbers
    551             %             if index==1
    552559            Input=read_GUI(handles.InputFile);
    553560            if ~isfield(Input,'RootPath_1')||strcmp(Input.RootPath_1,'"')
     
    564571            if exist(FileName_1,'file')
    565572                FileIndex_1=fullfile_uvmat('','','','',Input.NomType_1,i1,i2,j1,j2);
    566                 %FileIndex_1=name_generator('',i1,i2,'',NomType_1,1,j1,j2,'');
    567573                set(handles.FileIndex_1,'String',FileIndex_1)
    568574            else
     
    588594        set(handles.frame_object,'Visible','on')
    589595       
    590         % initiate input file series and refresh the current field view:
    591        
     596        % initiate input file series and refresh the current field view:     
    592597        update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject,index);
    593598
    594599end
     600
     601%% set back the mouse pointer to arrow
     602set(handles.uvmat,'Pointer','arrow')
    595603
    596604%------------------------------------------------------------------------
     
    601609[RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
    602610fileinput=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
    603 % fileinput=read_file_boxes(handles);
    604611% detect the file type, get the movie object if relevant, and look for the corresponding file series:
    605612[RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,MovieObject]=find_file_series(fileinput);
     
    640647function update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject,index)
    641648%------------------------------------------------------------------------
    642 %% TODO: have a unique function for update_rootinfo and update_rootinfo_1
     649%% define the relevant handles depending on the index (1=first file series, 2= second file series)
    643650if ~exist('index','var')
    644651    index=1;
     
    650657    handles_RootPath=handles.RootPath_1;
    651658    handles_Fields=handles.Fields_1;
    652     %..........................
    653659end
    654660
     
    664670UvData.j1_series{index}=j1_series;
    665671UvData.j2_series{index}=j2_series;
    666 set(handles.fix_pair,'Value',1) % activate by default the comp_input '-'input window
     672% set(handles.CheckFixPair,'Value',1) % activate by default the comp_input '-'input window
    667673set(handles.FixVelType,'Value',0); %desactivate fixed veltype
    668 %[FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles);
    669674if index==1
    670 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
     675    [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
    671676else
    672677    [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes_1(handles);
     
    681686nbfield_j=[];%default
    682687
    683 % read timing and total frame number from the current file (movie files) !! may be overrid by xml file
     688%% read timing and total frame number from the current file (movie files) !! may be overrid by xml file
    684689XmlData.Time=[];%default
    685690XmlData.GeometryCalib=[];%default
     
    732737set(handles.CheckBW,'Value',strcmp(ColorType,'grayscale'))% select handles.CheckBW if grayscale image
    733738
    734 % read parameters (time, geometric calibration..) from a documentation file (.xml advised)
     739%% read parameters (time, geometric calibration..) from a documentation file (.xml advised)
    735740filexml=[FileBase '.xml'];
    736741fileciv=[FileBase '.civ'];
    737742warntext='';%default warning message
    738743NbSlice=1;%default
    739 
     744set(handles.RootPath,'BackgroundColor',[1 1 1])
    740745if exist(filexml,'file')
    741746    set(handles.view_xml,'Visible','on')
    742747    set(handles.view_xml,'BackgroundColor',[1 1 0])
    743     set(handles.RootPath,'BackgroundColor',[1 1 1])
    744748    set(handles.view_xml,'String','view .xml')
    745749    drawnow
     
    815819    if isequal(nbfield,1) && ~isequal(nbfield_j,1)% .Time is a line vector
    816820        NomType=get(handles.NomType,'String');
    817 %         NomType=get(handles.FileIndex,'UserData');
    818821        if numel(NomType)>=2 &&(strcmp(NomType,'_i')||strcmp(NomType(1:2),'%0')||strcmp(NomType(1:2),'_%'))
    819822            XmlData.Time=(XmlData.Time)';
     
    838841set(handles.last_j,'String',last_j_cell);
    839842
    840 % store geometric calibration in UvData
     843%% store geometric calibration in UvData
    841844if isfield(XmlData,'GeometryCalib')
    842845    GeometryCalib=XmlData.GeometryCalib;
     
    877880end
    878881
    879 %update the data attached to the uvmat interface
     882%% update the data attached to the uvmat interface
    880883if ~isempty(TimeUnit)
    881884    set(handles.time_txt,'String',['time (' TimeUnit ')'])
    882885end
    883886UvData.TimeUnit=TimeUnit;
    884 UvData.XmlData=XmlData;
     887UvData.XmlData{index}=XmlData;
    885888UvData.NewSeries=1;
    886889% UvData.MovieObject=MovieObject;
     
    891894end
    892895
    893 % set default options in menu 'Fields'
     896%% set default options in menu 'Fields'
    894897if ~testima
    895898    testcivx=0;
     
    919922
    920923%% set index navigation options and refresh plots
    921 set(handles.RootPath,'BackgroundColor',[1 1 1])
    922 drawnow
    923 set_scan_options(handles)
    924 
    925 %% update list of recent files in the menubar
    926 MenuFile=[{get(handles.MenuFile_1,'Label')};{get(handles.MenuFile_2,'Label')};...
    927     {get(handles.MenuFile_3,'Label')};{get(handles.MenuFile_4,'Label')};{get(handles.MenuFile_5,'Label')}];
    928 str_find=strcmp(FileName,MenuFile);
    929 if isempty(find(str_find,1))
    930     MenuFile=[{FileName};MenuFile];%insert the current file if not already in the list
    931 end
    932 for ifile=1:min(length(MenuFile),5)
    933     eval(['set(handles.MenuFile_' num2str(ifile) ',''Label'',MenuFile{ifile});'])
    934     eval(['set(handles.MenuFile_' num2str(ifile) '_1,''Label'',MenuFile{ifile});'])
    935 end
    936 dir_perso=prefdir;
    937 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
    938 if exist(profil_perso,'file')
    939     save (profil_perso,'MenuFile','-append'); %store the file names for future opening of uvmat
    940 else
    941     save (profil_perso,'MenuFile','-V6'); %store the file names for future opening of uvmat
    942 end
    943 
    944 %------------------------------------------------------------------------
    945 %--- Set index navigation options for new series input and refresh plot
    946 %------------------------------------------------------------------------
    947 function set_scan_options(handles)
    948 
    949 %  set the corresponding index navigation options
    950  NomType=get(handles.NomType,'String');       
    951  NomType_1=get(handles.NomType_1,'String');
    952 % NomType=get(handles.FileIndex,'UserData');       
    953 % NomType_1=get(handles.FileIndex_1,'UserData');
    954 last_i_str=get(handles.last_i,'String');
    955 nbfield=str2num(last_i_str{1});
    956 if numel(last_i_str)==2
    957     nbfield=min(nbfield,str2num(last_i_str{2}));
    958 end 
     924scan_option='i';%default
    959925state_j='off'; %default
    960 scan_option='i';%default
    961 NomTypeRaw=regexprep(NomType(2:end), '-', '');
    962 if numel(regexp(NomTypeRaw,'\D'))>=1
     926if index==2
     927    if get(handles.scan_j,'Value')
     928        scan_option='j'; %keep the scan option for the second fiel series
     929    end
     930    if strcmp(get(handles.j1,'Visible'),'on')
    963931        state_j='on';
    964         if isequal(nbfield,1)
     932    end
     933end
     934if ~isempty(j1_series)
     935        state_j='on';
     936        if isequal(nbfield,1) &&index==1
    965937            scan_option='j'; %scan j index by default if nbfield=1               
    966938        end
    967 end
    968 if ~isempty(NomType_1)
    969     NomTypeRaw=regexprep(NomType_1(2:end), '-', '');
    970     if numel(regexp(NomTypeRaw,'\D'))>=1
    971             state_j='on';
    972             if isequal(nbfield,1)
    973                 scan_option='j';                 
    974             end           
    975     end
    976939end
    977940if isequal(scan_option,'i')
     
    988951set(handles.frame_j,'Visible',state_j);
    989952set(handles.j_text,'Visible',state_j);
    990 if strcmp(state_j,'on')
    991     set(handles.fix_pair,'Visible','on')
    992 else
    993     set(handles.fix_pair,'Visible','off')
     953if ~isempty(i2_series)||~isempty(j2_series)
     954    set(handles.CheckFixPair,'Visible','on')
     955elseif index==1
     956    set(handles.CheckFixPair,'Visible','off')
    994957end
    995958
     
    1004967    CheckMask_Callback([],[],handles)
    1005968end
     969
     970%% update list of recent files in the menubar
     971MenuFile=[{get(handles.MenuFile_1,'Label')};{get(handles.MenuFile_2,'Label')};...
     972    {get(handles.MenuFile_3,'Label')};{get(handles.MenuFile_4,'Label')};{get(handles.MenuFile_5,'Label')}];
     973str_find=strcmp(FileName,MenuFile);
     974if isempty(find(str_find,1))
     975    MenuFile=[{FileName};MenuFile];%insert the current file if not already in the list
     976end
     977for ifile=1:min(length(MenuFile),5)
     978    eval(['set(handles.MenuFile_' num2str(ifile) ',''Label'',MenuFile{ifile});'])
     979    eval(['set(handles.MenuFile_' num2str(ifile) '_1,''Label'',MenuFile{ifile});'])
     980end
     981dir_perso=prefdir;
     982profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
     983if exist(profil_perso,'file')
     984    save (profil_perso,'MenuFile','-append'); %store the file names for future opening of uvmat
     985else
     986    save (profil_perso,'MenuFile','-V6'); %store the file names for future opening of uvmat
     987end
     988
    1006989
    1007990%------------------------------------------------------------------------
     
    11101093display_file_name(hObject,eventdata,handles,fileinput_1,2)
    11111094
    1112 %------------------------------------------------------------------------
    1113 % NOT USED  fills the edit boxes RootPath_1, RootFile_1,NomType_1...from an input file name 'fileinput_1'
    1114 %------------------------------------------------------------------------
    1115 % function display_file_name_1(hObject,eventdata,handles,fileinput_1)
    1116 %
    1117 % %[path,name,ext]=fileparts(fileinput_1);
    1118 % [tild,SubDir_1,tild,i1,i2,j1,j2,FileExt_1]=fileparts_uvmat(fileinput_1);
    1119 % [RootPath_1,RootFile_1,i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject]=find_file_series(fileinput_1);
    1120 % % [RootPath_1,RootFile_1,field_count,str2,str_a,str_b,FileExt_1,NomType_1,SubDir_1]=name2display(fileinput_1);
    1121 % switch FileType
    1122 %     case ''
    1123 %        msgbox_uvmat('ERROR','invalid input file type')
    1124 %     case 'txt'
    1125 %         edit(fileinput) 
    1126 %     case 'figure'                           %display matlab figure
    1127 %         hfig=open(fileinput_1);
    1128 %         set(hfig,'WindowButtonMotionFcn','mouse_motion')%set mouse action functio
    1129 %         set(hfig,'WindowButtonUpFcn','mouse_up')%set mouse click action function
    1130 %         set(hfig,'WindowButtonUpFcn','mouse_down')%set mouse click action function
    1131 %     case {'xml','xls'}                % edit xml or Excel files
    1132 %        editxml(fileinput_1);
    1133 % %     case {'.avi','.image','.vol','.nc','.cdf'} 
    1134 %     otherwise
    1135 %         set(handles.RootPath_1,'String',RootPath_1);
    1136 %         if  isequal(SubDir_1,'')
    1137 %             rootname=fullfile(RootPath_1,RootFile_1);
    1138 %         else
    1139 %             rootname=fullfile(RootPath_1,SubDir_1,RootFile_1);
    1140 %             SubDir=['/' SubDir_1]; %display the separator
    1141 %         end
    1142 %         set(handles.SubDir_1,'String',SubDir_1);
    1143 %         set(handles.RootFile_1,'String',['/' RootFile_1]); %display the separator
    1144 %         indices=fileinput_1(length(rootname)+1:end);
    1145 %         indices(end-length(FileExt_1)+1:end)=[]; %remove extension
    1146 %         set(handles.FileIndex,'String',indices);       
    1147 % %         set(handles.FileIndex,'UserData',NomType);
    1148 %         set(handles.NomType_1,'String',NomType);
    1149 %         set(handles.FileExt_1,'String',FileExt_1);
    1150 %         % fill file index counters
    1151 %         set(handles.i1,'String',num2str(i1));   
    1152 %         set(handles.i2,'String',num2str(i2));
    1153 %         set(handles.j1,'String',num2str(j1));
    1154 %         set(handles.j2,'String',num2str(j2));
    1155 %         
    1156 %         % synchronise indices of the second  input file if it exists
    1157 %         if get(handles.SubField,'Value')==1% if the subfield button is activated, update the field numbers
    1158 %             [RootPath_1,SubDir_1,RootFile_1,FileIndices_1,FileExt_1]=read_file_boxes_1(handles);
    1159 %             %[ff,rr,FileBase_1,ii,FileExt_1,SubDir_1]=read_file_boxes_1(handles);
    1160 %             NomType_1=get(handles.NomType_1,'String');
    1161 % %             NomType_1=get(handles.FileIndex_1,'UserData');     
    1162 %             %FileName_1=name_generator(FileBase_1,i1,i2,FileExt_1,NomType_1,1,j1,j2,SubDir_1);
    1163 %             FileName_1=fullfile_uvmat(RootPath_1,SubDir_1,RootFile_1,FileExt_1,NomType_1,i1,i2,j1,j2);
    1164 %             if exist(FileName_1,'file')
    1165 %                 FileIndex_1=fullfile_uvmat('','','','',NomType_1,i1,i2,j1,j2);
    1166 %                 %FileIndex_1=name_generator('',i1,i2,'',NomType_1,1,j1,j2,'');
    1167 %                 set(handles.FileIndex_1,'String',FileIndex_1)
    1168 %             else
    1169 %                 set(handles.SubField,'Value',0)
    1170 %                 SubField_Callback(hObject, eventdata, handles)
    1171 %             end
    1172 %         end 
    1173 % end
    1174 %
    1175 % % test for image series in a single file and synchronise file indices of the two series
    1176 % if nbfield_1 >1 %case of image with multiple frames
    1177 %     if nbfield_1 < num_i1
    1178 %         msgbox_uvmat('ERROR','current frame index beyond the input movie length')
    1179 %         return
    1180 %     else
    1181 %         NomType_1='*'; %indicate a set of indexed frames within a single file
    1182 %         filename_new=fileinput_1;
    1183 %     end
    1184 % else  % cases of data files   
    1185 %     RootPath=get(handles.RootPath,'String');
    1186 %     RootFile=get(handles.RootFile,'String');
    1187 %     FileBase=fullfile(RootPath,RootFile);
    1188 %     FileBase_1=fullfile(RootPath_1,RootFile_1);
    1189 %     if isequal(FileBase,FileBase_1)
    1190 %         filename_new=fileinput_1;
    1191 %     else       
    1192 %         num_i1=stra2num(get(handles.i1,'String'));%get the current file indices from counters
    1193 %         num_j1=stra2num(get(handles.j1,'String'));
    1194 %         num_i2=stra2num(get(handles.i2,'String'));
    1195 %         num_j2=stra2num(get(handles.j2,'String'));
    1196 %         [filename_new,idetect]=...
    1197 %            name_generator(FileBase_1,num_i1,num_j1,FileExt_1,NomType_1,1,num_i2,num_j2,SubDir_1);%create name with indices synchronised with the first file
    1198 %         indices=''; %default
    1199 %         if ~idetect
    1200 %             msgbox_uvmat('ERROR','second input file with indices corresponding to the first one does not exist')
    1201 %             return
    1202 %         end
    1203 %     end
    1204 % end
    1205 % set(handles.NomType_1,'String',NomType_1);
    1206 % % set(handles.FileIndex_1,'UserData',NomType_1);
    1207 %
    1208 % % make visible and fill the second raw of edit boxes
    1209 % set(handles.RootPath_1,'Visible','on')
    1210 % set(handles.RootFile_1,'Visible','on')
    1211 % set(handles.SubDir_1,'Visible','on');
    1212 % set(handles.FileIndex_1,'Visible','on');
    1213 % set(handles.FileExt_1,'Visible','on');
    1214 % %[FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles);
    1215 % [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
    1216 % FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
    1217 % FileBase=fullfile(RootPath,RootFile);
    1218 % if isequal(FileBase,FileBase_1)
    1219 %     set(handles.RootPath_1,'String','"')
    1220 %     set(handles.RootFile_1,'String','"');
    1221 % else
    1222 %     set(handles.RootPath_1,'String',RootPath_1)
    1223 %     set(handles.RootFile_1,'String',['/' RootFile_1]);
    1224 % end
    1225 % if  isequal(SubDir_1,'')
    1226 %      set(handles.SubDir_1,'String','');
    1227 %      FileBaseSub_1=FileBase_1;
    1228 % else 
    1229 %     set(handles.SubDir_1,'String',['/' SubDir_1]);
    1230 %     FileBaseSub_1=fullfile(FileBase_1,SubDir_1);
    1231 % end
    1232 % indices=filename_new(length(FileBaseSub_1)+1:end);
    1233 % indices(end-length(FileExt_1)+1:end)=[]; %remove extension
    1234 % set(handles.FileIndex_1,'String',indices)
    1235 % set(handles.NomType_1,'String',NomType_1)
    1236 % % set(handles.FileIndex_1,'UserData',NomType_1)
    1237 % set(handles.FileExt_1,'String',FileExt_1);
    1238 %
    1239 % % % default choice of fields
    1240 % %set(handles.SubField,'Visible','on')
    1241 % set(handles.SubField,'Value',1)
    1242 % RootPath_1_Callback(hObject,eventdata,handles); 
    1243 
    12441095%-----------------------------------------------------------------------
    12451096% --- Called by action in RootPath_1 edit box
    12461097function RootPath_1_Callback(hObject,eventdata,handles)
    12471098% -----------------------------------------------------------------------
    1248 update_rootinfo_1(hObject,eventdata,handles)
    1249 
     1099% update_rootinfo_1(hObject,eventdata,handles)
     1100[RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes_1(handles);
     1101fileinput=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
     1102% detect the file type, get the movie object if relevant, and look for the corresponding file series:
     1103[tild,tild,i1_series,i2_series,j1_series,j2_series,tild,FileType,MovieObject]=find_file_series(fileinput);
     1104% initiate the input file series and refresh the current field view:
     1105update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject,2);
    12501106%-----------------------------------------------------------------------
    12511107% --- Called by action in RootFile_1 edit box
    12521108function RootFile_1_Callback(hObject, eventdata, handles)
    12531109% -----------------------------------------------------------------------
    1254 update_rootinfo_1(hObject,eventdata,handles)
     1110RootPath_1_Callback(hObject,eventdata,handles)
    12551111
    12561112%------------------------------------------------------------------------
     
    12591115%------------------------------------------------------------------------
    12601116run0_Callback(hObject, eventdata, handles)
    1261 
    1262 % %------------------------------------------------------------------------
    1263 % % --- Update information about a new second field series (indices to scan, timing,
    1264 % %     calibration from an xml file, then refresh current plots
    1265 % function update_rootinfo_1(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject) %A REVOIR
    1266 % % -----------------------------------------------------------------------
    1267 % set(handles.RootPath_1,'BackgroundColor',[1 1 0])% indicate active program by yellow color
    1268 % drawnow
    1269 % UvData=get(handles.uvmat,'UserData');%huvmat=handles of the uvmat interface
    1270 % UvData.NewSeries=1; %flag for run0: begin a new series
    1271 % [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes_1(handles);
    1272 % FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
    1273 % %[FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes_1(handles);
    1274 % if ~exist(FileName,'file')
    1275 %     msgbox_uvmat('ERROR',['input file ' FileName ' not found']);
    1276 % end
    1277 % set(handles.FixVelType,'Value',0); %desactivate fixed veltype
    1278 % nbfield_1=[];%default
    1279 % nbfield_j_1=[];%default
    1280 % XmlData.Time=[];
    1281 % XmlData.GeometryCalib=[];%default
    1282 % TimeUnit=[];
    1283 % if isfield(UvData,'TimeUnit')
    1284 %     TimeUnit=UvData.TimeUnit;
    1285 % end
    1286 % TimeUnit_1=[];
    1287 % hhh='';%default, test for  movie reading with mmreader
    1288 % imainfo=[];
    1289 % FileBase=fullfile(RootPath,RootFile);
    1290 % if isequal(lower(FileExt),'.avi') %.avi file
    1291 %     imainfo=aviinfo([FileBase FileIndices FileExt]);
    1292 %     nbfield_1=imainfo.NumFrames;
    1293 %     nbfield_j_1=1;
    1294 %     set(handles.Dt_txt,'String',['Dt=' num2str(1000/info.FramesPerSecond) 'ms']);%display the elementary time interval in millisec
    1295 %     time=(0:1/imainfo.FramesPerSecond:(imainfo.NumFrames-1)/imainfo.FramesPerSecond)';
    1296 %     ColorType=imainfo.ImageType;%='truecolor' for color images
    1297 %     hhh=which('mmreader');
    1298 % elseif ~isempty(imformats(FileExt(2:end)))|| isequal(FileExt,'.vol')
    1299 %     if ~isequal(SubDir,'')
    1300 %         RootFile=get(handles.RootFile,'String');
    1301 %         imainfo=imfinfo([fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]);
    1302 %     else
    1303 %         imainfo=imfinfo([FileBase FileIndices FileExt]);
    1304 %     end
    1305 %     ColorType=imainfo.ColorType;%='truecolor' for color images
    1306 %     if length(imainfo) >1 %case of image with multiple frames
    1307 %         nbfield_1=length(imainfo);
    1308 %         nbfield_j_1=1;
    1309 %     end
    1310 % end
    1311 % if ~strcmp(hhh,'')&& mmreader.isPlatformSupported()% if the function is found (recent version of matlab)
    1312 %     UvData.MovieObject_1=mmreader([FileBase FileIndices FileExt]);
    1313 % elseif isfield(UvData,'MovieObject_1')
    1314 %     UvData=rmfield(UvData,'MovieObject_1');
    1315 % end
    1316 % if ~isempty(imainfo)% (an image has been introduced as second fierld input)
    1317 %     if strcmp(get(handles.num_Npx,'String'),'') || strcmp(get(handles.num_Npy,'String'),'')%update npx and npy if it is not already filled by the first input field
    1318 %         if  isfield(imainfo,'Width') && isfield(imainfo,'Height')
    1319 %             set(handles.num_Npx,'String',num2str(imainfo.Width));%fills nbre of pixels x box
    1320 %             set(handles.num_Npy,'String',num2str(imainfo.Height));%fills nbre of pixels x box
    1321 %         else
    1322 %             set(handles.num_Npx,'String','');%fills nbre of pixels x box
    1323 %             set(handles.num_Npy,'String','');%fills nbre of pixels x box
    1324 %         end
    1325 %         set(handles.CheckBW,'Value',strcmp(ColorType,'grayscale'))% select handles.CheckBW if grayscale image
    1326 %     end
    1327 % end
    1328 % % find scaling parameters
    1329 % filexml=[FileBase '.xml'];
    1330 % fileciv=[FileBase '.civ'];
    1331 % warntext='';%default warning text
    1332 % if exist(filexml,'file')
    1333 %     [XmlData,warntext]=imadoc2struct(filexml);
    1334 %     if ~isempty(warntext)
    1335 %         msgbox_uvmat('WARNING',warntext)
    1336 %     end
    1337 %     if isfield(XmlData,'Camera')
    1338 %         if isfield(XmlData.Camera,'TimeUnit')&& ~isempty(XmlData.Camera.TimeUnit)
    1339 %             TimeUnit=XmlData.Camera.TimeUnit;
    1340 %         end
    1341 %     end
    1342 % elseif exist(fileciv,'file')% if .civ file found
    1343 %     [error,XmlData.Time,TimeUnit,mode,npx,npy,pxcmx,pxcmy]=read_imatext([FileBase '.civ']);
    1344 %     GeometryCalib.R=[pxcmx 0 0; 0 pxcmy 0;0 0 0];
    1345 %     GeometryCalib.Tx=0;
    1346 %     GeometryCalib.Ty=0;
    1347 %     GeometryCalib.Tz=1;
    1348 %     GeometryCalib.dpx=1;
    1349 %     GeometryCalib.dpy=1;
    1350 %     GeometryCalib.sx=1;
    1351 %     GeometryCalib.Cx=0;
    1352 %     GeometryCalib.Cy=0;
    1353 %     GeometryCalib.f=1;
    1354 %     GeometryCalib.kappa1=0;
    1355 %     GeometryCalib.CoordUnit='cm';
    1356 %     XmlData.GeometryCalib=GeometryCalib;
    1357 %     if error==2, warntext=['no file ' FileBase '.civ'];
    1358 %     elseif error==1, warntext='inconsistent number of fields in the .civ file';
    1359 %     end
    1360 %     
    1361 %     set(handles.num_Npx,'String',num2str(npx));%fills nbre of pixels x box
    1362 %     set(handles.num_Npy,'String',num2str(npy));%fills nbre of pixels y box
    1363 %     set(handles.pxcm,'String',num2str(pxcmx));%fills scale x (pixel/cm) box
    1364 %     set(handles.pycm,'String',num2str(pxcmy));%fills scale y (pixel/cm) box
    1365 %     set(handles.pxcm,'Visible','on');%fills scale x (pixel/cm) box
    1366 %     set(handles.pycm,'Visible','on');%fills scale y (pixel/cm) box
    1367 % end   
    1368 % if ~isempty(TimeUnit_1) && ~isequal(TimeUnit_1,TimeUnit)
    1369 %         msgbox_uvmat('WARNING','the time units for the second series differs from the first one')
    1370 % end
    1371 %         
    1372 % % store last index in handles.lat_i and .last_j
    1373 % if ~isempty(XmlData.Time)
    1374 %     nbfield_1=size(XmlData.Time,1);
    1375 %     nbfield_j_1=size(XmlData.Time,2);   
    1376 % end
    1377 % last_i_cell=get(handles.last_i,'String');
    1378 % if isempty(nbfield_1)
    1379 %     last_i_cell{2}='';
    1380 % else
    1381 %     last_i_cell{2}=num2str(nbfield_1);
    1382 % end
    1383 % set(handles.last_i,'String',last_i_cell)
    1384 % last_j_cell=get(handles.last_j,'String');
    1385 % if isempty(nbfield_j_1)
    1386 %      last_j_cell{2}='';
    1387 % else
    1388 %      last_j_cell{2}=num2str(nbfield_j_1);
    1389 % end
    1390 % set(handles.last_j,'String',last_j_cell);
    1391 % if ~isequal(last_i_cell{1},last_i_cell{2}) || ~isequal(last_j_cell{1},last_j_cell{2})
    1392 %         msgbox_uvmat('WARNING','the numbers of input file of the second series differs from the first one')
    1393 % end
    1394 %
    1395 % % store calibration data
    1396 % GeometryCalib=XmlData.GeometryCalib;
    1397 % if isempty(GeometryCalib)
    1398 %     if isfield(UvData, 'GeometryCalib_1')
    1399 %         UvData=rmfield(UvData,'GeometryCalib_1');
    1400 %     end
    1401 % else
    1402 %     UvData.GeometryCalib_1=GeometryCalib;
    1403 %     if (isfield(GeometryCalib,'R')&& ~isequal(GeometryCalib.R(2,1),0) && ~isequal(GeometryCalib.R(1,2),0)) ||...
    1404 %         (isfield(GeometryCalib,'kappa1')&& ~isequal(GeometryCalib.kappa1,0))
    1405 %         set(handles.pxcm,'String','var')
    1406 %         set(handles.pycm,'String','var')
    1407 %     else
    1408 %         if isfield(GeometryCalib,'fx_fy')
    1409 %             pixcmx=GeometryCalib.fx_fy(1);
    1410 %             pixcmy=GeometryCalib.fx_fy(2);
    1411 %             set(handles.pxcm,'String',num2str(pixcmx))
    1412 %             set(handles.pycm,'String',num2str(pixcmy))
    1413 %         end
    1414 %     end
    1415 % end
    1416 % UvData.XmlData_1=XmlData;
    1417 % set(handles.uvmat,'UserData',UvData)%update the data attached to the uvmat interface
    1418 %
    1419 % if ~isequal(warntext,'')
    1420 %     msgbox_uvmat('WARNING',warntext)
    1421 % end
    1422 %
    1423 % set(handles.RootPath_1,'BackgroundColor',[1 1 1])% signa the end the input operation
    1424 % drawnow
    1425 %
    1426 % set_scan_options(handles)
    14271117
    14281118%------------------------------------------------------------------------
     
    14331123    set(handles.scan_i,'BackgroundColor',[1 1 0])
    14341124    set(handles.scan_j,'Value',0)
    1435 %     set(handles.scan_j,'BackgroundColor',[0.831 0.816 0.784])
    14361125else
    14371126    set(handles.scan_i,'BackgroundColor',[0.831 0.816 0.784])
    14381127    set(handles.scan_j,'Value',1)
    1439 %     set(handles.scan_j,'BackgroundColor',[1 1 0])
    14401128end
    14411129scan_j_Callback(hObject, eventdata, handles)
     
    14491137    set(handles.scan_i,'Value',0)
    14501138    set(handles.scan_i,'BackgroundColor',[0.831 0.816 0.784])
    1451     NomType=get(handles.NomType,'String');
    1452 %     NomType=get(handles.FileIndex,'UserData');
    1453     switch NomType
    1454     case {'_1_1-2','#_ab','%3dab'},% pair with j index
    1455         set(handles.fix_pair,'Visible','on')% option fixed pair on/off made visible (choice of avaible pair with buttons + and - if ='off')
    1456     otherwise
    1457         set(handles.fix_pair,'Visible','off')
    1458     end
     1139%     NomType=get(handles.NomType,'String');
     1140%     switch NomType
     1141%     case {'_1_1-2','#_ab','%3dab'},% pair with j index
     1142%         set(handles.CheckFixPair,'Visible','on')% option fixed pair on/off made visible (choice of avaible pair with buttons + and - if ='off')
     1143%     otherwise
     1144%         set(handles.CheckFixPair,'Visible','off')
     1145%     end
    14591146else
    14601147    set(handles.scan_j,'BackgroundColor',[0.831 0.816 0.784])
    14611148    set(handles.scan_i,'Value',1)
    14621149    set(handles.scan_i,'BackgroundColor',[1 1 0])
    1463     set(handles.fix_pair,'Visible','off')
     1150    set(handles.CheckFixPair,'Visible','off')
    14641151end
    14651152
     
    17051392        transform=transform_list{choice_value};
    17061393        if  ~isequal(transform_name,'') && ~isequal(transform_name,'px')
    1707             if isfield(UvData,'XmlData') && isfield(UvData.XmlData,'GeometryCalib')%use geometry calib recorded from the ImaDoc xml file as first priority
    1708                 Calib=UvData.XmlData.GeometryCalib;
    1709                 Mask=transform(Mask,UvData.XmlData);
     1394            if isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'GeometryCalib')%use geometry calib recorded from the ImaDoc xml file as first priority
     1395                Calib=UvData.XmlData{1}.GeometryCalib;
     1396                Mask=transform(Mask,UvData.XmlData{1});
    17101397            end
    17111398        end
     
    17631450drawnow
    17641451%TODO: introduce the option: increment ='*' to move to the next available view
    1765 increment=str2double(get(handles.increment_scan,'String')); %get the field increment d
    1766 if isnan(increment)
    1767     set(handles.increment_scan,'String','1')%default value
    1768     increment=1;
    1769 end
     1452increment=str2num(get(handles.increment_scan,'String')); %get the field increment d
     1453% if isnan(increment)
     1454%     set(handles.increment_scan,'String','1')%default value
     1455%     increment=1;
     1456% end
    17701457errormsg=runpm(hObject,eventdata,handles,increment);
    17711458if ~isempty(errormsg)
     
    17821469set(handles.runmin,'BackgroundColor',[1 1 0])%paint the command button in yellow
    17831470drawnow
    1784 increment=-str2double(get(handles.increment_scan,'String')); %get the field increment d
    1785 if isnan(increment)
    1786     set(handles.increment_scan,'String','1')%default value
    1787     increment=1;
    1788 end
     1471increment=-str2num(get(handles.increment_scan,'String')); %get the field increment d
     1472% if isnan(increment)
     1473%     set(handles.increment_scan,'String','1')%default value
     1474%     increment=1;
     1475% end
    17891476errormsg=runpm(hObject,eventdata,handles,increment);
    17901477if ~isempty(errormsg)
     
    17991486set(handles.Movie,'BackgroundColor',[1 1 0])%paint the command button in yellow
    18001487drawnow
    1801 increment=str2double(get(handles.increment_scan,'String')); %get the field increment d
    1802 if isnan(increment)
    1803     set(handles.increment_scan,'String','1')%default value
    1804     increment=1;
    1805 end
     1488increment=str2num(get(handles.increment_scan,'String')); %get the field increment d
     1489% if isnan(increment)
     1490%     set(handles.increment_scan,'String','1')%default value
     1491%     increment=1;
     1492% end
    18061493set(handles.STOP,'Visible','on')
    18071494set(handles.speed,'Visible','on')
     
    18301517set(handles.MovieBackward,'BackgroundColor',[1 1 0])%paint the command button in yellow
    18311518drawnow
    1832 increment=-str2double(get(handles.increment_scan,'String')); %get the field increment d
    1833 if isnan(increment)
    1834     set(handles.increment_scan,'String','1')%default value
    1835     increment=1;
    1836 end
     1519increment=-str2num(get(handles.increment_scan,'String')); %get the field increment d
    18371520set(handles.STOP,'Visible','on')
    18381521set(handles.speed,'Visible','on')
     
    18711554function errormsg=runpm(hObject,eventdata,handles,increment)
    18721555%------------------------------------------------------------------------
     1556errormsg='';%default
    18731557%% check for movie pair status
    18741558movie_status=get(handles.movie_pair,'Value');
     
    18811565InputFile.RootFile=regexprep(InputFile.RootFile,'^[\\/]|[\\/]$','');%suppress possible / or \ separator at the beginning or the end of the string
    18821566InputFile.SubDir=regexprep(InputFile.SubDir,'^[\\/]|[\\/]$','');%suppress possible / or \ separator at the beginning or the end of the string
    1883 % if isempty(InputFile.RootFile)
    1884 %     filebase=InputFile.RootPath;
    1885 % else
    1886  filebase=fullfile(InputFile.RootPath,InputFile.RootFile);
    1887 % end
    18881567FileExt=InputFile.FileExt;
    1889 % [FileName,RootPath,filebase,FileIndices,FileExt,subdir]=read_file_boxes(handles);
    18901568NomType=get(handles.NomType,'String');
    1891 % NomType=get(handles.FileIndex,'UserData');
    18921569i1=str2num(get(handles.i1,'String'));%read the field indices (for movie, it is not given by the file name)
    18931570i2=str2num(get(handles.i2,'String'));
     
    18951572j2=stra2num(get(handles.j2,'String'));
    18961573sub_value= get(handles.SubField,'Value');
    1897 if sub_value % a second input file has been entered
    1898    
     1574if sub_value % a second input file has been entered
    18991575    [FileName_1,RootPath_1,filebase_1,FileIndices_1,FileExt_1,SubDir_1]=read_file_boxes_1(handles);
    19001576    [tild,tild,tild,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(FileIndices_1);
    1901   %  [pp,ff,i1_1_str,i2_1_str,j1_1_str,j2_1_str]=name2display(FileIndices_1);
    1902 %     i1_1=stra2num(i1_1_str);%current set of indices for the second field (may be set different than the main indices)
    1903 %     i2_1=stra2num(i2_1_str);
    1904 %     j1_1=stra2num(j1_1_str);
    1905 %     j2_1=stra2num(j2_1_str);
    19061577    NomType_1=get(handles.NomType_1,'String');
    1907 %     NomType_1=get(handles.FileIndex_1,'UserData');
    19081578else
    19091579    filename_1=[];
    19101580end   
    1911 comp_input=get(handles.fix_pair,'Value');
    19121581
    19131582%% increment (or decrement) the field indices and update the input filename(s)
    1914 if get(handles.scan_i,'Value')==1% case of scanning along index i
    1915     i1=i1+increment;
    1916     i2=i2+increment;
    1917     if sub_value
    1918         i1_1=i1_1+increment;
    1919         i2_1=i2_1+increment;
    1920     end
    1921 else % case of scanning along index j (burst numbers)
    1922     j1=j1+increment;
    1923     j2=j2+increment;
    1924     if sub_value
    1925         j1_1=j1_1+increment;
    1926         j2_1=j2_1+increment;
    1927     end
    1928 end
    1929 if ~comp_input
     1583CheckSearch=0;
     1584if isempty(increment)
     1585    CheckSearch=1;% search for the next available file
     1586    set(handles.CheckFixPair,'Value',0)
     1587end
     1588CheckFixPair=get(handles.CheckFixPair,'Value');
     1589if CheckFixPair
     1590    if get(handles.scan_i,'Value')==1% case of scanning along index i
     1591        i1=i1+increment;
     1592        i2=i2+increment;
     1593        if sub_value
     1594            i1_1=i1_1+increment;
     1595            i2_1=i2_1+increment;
     1596        end
     1597    else % case of scanning along index j (burst numbers)
     1598        j1=j1+increment;
     1599        j2=j2+increment;
     1600        if sub_value
     1601            j1_1=j1_1+increment;
     1602            j2_1=j2_1+increment;
     1603        end
     1604    end
     1605else
    19301606    UvData=get(handles.uvmat,'UserData');
    19311607    ref_i=i1;
     
    19401616        end
    19411617    end
    1942     if ref_i+1>size(UvData.i1_series{1},1)
    1943         msgbox_uvmat('ERROR','maximum i index exceeded');
    1944         return
    1945     end
    1946     if ref_j+1>size(UvData.i1_series{1},2)
    1947         msgbox_uvmat('ERROR','maximum j index exceeded');
     1618    if ~isempty(increment)
     1619        if get(handles.scan_i,'Value')==1% case of scanning along index i
     1620            ref_i=ref_i+increment;
     1621        else % case of scanning along index j (burst numbers)
     1622            ref_j=ref_j+increment;
     1623        end
     1624    else% free increment
     1625        if isequal(get(handles.runplus,'BackgroundColor'),[1 1 0])% if runplus is activated
     1626            step=1;
     1627        else
     1628            step=-1;
     1629        end
     1630        if get(handles.scan_i,'Value')==1% case of scanning along index i
     1631            ref_i=ref_i+step;
     1632            while ref_i>=0  && size(UvData.i1_series{1},1)>=ref_i+1 && UvData.i1_series{1}(ref_i+1,ref_j+1,1)==0
     1633                ref_i=ref_i+step;
     1634            end
     1635        else % case of scanning along index j (burst numbers)
     1636            ref_j=ref_j+step;
     1637            while ref_j>=0  && size(UvData.i1_series{1},2)>=ref_j+1 && UvData.i1_series{1}(ref_i+1,ref_j+1,1)==0
     1638                ref_j=ref_j+step;
     1639            end
     1640        end
     1641    end
     1642    if ref_i<0
     1643        errormsg='minimum i index reached';
     1644    elseif ref_j<0
     1645        errormsg='minimum j index reached';
     1646    elseif ref_i+1>size(UvData.i1_series{1},1)
     1647        errormsg='maximum i index reached';
     1648    elseif ref_j+1>size(UvData.i1_series{1},2)
     1649        errormsg='maximum j index reached';
     1650    end
     1651    if ~isempty(errormsg)
    19481652        return
    19491653    end
     
    21211825transform=transform_list{choice_value};
    21221826if  ~isequal(transform_name,'') && ~isequal(transform_name,'px')
    2123     if test_1 && isfield(UvData,'XmlData_1') && isfield(UvData.XmlData_1,'GeometryCalib')%use geometry calib recorded from the ImaDoc xml file as first priority
    2124         Field_a=transform(Field_a,UvData.XmlData_1);%the first field has been stored without transform
    2125         Field_b=transform(Field_b,UvData.XmlData_1);
    2126     elseif ~test_1 && isfield(UvData,'XmlData') && isfield(UvData.XmlData,'GeometryCalib')%use geometry calib
    2127         Field_b=transform(Field_b,UvData.XmlData);
     1827    if test_1 && isfield(UvData,'XmlData') && numel(UvData.XmlData)==2 && isfield(UvData.XmlData{2},'GeometryCalib')%use geometry calib recorded from the ImaDoc xml file as first priority
     1828        Field_a=transform(Field_a,UvData.XmlData{2});%the first field has been stored without transform
     1829        Field_b=transform(Field_b,UvData.XmlData{2});
     1830    elseif ~test_1 && isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'GeometryCalib')%use geometry calib
     1831        Field_b=transform(Field_b,UvData.XmlData{1});
    21281832    end
    21291833end
     
    23292033            end
    23302034    end
    2331 %     if strcmp(get(handles.FileExt_1,'Visible'),'on')
    2332 %         FileExt_1=get(handles.FileExt_1,'String');
    2333 %     else
    2334 %         FileExt_1=get(handles.FileExt,'String');%read the file extension for the first series (case of veltype comparison within a single file)
    2335 %     end
    23362035    NomType_1=get(handles.NomType_1,'String');
    2337 %     %         NomType_1=get(handles.FileIndex_1,'UserData');
    2338 %     if isequal(Ext_1,'.nc')||isequal(Ext_1,'.cdf')
    2339 %         FileType_1='netcdf';
    2340 %     elseif isfield(UvData,'MovieObject_1')
    2341 %         Name=UvData.MovieObject_1;
    2342 %         FileType_1='movie';
    2343 %     elseif isequal(lower(Ext_1),'.avi')
    2344 %         FileType_1='avi';
    2345 %     elseif isequal(lower(Ext_1),'.vol')
    2346 %         FileType_1='vol';
    2347 %         if isfield(UvData.XmlData_1,'Npy') && isfield(UvData.XmlData_1,'Npx')
    2348 %             ParamIn.Npy=UvData.XmlData_1.Npy;
    2349 %             ParamIn.Npx=UvData.XmlData_1.Npx;
    2350 %         else
    2351 %             errormsg='Npx and Npy need to be defined in the xml file for volume images .vol';
    2352 %             return
    2353 %         end
    2354 %     else
    2355 %         if length(Ext_1)>=2
    2356 %             form=imformats(Ext_1(2:end));
    2357 %             if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab
    2358 %                 if isequal(NomType_1,'*');
    2359 %                     FileType_1='multimage';
    2360 %                 else
    2361 %                     FileType_1='image';
    2362 %                 end
    2363 %             end
    2364 %         end
    2365 %     end
    2366 %     if strcmp(FileType_1,'netcdf')
    2367 %         list_fields=get(handles.Fields_1,'String');% list menu fields
    2368 %         index_fields=get(handles.Fields_1,'Value');% selected string index
    2369 %         FieldName_1= list_fields{index_fields}; % selected field
    2370 %         if ~isequal(FieldName_1,'get_field...')% read the field names on the interface get_field...
    2371 %             VelType_1='';
    2372 %             if get(handles.FixVelType,'Value')
    2373 %                 VelTypeList=get(handles.VelType_1,'String');
    2374 %                 index=get(handles.VelType_1,'Value');
    2375 %                 VelType_1=VelTypeList{index};
    2376 %             end
    2377 %         end
    2378 %         if strcmp(VelType_1,'*')% free veltype choice
    2379 %             VelType_1=[];
    2380 %         elseif strcmp(VelType_1,'"')% veltype the same as for the first field
    2381 %             if isempty(VelType)
    2382 %                 VelType_1=[];
    2383 %             else
    2384 %                 VelType_1=VelType;
    2385 %             end
    2386 %         end
    2387 %         if strcmp(FieldName_1,'velocity')
    2388 %             list_code=get(handles.ListColorCode,'String');% list menu fields
    2389 %             index_code=get(handles.ListColorCode,'Value');% selected string index
    2390 %             if  ~strcmp(list_code{index_code},'black') &&  ~strcmp(list_code{index_code},'white')
    2391 %                 list_code=get(handles.ListColorScalar,'String');% list menu fields
    2392 %                 index_code=get(handles.ListColorScalar,'Value');% selected string index
    2393 %                 ParamIn.ColorVar= list_code{index_code}; % selected field
    2394 %             end
    2395 %         end
    2396 %     end
    23972036    test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged
    23982037    if ~isequal(NomType_1,'*')%in case of a series of files (not avi movie)
     
    25132152%% apply coordinate transform or other user fct
    25142153XmlData=[];%default
     2154XmlData_1=[];%default
    25152155if isfield(UvData,'XmlData')%use geometry calib recorded from the ImaDoc xml file as first priority
    2516     XmlData=UvData.XmlData;
    2517 end
    2518 XmlData_1=[];%default
    2519 if isfield(UvData,'XmlData_1')
    2520    XmlData_1=UvData.XmlData_1;
    2521 end
     2156    XmlData=UvData.XmlData{1};
     2157    if numel(UvData.XmlData)==2
     2158        XmlData_1=UvData.XmlData{2};
     2159    end
     2160end
     2161
    25222162% menu_transform=get(handles.transform_fct,'String');
    25232163choice_value=get(handles.transform_fct,'Value');
     
    26842324elseif isfield(UvData,'Z')
    26852325    if isfield(UvData,'CoordType')&& isequal(UvData.CoordType,'phys') && isfield(UvData,'XmlData')
    2686         XmlData=UvData.XmlData;
     2326        XmlData=UvData.XmlData{1};
    26872327        if isfield(XmlData,'PlanePos')
    26882328            UvData.Object{1}.Coord=XmlData.PlanePos(UvData.ZIndex,:);
     
    27262366    UvData.Object={[]};
    27272367    set(handles.ListObject,'Value',1)
    2728 %     set(handles.list_object_2,'Value',1)
    2729 %     set(handles.list_object_2,'String',{''})
    2730 %     set(handles.list_object_2,'Visible','off')
    27312368end
    27322369IndexObj=get(handles.ListObject,'Value');%selected projection object for main view
     
    29282565end
    29292566% time from xml file overset previous result
    2930 if isfield(UvData,'XmlData') && isfield(UvData.XmlData,'Time')
     2567if isfield(UvData,'XmlData') && isfield(UvData.XmlData{1},'Time')
    29312568    if isempty(num_i2)||isnan(num_i2)
    29322569        num_i2=num_i1;
     
    29382575        num_j2=num_j1;
    29392576    end
    2940     siz=size(UvData.XmlData.Time);
     2577    siz=size(UvData.XmlData{1}.Time);
    29412578    if siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2)
    2942         abstime=(UvData.XmlData.Time(num_i1,num_j1)+UvData.XmlData.Time(num_i2,num_j2))/2;%overset the time read from files
    2943         dt=(UvData.XmlData.Time(num_i2,num_j2)-UvData.XmlData.Time(num_i1,num_j1));
     2579        abstime=(UvData.XmlData{1}.Time(num_i1,num_j1)+UvData.XmlData{1}.Time(num_i2,num_j2))/2;%overset the time read from files
     2580        dt=(UvData.XmlData{1}.Time(num_i2,num_j2)-UvData.XmlData{1}.Time(num_i1,num_j1));
    29442581        testimedoc=1;
    2945         if isfield(UvData.XmlData,'TimeUnit')
    2946             TimeUnit=UvData.XmlData.TimeUnit;
    2947         end
    2948     end
    2949 end
    2950 if isfield(UvData,'XmlData_1') && isfield(UvData.XmlData_1,'Time')
    2951     [tild,tild,tild,num_i1,num_i2,num_j1,num_j2]=fileparts_uvmat(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]);
    2952   %  [P,F,str1,str2,str_a,str_b,E]=name2display(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]);
    2953     if isempty(num_i2)
    2954         num_i2=num_i1;
    2955     end
    2956     if isempty(num_j1)
    2957         num_j1=1;
    2958     end
    2959     if isempty(num_j2)
    2960         num_j2=num_j1;
    2961     end
    2962     siz=size(UvData.XmlData_1.Time);
    2963     if siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2)
    2964         abstime_1=(UvData.XmlData_1.Time(num_i1,num_j1)+UvData.XmlData_1.Time(num_i2,num_j2))/2;%overset the time read from files
    2965     end
    2966 end
     2582        if isfield(UvData.XmlData{1},'TimeUnit')
     2583            TimeUnit=UvData.XmlData{1}.TimeUnit;
     2584        end
     2585    end
     2586    if numel(UvData.XmlData)==2
     2587        [tild,tild,tild,num_i1,num_i2,num_j1,num_j2]=fileparts_uvmat(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]);
     2588        %  [P,F,str1,str2,str_a,str_b,E]=name2display(['xx' get(handles.FileIndex_1,'String') get(handles.FileExt_1,'String')]);
     2589        if isempty(num_i2)
     2590            num_i2=num_i1;
     2591        end
     2592        if isempty(num_j1)
     2593            num_j1=1;
     2594        end
     2595        if isempty(num_j2)
     2596            num_j2=num_j1;
     2597        end
     2598        siz=size(UvData.XmlData{2}.Time);
     2599        if siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2)
     2600            abstime_1=(UvData.XmlData{2}.Time(num_i1,num_j1)+UvData.XmlData{2}.Time(num_i2,num_j2))/2;%overset the time read from files
     2601        end
     2602    end
     2603end
     2604
    29672605if ~isequal(numel(abstime),1)
    29682606    abstime=[];
     
    30202658end
    30212659
    3022 
    30232660%-------------------------------------------------------------------
    30242661
     
    30352672    set(handles.CheckZoom,'BackgroundColor',[0.7 0.7 0.7])
    30362673end
    3037 
    30382674
    30392675%-------------------------------------------------------------------
     
    30982734fin=close(nc);
    30992735
    3100 
    31012736%-------------------------------------------------------------------
    31022737%determines the fields to read from the interface
     
    31072742VelType=VelTypeList{index};
    31082743
    3109 % VelType=[]; %default
    3110 % if (get(handles.VelType,'Value') == 1);
    3111 %         VelType='civ1';
    3112 % % interp1   
    3113 % elseif (get(handles.interp1,'Value') == 1);
    3114 %     VelType='interp1';
    3115 % % filter1   
    3116 % elseif (get(handles.filter1,'Value') == 1);
    3117 %     VelType='filter1'; 
    3118 % % CIV2
    3119 % elseif (get(handles.civ2,'Value') == 1);
    3120 %     VelType='civ2';
    3121 % % interp2   
    3122 % elseif (get(handles.interp2,'Value') == 1);
    3123 %     VelType='interp2';
    3124 % % filter2   
    3125 % elseif (get(handles.filter2,'Value') == 1); 
    3126 %     VelType='filter2';
    3127 % end
    3128 %
    3129 % if isequal(get(handles.filter2,'Visible'),'on');
    3130 %     civ=6;
    3131 % % interp1   
    3132 % elseif isequal(get(handles.interp2,'Visible'),'on');
    3133 %     civ=5;
    3134 % % filter1   
    3135 % elseif isequal(get(handles.civ2,'Visible'),'on');
    3136 %     civ=4; 
    3137 % % CIV2
    3138 % elseif isequal(get(handles.filter1,'Visible'),'on');
    3139 %    civ=3;
    3140 % % interp2   
    3141 % elseif isequal(get(handles.interp1,'Visible'),'on');
    3142 %     civ=2;
    3143 % % filter2   
    3144 % elseif isequal(get(handles.VelType,'Visible'),'on'); 
    3145 %     civ=1;
    3146 % else
    3147 %     civ=0;
    3148 % end
    3149 
    31502744%-------------------------------------------------------------------
    31512745%determines the veltype of the second field to read from the iinterface
     
    31552749index=get(handles.VelType_1,'Value');
    31562750VelType=VelTypeList{index};
    3157 % VelType=[]; %default
    3158 % if (get(handles.VelType_1,'Value') == 1);
    3159 %     VelType='civ1';
    3160 % % interp1   
    3161 % elseif (get(handles.interp1_1,'Value') == 1);
    3162 %     VelType='interp1';
    3163 % % filter1   
    3164 % elseif (get(handles.filter1_1,'Value') == 1);
    3165 %     VelType='filter1'; 
    3166 % % CIV2
    3167 % elseif (get(handles.civ2_1,'Value') == 1);
    3168 %     VelType='civ2';
    3169 % % interp2   
    3170 % elseif (get(handles.interp2_1,'Value') == 1);
    3171 %     VelType='interp2';
    3172 % % filter2   
    3173 % elseif (get(handles.filter2_1,'Value') == 1); 
    3174 %     VelType='filter2';
    3175 % end
    3176 
    31772751
    31782752%---------------------------------------------------
     
    32882862[RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
    32892863FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
    3290 % [FileName,RootPath,FileBase,FileIndices,FileExt]=read_file_boxes(handles);
    32912864[tild,tild,tild,i1,i2,j1,j2,tild,NomType]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt]);
    3292 % [P,F,str1,str2,str_a,str_b,E,NomType]=name2display(['xxx' get(handles.FileIndex,'String') FileExt]);
    3293 NomTypeNew=NomType;%default
     2865% NomTypeNew=NomType;%default
    32942866if isequal(field,'image')
    3295     if isequal(NomType,'_1-2_1')||isequal(NomType,'_1_1-2')
    3296         NomTypeNew='_1_1';
    3297     elseif isequal(NomType,'#_ab')
    3298         NomTypeNew='#a';
    3299     elseif isequal(NomType,'_1-2')
    3300         NomTypeNew='_1';
    3301     end
    3302     imagename=fullfile_uvmat(RootPath,SubDir,RootFile,'.png',NomTypeNew,i1,i2,j1,j2);
    3303 %     imagename=name_generator(FileBase,i1,j1,'.png',NomTypeNew,1,i2,j2,'');
     2867%     if isequal(NomType,'_1-2_1')||isequal(NomType,'_1_1-2')
     2868%         NomTypeNew='_1_1';
     2869%     elseif isequal(NomType,'#_ab')
     2870%         NomTypeNew='#a';
     2871%     elseif isequal(NomType,'_1-2')
     2872%         NomTypeNew='_1';
     2873%     end
     2874    imagename=fullfile_uvmat(RootPath,SubDir,RootFile,'.png',NomType,i1,[],j1,[]);
    33042875    if ~exist(imagename,'file')
    33052876        [FileName,PathName] = uigetfile( ...
     
    33312902    end
    33322903end
    3333 % indices=name_generator('',i1,j1,'',NomTypeNew,1,i2,j2,'');
    3334 indices=fullfile_uvmat('','','','',NomTypeNew,i1,i2,j1,j2);
     2904indices=fullfile_uvmat('','','','',NomType,i1,i2,j1,j2);
    33352905set(handles.FileIndex,'String',indices)
    3336 set(handles.NomType,'String',NomTypeNew)
    3337 % set(handles.FileIndex,'UserData',NomTypeNew)
     2906% set(handles.NomType,'String',NomType)
     2907
    33382908%common to Fields_1_Callback
    33392909if isequal(field,'image')||isequal(field_1,'image')
     
    33612931UvData=get(handles.uvmat,'UserData');
    33622932if check_new && isfield(UvData,'XmlData')
    3363     UvData.XmlData_1=UvData.XmlData;
     2933    UvData.XmlData{2}=UvData.XmlData{1};
    33642934end
    33652935list_fields=get(handles.Fields,'String');% list menu fields
     
    33872957switch field_1
    33882958    case 'get_field...'
    3389         %veltype_handles=[handles.VelType handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];
    33902959        set_veltype_display(0) % no veltype display
    3391         %      [RootPath_1,SubDir_1,RootFile_1,FileIndices_1,FileExt_1]=read_file_boxes_1(handles);
    3392         %      filename=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndices_1 FileExt_1];
    33932960        hget_field=findobj(allchild(0),'name','get_field_1');
    33942961        if ~isempty(hget_field)
     
    34062973        NomType=get(handles.NomType,'string');
    34072974        check_letter=~isempty(regexp(NomType,'[ab|AB]$'));%detect pair label by letter
    3408         NomType_1=NomType;
    3409         if check_letter
    3410             NomType_1=NomType_1(1:end-1);
    3411         else
    3412             r=regexp(NomType_1,'.-(?<num2>\d+$','names');
    3413             if ~isempty(r)
    3414                 NomType_1=regexprep(NomType_1,['-' r.num2],'');
    3415             end
    3416         end
    3417         imagename=fullfile_uvmat(RootPath_1,'',RootFile_1,'.png',NomType_1,i1,[],j1);
     2975%         NomType_1=NomType;
     2976%         if check_letter
     2977%             NomType_1=NomType_1(1:end-1);
     2978%         else
     2979%             r=regexp(NomType_1,'.-(?<num2>\d+$','names');
     2980%             if ~isempty(r)
     2981%                 NomType_1=regexprep(NomType_1,['-' r.num2],'');
     2982%             end
     2983%         end
     2984        imagename=fullfile_uvmat(RootPath_1,'',RootFile_1,'.png',NomType,i1,[],j1);
    34182985        if ~exist(imagename,'file')
    34192986            [FileName,PathName] = uigetfile( ...
     
    34523019        end
    34533020end
    3454 
    34553021
    34563022%------------------------------------------------------------------------
     
    36383204            testphys=0; %coordinates in pixels by default
    36393205            if isfield(ObjectData,'CoordType') && isequal(ObjectData.CoordType,'phys')
    3640                 if isfield(UvData,'XmlData')&& isfield(UvData.XmlData,'GeometryCalib')
    3641                     Calib=UvData.XmlData.GeometryCalib;
     3206                if isfield(UvData,'XmlData')&& isfield(UvData.XmlData{1},'GeometryCalib')
     3207                    Calib=UvData.XmlData{1}.GeometryCalib;
    36423208                    testphys=1;
    36433209                end
     
    38913457     UvData.Object=UvData.Object(1);
    38923458end
    3893 %list_object=get(handles.ListObject,'String');
    38943459set(handles.ListObject,'Value',1)
    38953460set(handles.ListObject,'String',{''})
    3896 %set(handles.list_object_2,'Value',1)
    3897 %set(handles.list_object_2,'String',{''})
    3898 %list_object_2_Callback(hObject, eventdata, handles)
    38993461
    39003462%delete mask if it is displayed
     
    39863548            end
    39873549        end
    3988 %         set(haxes,'XLimMode','auto')%reset auto mode (after CheckZoom effect)
    3989 %         set(haxes,'YLimMode','auto')
    3990 %         PlotParam.Auto_xy=1;
    39913550        plot_field(Histo,haxes);
    39923551    end
     
    42113770[PP,PlotParamOut]= plot_field(AxeData,handles.axes3,PlotParam);
    42123771write_plot_param(handles,PlotParamOut); %update the auto plot parameters
    4213 
    4214 % %-------------------------------------------------------------------
    4215 % % --- Executes on button press in grid.
    4216 % function grid_Callback(hObject, eventdata, handles)
    4217 
    42183772
    42193773%-------------------------------------------------------------------
     
    42373791    UvData.MouseAction='none';
    42383792    set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7])   
    4239 %     hset_object=findobj(allchild(0),'tag','set_object');% look for the set_object GUI
    4240 %     if ~isempty(hset_object)
    4241 %         delete(hset_object)% delete the current GUI set_object
    4242 %     end
    42433793end
    42443794set(handles.uvmat,'UserData',UvData);
     
    43533903ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData
    43543904plot_field(ProjData,ViewObjectAxes,read_GUI(get(ViewObjectAxes,'Parent')));%read plotting parameters on the uvmat interfacPlotHandles);
    4355 %
    4356 % UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2));
    4357 % set(handles.uvmat,'UserData',UvData)
    43583905
    43593906%------------------------------------------------------------------------
     
    44063953end
    44073954end
    4408 
    4409 %         SubObjectData=get(ObjectData.DisplayHandle_uvmat,'UserData');
    4410 
    4411 
    4412 
    4413 
    4414 
    4415 
    44163955
    44173956%------------------------------------------------------
     
    45064045UvData.plotaxes=newaxes;% the axis in the new figure becomes the current main plotting axes
    45074046set(huvmat,'UserData',UvData);
    4508 increment=str2double(get(handles.increment_scan,'String')); %get the field increment d
    4509 if isnan(increment)
    4510     set(handles.increment_scan,'String','1')%default value
    4511     increment=1;
    4512 end
     4047increment=str2num(get(handles.increment_scan,'String')); %get the field increment d
    45134048set(handles.STOP,'Visible','on')
    45144049set(handles.speed,'Visible','on')
     
    46074142                testphys=0; %coordinates in pixels by default
    46084143                if isfield(ObjectData,'CoordUnit') && ~isequal(ObjectData.CoordUnit,'pixel')
    4609                     if isfield(UvData,'XmlData')&& isfield(UvData.XmlData,'GeometryCalib')
    4610                         Calib=UvData.XmlData.GeometryCalib;
     4144                    if isfield(UvData,'XmlData')&& isfield(UvData.XmlData{1},'GeometryCalib')
     4145                        Calib=UvData.XmlData{1}.GeometryCalib;
    46114146                        testphys=1;
    46124147                    end
     
    46954230[RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
    46964231FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
    4697 %FileName=read_file_boxes(handles);
    46984232CoordList=get(handles.transform_fct,'String');
    46994233val=get(handles.transform_fct,'Value');
     
    47074241[RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
    47084242param.FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
    4709 %[param.FileName]=read_file_boxes(handles);
    47104243if isequal(get(handles.SubField,'Value'),1)
    47114244    [RootPath_1,SubDir_1,RootFile_1,FileIndices_1,FileExt_1]=read_file_boxes_1(handles);
     
    47204253param.NomType_1=get(handles.NomType_1,'String');
    47214254% param.NomType_1=get(handles.FileIndex_1,'UserData');
    4722 param.comp_input=get(handles.fix_pair,'Value');
     4255param.CheckFixPair=get(handles.CheckFixPair,'Value');
    47234256huvmat=get(handles.MenuSeries,'parent');
    47244257UvData=get(huvmat,'UserData');
    4725 if isfield(UvData,'Time')
    4726     param.Time=UvData.XmlData.Time;
     4258if isfield(UvData,'XmlData')&& isfield(UvData.XmlData{1},'Time')
     4259    param.Time=UvData.XmlData{1}.Time;
    47274260end
    47284261if isequal(get(handles.scan_i,'Value'),1)
    4729     param.incr_i=str2double(get(handles.increment_scan,'String'));
     4262    param.incr_i=str2num(get(handles.increment_scan,'String'));
    47304263elseif isequal(get(handles.scan_j,'Value'),1)
    4731     param.incr_j=str2double(get(handles.increment_scan,'String'));
     4264    param.incr_j=str2num(get(handles.increment_scan,'String'));
    47324265end
    47334266param.list_fields=get(handles.Fields,'String');% list menu fields
     
    47534286 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
    47544287 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
    4755 %FileName=read_file_boxes(handles);
    4756 %[FileName,RootPath,filebase,FileIndices,ext,SubDir]=read_file_boxes(handles)
    4757 % num1=stra2num(get(handles.i1,'String'));
    4758 % num2=stra2num(get(handles.i2,'String'));
    4759 % num_a=stra2num(get(handles.j1,'String'));
    4760 % num_b=stra2num(get(handles.j2,'String'));
    4761 % NomType=get(handles.FileIndex,'UserData');
    4762 % ind_opening=1; % default (images): will advice civ1 option by default in the civ interface
    4763 % if isequal(ext,'.nc') ||  isequal(ext,'.cdf')% netcdf files
    4764 %     ind_opening=2;% propose 'fix' as the default option
    4765 % % +read the current netcdf rootfile
    4766 %     Data=nc2struct(FileName,'ListGlobalAttribute','fix','patch','civ2','fix2');
    4767 %     if isfield(Data,'fix') && isequal(Data.fix,1)
    4768 %         ind_opening=3;
    4769 %     end
    4770 %     if isfield(Data,'patch') && isequal(Data.patch,1)
    4771 %         ind_opening=4;
    4772 %     end
    4773 %     if isfield(Data,'civ2') && isequal(Data.civ2,1)
    4774 %         ind_opening=5;
    4775 %     end
    4776 %     if isfield(Data,'fix2') && isequal(Data.fix2,1)
    4777 %         ind_opening=6;
    4778 %     end
    4779 % end     
    4780 % param.RootName=filebase;
    4781 % param.NomType=NomType;
    4782 % param.num1=num1;
    4783 % param.num2=num2;
    4784 % param.num_a=num_a;
    4785 % param.num_b=num_b;
    4786 % param.SubDir=SubDir;
    4787 % param.IndOpening=ind_opening;% A REVOIR +TRANSMETTRE IMADOC INFO
    4788 % param.ImaExt=ext;
    47894288civ(FileName);% interface de civ(not in the uvmat file)
    47904289
     
    48974396        'Pick an xml Object file',get(handles.RootPath,'String'));
    48984397fileinput=[PathName FileName];%complete file name
    4899 % testblank=findstr(fileinput,' ');%look for blanks
    4900 % if ~isempty(testblank)
    4901 %     msgbox_uvmat('ERROR','forbidden input file name: contain blanks')
    4902 %     return
    4903 % end
    49044398sizf=size(fileinput);
    49054399if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end
     
    49154409    delete(hset_object)% delete existing version of set_object
    49164410end
    4917 % UvData=get(handles.uvmat,'UserData');
    49184411set_object(data);% call the set_object interface
    4919 % %position the set_object GUI with respect to uvmat
    4920 % pos_uvmat=get(handles.uvmat,'Position');
    4921 % if isfield(UvData,'SetObjectOrigin')
    4922 %     pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2);
    4923 %     pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4);
    4924 %     set(hset_object,'Position',pos_set_object)
    4925 % end
    49264412set(handles.edit_object,'Value',0); %suppress the object edit mode
    49274413set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7]) 
    49284414set(handles.MenuObject,'checked','on')
    4929 %UvData.MouseAction='create_object';
    4930 % set(handles.uvmat,'UserData',UvData)
    49314415set(handles.delete_object,'Visible','on')
    4932 % set(handles.uvmat_title,'Visible','on')
    4933 % set(handles.view_field_title,'Visible','on')
    49344416
    49354417%------------------------------------------------------------------------
     
    50424524end
    50434525
    5044 
    50454526% --- Executes on button press in ViewObject.
    50464527function ViewObject_Callback(hObject, eventdata, handles)
     
    50654546
    50664547
    5067 
    50684548function NomType_Callback(hObject, eventdata, handles)
    50694549
Note: See TracChangeset for help on using the changeset viewer.