Changeset 89 for trunk/src/series.m
- Timestamp:
- May 20, 2010, 1:48:25 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r76 r89 430 430 update_file(hObject, eventdata, handles,fileinput,1) 431 431 432 % 433 % refresh the GUI data after introduction of a new file series432 %------------------------------------------------------------------------ 433 % --- refresh the GUI data after introduction of a new file series 434 434 function update_file(hObject, eventdata, handles,fileinput,addtest) 435 % hseries=get(handles.RootPath,'parent');435 %------------------------------------------------------------------------ 436 436 if ~exist(fileinput,'file') 437 437 msgbox_uvmat('ERROR',['input file ' fileinput ' does not exist']) 438 438 return 439 439 end 440 hseries=handles.figure1; 440 441 441 % refresh input root name, indices, file extension and nomenclature 442 442 [RootPath,RootFile,field_count,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(fileinput); 443 443 444 %check for movie image files 444 445 if ~isempty(FileExt) 445 if ~isempty(imformats(FileExt(2:end)))446 imainfo=imfinfo(fileinput);447 if length(imainfo) >1 %case of image with multiple frames448 NomType='*';449 [RootPath,RootFile]=fileparts(fileinput);450 end451 end446 if ~isempty(imformats(FileExt(2:end))) 447 imainfo=imfinfo(fileinput); 448 if length(imainfo) >1 %case of image with multiple frames 449 NomType='*'; 450 [RootPath,RootFile]=fileparts(fileinput); 451 end 452 end 452 453 end 453 454 NcType='none';%default … … 467 468 set(handles.nb_field2,'Value',1) 468 469 if addtest 469 SeriesData=get(h series,'UserData');470 SeriesData=get(handles.figure1,'UserData'); 470 471 SeriesData.displ_num=[0 0 0 0;SeriesData.displ_num]; 471 472 SeriesData.CurrentInputFile_1=SeriesData.CurrentInputFile; … … 520 521 set(handles.first_j,'String',num2str(ref_j)) 521 522 set(handles.last_j,'String',num2str(ref_j)); 522 %set(hseries,'UserData',SeriesData);523 523 524 524 %enable other menus and uicontrols … … 544 544 FileBase=fullfile(RootPath,RootFile); 545 545 546 % nb_field{icell,1}='?';%default547 % nb_field2{icell,1}='?';%default548 546 testima=0; %test for image input 549 547 if isequal(lower(FileExt),'.avi') %.avi file … … 681 679 [error,XmlData.Time,TimeUnit,mode,npx,npy,pxcmx,pxcmy]=read_imatext([FileBase '.civ']); 682 680 time=XmlData.Time; 683 size(time)684 GeometryCalib.R=[pxcmx 0 0; 0 pxcmy 0;0 0 0];685 GeometryCalib.Tx=0;686 GeometryCalib.Ty=0;687 GeometryCalib.Tz=1;688 GeometryCalib.dpx=1;689 GeometryCalib.dpy=1;690 GeometryCalib.sx=1;691 GeometryCalib.Cx=0;692 GeometryCalib.Cy=0;693 GeometryCalib.f=1;694 GeometryCalib.kappa1=0;695 GeometryCalib.CoordUnit='cm';696 XmlData.GeometryCalib=GeometryCalib;697 681 if error==2, warntext=['no file ' FileBase '.civ']; 698 682 elseif error==1, warntext='inconsistent number of fields in the .civ file'; … … 705 689 end 706 690 707 if ~isempty(time) 708 siztime=size(time); 709 nb_field=siztime(1); 710 nb_field2=siztime(2); 711 end 691 692 % if ~isempty(time) 693 % siztime=size(time); 694 % nb_field=siztime(1); 695 % nb_field2=siztime(2); 696 % end 712 697 set(handles.TimeUnit,'String',TimeUnit) 698 %look for max indices 699 if ~strcmp(NomType,'*') 700 [num_i1,num_i2,num_j1,num_j2]=find_indexseries(fileinput); 701 nb_field=max(floor((max(num_i1)+max(num_i2))/2)); 702 nb_field2=max(floor((max(num_j1)+max(num_j2))/2)); 703 end 713 704 if isempty(nb_field) 714 705 nb_field_str='?'; … … 727 718 set(handles.nb_field,'String',nb_field_cell); 728 719 set(handles.nb_field2,'String',nb_field2_cell); 729 set(h series,'UserData',SeriesData);720 set(handles.figure1,'UserData',SeriesData); 730 721 731 722 %number of slices … … 743 734 NomType_Callback(hObject, eventdata, handles) 744 735 736 %store the root name for future opening of uvmat 745 737 dir_perso=prefdir; 746 738 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 747 % save(profil_perso, 'FileBase'); %store the root name for future opening of uvmat748 739 if exist(profil_perso,'file') 749 740 save (profil_perso,'RootPath','SubDir','RootFile','NomType', '-append'); %store the root name for future opening of uvmat … … 839 830 NomType_Callback(hObject, eventdata, handles) 840 831 832 %------------------------------------------------------------------------ 841 833 function NomType_Callback(hObject, eventdata, handles) 834 %------------------------------------------------------------------------ 842 835 hseries=get(handles.ProjObject,'Parent'); 843 836 SeriesData=get(hseries,'UserData'); … … 897 890 state_j='on'; 898 891 end 899 end 892 end 900 893 if testpair 901 894 mode_Callback(hObject, eventdata, handles) 902 895 else 903 896 set(handles.NomType,'String',NomTypeCell) 904 end 905 set(handles.first_j,'Visible',state_j) 906 set(handles.incr_j,'Visible',state_j) 907 set(handles.last_j,'Visible',state_j) 908 set(handles.nb_field2,'Visible',state_j) 897 set(handles.first_j,'Visible',state_j) 898 set(handles.incr_j,'Visible',state_j) 899 set(handles.last_j,'Visible',state_j) 900 set(handles.nb_field2,'Visible',state_j) 901 end 902 909 903 910 904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%???????????? … … 926 920 test_find_pair=isequal(NomType,'_i_j1-j2')|| isequal(NomType,'_i1-i2_j')|| isequal(NomType,'_i1-i2')|| isequal(NomType,'#_ab'); 927 921 end 928 % displ_num=[];%default929 % first_i=str2num(get(handles.first_i,'String'));930 % last_i=str2num(get(handles.last_i,'String'));931 922 time=[]; 932 923 if isfield(SeriesData,'Time') … … 939 930 if isequal(mode,'bursts') 940 931 enable_i(handles,'On') 941 enable_j(handles,'Off') 932 enable_j(handles,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice) 942 933 elseif isequal(NomType,'_i_j1-j2')|| isequal(NomType,'_i1-i2_j') 943 934 enable_i(handles,'On') 944 enable_j(handles,'On') 935 enable_j(handles,'On') % allow both i and j index scanning 945 936 else 946 937 enable_i(handles,'On') … … 993 984 994 985 %-------------------------------------------------------------- 995 % determine the menu for civ1 pairs depending on existing netcdf file at the middle of996 % the field series set by first_i, incr, last_i986 % determine the menu for civ1 pairs depending on existing netcdf files 987 % with the reference indices ref_i and ref_j 997 988 %---------------------------------------------------------------- 998 989 function find_netcpair_civ(hObject, eventdata, handles,Val) … … 1087 1078 displ_num(4,ind_exist)=0; 1088 1079 %[cte_detect,vdt,cte_read]=read_netcdf(filename,{'dt','dt2','absolut_time_T0','absolute_time_TO_2'}); 1089 [Cte,var_detect,ichoice]=nc2struct( nc,{});1080 [Cte,var_detect,ichoice]=nc2struct(filename,{}); 1090 1081 if isfield(Cte,'dt2') 1091 1082 dt=Cte.dt2; … … 1357 1348 end 1358 1349 Series.hseries=handles.figure1; % handles to the series GUI 1359 % if isequal(get(handles.ParamVal,'Visible'),'on')1360 % ParamKey=get(handles.ParamKey,'String');1361 % if ischar(ParamKey)1362 % ParamKey{1}=ParamKey;1363 % end1364 % ParamString=get(handles.ParamVal,'String');1365 % if ischar(ParamString)1366 % for ilist=1:size(ParamString,1)1367 % ParamVal{ilist}=ParamString(ilist,:);1368 % end1369 % else1370 % ParamVal=ParamString;1371 % end1372 % end1373 1350 1374 1351 %read the set of field numbers … … 1433 1410 %case of pairs (.nc files) 1434 1411 1435 if isequal(NomType{iview},'_i_j1-j2')| isequal(NomType{iview},'_i1-i2_j')| isequal(NomType{iview},'_i1-i2')| isequal(NomType{iview},'#_ab')1412 if isequal(NomType{iview},'_i_j1-j2')|| isequal(NomType{iview},'_i1-i2_j')|| isequal(NomType{iview},'_i1-i2')|| isequal(NomType{iview},'#_ab') 1436 1413 ind_shift=SeriesData.displ_num(iview,:); 1437 1414 if isequal(ind_shift,[0 0 0 0]) % undefined pairs … … 1928 1905 end 1929 1906 1930 %---------------------------------------------------- 1931 % determine the list of index pairs of processing file 1932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1907 %------------------------------------------------------------------------ 1908 % --- determine the list of index pairs of processing file 1933 1909 function [num_i1,num_i2,num_j1,num_j2,num_i_out,num_j_out]=find_file_indices(num_i,num_j,ind_shift,NomType,mode) 1910 %------------------------------------------------------------------------ 1934 1911 num_i1=num_i;% set of first image numbers by default 1935 1912 num_i2=num_i; … … 1938 1915 num_i_out=num_i; 1939 1916 num_j_out=num_j; 1940 if isequal (NomType,'_i1-i2_j') | isequal (NomType,'_i1-i2')1917 if isequal (NomType,'_i1-i2_j') || isequal (NomType,'_i1-i2') 1941 1918 num_i1_line=num_i+ind_shift(3);% set of first image numbers 1942 1919 num_i2_line=num_i+ind_shift(4); … … 2211 2188 set(handles.path_transform,'String',fileparts(func.file)); %show the path to the senlected function 2212 2189 2213 %------------------------------------------------------------- 2214 %generates a series of file names with reference numbers between range1 and 2215 %range2 with increment incr. The reference number num_ref is the image number at the middle of the 2216 %image pair. The set of first numbers num1 of the image pairs is also 2217 %given as output 2218 %------------------------------------------------------ 2190 %------------------------------------------------------------------------ 2191 % --- generates a series of file names with reference numbers between range1 and 2192 % --- range2 with increment incr. The reference number num_ref is the image number at the middle of the 2193 % --- image pair. The set of first numbers num1 of the image pairs is also 2194 % --- given as output 2219 2195 function [num_i1,num_i2,num_j1,num_j2,nbmissing]=netseries_generator(filebase,subdir,mode,first_i,incr_i,last_i,first_j,incr_j,last_j) 2196 %------------------------------------------------------------------------ 2220 2197 [Path,Name]=fileparts(filebase); 2221 2198 filebasesub=fullfile(Path,subdir,Name); … … 2236 2213 dirpair=dir([filebasesub '_*-*_*.nc']); 2237 2214 else 2238 errordlg('option *|* not yet implemented')2215 msgbox_uvmat('ERROR','option *|* not yet implemented') 2239 2216 return 2240 2217 end 2241 2218 if isempty(dirpair) 2242 errordlg('no pair detected in the selected range')2219 msgbox_uvmat('ERROR','no pair detected in the selected range') 2243 2220 return 2244 2221 end 2245 %ind0_i=first_i:incr_i:last_i; 2246 %nbcolumn=length(ind0_i); 2247 %dirpair=dir([filebasesub '_*_*-*.nc']); 2248 if isequal(mode,'bursts')|isequal(mode,'#_ab') 2222 2223 if isequal(mode,'bursts')||isequal(mode,'#_ab') 2249 2224 icount=0; 2250 2225 for ifile=1:length(dirpair) 2251 2226 [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name); 2252 2253 % if isempty(str2num(str_1))2254 % dirpair(ifile).name2255 % end2256 2227 num1_r=str2num(str_1); 2257 2228 if isequal(RootFile,Name) & ~isempty(num1_r) … … 2259 2230 num_a(ifile)=stra2num(str_a); 2260 2231 num_b(ifile)=stra2num(str_b); 2261 % icount=icount+1;2262 2232 end 2263 2233 end 2264 length(dirpair)2265 % num_j=floor((num_a+num_b)/2); %list of reference indices of the detected files2266 2234 test_range= (num_i1 >=first_i)&(num_i1<= last_i);% =1 when both numbers are in the range 2267 2235 ind_i=((num_i1-first_i)/incr_i)+1;%indices i in the list of prescribed file indices … … 2309 2277 num_i1_r=num_i1_r(select); 2310 2278 num_i2_r=num_i2_r(select); 2311 % num_j=num_j(select);2312 2279 dirpair=dirpair(select); 2313 2280 [ind_remove]=find_pairs(dirpair,ind_ij,nbcolumn*nbline) ; … … 2325 2292 nbmissing=nbline*nbcolumn-length(ind_ij); 2326 2293 elseif isequal(mode,'series(Dj)') 2327 % ind0_i=first_i:incr_i:last_i;2328 % nbcolumn=length(ind0_i);2329 % ind0_j=first_j:incr_j:last_j;2330 % nbline=length(ind0_j);2331 % dirpair=dir([filebasesub '_*_*-*.nc']);2332 2294 for ifile=1:length(dirpair) 2333 2295 [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name); … … 2362 2324 num_i2=num_i1; 2363 2325 nbmissing=nbline*nbcolumn-length(ind_ij); 2364 % for i=1:length(indsel);%A SUPPRIMER ULTERIEUREMENT 2365 % if indsel(i)==0 2366 % filecell{i}=''; 2367 % else 2368 % Name=dirpair(indsel(i)).name; 2369 % filecell{i}=fullfile(Path,subdir,Name); 2370 % end 2371 % end 2372 %else 2373 % errordlg('option *|* not yet implemented') 2374 % return 2375 end 2376 2377 function path_transform_Callback(hObject, eventdata, handles) 2378 % hObject handle to path_transform (see GCBO) 2379 % eventdata reserved - to be defined in a future version of MATLAB 2380 % handles structure with handles and user data (see GUIDATA) 2381 2382 % Hints: get(hObject,'String') returns contents of path_transform as text 2383 % str2double(get(hObject,'String')) returns contents of path_transform as a double 2384 2385 2386 % --- Executes during object creation, after setting all properties. 2387 function path_transform_CreateFcn(hObject, eventdata, handles) 2388 % hObject handle to path_transform (see GCBO) 2389 % eventdata reserved - to be defined in a future version of MATLAB 2390 % handles empty - handles not created until after all CreateFcns called 2391 2392 % Hint: edit controls usually have a white background on Windows. 2393 % See ISPC and COMPUTER. 2394 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 2395 set(hObject,'BackgroundColor','white'); 2396 end 2397 2398 2326 end 2327 2328 %------------------------------------------------------------------------ 2329 % --- generates series of file indices corresponding to a file fileinput 2330 function [num_i1,num_i2,num_j1,num_j2]=find_indexseries(fileinput) 2331 %------------------------------------------------------------------------ 2332 num_i1=NaN;%default 2333 num_i2=NaN;%default 2334 num_j1=NaN;%default 2335 num_j2=NaN;%default 2336 % refresh input root name, indices, file extension and nomenclature 2337 [RootPath,RootFile,field_count,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(fileinput); 2338 if strcmp(SubDir,'') 2339 filebasesub=fullfile(RootPath,RootFile); 2340 else 2341 filebasesub=fullfile(RootPath,SubDir,RootFile); 2342 end 2343 dirpair=[]; %default 2344 switch NomType 2345 case '_i' 2346 dirpair=dir([filebasesub '_*' FileExt]); 2347 case '_i_j' 2348 dirpair=dir([filebasesub '_*_*' FileExt]); 2349 case '_i1-i2' 2350 dirpair=dir([filebasesub '_*-*' FileExt]); 2351 case '#_ab' 2352 dirpair=dir([filebasesub '*_*' FileExt]); 2353 case '_i_j1-j2' 2354 dirpair=dir([filebasesub '*_*-*' FileExt]); 2355 case '_i1-i2_j' 2356 dirpair=dir([filebasesub '*-*_*' FileExt]); 2357 end 2358 % nom_type='#' series of indexed images wich is not series_i 2359 % [filebase index ext], e.g. 'aa045.jpg' or 'aa45.tif' 2360 % nom_type='#a','#A' with a numerical index and an index letter(e.g.'aa045b.png'), OBSOLETE (replaced by 'series_i_j') 2361 % nom_type='%03d' or '%04d', series of indexed images with numbers completed with zeros to 3 or 4 digits, e.g.'aa045.tif' 2362 % nom_type='_%03d', '_%04d', or '_%05d', series of indexed images with _ and numbers completed with zeros to 3, 4 or 5 digits, e.g.'aa_045.tif' 2363 % nom_type='raw_SMD', same as '#a' but with no extension ext='', OBSOLETE 2364 % nom_type='#_ab' from pairs of '#a' images (e.g. 'aa045bc.nc'), ext='.nc', OBSOLETE (replaced by 'netc_2D') 2365 % nom_type='%3dab' from pairs of '%3da' images (e.g. 'aa045bc.nc'), ext='.nc', OBSOLETE (replaced by 'netc_2D') 2366 for ifile=1:length(dirpair) 2367 [RootPath,RF,str_1,str_2,str_a,str_b]=name2display(dirpair(ifile).name); 2368 num_i1(ifile)=str2double(str_1); 2369 num_i2(ifile)=str2double(str_2); 2370 if isnan(num_i2(ifile)) 2371 num_i2(ifile)=num_i1(ifile); 2372 end 2373 num_j1(ifile)=stra2num(str_a); 2374 if isnan(num_j1(ifile)) 2375 num_j1(ifile)=1; 2376 end 2377 num_j2(ifile)=stra2num(str_b); 2378 if isnan(num_j2(ifile)) 2379 num_j2(ifile)=num_j1(ifile); 2380 end 2381 end 2382
Note: See TracChangeset
for help on using the changeset viewer.