- Timestamp:
- Dec 30, 2011, 5:00:25 PM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r353 r354 1210 1210 nbslice_mask=str2double(Param.Civ1.Mask(1:end-4)); % 1211 1211 i1_mask=mod(i1_civ1(ifile)-1,nbslice_mask)+1; 1212 Param.Civ1.Mask=name_generator(maskbase,i1_mask,1,'.png','_i'); 1212 [RootPathMask,RootFileMask]=fileparts(maskbase); 1213 Param.Civ1.Mask=fullfile_uvmat(RootPathMask,[],RootFileMask,'.png','_1',i1_mask); 1214 % Param.Civ1.Mask=name_generator(maskbase,i1_mask,1,'.png','_i'); 1213 1215 end 1214 1216 end … … 1219 1221 if ~isnan(nbslice_grid) 1220 1222 i1_grid=mod(i1_civ1(ifile)-1,nbslice_grid)+1; 1221 Param.Civ1.Grid=[filecell.filebase '_' name_generator(Param.Civ1.Grid,i1_grid,1,'.grid','_i')]; 1223 Param.Civ1.Grid=[filecell.filebase '_' fullfile_uvmat('','',Param.Civ1.Grid,'.grid','_1',i1_grid)]; 1224 % Param.Civ1.Grid=[filecell.filebase '_' name_generator(Param.Civ1.Grid,i1_grid,1,'.grid','_i')]; 1222 1225 if ~exist(Param.Civ1.GridName,'file') 1223 1226 msgbox_uvmat('ERROR','grid file absent for civ1') … … 1297 1300 if ~isnan(nbslice_grid) 1298 1301 i1_grid=mod(i1_civ1(ifile)-1,nbslice_grid)+1; 1299 patch1.gridPatch=[filecell.filebase '_' name_generator(gridname,i1_grid,1,'.grid','_i')]; 1302 patch1.gridPatch=[filecell.filebase '_' fullfile_uvmat('','',gridname,'.grid','_1',i1_grid)]; 1303 % patch1.gridPatch=[filecell.filebase '_' name_generator(gridname,i1_grid,1,'.grid','_i')]; 1300 1304 if ~exist(patch1.gridPatch,'file') 1301 1305 msgbox_uvmat('ERROR','grid file absent for patch1') … … 1346 1350 nbslice_mask=str2double(Param.Civ2.Mask(1:end-4)); % 1347 1351 i1_mask=mod(i1_civ2(ifile)-1,nbslice_mask)+1; 1348 Param.Civ2.Mask=name_generator(maskbase,i1_mask,1,'.png','_i'); 1352 [RootPathMask,RootFileMask]=fileparts(maskbase); 1353 Param.Civ2.Mask=fullfile_uvmat(RootPathMask,[],RootFileMask,'.png','_1',i1_mask); 1354 % Param.Civ2.Mask=name_generator(maskbase,i1_mask,1,'.png','_i'); 1349 1355 end 1350 1356 end … … 1355 1361 if ~isnan(nbslice_grid) 1356 1362 i1_grid=mod(i1_civ2(ifile)-1,nbslice_grid)+1; 1357 Param.Civ2.Grid=[filecell.filebase '_' name_generator(gridname,i1_grid,1,'.grid','_i')]; 1363 Param.Civ2.Grid=[filecell.filebase '_' fullfile_uvmat('','',gridname,'.grid','_1',i1_grid)]; 1364 % Param.Civ2.Grid=[filecell.filebase '_' name_generator(gridname,i1_grid,1,'.grid','_i')]; 1358 1365 end 1359 1366 end … … 1431 1438 if ~isnan(nbslice_grid) 1432 1439 i1_grid=mod(i1_civ2(ifile)-1,nbslice_grid)+1; 1433 patch2.gridPatch=[filecell.filebase '_' name_generator(gridname,i1_grid,1,'.grid','_i')]; 1440 patch2.gridPatch=[filecell.filebase '_' fullfile_uvmat('','',gridname,'.grid','_1',i1_grid)]; 1441 % patch2.gridPatch=[filecell.filebase '_' name_generator(gridname,i1_grid,1,'.grid','_i')]; 1434 1442 if ~exist(patch2.gridPatch,'file') 1435 1443 msgbox_uvmat('ERROR','grid file absent for patch2') … … 1654 1662 fprintf(fid,['sh ' batch_file_list{p} '\n']); 1655 1663 else 1656 fprintf(fid,['@call "' regexprep( filename_bat,'\\','\\\\') '"' '\n']);1664 fprintf(fid,['@call "' regexprep(batch_file_list{p},'\\','\\\\') '"' '\n']); 1657 1665 end 1658 1666 end … … 1809 1817 filebase_nc=filebase_B; 1810 1818 end 1811 [RootPath_ima1,RootFile_ima1]=fileparts(filebase_ima1); 1812 [RootPath_ima2,RootFile_ima2]=fileparts(filebase_ima2); 1813 [RootPath_nc,RootFile_ima1]=fileparts(filebase_nc); 1819 [RootPath_ima1,RootFile_ima1]=fileparts(filebase_ima1); 1820 [RootPath_ima2,RootFile_ima2]=fileparts(filebase_ima2); 1821 [RootPath_nc,RootFile_nc]=fileparts(filebase_nc); 1822 [RootPath_A,RootFile_A]=fileparts(filebase_A); 1823 [RootPath_AB,RootFile_AB]=fileparts(filebase_AB); 1814 1824 1815 1825 %determine reference files for fix: … … 1955 1965 for ifile=1:nbfield 1956 1966 for j=1:nbslice 1957 [RootPath,RootFile]=fileparts(ref.filebase_nc); 1958 filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1_new); 1967 [RootPath,RootFile]=fileparts(filebase_nc); 1968 filename=fullfile_uvmat(RootPath_nc,subdir_civ1_new,RootFile_nc,'.nc',nom_type_nc,num1_civ1(ifile),num2_civ1(ifile),num_a_civ1(j),num_b_civ1(j)); 1969 % filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1_new); 1959 1970 detect=exist(filename,'file')==2; 1960 1971 if detect% if a netcdf file already exists … … 1999 2010 for ifile=1:nbfield 2000 2011 for j=1:nbslice 2001 filename=name_generator(filebase_A,num1_civ1(ifile),num_a_civ1(j),'.nc',nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1_new);% 2012 filename=fullfile_uvmat(RootPath_A,subdir_civ1_new,RootFile_A,'.nc',nom_type_nc,num1_civ1(ifile),num2_civ1(ifile),num_a_civ1(j),num_b_civ1(j)); 2013 % filename=name_generator(filebase_A,num1_civ1(ifile),num_a_civ1(j),'.nc',nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1_new);% 2002 2014 detect=exist(filename,'file')==2; 2003 2015 if detect% if a netcdf file already exists … … 2045 2057 for ifile=1:nbfield 2046 2058 for j=1:nbslice 2047 filename=name_generator(filebase_ima1, num1_civ1(ifile),num_a_civ1(j),ext_ima,nom_type_ima1); 2059 filename=fullfile_uvmat(RootPath_ima1,'',RootFile_ima1,ext_ima,nom_type_ima1,num1_civ1(ifile),[],num_a_civ1(j)); 2060 % filename=name_generator(filebase_ima1, num1_civ1(ifile),num_a_civ1(j),ext_ima,nom_type_ima1); 2048 2061 idetect(j)=exist(filename,'file')==2; 2049 2062 filecell.ima1.civ1(ifile,j)={filename}; %first image 2050 filename=name_generator(filebase_ima2, num2_civ1(ifile),num_b_civ1(j),ext_ima,nom_type_ima2); 2063 filename=fullfile_uvmat(RootPath_ima2,'',RootFile_ima2,ext_ima,nom_type_ima2,num2_civ1(ifile),[],num_b_civ1(j)); 2064 % filename=name_generator(filebase_ima2, num2_civ1(ifile),num_b_civ1(j),ext_ima,nom_type_ima2); 2051 2065 idetect_1(j)=exist(filename,'file')==2; 2052 2066 filecell.ima2.civ1(ifile,j)={filename};%second image … … 2070 2084 for ifile=1:nbfield 2071 2085 for j=1:nbslice 2072 filename=name_generator(filebase_A, num1_civ1(ifile),num_a_civ1(j),ext_ima,nom_type_ima1); 2086 filename=fullfile_uvmat(RootPath_A,'',RootFile_A,ext_ima,nom_type_ima1,num1_civ1(ifile),[],num_a_civ1(j)); 2087 % filename=name_generator(filebase_A, num1_civ1(ifile),num_a_civ1(j),ext_ima,nom_type_ima1); 2073 2088 idetect(j)=exist(filename,'file')==2; 2074 2089 filecell.imaA1.civ1(ifile,j)={filename} ;%first image 2075 filename=name_generator(filebase_A, num2_civ1(ifile),num_b_civ1(j),ext_ima,nom_type_ima2); 2090 filename=fullfile_uvmat(RootPath_A,'',RootFile_A,ext_ima,nom_type_ima2,num2_civ1(ifile),[],num_b_civ1(j)); 2091 % filename=name_generator(filebase_A, num2_civ1(ifile),num_b_civ1(j),ext_ima,nom_type_ima2); 2076 2092 idetect_1(j)=exist(filename,'file')==2; 2077 2093 filecell.imaA2.civ1(ifile,j)={filename};%second image … … 2098 2114 for ifile=1:nbfield 2099 2115 for j=1:nbslice 2100 filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',... 2101 nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% 2116 filename=fullfile_uvmat(RootPath_nc,subdir_civ1,RootFile_nc,'.nc',nom_type_nc,num1_civ1(ifile),num2_civ1(ifile),num_a_civ1(j),num_b_civ1(j)); 2117 % filename=name_generator(filebase_nc,num1_civ1(ifile),num_a_civ1(j),'.nc',... 2118 % nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% 2102 2119 detect=exist(filename,'file')==2; 2103 2120 if detect==0 … … 2113 2130 for ifile=1:nbfield 2114 2131 for j=1:nbslice 2115 filename=name_generator(filebase_A,num1_civ1(ifile),num_a_civ1(j),'.nc',nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% 2132 filename=fullfile_uvmat(RootPath_A,subdir_civ1,RootFile_A,'.nc',nom_type_nc,num1_civ1(ifile),num2_civ1(ifile),num_a_civ1(j),num_b_civ1(j)); 2133 % filename=name_generator(filebase_A,num1_civ1(ifile),num_a_civ1(j),'.nc',nom_type_nc,1,num2_civ1(ifile),num_b_civ1(j),subdir_civ1);% 2116 2134 filecell.ncA.civ1(ifile,j)={filename}; 2117 2135 if ~exist(filename,'file') … … 2139 2157 for ifile=1:nbfield 2140 2158 for j=1:nbslice 2141 filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2_new);% 2159 filename=fullfile_uvmat(RootPath_nc,subdir_civ2_new,RootFile_nc,'.nc',nom_type_nc,num1_civ2(ifile),num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j)); 2160 % filename=name_generator(filebase_nc,num1_civ2(ifile),num_a_civ2(j),'.nc',nom_type_nc,1,num2_civ2(ifile),num_b_civ2(j),subdir_civ2_new);% 2142 2161 detect=exist(filename,'file')==2; 2143 2162 if detect% if a netcdf file already exists … … 2172 2191 for ifile=1:nbfield 2173 2192 for j=1:nbslice 2174 filename=name_generator(filebase_A,num1_civ2(ifile),num_a_civ2(j),'.nc',... 2175 nom_type_nc,1,num2_civ2(ifile),num_b_civ1(j),subdir_civ2_new);% 2193 filename=fullfile_uvmat(RootPath_A,subdir_civ2_new,RootFile_A,'.nc',nom_type_nc,num1_civ2(ifile),num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j)); 2194 % filename=name_generator(filebase_A,num1_civ2(ifile),num_a_civ2(j),'.nc',... 2195 % nom_type_nc,1,num2_civ2(ifile),num_b_civ1(j),subdir_civ2_new);% 2176 2196 detect=exist(filename,'file')==2; 2177 2197 if detect% if a netcdf file already exists … … 2289 2309 for ifile=1:nbfield 2290 2310 for j=1:nbslice 2291 filename=fullfile_uvmat(RootPath_ima1,[],RootFile_ima1,ext_ima,nom_type_ima1,num1_civ2(ifile), num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j));2311 filename=fullfile_uvmat(RootPath_ima1,[],RootFile_ima1,ext_ima,nom_type_ima1,num1_civ2(ifile),[],num_a_civ2(j)); 2292 2312 %filename=name_generator(filebase_ima1, num1_civ2(ifile),num_a_civ2(j),ext_ima,nom_type_ima1); 2293 2313 idetect_2(j)=exist(filename,'file')==2; … … 2309 2329 for ifile=1:nbfield 2310 2330 for j=1:nbslice 2311 filename=fullfile_uvmat(RootPath_ima2,[],RootFile_ima2,ext_ima,nom_type_ima2,num 1_civ2(ifile),num2_civ2(ifile),num_a_civ2(j),num_b_civ2(j));2331 filename=fullfile_uvmat(RootPath_ima2,[],RootFile_ima2,ext_ima,nom_type_ima2,num2_civ2(ifile),[],num_b_civ2(j)); 2312 2332 % filename=name_generator(filebase_ima2, num2_civ2(ifile),num_b_civ2(j),ext_ima,nom_type_ima2); 2313 2333 idetect_3(j)=exist(filename,'file')==2; … … 2450 2470 waitbar(ifile/nbfield); 2451 2471 for j=1:nbslice 2452 filename=fullfile_uvmat(RootPath_ima1,[],RootFile_ima1,'.png',nom_type_imanew1,num1_civ1(ifile), num2_civ1(ifile),num_a_civ1(j),num_b_civ1(j));2472 filename=fullfile_uvmat(RootPath_ima1,[],RootFile_ima1,'.png',nom_type_imanew1,num1_civ1(ifile),[],num_a_civ1(j)); 2453 2473 % filename=name_generator(filebase_ima1,num1_civ1(ifile),num_a_civ1(j),'.png',nom_type_imanew1); 2454 2474 if ~exist(filename,'file') … … 2457 2477 end 2458 2478 filecell.ima1.civ1(ifile,j)={filename}; 2459 filename=fullfile_uvmat(RootPath_ima2,[],RootFile_ima2,'.png',nom_type_imanew2,num2_civ1(ifile), num2_civ1(ifile),num_b_civ1(j),num_b_civ1(j));2479 filename=fullfile_uvmat(RootPath_ima2,[],RootFile_ima2,'.png',nom_type_imanew2,num2_civ1(ifile),[],num_b_civ1(j)); 2460 2480 %filename=name_generator(filebase_ima2, num2_civ1(ifile),num_b_civ1(j),'.png',nom_type_imanew2); 2461 2481 if ~exist(filename,'file') … … 2473 2493 waitbar(ifile/nbfield); 2474 2494 for j=1:nbslice 2475 filename=fullfile_uvmat(RootPath_ima1,[],RootFile_ima1,'.png',nom_type_imanew1,num1_civ2(ifile),[],num_a_civ 1(j));2495 filename=fullfile_uvmat(RootPath_ima1,[],RootFile_ima1,'.png',nom_type_imanew1,num1_civ2(ifile),[],num_a_civ2(j)); 2476 2496 %filename=name_generator(filebase_ima1,num1_civ2(ifile),num_a_civ2(j),'.png',nom_type_imanew1); 2477 2497 if ~exist(filename,'file') … … 2480 2500 end 2481 2501 filecell.ima1.civ2(ifile,j)={filename}; 2482 filename=name_generator(filebase_ima2, num2_civ2(ifile),num_b_civ2(j),'.png',nom_type_imanew2); 2502 filename=fullfile_uvmat(RootPath_ima2,[],RootFile_ima2,'.png',nom_type_imanew2,num2_civ2(ifile),[],num_b_civ2(j)); 2503 % filename=name_generator(filebase_ima2, num2_civ2(ifile),num_b_civ2(j),'.png',nom_type_imanew2); 2483 2504 if ~exist(filename,'file') 2484 2505 A=read_image(cell2mat(filecell.ima2.civ2(ifile,j)),type_ima2,num2_civ2(ifile)); … … 3054 3075 3055 3076 %% case with no Civ1 operation, netcdf files need to exist for reading 3077 [RootPath,RootFile]=fileparts(filebase); 3056 3078 if ~get(handles.CheckCiv1,'Value') % 3057 3079 if ~exist(fullfile(filepath,subdir_civ1,ext_dir),'dir') … … 3061 3083 end 3062 3084 for ipair=1:nbpair 3063 filename=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,... 3064 ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1); 3085 filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile,'.nc',nom_type_nc,... 3086 ref_i+displ_num(3,ipair),ref_i+displ_num(4,ipair),ref_j+displ_num(1,ipair),ref_j+displ_num(2,ipair)); 3087 % filename=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,... 3088 % ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1); 3065 3089 select(ipair)=exist(filename,'file')==2;% put flag to 0 if the file does not exist 3066 3090 end … … 3072 3096 num_j1=ref_j-floor(browse.incr_pair(2)/2); 3073 3097 num_j2=ref_j+ceil(browse.incr_pair(2)/2); 3074 filename=name_generator(filebase,num_i1,num_j1,'.nc',nom_type_nc,1,num_i2,num_j2,subdir_civ1); 3098 filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile,'.nc',nom_type_nc,num_i1,num_i2,num_j1,num_j2); 3099 %filename=name_generator(filebase,num_i1,num_j1,'.nc',nom_type_nc,1,num_i2,num_j2,subdir_civ1); 3075 3100 select(1)=exist(filename,'file')==2; 3076 3101 testpair=1; … … 3251 3276 displ_pair={''}; %default 3252 3277 select=ones(size(1:nbpair));%default =1 for numbers of displayed pairs 3278 [RootPath,RootFile]=fileparts(filebase); 3253 3279 if ~get(handles.CheckCiv2,'Value') && ~get(handles.CheckCiv1,'Value') && ~get(handles.CheckFix1,'Value') && ~get(handles.CheckPatch1,'Value') 3254 3280 if ~exist(fullfile(filepath,subdir_civ2,ext_dir),'dir') … … 3259 3285 end 3260 3286 for ipair=1:nbpair 3261 filename=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,... 3262 ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1); 3287 filename=fullfile_uvmat(RootPath,subdir_civ1,RootFile,'.nc',nom_type_nc,... 3288 ref_i+displ_num(3,ipair),ref_i+displ_num(4,ipair),ref_j+displ_num(1,ipair),ref_j+displ_num(2,ipair)); 3289 % filename=name_generator(filebase,ref_i+displ_num(3,ipair),ref_j+displ_num(1,ipair),'.nc',nom_type_nc,1,... 3290 % ref_i+displ_num(4,ipair),ref_j+displ_num(2,ipair),subdir_civ1); 3263 3291 select(ipair)=exist(filename,'file')==2; 3264 3292 end … … 3269 3297 num_j1=ref_j-floor(browse.incr_pair(2)/2); 3270 3298 num_j2=ref_j+floor((browse.incr_pair(2)+1)/2); 3271 filename=name_generator(filebase,num_i1,num_j1,'.nc',nom_type_nc,1,num_i2,num_j2,subdir_civ2); 3299 filename=fullfile_uvmat(RootPath,subdir_civ2,RootFile,'.nc',nom_type_nc,num_i1,num_i2,num_j1,num_j2); 3300 %filename=name_generator(filebase,num_i1,num_j1,'.nc',nom_type_nc,1,num_i2,num_j2,subdir_civ2); 3272 3301 select(1)=exist(filename,'file')==2; 3273 3302 else 3274 3303 if isequal(mode,'series(Dj)')% | isequal(mode,'st_series(Dj)') 3275 errordlg(['no civ2 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ2])3304 msgbox_uvmat('ERROR',['no civ2 file available for the selected reference index j=' num2str(ref_j) ' and subdirectory ' subdir_civ2]) 3276 3305 else 3277 errordlg(['no civ2 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ2])3306 msgbox_uvmat('ERROR',['no civ2 file available for the selected reference index i=' num2str(ref_i) ' and subdirectory ' subdir_civ2]) 3278 3307 end 3279 3308 set(handles.ListPairCiv2,'Value',1); -
trunk/src/find_file_series.m
r353 r354 71 71 NomType='*'; 72 72 FileType='multimage'; 73 i1_series= 1:length(imainfo);73 i1_series=(1:length(imainfo))'; 74 74 [RootPath,RootFile]=fileparts(fileinput); 75 75 end … … 80 80 if ~isempty(Data.absolut_time_T0') 81 81 FileType='civx'; % test for civx velocity fields 82 elseif strcmp(Data.Conventions ','uvmat/civdata')82 elseif strcmp(Data.Conventions,'uvmat/civdata') 83 83 FileType='civdata'; % test for civx velocity fields 84 84 else … … 87 87 end 88 88 try 89 Object=VideoReader(fileinput); 89 if exist('VideoReader','file')%recent version of Matlab 90 Object=VideoReader(fileinput); 91 else 92 Object=mmreader(fileinput);%older Matlab function for movies 93 end 90 94 NomType='*'; 91 FileType='video'; 92 i1_series=[1:get(Object,'NumberOfFrames')]; 93 [RootPath,RootFile]=fileparts(fileinput); 95 FileType='video'; 96 i1_series=(1:get(Object,'NumberOfFrames'))'; 94 97 end 95 98 end -
trunk/src/fullfile_uvmat.m
r353 r354 133 133 if ~isempty(r)&& ~isempty(j2) 134 134 sep4='-'; 135 j2_str=num2str(j2,['%0' num2str(length(r.num4)) 'd']) 135 j2_str=num2str(j2,['%0' num2str(length(r.num4)) 'd']); 136 136 end 137 137 end -
trunk/src/read_field.m
r334 r354 29 29 function [Field,ParamOut,errormsg] = read_field(ObjectName,FileType,ParamIn,num) 30 30 Field=[]; 31 ParamOut=[]; 31 if ~exist('num','var') 32 num=1; 33 end 34 if ~exist('ParamIn','var') 35 ParamIn=[]; 36 end 37 ParamOut=ParamIn;%default 32 38 errormsg=''; 33 39 if isfield(ParamIn,'VelType') … … 38 44 switch FileType 39 45 case {'civx','civdata','netcdf'} %read the first nc field 40 ParamOut.FieldName=ParamIn.FieldName;46 % ParamOut.FieldName=ParamIn.FieldName; 41 47 GUIName='get_field'; %default name of the GUI get_field 42 48 if isfield(ParamIn,'GUIName') … … 140 146 end 141 147 142 case ' movie'148 case 'video' 143 149 try 144 150 A=read(ObjectName,num); 145 FieldName='image';146 151 catch ME 147 errormsg=ME.message ;152 errormsg=ME.message 148 153 return 149 154 end 150 case 'avi' 151 try 152 mov=aviread(ObjectName,num); 153 catch ME 154 errormsg=ME.message; 155 return 156 end 157 A=frame2im(mov(1)); 158 FieldName='image'; 155 FieldName='image'; 156 % case 'avi' 157 % try 158 % mov=aviread(ObjectName,num); 159 % catch ME 160 % errormsg=ME.message; 161 % return 162 % end 163 % A=frame2im(mov(1)); 164 % FieldName='image'; 159 165 case 'vol' 160 166 A=imread(ObjectName); -
trunk/src/uvmat.m
r353 r354 391 391 % search the files, recognize their type according to their name and fill the rootfile input windows 392 392 function MenuBrowse_Callback(hObject, eventdata, handles) 393 oldfile=read_file_boxes(handles); 394 393 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 394 oldfile=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 395 % oldfile=read_file_box,es(handles); 395 396 if isempty(oldfile)||isequal(oldfile,'') %loads the previously stored file name and set it as default in the file_input box 396 397 dir_perso=prefdir; … … 466 467 %------------------------------------------------------------------------ 467 468 % --- Fills the edit boxes RootPath, RootFile,NomType...from an input file name 'fileinput' 468 function display_file_name(hObject, eventdata, handles,fileinput )469 function display_file_name(hObject, eventdata, handles,fileinput,index) 469 470 %------------------------------------------------------------------------ 470 471 %% analyse the input file … … 473 474 return 474 475 end 476 477 %% have a unique function for fileinput (index=1) and fileinput_1 (index=2) 478 if ~exist('index','var') 479 index=1; 480 end 481 if index==1 482 handles_RootPath=handles.RootPath; 483 handles_SubDir=handles.SubDir; 484 handles_RootFile=handles.RootFile; 485 handles_FileIndex=handles.FileIndex; 486 handles_NomType=handles.NomType; 487 handles_FileExt=handles.FileExt; 488 handles_Fields=handles.Fields; 489 elseif index==2 490 handles_RootPath=handles.RootPath_1; 491 handles_SubDir=handles.SubDir_1; 492 handles_RootFile=handles.RootFile_1; 493 handles_FileIndex=handles.FileIndex_1; 494 handles_NomType=handles.NomType_1; 495 handles_FileExt=handles.FileExt_1; 496 handles_Fields=handles.Fields_1; 497 set(handles.RootPath_1,'Visible','on') 498 set(handles.RootFile_1,'Visible','on') 499 set(handles.SubDir_1,'Visible','on'); 500 set(handles.FileIndex_1,'Visible','on'); 501 set(handles.FileExt_1,'Visible','on'); 502 set(handles.NomType_1,'Visible','on'); 503 end 475 504 % detect root name, nomenclature and indices in the input file name: 476 [ ff,SubDir,ii,i1,i2,j1,j2,FileExt]=fileparts_uvmat(fileinput);505 [tild,SubDir,tild,i1,i2,j1,j2,FileExt]=fileparts_uvmat(fileinput); 477 506 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 478 % [i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject]=find_file_series(fileinput);479 507 [RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject]=find_file_series(fileinput); 508 if strcmp(NomType,'*')% movies will be opened at the first frame 509 i1=1; 510 i2=[]; 511 j1=[]; 512 j2=[]; 513 end 480 514 % open the file or fill the GUI uvmat according to the detected file type 481 515 switch FileType 482 516 case '' 483 msgbox_uvmat('ERROR','invalid input file type')517 msgbox_uvmat('ERROR','invalid input file type') 484 518 case 'txt' 485 edit(fileinput) 519 edit(fileinput) 486 520 case 'figure' %display matlab figure 487 521 hfig=open(fileinput); … … 490 524 set(hfig,'WindowButtonUpFcn','mouse_down')%set mouse click action function 491 525 case {'xml','xls'} % edit xml or Excel files 492 editxml(fileinput);526 editxml(fileinput); 493 527 otherwise 494 set(handles.RootPath,'String',RootPath); 495 if isequal(SubDir,'') 496 rootname=fullfile(RootPath,RootFile); 497 else 498 rootname=fullfile(RootPath,SubDir,RootFile); 499 SubDir=['/' SubDir]; %display the separator 500 end 501 set(handles.SubDir,'String',SubDir); 502 set(handles.RootFile,'String',['/' RootFile]); %display the separator 528 set(handles_RootPath,'String',RootPath); 529 rootname=fullfile(RootPath,SubDir,RootFile); 530 set(handles_SubDir,'String',['/' SubDir]); 531 set(handles_RootFile,'String',['/' RootFile]); %display the separator 503 532 indices=fileinput(length(rootname)+1:end); 504 533 indices(end-length(FileExt)+1:end)=[]; %remove extension 505 set(handles.FileIndex,'String',indices); 506 % set(handles.FileIndex,'UserData',NomType); 507 set(handles.NomType,'String',NomType); 508 set(handles.FileExt,'String',FileExt); 509 % fill file index counters 510 set(handles.i1,'String',num2str(i1)); 511 set(handles.i2,'String',num2str(i2)); 512 set(handles.j1,'String',num2stra(j1,NomType)); 513 set(handles.j2,'String',num2stra(j2,NomType)); 514 534 set(handles_FileIndex,'String',indices); 535 set(handles_NomType,'String',NomType); 536 set(handles_FileExt,'String',FileExt); 537 if index==1 538 % fill file index counters 539 set(handles.i1,'String',num2str(i1)); 540 set(handles.i2,'String',num2str(i2)); 541 set(handles.j1,'String',num2stra(j1,NomType)); 542 set(handles.j2,'String',num2stra(j2,NomType)); 543 else %read the current field index 544 i1=str2num(get(handles.i1,'String')); 545 i2=str2num(get(handles.i2,'String')); 546 j1=stra2num(get(handles.j1,'String')); 547 j2=stra2num(get(handles.j2,'String')); 548 end 515 549 % synchronise indices of the second input file if it exists 516 550 if get(handles.SubField,'Value')==1% if the subfield button is activated, update the field numbers 551 % if index==1 517 552 Input=read_GUI(handles.InputFile); 518 if ~isfield(Input,'RootPath_1') 553 if ~isfield(Input,'RootPath_1')||strcmp(Input.RootPath_1,'"') 519 554 Input.RootPath_1=Input.RootPath; 520 555 end 521 if ~isfield(Input,'SubDir_1') 556 if ~isfield(Input,'SubDir_1')||strcmp(Input.SubDir_1,'"') 522 557 Input.SubDir_1=Input.SubDir; 523 558 end 524 if ~isfield(Input,'RootFile_1') 525 Input. SubDir_1=Input.RootFile;559 if ~isfield(Input,'RootFile_1')||strcmp(Input.RootFile_1,'"') 560 Input.RootFile_1=Input.RootFile; 526 561 end 527 % [ff,rr,FileBase_1,ii,FileExt_1,SubDir_1]=read_file_boxes_1(handles); 528 % NomType_1=get(handles.NomType_1,'String'); 529 % NomType_1=get(handles.FileIndex_1,'UserData'); 530 % FileName_1=name_generator(FileBase_1,i1,i2,FileExt_1,NomType_1,1,j1,j2,SubDir_1); 562 %updtate the indices of the second field series to correspond to the newly opened one 531 563 FileName_1=fullfile_uvmat(Input.RootPath_1,Input.SubDir_1,Input.RootFile_1,Input.FileExt_1,Input.NomType_1,i1,i2,j1,j2); 532 564 if exist(FileName_1,'file') 533 FileIndex_1=name_generator('',i1,i2,'',NomType_1,1,j1,j2,''); 565 FileIndex_1=fullfile_uvmat('','','','',Input.NomType_1,i1,i2,j1,j2); 566 %FileIndex_1=name_generator('',i1,i2,'',NomType_1,1,j1,j2,''); 534 567 set(handles.FileIndex_1,'String',FileIndex_1) 535 568 else … … 537 570 SubField_Callback(hObject, eventdata, handles) 538 571 end 539 end 540 572 end 573 541 574 %enable other menus 542 575 set(handles.MenuOpen_1,'Enable','on') … … 555 588 set(handles.frame_object,'Visible','on') 556 589 557 % initiate input file series and refresh the current field view: 558 update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject); 590 % initiate input file series and refresh the current field view: 591 592 update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject,index); 593 559 594 end 560 595 … … 564 599 %------------------------------------------------------------------------ 565 600 % read the current input file name: 566 fileinput=read_file_boxes(handles); 601 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 602 fileinput=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 603 % fileinput=read_file_boxes(handles); 567 604 % detect the file type, get the movie object if relevant, and look for the corresponding file series: 568 605 [RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,MovieObject]=find_file_series(fileinput); … … 601 638 % --- Update information about a new field series (indices to scan, timing, 602 639 % calibration from an xml file, then refresh current plots 603 function update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject) 604 %------------------------------------------------------------------------ 605 set(handles.RootPath,'BackgroundColor',[1 1 0]) 640 function update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,MovieObject,index) 641 %------------------------------------------------------------------------ 642 %% TODO: have a unique function for update_rootinfo and update_rootinfo_1 643 if ~exist('index','var') 644 index=1; 645 end 646 if index==1 647 handles_RootPath=handles.RootPath; 648 handles_Fields=handles.Fields; 649 elseif index==2 650 handles_RootPath=handles.RootPath_1; 651 handles_Fields=handles.Fields_1; 652 %.......................... 653 end 654 655 set(handles_RootPath,'BackgroundColor',[1 1 0]) 606 656 drawnow 607 657 set(handles.Fields,'UserData',[])% reinialize data from uvmat opening … … 609 659 UvData.NewSeries=1; %flag for run0: begin a new series 610 660 UvData.TestInputFile=1; 611 UvData.FileType =FileType;612 UvData.i1_series =i1_series;613 UvData.i2_series =i2_series;614 UvData.j1_series =j1_series;615 UvData.j2_series =j2_series;661 UvData.FileType{index}=FileType; 662 UvData.i1_series{index}=i1_series; 663 UvData.i2_series{index}=i2_series; 664 UvData.j1_series{index}=j1_series; 665 UvData.j2_series{index}=j2_series; 616 666 set(handles.fix_pair,'Value',1) % activate by default the comp_input '-'input window 617 667 set(handles.FixVelType,'Value',0); %desactivate fixed veltype 618 [FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles); 619 668 %[FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles); 669 if index==1 670 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 671 else 672 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes_1(handles); 673 end 674 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 675 FileBase=fullfile(RootPath,RootFile); 620 676 if ~exist(FileName,'file') 621 677 msgbox_uvmat('ERROR',['input file ' FileName ' not found']); … … 635 691 if isequal(lower(FileExt),'.avi') %.avi file 636 692 testima=1; 637 imainfo=aviinfo([File Base FileIndices FileExt]);693 imainfo=aviinfo([FileName]); 638 694 nbfield=imainfo.NumFrames; 639 695 nbfield_j=1; … … 658 714 end 659 715 if ~strcmp(hhh,'')% if the function mmreader is found (recent version of matlab) 660 UvData.MovieObject =mmreader([FileBase FileIndices FileExt]);661 else if isfield(UvData,'MovieObject')662 UvData =rmfield(UvData,'MovieObject');716 UvData.MovieObject{index}=mmreader([FileBase FileIndices FileExt]); 717 else 718 UvData.MovieObject{index}=[]; 663 719 end 664 720 if isfield(imainfo,'Width') && isfield(imainfo,'Height') … … 700 756 drawnow 701 757 if isfield(XmlData, 'GeometryCalib') && ~isempty(XmlData.GeometryCalib) 702 XmlData.GeometryCalib703 758 if isfield(XmlData.GeometryCalib,'VolumeScan') && isequal(XmlData.GeometryCalib.VolumeScan,'y') 704 759 set (handles.nb_slice,'String','volume') … … 829 884 UvData.XmlData=XmlData; 830 885 UvData.NewSeries=1; 831 UvData.MovieObject=MovieObject;886 % UvData.MovieObject=MovieObject; 832 887 833 888 %display warning message … … 840 895 testcivx=0; 841 896 if isfield(UvData,'FieldsString') && isequal(UvData.FieldsString,{'get_field...'})% field menu defined as input (from get_field) 842 set(handles .Fields,'Value',1)843 set(handles .Fields,'String',{'get_field...'})897 set(handles_Fields,'Value',1) 898 set(handles_Fields,'String',{'get_field...'}) 844 899 UvData=rmfield(UvData,'FieldsString'); 845 900 else … … 847 902 if strcmp(Data.Conventions,'uvmat/civdata') ||( ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0))%if the new input is Civx 848 903 FieldList=calc_field; 849 set(handles .Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data850 set(handles .Fields,'Value',2) % set menu to 'velocity'904 set(handles_Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data 905 set(handles_Fields,'Value',2) % set menu to 'velocity' 851 906 col_vec=FieldList; 852 907 col_vec(1)=[];%remove 'velocity' option for vector color (must be a scalar) … … 854 909 end 855 910 if ~testcivx 856 set(handles .Fields,'Value',1) % set menu to 'get_field...857 set(handles .Fields,'String',{'get_field...'})911 set(handles_Fields,'Value',1) % set menu to 'get_field... 912 set(handles_Fields,'String',{'get_field...'}) 858 913 col_vec={'get_field...'}; 859 914 end … … 981 1036 982 1037 % refresh the current displayed field 983 display_file_name_1(hObject,eventdata,handles,fileinput_1) 1038 set(handles.SubField,'Value',1) 1039 display_file_name(hObject,eventdata,handles,fileinput_1,2) 984 1040 985 1041 %update list of recent files in the menubar … … 1019 1075 % ----------------------------------------------------------------------- 1020 1076 fileinput_1=get(handles.MenuFile_1_1,'Label'); 1021 display_file_name_1(hObject,eventdata,handles,fileinput_1) 1077 set(handles.SubField,'Value',1) 1078 display_file_name(hObject,eventdata,handles,fileinput_1,2) 1022 1079 1023 1080 % ----------------------------------------------------------------------- … … 1026 1083 % ----------------------------------------------------------------------- 1027 1084 fileinput_1=get(handles.MenuFile_2_1,'Label'); 1028 display_file_name_1(hObject,eventdata,handles,fileinput_1) 1085 set(handles.SubField,'Value',1) 1086 display_file_name(hObject,eventdata,handles,fileinput_1,2) 1029 1087 1030 1088 % ----------------------------------------------------------------------- … … 1033 1091 % ----------------------------------------------------------------------- 1034 1092 fileinput_1=get(handles.MenuFile_3_1,'Label'); 1035 display_file_name_1(hObject,eventdata,handles,fileinput_1) 1093 set(handles.SubField,'Value',1) 1094 display_file_name(hObject,eventdata,handles,fileinput_1,2) 1036 1095 1037 1096 % ----------------------------------------------------------------------- … … 1040 1099 % ----------------------------------------------------------------------- 1041 1100 fileinput_1=get(handles.MenuFile_4_1,'Label'); 1042 display_file_name_1(hObject,eventdata,handles,fileinput_1) 1101 set(handles.SubField,'Value',1) 1102 display_file_name(hObject,eventdata,handles,fileinput_1,2) 1043 1103 1044 1104 % ----------------------------------------------------------------------- … … 1047 1107 % ----------------------------------------------------------------------- 1048 1108 fileinput_1=get(handles.MenuFile_5_1,'Label'); 1049 display_file_name_1(hObject,eventdata,handles,fileinput_1) 1050 1051 %------------------------------------------------------------------------ 1052 % fills the edit boxes RootPath_1, RootFile_1,NomType_1...from an input file name 'fileinput_1' 1053 %------------------------------------------------------------------------ 1054 function display_file_name_1(hObject,eventdata,handles,fileinput_1) 1055 1056 %[path,name,ext]=fileparts(fileinput_1); 1057 [tild,SubDir_1,tild,i1,i2,j1,j2,FileExt_1]=fileparts_uvmat(fileinput_1); 1058 [RootPath_1,RootFile_1,i1_series,i2_series,j1_series,j2_series,NomType,FileType,MovieObject]=find_file_series(fileinput_1); 1059 % [RootPath_1,RootFile_1,field_count,str2,str_a,str_b,FileExt_1,NomType_1,SubDir_1]=name2display(fileinput_1); 1060 switch FileType 1061 case '' 1062 msgbox_uvmat('ERROR','invalid input file type') 1063 case 'txt' 1064 edit(fileinput) 1065 case 'figure' %display matlab figure 1066 hfig=open(fileinput); 1067 set(hfig,'WindowButtonMotionFcn','mouse_motion')%set mouse action functio 1068 set(hfig,'WindowButtonUpFcn','mouse_up')%set mouse click action function 1069 set(hfig,'WindowButtonUpFcn','mouse_down')%set mouse click action function 1070 case {'xml','xls'} % edit xml or Excel files 1071 editxml(fileinput); 1072 % case {'.avi','.image','.vol','.nc','.cdf'} 1073 otherwise 1074 set(handles.RootPath,'String',RootPath); 1075 if isequal(SubDir,'') 1076 rootname=fullfile(RootPath,RootFile); 1077 else 1078 rootname=fullfile(RootPath,SubDir,RootFile); 1079 SubDir=['/' SubDir]; %display the separator 1080 end 1081 set(handles.SubDir,'String',SubDir); 1082 set(handles.RootFile,'String',['/' RootFile]); %display the separator 1083 indices=fileinput(length(rootname)+1:end); 1084 indices(end-length(FileExt)+1:end)=[]; %remove extension 1085 set(handles.FileIndex,'String',indices); 1086 % set(handles.FileIndex,'UserData',NomType); 1087 set(handles.NomType,'String',NomType); 1088 set(handles.FileExt,'String',FileExt); 1089 % fill file index counters 1090 set(handles.i1,'String',num2str(i1)); 1091 set(handles.i2,'String',num2str(i2)); 1092 set(handles.j1,'String',num2str(j1)); 1093 set(handles.j2,'String',num2str(j2)); 1094 1095 % synchronise indices of the second input file if it exists 1096 if get(handles.SubField,'Value')==1% if the subfield button is activated, update the field numbers 1097 [ff,rr,FileBase_1,ii,FileExt_1,SubDir_1]=read_file_boxes_1(handles); 1098 NomType_1=get(handles.NomType_1,'String'); 1099 % NomType_1=get(handles.FileIndex_1,'UserData'); 1100 FileName_1=name_generator(FileBase_1,i1,i2,FileExt_1,NomType_1,1,j1,j2,SubDir_1); 1101 if exist(FileName_1,'file') 1102 FileIndex_1=name_generator('',i1,i2,'',NomType_1,1,j1,j2,''); 1103 set(handles.FileIndex_1,'String',FileIndex_1) 1104 else 1105 set(handles.SubField,'Value',0) 1106 SubField_Callback(hObject, eventdata, handles) 1107 end 1108 end 1109 end 1109 set(handles.SubField,'Value',1) 1110 display_file_name(hObject,eventdata,handles,fileinput_1,2) 1111 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) 1110 1116 % 1111 % 1112 % nbfield_1=1; %default 1113 % ext_test=FileExt_1;%default 1114 % form=imformats(FileExt_1(2:end)); 1115 % if ~isempty(form) % if the extension corresponds to an image format recognized by Matlab 1116 % imainfo=imfinfo(fileinput_1); 1117 % nbfield_1=length(imainfo); 1118 % ext_test='.image'; 1119 % elseif isequal(lower(FileExt_1),'.avi') 1120 % info=aviinfo(fileinput_1); 1121 % nbfield_1=info.NumFrames; 1122 % ext_test='.image'; 1123 % end 1124 % 1125 % %open directly fig or text files 1126 % switch ext_test 1127 % case {'.civ','.log','.cmx','.cmx2','.txt'} %display text file 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' 1128 1125 % edit(fileinput) 1129 % return 1130 % case '.fig' %display matlab figure 1131 % hfig=open(fileinput); 1126 % case 'figure' %display matlab figure 1127 % hfig=open(fileinput_1); 1132 1128 % set(hfig,'WindowButtonMotionFcn','mouse_motion')%set mouse action functio 1133 1129 % set(hfig,'WindowButtonUpFcn','mouse_up')%set mouse click action function 1134 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') 1135 1179 % return 1136 % case {'.xml','.xls'} % edit xml or Excel files 1137 % heditxml=editxml(fileinput); 1138 % return 1139 % case {'.image','.nc','.cdf'} 1140 % % set(handles.FileIndex,'UserData',NomType_1); 1141 % otherwise 1142 % msgbox_uvmat(['invalid input file extension ' FileExt_1 ' for uvmat'],'ERROR') 1143 % 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 1144 1204 % end 1145 1146 % test for image series in a single file and synchronise file indices of the two series 1147 if nbfield_1 >1 %case of image with multiple frames 1148 if nbfield_1 < num_i1 1149 msgbox_uvmat('ERROR','current frame index beyond the input movie length') 1150 return 1151 else 1152 NomType_1='*'; %indicate a set of indexed frames within a single file 1153 filename_new=fileinput_1; 1154 end 1155 else % cases of data files 1156 RootPath=get(handles.RootPath,'String'); 1157 RootFile=get(handles.RootFile,'String'); 1158 FileBase=fullfile(RootPath,RootFile); 1159 FileBase_1=fullfile(RootPath_1,RootFile_1); 1160 if isequal(FileBase,FileBase_1) 1161 filename_new=fileinput_1; 1162 else 1163 num_i1=stra2num(get(handles.i1,'String'));%get the current file indices from counters 1164 num_j1=stra2num(get(handles.j1,'String')); 1165 num_i2=stra2num(get(handles.i2,'String')); 1166 num_j2=stra2num(get(handles.j2,'String')); 1167 [filename_new,idetect]=... 1168 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 1169 indices=''; %default 1170 if ~idetect 1171 msgbox_uvmat('ERROR','second input file with indices corresponding to the first one does not exist') 1172 return 1173 end 1174 end 1175 end 1176 set(handles.NomType_1,'String',NomType_1); 1177 % set(handles.FileIndex_1,'UserData',NomType_1); 1178 1179 % make visible and fill the second raw of edit boxes 1180 set(handles.RootPath_1,'Visible','on') 1181 set(handles.RootFile_1,'Visible','on') 1182 set(handles.SubDir_1,'Visible','on'); 1183 set(handles.FileIndex_1,'Visible','on'); 1184 set(handles.FileExt_1,'Visible','on'); 1185 [FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles); 1186 if isequal(FileBase,FileBase_1) 1187 set(handles.RootPath_1,'String','"') 1188 set(handles.RootFile_1,'String','"'); 1189 else 1190 set(handles.RootPath_1,'String',RootPath_1) 1191 set(handles.RootFile_1,'String',['/' RootFile_1]); 1192 end 1193 if isequal(SubDir_1,'') 1194 set(handles.SubDir_1,'String',''); 1195 FileBaseSub_1=FileBase_1; 1196 else 1197 set(handles.SubDir_1,'String',['/' SubDir_1]); 1198 FileBaseSub_1=fullfile(FileBase_1,SubDir_1); 1199 end 1200 indices=filename_new(length(FileBaseSub_1)+1:end); 1201 indices(end-length(FileExt_1)+1:end)=[]; %remove extension 1202 set(handles.FileIndex_1,'String',indices) 1203 set(handles.NomType_1,'String',NomType_1) 1204 % set(handles.FileIndex_1,'UserData',NomType_1) 1205 set(handles.FileExt_1,'String',FileExt_1); 1206 1207 % % default choice of fields 1208 %set(handles.SubField,'Visible','on') 1209 set(handles.SubField,'Value',1) 1210 RootPath_1_Callback(hObject,eventdata,handles); 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); 1211 1243 1212 1244 %----------------------------------------------------------------------- … … 1228 1260 run0_Callback(hObject, eventdata, handles) 1229 1261 1230 %------------------------------------------------------------------------ 1231 % --- Update information about a new second field series (indices to scan, timing, 1232 % calibration from an xml file, then refresh current plots 1233 function update_rootinfo_1(hObject,eventdata,handles) %A REVOIR 1234 % ----------------------------------------------------------------------- 1235 set(handles.RootPath_1,'BackgroundColor',[1 1 0])% indicate active program by yellow color 1236 drawnow 1237 UvData=get(handles.uvmat,'UserData');%huvmat=handles of the uvmat interface 1238 UvData.NewSeries=1; %flag for run0: begin a new series 1239 1240 [FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes_1(handles); 1241 if ~exist(FileName,'file') 1242 msgbox_uvmat('ERROR',['input file ' FileName ' not found']); 1243 end 1244 set(handles.FixVelType,'Value',0); %desactivate fixed veltype 1245 nbfield_1=[];%default 1246 nbfield_j_1=[];%default 1247 XmlData.Time=[]; 1248 XmlData.GeometryCalib=[];%default 1249 TimeUnit=[]; 1250 if isfield(UvData,'TimeUnit') 1251 TimeUnit=UvData.TimeUnit; 1252 end 1253 TimeUnit_1=[]; 1254 hhh='';%default, test for movie reading with mmreader 1255 imainfo=[]; 1256 if isequal(lower(FileExt),'.avi') %.avi file 1257 imainfo=aviinfo([FileBase FileIndices FileExt]); 1258 nbfield_1=imainfo.NumFrames; 1259 nbfield_j_1=1; 1260 set(handles.Dt_txt,'String',['Dt=' num2str(1000/info.FramesPerSecond) 'ms']);%display the elementary time interval in millisec 1261 time=(0:1/imainfo.FramesPerSecond:(imainfo.NumFrames-1)/imainfo.FramesPerSecond)'; 1262 ColorType=imainfo.ImageType;%='truecolor' for color images 1263 hhh=which('mmreader'); 1264 elseif ~isempty(imformats(FileExt(2:end)))|| isequal(FileExt,'.vol') 1265 if ~isequal(SubDir,'') 1266 RootFile=get(handles.RootFile,'String'); 1267 imainfo=imfinfo([fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]); 1268 else 1269 imainfo=imfinfo([FileBase FileIndices FileExt]); 1270 end 1271 ColorType=imainfo.ColorType;%='truecolor' for color images 1272 if length(imainfo) >1 %case of image with multiple frames 1273 nbfield_1=length(imainfo); 1274 nbfield_j_1=1; 1275 end 1276 end 1277 if ~strcmp(hhh,'')&& mmreader.isPlatformSupported()% if the function is found (recent version of matlab) 1278 UvData.MovieObject_1=mmreader([FileBase FileIndices FileExt]); 1279 elseif isfield(UvData,'MovieObject_1') 1280 UvData=rmfield(UvData,'MovieObject_1'); 1281 end 1282 if ~isempty(imainfo)% (an image has been introduced as second fierld input) 1283 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 1284 if isfield(imainfo,'Width') && isfield(imainfo,'Height') 1285 set(handles.num_Npx,'String',num2str(imainfo.Width));%fills nbre of pixels x box 1286 set(handles.num_Npy,'String',num2str(imainfo.Height));%fills nbre of pixels x box 1287 else 1288 set(handles.num_Npx,'String','');%fills nbre of pixels x box 1289 set(handles.num_Npy,'String','');%fills nbre of pixels x box 1290 end 1291 set(handles.CheckBW,'Value',strcmp(ColorType,'grayscale'))% select handles.CheckBW if grayscale image 1292 end 1293 end 1294 % find scaling parameters 1295 filexml=[FileBase '.xml']; 1296 fileciv=[FileBase '.civ']; 1297 warntext='';%default warning text 1298 if exist(filexml,'file') 1299 [XmlData,warntext]=imadoc2struct(filexml); 1300 if ~isempty(warntext) 1301 msgbox_uvmat('WARNING',warntext) 1302 end 1303 if isfield(XmlData,'Camera') 1304 if isfield(XmlData.Camera,'TimeUnit')&& ~isempty(XmlData.Camera.TimeUnit) 1305 TimeUnit=XmlData.Camera.TimeUnit; 1306 end 1307 end 1308 elseif exist(fileciv,'file')% if .civ file found 1309 [error,XmlData.Time,TimeUnit,mode,npx,npy,pxcmx,pxcmy]=read_imatext([FileBase '.civ']); 1310 GeometryCalib.R=[pxcmx 0 0; 0 pxcmy 0;0 0 0]; 1311 GeometryCalib.Tx=0; 1312 GeometryCalib.Ty=0; 1313 GeometryCalib.Tz=1; 1314 GeometryCalib.dpx=1; 1315 GeometryCalib.dpy=1; 1316 GeometryCalib.sx=1; 1317 GeometryCalib.Cx=0; 1318 GeometryCalib.Cy=0; 1319 GeometryCalib.f=1; 1320 GeometryCalib.kappa1=0; 1321 GeometryCalib.CoordUnit='cm'; 1322 XmlData.GeometryCalib=GeometryCalib; 1323 if error==2, warntext=['no file ' FileBase '.civ']; 1324 elseif error==1, warntext='inconsistent number of fields in the .civ file'; 1325 end 1326 1327 set(handles.num_Npx,'String',num2str(npx));%fills nbre of pixels x box 1328 set(handles.num_Npy,'String',num2str(npy));%fills nbre of pixels y box 1329 set(handles.pxcm,'String',num2str(pxcmx));%fills scale x (pixel/cm) box 1330 set(handles.pycm,'String',num2str(pxcmy));%fills scale y (pixel/cm) box 1331 set(handles.pxcm,'Visible','on');%fills scale x (pixel/cm) box 1332 set(handles.pycm,'Visible','on');%fills scale y (pixel/cm) box 1333 end 1334 if ~isempty(TimeUnit_1) && ~isequal(TimeUnit_1,TimeUnit) 1335 msgbox_uvmat('WARNING','the time units for the second series differs from the first one') 1336 end 1337 1338 % store last index in handles.lat_i and .last_j 1339 if ~isempty(XmlData.Time) 1340 nbfield_1=size(XmlData.Time,1); 1341 nbfield_j_1=size(XmlData.Time,2); 1342 end 1343 last_i_cell=get(handles.last_i,'String'); 1344 if isempty(nbfield_1) 1345 last_i_cell{2}=''; 1346 else 1347 last_i_cell{2}=num2str(nbfield_1); 1348 end 1349 set(handles.last_i,'String',last_i_cell) 1350 last_j_cell=get(handles.last_j,'String'); 1351 if isempty(nbfield_j_1) 1352 last_j_cell{2}=''; 1353 else 1354 last_j_cell{2}=num2str(nbfield_j_1); 1355 end 1356 set(handles.last_j,'String',last_j_cell); 1357 if ~isequal(last_i_cell{1},last_i_cell{2}) || ~isequal(last_j_cell{1},last_j_cell{2}) 1358 msgbox_uvmat('WARNING','the numbers of input file of the second series differs from the first one') 1359 end 1360 1361 % store calibration data 1362 GeometryCalib=XmlData.GeometryCalib; 1363 if isempty(GeometryCalib) 1364 if isfield(UvData, 'GeometryCalib_1') 1365 UvData=rmfield(UvData,'GeometryCalib_1'); 1366 end 1367 else 1368 UvData.GeometryCalib_1=GeometryCalib; 1369 if (isfield(GeometryCalib,'R')&& ~isequal(GeometryCalib.R(2,1),0) && ~isequal(GeometryCalib.R(1,2),0)) ||... 1370 (isfield(GeometryCalib,'kappa1')&& ~isequal(GeometryCalib.kappa1,0)) 1371 set(handles.pxcm,'String','var') 1372 set(handles.pycm,'String','var') 1373 else 1374 if isfield(GeometryCalib,'fx_fy') 1375 pixcmx=GeometryCalib.fx_fy(1); 1376 pixcmy=GeometryCalib.fx_fy(2); 1377 set(handles.pxcm,'String',num2str(pixcmx)) 1378 set(handles.pycm,'String',num2str(pixcmy)) 1379 end 1380 end 1381 end 1382 UvData.XmlData_1=XmlData; 1383 set(handles.uvmat,'UserData',UvData)%update the data attached to the uvmat interface 1384 1385 if ~isequal(warntext,'') 1386 msgbox_uvmat('WARNING',warntext) 1387 end 1388 1389 set(handles.RootPath_1,'BackgroundColor',[1 1 1])% signa the end the input operation 1390 drawnow 1391 1392 set_scan_options(handles) 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) 1393 1427 1394 1428 %------------------------------------------------------------------------ … … 1435 1469 set(handles.i1,'BackgroundColor',[0.7 0.7 0.7]) 1436 1470 NomType=get(handles.NomType,'String'); 1437 % NomType=get(handles.FileIndex,'UserData');1438 num1=stra2num(get(handles.i1,'String'));1439 num2=stra2num(get(handles.i2,'String'));1440 num_a=stra2num(get(handles.j1,'String'));1441 num_b=stra2num(get(handles.j2,'String'));1442 indices=name_generator('',num1,num_a,'',NomType,1,num2,num_b,'');1471 i1=stra2num(get(handles.i1,'String')); 1472 i2=stra2num(get(handles.i2,'String')); 1473 j1=stra2num(get(handles.j1,'String')); 1474 j2=stra2num(get(handles.j2,'String')); 1475 indices=fullfile_uvmat('','','','',NomType,i1,i2,j1,j2); 1476 %indices=name_generator('',num1,num_a,'',NomType,1,num2,num_b,''); 1443 1477 set(handles.FileIndex,'String',indices) 1444 1478 set(handles.FileIndex,'BackgroundColor',[0.7 0.7 0.7]) 1445 1479 if get(handles.SubField,'Value')==1 1446 1480 NomType_1=get(handles.NomType_1,'String'); 1447 % FileExt_1=get(handles.FileExt_1,'String'); 1448 % [P,F,str1,str2,str_a,str_b,Ext,NomType_1]=name2display(['xx' NomType_1 FileExt_1]); 1449 indices=name_generator('',num1,num_a,'',NomType_1,1,num2,num_b,''); 1481 indices=fullfile_uvmat('','','','',NomType,i1,i2,j1,j2); 1482 %indices=name_generator('',num1,num_a,'',NomType_1,1,num2,num_b,''); 1450 1483 set(handles.FileIndex_1,'String',indices) 1451 1484 set(handles.FileIndex_1,'BackgroundColor',[0.7 0.7 0.7]) … … 1512 1545 function view_xml_Callback(hObject, eventdata, handles) 1513 1546 %------------------------------------------------------------------------ 1514 [FileName,RootPath,FileBase,FileIndices,FileExt]=read_file_boxes(handles); 1547 %[FileName,RootPath,FileBase,FileIndices,FileExt]=read_file_boxes(handles); 1548 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 1549 FileBase=fullfile(RootPath,RootFile); 1515 1550 option=get(handles.view_xml,'String'); 1516 1551 if isequal(option,'view .xml') … … 1525 1560 %case of view mask selection 1526 1561 if isequal(get(handles.CheckMask,'Value'),1) 1527 [FF,RootPath,FileBase]=read_file_boxes(handles); 1562 % [FF,RootPath,FileBase]=read_file_boxes(handles); 1563 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 1564 FileBase=fullfile(RootPath,RootFile); 1528 1565 num_i1=stra2num(get(handles.i1,'String')); 1529 1566 num_j1=stra2num(get(handles.j1,'String')); … … 1562 1599 num_i1=mod(num_i1-1,nbslice)+1; 1563 1600 Mask.NomType=regexprep(Mask_NomType{1},'0','');%remove '0' in nom type for masks 1564 maskname=name_generator(Mask.Base,num_i1,num_j1,'.png',Mask.NomType);% 1601 [RootPath,RootFile]=fileparts(Mask.Base); 1602 maskname=fullfile_uvmat(RootPath,'',RootFile,'.png',Mask.NomType,num_i1,[],num_j1); 1603 %maskname=name_generator(Mask.Base,num_i1,num_j1,'.png',Mask.NomType);% 1565 1604 mdetect=exist(maskname,'file'); 1566 1605 if mdetect … … 1624 1663 end 1625 1664 num_i1_mask=mod(num_i1-1,MaskData.NbSlice)+1; 1626 MaskName=name_generator(MaskData.Base,num_i1_mask,num_j1,'.png',MaskData.NomType); 1665 [RootPath,RootFile]=fileparts(MaskData.Base); 1666 MaskName=fullfile_uvmat(RootPath,'',RootFile,'.png',MaskData.NomType,num_i1_mask,[],num_j1); 1667 %MaskName=name_generator(MaskData.Base,num_i1_mask,num_j1,'.png',MaskData.NomType); 1627 1668 huvmat=get(handles.CheckMask,'parent'); 1628 1669 UvData=get(huvmat,'UserData'); … … 1840 1881 InputFile.RootFile=regexprep(InputFile.RootFile,'^[\\/]|[\\/]$','');%suppress possible / or \ separator at the beginning or the end of the string 1841 1882 InputFile.SubDir=regexprep(InputFile.SubDir,'^[\\/]|[\\/]$','');%suppress possible / or \ separator at the beginning or the end of the string 1842 if isempty(InputFile.RootFile)1843 filebase=InputFile.RootPath;1844 else1845 1846 end1883 % if isempty(InputFile.RootFile) 1884 % filebase=InputFile.RootPath; 1885 % else 1886 filebase=fullfile(InputFile.RootPath,InputFile.RootFile); 1887 % end 1847 1888 FileExt=InputFile.FileExt; 1848 1889 % [FileName,RootPath,filebase,FileIndices,FileExt,subdir]=read_file_boxes(handles); … … 1855 1896 sub_value= get(handles.SubField,'Value'); 1856 1897 if sub_value % a second input file has been entered 1898 1857 1899 [FileName_1,RootPath_1,filebase_1,FileIndices_1,FileExt_1,SubDir_1]=read_file_boxes_1(handles); 1858 1900 [tild,tild,tild,i1_1,i2_1,j1_1,j2_1]=fileparts_uvmat(FileIndices_1); … … 1873 1915 i1=i1+increment; 1874 1916 i2=i2+increment; 1917 if sub_value 1918 i1_1=i1_1+increment; 1919 i2_1=i2_1+increment; 1920 end 1875 1921 else % case of scanning along index j (burst numbers) 1876 1922 j1=j1+increment; 1877 1923 j2=j2+increment; 1924 if sub_value 1925 j1_1=j1_1+increment; 1926 j2_1=j2_1+increment; 1927 end 1878 1928 end 1879 1929 if ~comp_input … … 1890 1940 end 1891 1941 end 1892 if ref_i+1>size(UvData.i1_series ,1)1942 if ref_i+1>size(UvData.i1_series{1},1) 1893 1943 msgbox_uvmat('ERROR','maximum i index exceeded'); 1894 1944 return 1895 1945 end 1896 if ref_j+1>size(UvData.i1_series ,2)1946 if ref_j+1>size(UvData.i1_series{1},2) 1897 1947 msgbox_uvmat('ERROR','maximum j index exceeded'); 1898 1948 return 1899 1949 end 1900 i1=UvData.i1_series (ref_i+1,ref_j+1,1);1901 if ~isempty(UvData.i2_series )1902 i2=UvData.i2_series (ref_i+1,ref_j+1,1);1903 end 1904 if ~isempty(UvData.j1_series )1905 j1=UvData.j1_series (ref_i+1,ref_j+1,1);1906 end 1907 if ~isempty(UvData.j2_series )1908 j2=UvData.j2_series (ref_i+1,ref_j+1,1);1950 i1=UvData.i1_series{1}(ref_i+1,ref_j+1,1); 1951 if ~isempty(UvData.i2_series{1}) 1952 i2=UvData.i2_series{1}(ref_i+1,ref_j+1,1); 1953 end 1954 if ~isempty(UvData.j1_series{1}) 1955 j1=UvData.j1_series{1}(ref_i+1,ref_j+1,1); 1956 end 1957 if ~isempty(UvData.j2_series{1}) 1958 j2=UvData.j2_series{1}(ref_i+1,ref_j+1,1); 1909 1959 end 1910 1960 end 1911 1961 filename=fullfile_uvmat(InputFile.RootPath,InputFile.SubDir,InputFile.RootFile,FileExt,NomType,i1,i2,j1,j2); 1912 % filename=name_generator(filebase,i1,j1,FileExt,NomType,comp_input,i2,j2,InputFile.SubDir);1913 1962 if sub_value 1914 j1_1=j1_1+increment; 1915 j2_1=j2_1+increment; 1916 filename_1=name_generator(filebase_1,i1_1,j1_1,FileExt_1,NomType_1,1,i2_1,j2_1,SubDir_1); 1963 filename_1=fullfile_uvmat(InputFile.RootPath_1,InputFile.SubDir_1,InputFile.RootFile_1,FileExt_1,NomType_1,i1_1,i2_1,j1_1,j2_1); 1917 1964 end 1918 1965 … … 1938 1985 set(handles.FileIndex,'String',indices); 1939 1986 if ~isempty(filename_1) 1940 indices_1=name_generator('',i1_1,j1_1,'',NomType_1,1,i2_1,j2_1,''); 1987 indices_1=fullfile_uvmat('','','','',NomType_1,i1_1,i2_1,j1_1,j2_1); 1988 %indices_1=name_generator('',i1_1,j1_1,'',NomType_1,1,i2_1,j2_1,''); 1941 1989 set(handles.FileIndex_1,'String',indices_1); 1942 1990 end … … 1951 1999 function movie_pair_Callback(hObject, eventdata, handles) 1952 2000 %------------------------------------------------------------------------ 1953 1954 2001 %% stop movie action if the movie_pair button is off 1955 2002 if ~get(handles.movie_pair,'value') … … 1971 2018 if isequal(FieldName,'image') 1972 2019 test_1=0; 1973 [ ff,rr,filebase,xx,Ext,SubDir]=read_file_boxes(handles);2020 [RootPath,SubDir,RootFile,FileIndices,Ext]=read_file_boxes(handles); 1974 2021 NomType=get(handles.NomType,'String'); 1975 2022 else … … 1979 2026 if isequal(FieldName,'image') 1980 2027 test_1=1; 1981 [ff,rr,filebase,xx,Ext,SubDir]=read_file_boxes_1(handles); 1982 NomType=get(handles.NomType_1,'String'); 1983 % NomType=get(handles.FileIndex_1,'UserData'); 2028 [RootPath,tild,RootFile,FileIndex_1,Ext,NomType]=read_file_boxes_1(handles); 1984 2029 else 1985 2030 msgbox_uvmat('ERROR','an image or movie must be first introduced as input') 1986 2031 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red 2032 set(handles.movie_pair,'Value',0) 1987 2033 return 1988 2034 end 1989 2035 end 1990 1991 num_i1=str2double(get(handles.i1,'String')); 2036 num_i1=str2num(get(handles.i1,'String')); 1992 2037 num_j1=stra2num(get(handles.j1,'String')); 1993 num_i2=str2 double(get(handles.i2,'String'));2038 num_i2=str2num(get(handles.i2,'String')); 1994 2039 num_j2=stra2num(get(handles.j2,'String')); 1995 if is nan(num_j2)2040 if isempty(num_j2) 1996 2041 if isempty(num_i2) 1997 2042 msgbox_uvmat('ERROR', 'a second image index i2 or j2 is needed to show the pair as a movie') 1998 2043 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red 2044 set(handles.movie_pair,'Value',0) 1999 2045 return 2000 2046 else … … 2002 2048 end 2003 2049 end 2004 if is nan(num_i2)2050 if isempty(num_i2) 2005 2051 num_i2=num_i1;%repeat the index i1 by default 2006 2052 end 2007 imaname_1=name_generator(filebase,num_i2,num_j2,Ext,NomType); 2053 % imaname_1=name_generator(filebase,num_i2,num_j2,Ext,NomType); 2054 imaname_1=fullfile_uvmat(RootPath,'',RootFile,Ext,NomType,num_i2,[],num_j2); 2008 2055 if ~exist(imaname_1,'file') 2009 2056 msgbox_uvmat('ERROR',['second input open (-) ' imaname_1 ' not found']); 2010 2057 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red 2058 set(handles.movie_pair,'Value',0) 2011 2059 return 2012 2060 end … … 2029 2077 2030 2078 %% determine the input file type 2031 if (test_1 && isfield(UvData,'MovieObject _1'))||(~test_1 && ~isempty(UvData.MovieObject))2079 if (test_1 && isfield(UvData,'MovieObject')&& numel(UvData.MovieObject>=2))||(~test_1 && ~isempty(UvData.MovieObject{1})) 2032 2080 FileType='movie'; 2033 2081 elseif isequal(lower(Ext),'.avi') … … 2048 2096 case 'movie' 2049 2097 if test_1 2050 Field_b.A=read(UvData.MovieObject _1,num_i2);2098 Field_b.A=read(UvData.MovieObject{2},num_i2); 2051 2099 else 2052 Field_b.A=read(UvData.MovieObject ,num_i2);2100 Field_b.A=read(UvData.MovieObject{1},num_i2); 2053 2101 end 2054 2102 case 'avi' … … 2094 2142 end 2095 2143 set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red 2144 set(handles.movie_pair,'Value',0) 2096 2145 2097 2146 %------------------------------------------------------------------------ … … 2101 2150 set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow 2102 2151 drawnow 2103 filename=read_file_boxes(handles); 2104 2152 %filename=read_file_boxes(handles); 2153 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 2154 filename=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 2105 2155 filename_1=[];%default 2106 2156 if get(handles.SubField,'Value') 2107 filename_1=read_file_boxes_1(handles); 2157 [RootPath_1,SubDir_1,RootFile_1,FileIndices_1,FileExt_1]=read_file_boxes_1(handles); 2158 filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndices_1 FileExt_1]; 2159 % filename_1=read_file_boxes_1(handles); 2108 2160 end 2109 2161 num_i1=stra2num(get(handles.i1,'String')); … … 2180 2232 FieldName=[];%default 2181 2233 VelType=[];%default 2182 Ext=get(handles.FileExt,'String');2183 FileType=UvData.FileType ;2234 FileExt=get(handles.FileExt,'String'); 2235 FileType=UvData.FileType{1}; 2184 2236 switch FileType 2185 2237 % if strcmp(Ext,'.nc')||strcmp(Ext,'.cdf') … … 2204 2256 end 2205 2257 case 'video' 2206 ObjectName=UvData.MovieObject; 2207 2258 ObjectName=UvData.MovieObject{1}; 2208 2259 case 'vol' %TODO: update 2209 2260 if isfield(UvData.XmlData,'Npy') && isfield(UvData.XmlData,'Npx') … … 2243 2294 errormsg=['second file ' filename_1 ' does not exist']; 2244 2295 return 2245 else 2246 Name=filename_1; 2247 FieldName_1=[];%default 2248 VelType_1=[];%default 2249 if strcmp(get(handles.FileExt_1,'Visible'),'on') 2250 Ext_1=get(handles.FileExt_1,'String'); 2251 else 2252 Ext_1=get(handles.FileExt,'String');%read the file extension for the first series (case of veltype comparison within a single file) 2253 end 2254 NomType_1=get(handles.NomType_1,'String'); 2255 % NomType_1=get(handles.FileIndex_1,'UserData'); 2256 if isequal(Ext_1,'.nc')||isequal(Ext_1,'.cdf') 2257 FileType_1='netcdf'; 2258 elseif isfield(UvData,'MovieObject_1') 2259 Name=UvData.MovieObject_1; 2260 FileType_1='movie'; 2261 elseif isequal(lower(Ext_1),'.avi') 2262 FileType_1='avi'; 2263 elseif isequal(lower(Ext_1),'.vol') 2264 FileType_1='vol'; 2265 if isfield(UvData.XmlData_1,'Npy') && isfield(UvData.XmlData_1,'Npx') 2266 ParamIn.Npy=UvData.XmlData_1.Npy; 2267 ParamIn.Npx=UvData.XmlData_1.Npx; 2268 else 2269 errormsg='Npx and Npy need to be defined in the xml file for volume images .vol'; 2270 return 2271 end 2272 else 2273 if length(Ext_1)>=2 2274 form=imformats(Ext_1(2:end)); 2275 if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab 2276 if isequal(NomType_1,'*'); 2277 FileType_1='multimage'; 2278 else 2279 FileType_1='image'; 2280 end 2281 end 2282 end 2283 end 2284 if strcmp(FileType_1,'netcdf') 2296 end 2297 Name=filename_1; 2298 FileType_1=UvData.FileType{2}; 2299 switch FileType_1 2300 % if strcmp(Ext,'.nc')||strcmp(Ext,'.cdf') 2301 case {'civx','civdata','netcdf'}; 2285 2302 list_fields=get(handles.Fields_1,'String');% list menu fields 2286 2303 index_fields=get(handles.Fields_1,'Value');% selected string index 2287 2304 FieldName_1= list_fields{index_fields}; % selected field 2288 if ~isequal(FieldName_1,'get_field...')% read the field names on the interface get_field... 2289 VelType_1=''; 2290 if get(handles.FixVelType,'Value') 2291 VelTypeList=get(handles.VelType_1,'String'); 2292 index=get(handles.VelType_1,'Value'); 2293 VelType_1=VelTypeList{index}; 2294 end 2295 end 2296 if strcmp(VelType_1,'*')% free veltype choice 2297 VelType_1=[]; 2298 elseif strcmp(VelType_1,'"')% veltype the same as for the first field 2299 if isempty(VelType) 2300 VelType_1=[]; 2301 else 2302 VelType_1=VelType; 2305 if ~strcmp(FieldName,'get_field...') 2306 TestVelType=get(handles.FixVelType,'Value'); 2307 if TestVelType 2308 VelType_1=setfield(handles);% read the velocity type. 2303 2309 end 2304 2310 end … … 2312 2318 end 2313 2319 end 2314 end 2315 test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged 2316 if ~isequal(NomType_1,'*')%in case of a series of files (not avi movie) 2317 if isfield(UvData,'filename_1')&& isfield(UvData,'VelType_1') && isfield(UvData,'FieldName_1') 2318 test_keepdata_1= strcmp(filename_1,UvData.filename_1) && strcmp(VelType_1,UvData.VelType_1) && strcmp(FieldName_1,UvData.FieldName_1); 2319 end 2320 end 2321 if test_keepdata_1 2322 Field{2}=UvData.Field_1; 2323 else 2324 ParamIn.FieldName=FieldName_1; 2325 ParamIn.VelType=VelType_1; 2326 ParamIn.GUIName='get_field_1'; 2327 [Field{2},ParamOut_1,errormsg] = read_field(Name,FileType_1,ParamIn,num_i1); 2328 if ~isempty(errormsg) 2329 errormsg=['error in reading ' FieldName_1 ' in ' filename_1 ': ' errormsg]; 2320 case 'video' 2321 Name=UvData.MovieObject{2}; 2322 case 'vol' %TODO: update 2323 if isfield(UvData.XmlData,'Npy') && isfield(UvData.XmlData,'Npx') 2324 ParamIn.Npy=UvData.XmlData.Npy; 2325 ParamIn.Npx=UvData.XmlData.Npx; 2326 else 2327 errormsg='Npx and Npy need to be defined in the xml file for volume images .vol'; 2330 2328 return 2331 2329 end 2332 UvData.Field_1=Field{2}; %store the second field for possible use at next RUN 2333 end 2334 end 2330 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 2336 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 2397 test_keepdata_1=0;% test for keeping the previous stored data if the input files are unchanged 2398 if ~isequal(NomType_1,'*')%in case of a series of files (not avi movie) 2399 if isfield(UvData,'filename_1')&& isfield(UvData,'VelType_1') && isfield(UvData,'FieldName_1') 2400 test_keepdata_1= strcmp(filename_1,UvData.filename_1) && strcmp(VelType_1,UvData.VelType_1) && strcmp(FieldName_1,UvData.FieldName_1); 2401 end 2402 end 2403 if test_keepdata_1 2404 Field{2}=UvData.Field_1; 2405 else 2406 ParamIn.FieldName=FieldName_1; 2407 ParamIn.VelType=VelType_1; 2408 ParamIn.GUIName='get_field_1'; 2409 [Field{2},ParamOut_1,errormsg] = read_field(Name,FileType_1,ParamIn,num_i1); 2410 if ~isempty(errormsg) 2411 errormsg=['error in reading ' FieldName_1 ' in ' filename_1 ': ' errormsg]; 2412 return 2413 end 2414 UvData.Field_1=Field{2}; %store the second field for possible use at next RUN 2415 end 2416 % end 2335 2417 end 2336 2418 … … 2346 2428 %% update the display menu for the first velocity type (first menuline) 2347 2429 test_veltype=0; 2348 if ~isequal(FileType,'netcdf')|| isequal(FieldName,'get_field...') 2349 set(handles.VelType,'Visible','off') 2350 else 2430 % if ~isequal(FileType,'netcdf')|| isequal(FieldName,'get_field...') 2431 if (strcmp(FileType,'civx')||strcmp(FileType,'civdata'))&& ~strcmp(FieldName,'get_field...') 2351 2432 test_veltype=1; 2352 2433 set(handles.VelType,'Visible','on') … … 2361 2442 set(handles.VelType_1,'String',[{''};menu]) 2362 2443 end 2444 else 2445 set(handles.VelType,'Visible','off') 2363 2446 end 2364 2447 field_index=strcmp(ParamOut.FieldName,ParamOut.FieldList); … … 2402 2485 set(handles.RootFile_1,'String','"') 2403 2486 set(handles.SubDir_1,'String','"'); 2404 [indices]=name_generator('',num_i1,num_j1,'',NomType,1,num_i2,num_j2,''); 2487 indices=fullfile_uvmat('','','','',NomType,num_i1,num_i2,num_j1,num_j2); 2488 %[indices]=name_generator('',num_i1,num_j1,'',NomType,1,num_i2,num_j2,''); 2405 2489 set(handles.FileIndex_1,'String',indices) 2406 2490 set(handles.FileExt_1,'String','"'); … … 2458 2542 2459 2543 %% calculate scalar 2460 if isequal(FileType,'netcdf') && ~isequal(ParamOut.CivStage,0)%&&~isempty(FieldName)%2544 if strcmp(FileType(1:3),'civ') && ~isequal(ParamOut.CivStage,0)%&&~isempty(FieldName)% 2461 2545 Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1}); 2462 2546 end 2463 if numel(Field)==2 && ~test_keepdata_1 && isequal(FileType_1 ,'netcdf') && ~isequal(ParamOut_1.FieldName,'get_field...')%&&~isempty(FieldName_1)2547 if numel(Field)==2 && ~test_keepdata_1 && isequal(FileType_1(1:3),'civ') && ~isequal(ParamOut_1.FieldName,'get_field...')%&&~isempty(FieldName_1) 2464 2548 Field{2}=calc_field([{ParamOut_1.FieldName} {ParamOut_1.ColorVar}],Field{2}); 2465 2549 end … … 2659 2743 %PlotParam{1}=read_plot_param(handles);%read plotting parameters on the uvmat interfac 2660 2744 PlotParam{1}=read_GUI(handles.uvmat); 2661 PlotParam{1}.Coordinates2662 2745 if ~isfield(PlotParam{1},'Vectors') 2663 2746 PlotParam{1}.Vectors.MaxVec=1; … … 2959 3042 function record_Callback(hObject, eventdata, handles) 2960 3043 % [filebase,num_i1,num_j1,num_i2,num_j2,Ext,NomType,SubDir]=read_input_file(handles); 2961 filename=read_file_boxes(handles); 3044 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 3045 filename=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 3046 %filename=read_file_boxes(handles); 2962 3047 [erread,message]=fileattrib(filename); 2963 3048 if ~isempty(message) && ~isequal(message.UserWrite,1) … … 3105 3190 set(handles.RootFile_1,'Visible','off') 3106 3191 set(handles.SubDir_1,'Visible','off'); 3192 set(handles.NomType_1,'Visible','off'); 3193 set(handles.abs_time_1,'Visible','off') 3107 3194 set(handles.FileIndex_1,'Visible','off'); 3108 3195 set(handles.FileExt_1,'Visible','off'); … … 3126 3213 % --- read the data displayed for the input rootfile windows (new): TODO use read_GUI 3127 3214 3128 function [ FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles)3215 function [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles) 3129 3216 %------------------------------------------------------------------------ 3130 3217 InputFile=read_GUI(handles.InputFile); 3131 3218 RootPath=InputFile.RootPath; 3132 FileName=InputFile.RootPath; %default 3133 if ~isempty(InputFile.SubDir) 3134 InputFile.SubDir=regexprep(InputFile.SubDir,'/|\',''); 3135 FileName=fullfile(InputFile.RootPath,InputFile.SubDir); 3136 end 3137 if ~isempty(InputFile.RootFile) 3138 InputFile.RootFile=regexprep(InputFile.RootFile,'/|\',''); 3139 FileName=fullfile(FileName,InputFile.RootFile); 3140 end 3141 SubDir=InputFile.SubDir; 3142 % if ~isempty(SubDir) && ~isequal(SubDir,'') 3143 % if (isequal(SubDir(1),'/')|| isequal(SubDir(1),'\')) 3144 % SubDir(1)=[]; %suppress possible / or \ separator 3145 % end 3146 % FileName=fullfile(RootPath,SubDir); 3147 % end 3148 % RootFile=get(handles.RootFile,'String'); 3149 % if ~isempty(RootFile) && ~isequal(RootFile,'') 3150 % if (isequal(RootFile(1),'/')|| isequal(RootFile(1),'\')) 3151 % RootFile(1)=[]; %suppress possible / or \ separator 3152 % end 3153 % FileName=fullfile(FileName,RootFile); 3154 % end 3155 FileBase=fullfile(InputFile.RootPath,InputFile.RootFile); 3219 SubDir=regexprep(InputFile.SubDir,'/|\',''); 3220 RootFile=regexprep(InputFile.RootFile,'/|\',''); 3156 3221 FileIndices=InputFile.FileIndex; 3157 3222 FileExt=InputFile.FileExt; 3158 FileName=[FileName InputFile.FileIndex InputFile.FileExt]; 3223 3159 3224 3160 3225 %------------------------------------------------------------------------ 3161 3226 % ---- read the data displayed for the second input rootfile windows 3162 function [ FileName_1,RootPath_1,FileBase_1,FileIndices_1,FileExt_1,SubDir_1]=read_file_boxes_1(handles)3227 function [RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1,NomType_1]=read_file_boxes_1(handles) 3163 3228 %------------------------------------------------------------------------ 3164 3229 RootPath_1=get(handles.RootPath_1,'String'); % read the data from the file1_input window … … 3166 3231 RootPath_1=get(handles.RootPath,'String'); 3167 3232 end; 3168 FileName_1=RootPath_1; %default3169 3233 SubDir_1=get(handles.SubDir_1,'String'); 3170 3234 if isequal(get(handles.SubDir_1,'Visible'),'off')|| isequal(SubDir_1,'"') 3171 3235 SubDir_1=get(handles.SubDir,'String'); 3172 3236 end 3237 SubDir_1=regexprep(SubDir_1,'\<[\\/]|[\\/]\>','');%suppress possible / or \ separator at the beginning or the end of the string 3173 3238 RootFile_1=get(handles.RootFile_1,'String'); 3174 SubDir_1=regexprep(SubDir_1,'\<[\\/]|[\\/]\>','');%suppress possible / or \ separator at the beginning or the end of the string3175 FileName_1=fullfile(RootPath_1,SubDir_1);3176 3239 if isequal(get(handles.RootFile_1,'Visible'),'off') || isequal(RootFile_1,'"') 3177 3240 RootFile_1=get(handles.RootFile,'String'); 3178 3241 end 3179 3242 RootFile_1=regexprep(RootFile_1,'\<[\\/]|[\\/]\>','');%suppress possible / or \ separator at the beginning or the end of the string 3180 if numel(RootFile_1)>=1 3181 FileName_1=fullfile(FileName_1,RootFile_1); 3182 end 3183 FileBase_1=fullfile(RootPath_1,RootFile_1); 3184 if isequal(get(handles.FileIndex_1,'Visible'),'off') 3185 FileIndices_1=get(handles.FileIndex,'String'); 3186 else 3187 FileIndices_1=get(handles.FileIndex_1,'String'); 3243 FileIndex_1=get(handles.FileIndex_1,'String'); 3244 if isequal(get(handles.FileIndex_1,'Visible'),'off')|| isequal(FileIndex_1,'"') 3245 FileIndex_1=get(handles.FileIndex,'String'); 3188 3246 end 3189 3247 FileExt_1=get(handles.FileExt_1,'String'); … … 3191 3249 FileExt_1=get(handles.FileExt,'String');%read FileExt by default 3192 3250 end 3193 FileName_1=[FileName_1 FileIndices_1 FileExt_1]; 3194 3251 NomType_1=get(handles.NomType_1,'String'); 3252 if isequal(get(handles.NomType_1,'Visible'),'off') || isequal(NomType_1,'"') 3253 NomType_1=get(handles.NomType,'String');%read FileExt by default 3254 end 3195 3255 %------------------------------------------------------------------------ 3196 3256 % --- Executes on menu selection Fields … … 3204 3264 set(handles.VelType,'visible','off') 3205 3265 set(handles.VelType_1,'visible','off') 3206 filename=read_file_boxes(handles); 3266 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 3267 filename=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 3268 %filename=read_file_boxes(handles); 3207 3269 hget_field=findobj(allchild(0),'name','get_field'); 3208 3270 if ~isempty(hget_field) … … 3224 3286 3225 3287 %read the rootfile input display 3226 [FileName,RootPath,FileBase,FileIndices,FileExt]=read_file_boxes(handles); 3288 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 3289 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 3290 % [FileName,RootPath,FileBase,FileIndices,FileExt]=read_file_boxes(handles); 3227 3291 [tild,tild,tild,i1,i2,j1,j2,tild,NomType]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt]); 3228 3292 % [P,F,str1,str2,str_a,str_b,E,NomType]=name2display(['xxx' get(handles.FileIndex,'String') FileExt]); … … 3236 3300 NomTypeNew='_1'; 3237 3301 end 3238 imagename=name_generator(FileBase,i1,j1,'.png',NomTypeNew,1,i2,j2,''); 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,''); 3239 3304 if ~exist(imagename,'file') 3240 3305 [FileName,PathName] = uigetfile( ... … … 3267 3332 end 3268 3333 % indices=name_generator('',i1,j1,'',NomTypeNew,1,i2,j2,''); 3269 indices=fullfile_uvmat('','','', FileExt,NomTypeNew,i1,i2,j1,j2);3334 indices=fullfile_uvmat('','','','',NomTypeNew,i1,i2,j1,j2); 3270 3335 set(handles.FileIndex,'String',indices) 3271 3336 set(handles.NomType,'String',NomTypeNew) … … 3292 3357 function Fields_1_Callback(hObject, eventdata, handles) 3293 3358 %------------------------------------------------- 3359 %% read input data 3360 check_new=~get(handles.SubField,'Value'); %check_new=1 if a second field was not previously entered 3361 UvData=get(handles.uvmat,'UserData'); 3362 if check_new && isfield(UvData,'XmlData') 3363 UvData.XmlData_1=UvData.XmlData; 3364 end 3294 3365 list_fields=get(handles.Fields,'String');% list menu fields 3295 3366 index_fields=get(handles.Fields,'Value');% selected string index … … 3298 3369 index_fields=get(handles.Fields_1,'Value');% selected string index 3299 3370 field_1= list_fields{index_fields(1)}; % selected string for the second field 3300 if isequal(field_1,'') %remove second field if 'blank' field is selected3371 if isequal(field_1,'')||(numel(UvData.FileType)>=2 && strcmp(UvData.FileType{2},'image')) 3301 3372 set(handles.SubField,'Value',0) 3373 check_new=1; 3302 3374 SubField_Callback(hObject, eventdata, handles) 3303 return 3304 end 3305 UvData=get(handles.uvmat,'UserData'); 3306 3307 %read the rootfile input display 3308 [FileName,RootPath,FileBase,FileIndices,FileExt_1]=read_file_boxes_1(handles); 3309 [tild,tild,tild,i1,i2,j1,j2,tild,NomType_1]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt_1]); 3310 % [P,F,str1,str2,str_a,str_b,E,NomType_1]=name2display(['xxx' get(handles.FileIndex,'String') FileExt_1]); 3311 if isempty(NomType_1)|| strcmp(NomType_1,'') 3312 [FileName,RootPath,FileBase,FileIndices,FileExt_1]=read_file_boxes(handles); 3313 [tild,tild,tild,i1,i2,j1,j2,tild,NomType_1]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt_1]); 3314 % [P,F,str1,str2,str_a,str_b,E,NomType_1]=name2display(['xxx' get(handles.FileIndex,'String') FileExt_1]); 3315 end 3316 NomTypeNew=NomType_1;%default 3317 3318 set(handles.SubField,'Value',1)%introduce second field 3319 if isfield(UvData,'XmlData') 3320 UvData.XmlData_1=UvData.XmlData; 3321 end 3375 if isempty(field_1)%remove second field if 'blank' field is selected 3376 return 3377 end 3378 end 3379 set(handles.SubField,'Value',1)%state that a second field is now entered 3380 3381 %% read the rootfile input display 3382 [RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1,NomTYpe_1]=read_file_boxes_1(handles); 3383 filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1]; 3384 [tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(get(handles.FileIndex,'String')); 3322 3385 set(handles.FileIndex_1,'Visible','on') 3323 3386 set(handles.FileExt_1,'Visible','on') 3324 RootPath_1=get(handles.RootPath_1,'String'); 3325 RootFile_1=get(handles.RootFile_1,'String'); 3326 if isempty(RootPath_1)||isequal(RootPath_1,'') 3327 set(handles.RootPath_1,'String','"') 3328 end 3329 if isempty(RootFile_1) || isequal(RootFile_1,'') 3330 set(handles.RootFile_1,'String','"') 3331 end 3332 if ~isempty(RootFile_1)&&(isequal(RootFile_1(1),'/')||isequal(RootFile_1(1),'\')) 3333 RootFile_1(1)=[]; 3334 end 3335 3336 if isequal(field_1,'get_field...') 3337 veltype_handles=[handles.VelType handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2]; 3338 set_veltype_display(veltype_handles,0) % unvisible civ buttons 3339 filename=read_file_boxes_1(handles); 3340 hget_field=findobj(allchild(0),'name','get_field_1'); 3341 if ~isempty(hget_field) 3342 delete(hget_field) 3343 end 3344 hget_field=get_field(filename); 3345 set(hget_field,'name','get_field_1') 3346 hhget_field=guidata(hget_field); 3347 set(hhget_field.list_fig,'Value',1) 3348 set(hhget_field.list_fig,'String',{'uvmat'}) 3349 set(handles.transform_fct,'Value',1)% no transform by default 3350 set(handles.path_transform,'String','') 3351 return %no action 3352 end 3353 if isequal(field_1,'image') 3354 % transform netc type to the corresponding image type 3355 if isequal(NomType_1,'_1-2_1')||isequal(NomType_1,'_1_1-2')|| isequal(NomType_1,'#_ab')|| isequal(NomType_1,'_1-2') 3356 UvData.SubDir_1=get(handles.SubDir_1,'String'); %preserve the InputFile.SubDir in memory 3357 if isequal(NomType_1,'_1-2_1')||isequal(NomType_1,'_1_1-2') 3358 NomTypeNew='_1_1'; 3359 elseif isequal(NomType_1,'#_ab') 3360 NomTypeNew='#a'; 3361 elseif isequal(NomType_1,'_1-2') 3362 NomTypeNew='_1'; 3363 end 3364 end 3365 % imagename=name_generator(FileBase,i1,j1,'.png',NomTypeNew,1,i2,j2,''); 3366 imagename=fullfile_uvmat(RootPath,SubDir,FileName,'.png',NomTypeNew,i1,i2,j1,j2); 3367 if ~exist(imagename,'file') 3368 [FileName,PathName] = uigetfile( ... 3369 {'*.png;*.jpg;*.tif;*.avi;*.AVI;*.vol', ' (*.png, .tif, *.avi,*.vol)'; 3370 '*.jpg',' jpeg image files'; ... 3371 '*.png','.png image files'; ... 3372 '*.tif','.tif image files'; ... 3373 '*.avi;*.AVI','.avi movie files'; ... 3374 '*.vol','.volume images (png)'; ... 3375 '*.*', 'All Files (*.*)'}, ... 3376 'Pick an image',imagename); 3377 % display the selected field and related information 3378 imagename=[PathName FileName]; 3379 end 3380 display_file_name_1(hObject, eventdata, handles,imagename)%display the image 3381 return 3382 else 3383 set(handles.SubDir_1,'Visible','on') 3384 if ~isequal(FileExt_1,'.nc') %find the new NomType if the previous display was not already a netcdf file 3385 RootPath_1=get(handles.RootPath_1,'String'); 3386 RootFile_1=get(handles.RootFile_1,'String'); 3387 if isempty(RootPath_1)||isequal(RootPath_1,'') 3388 set(handles.RootPath_1,'String','"') 3389 end 3390 if isempty(RootFile_1) || isequal(RootFile_1,'') 3391 set(handles.RootFile_1,'String','"') 3392 end 3393 if ~isempty(RootFile_1)&&(isequal(RootFile_1(1),'/')||isequal(RootFile_1(1),'\')) 3394 RootFile_1(1)=[]; 3395 end 3396 filebase_1=fullfile(RootPath_1,RootFile_1); 3397 SubDir_1=get(handles.SubDir,'String'); 3398 if isempty(SubDir_1)||isequal(SubDir_1,'') 3399 if isfield(UvData,'SubDir_1') 3400 SubDir_1=UvData.SubDir_1;%retrieve previous subdir 3401 else 3402 SubDir_1='?'; 3387 switch field_1 3388 case 'get_field...' 3389 %veltype_handles=[handles.VelType handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2]; 3390 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]; 3393 hget_field=findobj(allchild(0),'name','get_field_1'); 3394 if ~isempty(hget_field) 3395 delete(hget_field) 3396 end 3397 hget_field=get_field(filename_1); 3398 set(hget_field,'name','get_field_1') 3399 hhget_field=guidata(hget_field); 3400 set(hhget_field.list_fig,'Value',1) 3401 set(hhget_field.list_fig,'String',{'uvmat'}) 3402 set(handles.transform_fct,'Value',1)% no transform by default 3403 set(handles.path_transform,'String','') 3404 case 'image' 3405 % transform netc type to the corresponding image type 3406 NomType=get(handles.NomType,'string'); 3407 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],''); 3403 3415 end 3404 3416 end 3405 str1=get(handles.i1,'String'); 3406 str_a=get(handles.j1,'String'); 3407 if isequal(NomType_1,'#_ab')||isequal(NomType_1,'_1-2_1')||isequal(NomType_1,'_1_1-2')||isequal(NomType_1,'_1-2') 3408 NomTypeNew=NomType_1; 3409 elseif isequal(NomType_1,'#a') 3410 [filename, n1,na,n2,nb,SubDir_1]=name_generator(filebase_1, str2num(str1),stra2num(str_a),'.nc','#_ab',0,[],[],SubDir_1); 3411 NomTypeNew='#_ab'; 3412 elseif isequal(NomType_1,'_1_1') 3413 [filename,n1,na,n2,nb,SubDir_1]=name_generator(filebase_1,str2num(str1),stra2num(str_a),'.nc','_1-2_1',0,str2num(str1),[],SubDir_1); 3414 if idetect==1 3415 NomTypeNew='_1-2_1'; 3416 else 3417 NomTypeNew='_1_1-2'; 3418 end 3419 else %for instance avi files or any ima_num series 3420 [filename,n1,na,n2,nb,SubDir_1]=name_generator(filebase_1,str2num(str1),stra2num(str_a),'.nc','_1-2',0,str2num(str1),[],SubDir_1); 3421 NomTypeNew='_1-2'; 3422 end 3423 [Path,Name]=fileparts(filebase_1); 3424 set(handles.FileExt_1,'String','.nc'); 3425 if ~isempty(SubDir_1) && ~strcmp(SubDir_1,'''')&& ~strcmp(SubDir_1,'"')&& ~strcmp(SubDir_1(1),'/') 3426 SubDir_1=['/' SubDir_1]; 3427 end 3428 set(handles.SubDir_1,'String',SubDir_1); 3429 end 3430 if isequal(field,'vort') || isequal(field,'div') || isequal(field,'strain') 3431 set(handles.VelType_1,'BackgroundColor',[0.702 0.702 0.702]) % put their color to grey 3432 set(handles.civ2_1,'BackgroundColor',[0.702 0.702 0.702]) 3433 set(handles.interp1_1,'BackgroundColor',[0.702 0.702 0.702]) 3434 set(handles.interp2_1,'BackgroundColor',[0.702 0.702 0.702]) 3435 elseif isequal(field_1,'more...'); %add new item to the menu 3436 set(handles.VelType_1,'BackgroundColor',[0.702 0.702 0.702]) % put their color to grey 3437 set(handles.civ2_1,'BackgroundColor',[0.702 0.702 0.702]) 3438 str=calc_field;%get the list of available scalars by the function calc_scal 3439 [ind_answer,v] = listdlg('PromptString','Select a file:',... 3440 'SelectionMode','single',... 3441 'ListString',str); 3442 % edit the choice in the field and action menu 3443 scalar=cell2mat(str(ind_answer)); 3444 menu=update_menu(handles.Fields_1,scalar); 3445 set(handles.Fields_1,'String',menu);% store the selected scalar type 3446 end 3447 end 3448 str1=get(handles.i1,'String'); 3449 str2=get(handles.i2,'String'); 3450 str_a=get(handles.j1,'String'); 3451 str_b=get(handles.j2,'String'); 3452 indices=name_generator('',str2num(str1),stra2num(str_a),'',NomTypeNew,1,str2num(str2),stra2num(str_b),''); 3453 set(handles.FileIndex_1,'String',indices) 3454 set(handles.NomType_1,'String',NomTypeNew) 3455 % set(handles.FileIndex_1,'UserData',NomTypeNew) 3456 3457 %common to Fields_Callback 3458 if isequal(field,'image')||isequal(field_1,'image') 3459 set(handles.TitleNpx,'Visible','on')% visible npx,pxcm... buttons 3460 set(handles.TitleNpy,'Visible','on') 3461 set(handles.num_Npx,'Visible','on') 3462 set(handles.num_Npy,'Visible','on') 3463 % set(handles.fix_pair,'Value',0) 3464 else 3465 set(handles.TitleNpx,'Visible','off')% visible npx,pxcm... buttons 3466 set(handles.TitleNpy,'Visible','off') 3467 set(handles.num_Npx,'Visible','off') 3468 set(handles.num_Npy,'Visible','off') 3469 % set(handles.fix_pair,'Value',1) 3470 end 3471 if isequal(field,'velocity')||isequal(field_1,'velocity'); 3472 state_vect='on'; 3473 else 3474 state_vect='off'; 3475 end 3476 if ~isequal(field,'velocity')||(~isequal(field_1,'velocity')&~isequal(field_1,'')); 3477 state_scal='on'; 3478 else 3479 state_scal='off'; 3480 end 3481 set(handles.uvmat,'UserData',UvData) 3482 setfield(handles);% update the field structure ('civ1'....) 3483 if ~(isfield(UvData,'NewSeries')&&isequal(UvData.NewSeries,1)) 3484 run0_Callback(hObject, eventdata, handles) 3485 end 3417 imagename=fullfile_uvmat(RootPath_1,'',RootFile_1,'.png',NomType_1,i1,[],j1); 3418 if ~exist(imagename,'file') 3419 [FileName,PathName] = uigetfile( ... 3420 {'*.png;*.jpg;*.tif;*.avi;*.AVI;*.vol', ' (*.png, .tif, *.avi,*.vol)'; 3421 '*.jpg',' jpeg image files'; ... 3422 '*.png','.png image files'; ... 3423 '*.tif','.tif image files'; ... 3424 '*.avi;*.AVI','.avi movie files'; ... 3425 '*.vol','.volume images (png)'; ... 3426 '*.*', 'All Files (*.*)'}, ... 3427 'Pick an image',imagename); 3428 % display the selected field and related information 3429 imagename=[PathName FileName]; 3430 end 3431 set(handles.TitleNpx,'Visible','on')% visible npx,pxcm... buttons 3432 set(handles.TitleNpy,'Visible','on') 3433 set(handles.num_Npx,'Visible','on') 3434 set(handles.num_Npy,'Visible','on') 3435 display_file_name(hObject, eventdata, handles,imagename,2)%display the imag 3436 otherwise 3437 if check_new 3438 UvData.FileType{2}=UvData.FileType{1}; 3439 set(handles.FileIndex_1,'String',get(handles.FileIndex,'String')) 3440 set(handles.FileExt_1,'String',get(handles.FileExt,'String')) 3441 end 3442 if ~isequal(field,'image') 3443 set(handles.TitleNpx,'Visible','off')% visible npx,pxcm... buttons 3444 set(handles.TitleNpy,'Visible','off') 3445 set(handles.num_Npx,'Visible','off') 3446 set(handles.num_Npy,'Visible','off') 3447 end 3448 set(handles.uvmat,'UserData',UvData) 3449 setfield(handles);% update the field structure ('civ1'....) 3450 if ~(isfield(UvData,'NewSeries')&&isequal(UvData.NewSeries,1)) 3451 run0_Callback(hObject, eventdata, handles) 3452 end 3453 end 3454 3486 3455 3487 3456 %------------------------------------------------------------------------ … … 3502 3471 menu={'civ1';'interp1';'filter1';'civ2';'interp2';'filter2'}; 3503 3472 menu=menu(1:imax); 3504 % for ibutton=1:imax;3505 % set(handles(ibutton),'Visible','on') % unvisible civ buttons3506 % end3507 % % for ibutton=max(imax+1,2):6;3508 % for ibutton=imax+1:6;3509 % set(handles(ibutton),'Visible','off') % unvisible civ buttons3510 % set(handles(ibutton),'Value',0)%unactivate unvisible buttons3511 % end3512 3473 3513 3474 %------------------------------------------------------------------------ … … 3528 3489 drawnow 3529 3490 InputFile=read_GUI(handles.InputFile); 3530 filename=read_file_boxes(handles); 3491 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 3492 filename=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 3493 %filename=read_file_boxes(handles); 3531 3494 3532 3495 index=get(handles.VelType_1,'Value'); … … 3536 3499 SubField_Callback(hObject, eventdata, handles) 3537 3500 elseif get(handles.SubField,'Value')% if subfield is already 'on' 3538 filename_1=read_file_boxes_1(handles); %read the current second field 3501 [RootPath_1,SubDir_1,RootFile_1,FileIndices_1,FileExt_1]=read_file_boxes_1(handles); 3502 filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndices_1 FileExt_1]; 3503 %filename_1=read_file_boxes_1(handles); %read the current second field 3539 3504 else 3540 3505 filename_1=filename;% we compare two fields in the same file … … 3722 3687 masknumber=num2str(length(list)); 3723 3688 maskindex=get(handles.masklevel,'Value'); 3724 mask_name=name_generator([filebase '_' masknumber 'mask'],maskindex,1,'.png','_i'); 3689 mask_name=fullfile_uvmat(RootPath,SubDir,[RootFile '_' masknumber 'mask'],'.png','_1',maskindex); 3690 %mask_name=name_generator([filebase '_' masknumber 'mask'],maskindex,1,'.png','_i'); 3725 3691 imflag=uint8(255*(0.392+0.608*flag));% =100 for flag=0 (vectors not computed when 20<imflag<200) 3726 3692 imflag=flipdim(imflag,1); … … 4496 4462 huvmat=get(handles.run0,'parent'); 4497 4463 UvData=get(huvmat,'UserData'); 4498 [xx,xx,FileBase]=read_file_boxes(handles); 4464 %[xx,xx,FileBase]=read_file_boxes(handles); 4465 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 4466 FileBase=fullfile(RootPath,RootFile); 4499 4467 %read the current input file name 4500 4468 prompt = {'movie file name';'frames per second';'frame resolution (*[512x384] pixels)';'axis position relative to the frame';'total frame number (starting from the current uvmat display)'}; … … 4594 4562 pos(1)=pos(1)+pos(3)-0.311+0.04; %0.311= width of the geometry_calib interface (units relative to the srcreen) 4595 4563 pos(2)=pos(2)-0.02; 4596 [FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles); 4564 %[FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles); 4565 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 4566 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 4597 4567 set(handles.view_xml,'Backgroundcolor',[1 1 0])%indicate the reading of the current xml file by geometry_calib 4598 4568 if isfield(UvData.OpenParam,'CalOrigin') … … 4687 4657 masknumber=num2str(length(list)); 4688 4658 maskindex=get(handles.masklevel,'Value'); 4689 mask_name=name_generator([filebase '_' masknumber 'mask'],maskindex,1,'.png','_i'); 4659 mask_name=fullfile_uvmat(RootPath,SubDir,[RootFile '_' masknumber 'mask'],'.png','_1',maskindex); 4660 %mask_name=name_generator([filebase '_' masknumber 'mask'],maskindex,1,'.png','_i'); 4690 4661 imflag=uint8(255*(0.392+0.608*flag));% =100 for flag=0 (vectors not computed when 20<imflag<200) 4691 4662 imflag=flipdim(imflag,1); … … 4722 4693 4723 4694 %prepare display of the set_grid GUI 4724 FileName=read_file_boxes(handles); 4695 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 4696 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 4697 %FileName=read_file_boxes(handles); 4725 4698 CoordList=get(handles.transform_fct,'String'); 4726 4699 val=get(handles.transform_fct,'Value'); … … 4732 4705 %------------------------------------------------------------------------ 4733 4706 series; %first display of the GUI to fill waiting time 4734 [param.FileName]=read_file_boxes(handles); 4707 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 4708 param.FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 4709 %[param.FileName]=read_file_boxes(handles); 4735 4710 if isequal(get(handles.SubField,'Value'),1) 4736 FileName_1=read_file_boxes_1(handles);% 4711 [RootPath_1,SubDir_1,RootFile_1,FileIndices_1,FileExt_1]=read_file_boxes_1(handles); 4712 FileName_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndices_1 FileExt_1]; 4713 %FileName_1=read_file_boxes_1(handles);% 4737 4714 if ~isequal(FileName_1,param.FileName) 4738 4715 param.FileName_1=FileName_1; … … 4774 4751 function MenuPIV_Callback(hObject, eventdata, handles) 4775 4752 %------------------------------------------------------------------------ 4776 FileName=read_file_boxes(handles); 4753 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 4754 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 4755 %FileName=read_file_boxes(handles); 4777 4756 %[FileName,RootPath,filebase,FileIndices,ext,SubDir]=read_file_boxes(handles) 4778 4757 % num1=stra2num(get(handles.i1,'String'));
Note: See TracChangeset
for help on using the changeset viewer.