Changeset 667 for trunk/src/series.m
- Timestamp:
- Jul 15, 2013, 2:50:08 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r664 r667 75 75 RescaleFactor=min((ScreenSize(3)-80)/Width,(ScreenSize(4)-80)/Height); 76 76 if RescaleFactor>1 77 %RescaleFactor=RescaleFactor/2+1/2; %reduce the rescale factor to provide an increased margin for a big screen78 77 RescaleFactor=min(RescaleFactor,1); 79 78 end … … 89 88 set(handles.MinIndex_i,'ColumnEditable',false) 90 89 set(handles.MinIndex_i,'ColumnName',{'i min'}) 90 set(handles.MinIndex_i,'Data',[])% initiate Data to double (not cell) 91 91 92 92 % settings of table MinIndex_j … … 94 94 set(handles.MinIndex_j,'ColumnEditable',false) 95 95 set(handles.MinIndex_j,'ColumnName',{'j min'}) 96 set(handles.MinIndex_j,'Data',[])% initiate Data to double (not cell) 96 97 97 98 % settings of table MaxIndex_i … … 99 100 set(handles.MaxIndex_i,'ColumnEditable',false) 100 101 set(handles.MaxIndex_i,'ColumnName',{'i max'}) 102 set(handles.MaxIndex_i,'Data',[])% initiate Data to double (not cell) 101 103 102 104 % settings of table MaxIndex_j … … 104 106 set(handles.MaxIndex_j,'ColumnEditable',false) 105 107 set(handles.MaxIndex_j,'ColumnName',{'j max'}) 108 set(handles.MaxIndex_j,'Data',[])% initiate Data to double (not cell) 106 109 107 110 % settings of table PairString 108 111 set(handles.PairString,'ColumnName',{'pairs'}) 112 set(handles.PairString,'ColumnEditable',false) 113 set(handles.PairString,'ColumnFormat',{'char'}) 114 set(handles.PairString,'Data',{''}) 115 116 % settings of table MaskTable 117 set(handles.MaskTable,'ColumnName',{'mask name'}) 109 118 set(handles.PairString,'ColumnEditable',false) 110 119 set(handles.PairString,'ColumnFormat',{'char'}) … … 154 163 for ifile=1:min(length(h.MenuFile),5) 155 164 set(handles.(['MenuFile_' num2str(ifile)]),'Label',h.MenuFile{ifile}); 165 set(handles.(['MenuFile_' num2str(ifile+5)]),'Label',h.MenuFile{ifile}); 156 166 end 157 167 end … … 306 316 fileinput=uigetfile_uvmat('pick a file to append in the input table',oldfile); 307 317 if ~isempty(fileinput) 308 if get(handles.CheckAppend,'Value') 318 % if get(handles.CheckAppend,'Value') 319 % display_file_name(handles,fileinput,'append') 320 % else 321 display_file_name(handles,fileinput,'one') 322 % end 323 end 324 325 % -------------------------------------------------------------------- 326 function MenuBrowseAppend_Callback(hObject, eventdata, handles) 327 328 %% look for the previously opened file 'oldfile' 329 InputTable=get(handles.InputTable,'Data'); 330 RootPathCell=InputTable(:,1); 331 if isempty(RootPathCell{1})% no input file in the table 332 MenuBrowse_Callback(hObject, eventdata, handles)%refresh the input table, not append 333 return 334 end 335 SubDirCell=InputTable(:,2); 336 % oldfile=''; %default 337 % if ~(isempty(RootPathCell) || isequal(RootPathCell,{''}))%loads the previously stored file name and set it as default in the file_input box 338 oldfile=fullfile(RootPathCell{1},SubDirCell{1}); 339 % end 340 341 %% use a file name stored in prefdir 342 dir_perso=prefdir; 343 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 344 if exist(profil_perso,'file') 345 h=load (profil_perso); 346 if isfield(h,'RootPath') && ischar(h.RootPath) 347 oldfile=h.RootPath; 348 end 349 end 350 351 %% launch the browser 352 fileinput=uigetfile_uvmat('pick a file to append in the input table',oldfile); 353 if ~isempty(fileinput) 309 354 display_file_name(handles,fileinput,'append') 310 else311 display_file_name(handles,fileinput,'one')312 end313 355 end 314 356 … … 318 360 function MenuFile_Callback(hObject, eventdata, handles) 319 361 320 fileinput=get(hObject,'Label'); 321 if get(handles.CheckAppend,'Value') 322 display_file_name(handles,fileinput,'append') 362 display_file_name(handles,get(hObject,'Label'),'one') 363 364 %------------------------------------------------------------------------ 365 % --- fct activated by selecting a previous file under the menu Open/append 366 %------------------------------------------------------------------------ 367 function MenuFile_append_Callback(hObject, eventdata, handles) 368 369 InputTable=get(handles.InputTable,'Data'); 370 if isempty(InputTable{1,1})% no input file in the table 371 display_file_name(handles,get(hObject,'Label'),'one') %refresh the input table, not append 323 372 else 324 display_file_name(handles, fileinput,'one')373 display_file_name(handles,get(hObject,'Label'),'append')% append the selected file to the current list of InputTable 325 374 end 326 375 … … 424 473 %------------------------------------------------------------------------ 425 474 set(handles.REFRESH,'Visible','on') 426 set(handles.REFRESH_title,'Visible','on')475 % set(handles.REFRESH_title,'Visible','on') 427 476 iview=eventdata.Indices(1); 428 477 view_set=get(handles.REFRESH,'UserData'); … … 489 538 % iview: line index in the input table 490 539 % or 'one': refresh the list 491 % 'checkappend': add a new line to the list540 % 'append': add a new line to the input table 492 541 493 542 %% get the input root name, indices, file extension and nomenclature NomType … … 581 630 ref_j=floor((j1+j2)/2);% reference image number corresponding to the file 582 631 set(handles.num_ref_j,'String',num2str(ref_j)); 583 % set(handles.num_ref_j,'UserData',[j1 j2]);%store the indices for future opening584 632 585 633 %% update the list of recent files in the menubar and save it for future opening … … 629 677 ref_i=squeeze(max(i1_series(1,:,:),[],2));% select ref_j index for each ref_i 630 678 ref_j=squeeze(max(j1_series(1,:,:),[],3));% select ref_i index for each ref_j 631 % [ref_j,ref_i]=find(squeeze(i1_series(1,:,:)));632 % [ref_j,ref_i]=find(squeeze(i1_series(1,:,:)))633 679 MinIndex_i=min(find(ref_i))-1; 634 680 MaxIndex_i=max(find(ref_i))-1; 635 % MinIndex_j=min(ref_j)-1;636 681 MaxIndex_j=max(find(ref_j))-1; 637 % MinIndex_j=min(find(j1_series_j))-1;638 % MaxIndex_j=max(find(j1_series_j))-1;639 % MaxIndex_i=max(i1_series_i)-1;640 % MinIndex_j=min(i1_series_j)-1;641 % MaxIndex_j=max(i1_series_j)-1;642 % MaxIndex_i=max(ref_i)-1;643 682 MinIndex_j=min(find(ref_j))-1; 644 % MaxIndex_j=max(ref_j)-1;645 683 diff_j_max=diff(ref_j); 646 684 diff_i_max=diff(ref_i); … … 668 706 MinIndex_j=0; 669 707 end 670 MinIndex_i_ cell=get(handles.MinIndex_i,'Data');%retrieve the min indices in the table MinIndex671 MinIndex_j_ cell=get(handles.MinIndex_j,'Data');%retrieve the min indices in the table MinIndex672 MaxIndex_i_ cell=get(handles.MaxIndex_i,'Data');%retrieve the min indices in the table MinIndex673 MaxIndex_j_ cell=get(handles.MaxIndex_j,'Data');%retrieve the min indices in the table MinIndex674 MinIndex_i_ cell(iview,1)=MinIndex_i;675 MinIndex_j_ cell(iview,1)=MinIndex_j;676 MaxIndex_i_ cell(iview,1)=MaxIndex_i;677 MaxIndex_j_ cell(iview,1)=MaxIndex_j;678 set(handles.MinIndex_i,'Data',MinIndex_i_ cell)%display the min indices in the table MinIndex679 set(handles.MinIndex_j,'Data',MinIndex_j_ cell)%display the max indices in the table MaxIndex680 set(handles.MaxIndex_i,'Data',MaxIndex_i_ cell)%display the min indices in the table MinIndex681 set(handles.MaxIndex_j,'Data',MaxIndex_j_ cell)%display the max indices in the table MaxIndex708 MinIndex_i_table=get(handles.MinIndex_i,'Data');%retrieve the min indices in the table MinIndex 709 MinIndex_j_table=get(handles.MinIndex_j,'Data');%retrieve the min indices in the table MinIndex 710 MaxIndex_i_table=get(handles.MaxIndex_i,'Data');%retrieve the min indices in the table MinIndex 711 MaxIndex_j_table=get(handles.MaxIndex_j,'Data');%retrieve the min indices in the table MinIndex 712 MinIndex_i_table(iview,1)=MinIndex_i; 713 MinIndex_j_table(iview,1)=MinIndex_j; 714 MaxIndex_i_table(iview,1)=MaxIndex_i; 715 MaxIndex_j_table(iview,1)=MaxIndex_j; 716 set(handles.MinIndex_i,'Data',MinIndex_i_table)%display the min indices in the table MinIndex 717 set(handles.MinIndex_j,'Data',MinIndex_j_table)%display the max indices in the table MaxIndex 718 set(handles.MaxIndex_i,'Data',MaxIndex_i_table)%display the min indices in the table MinIndex 719 set(handles.MaxIndex_j,'Data',MaxIndex_j_table)%display the max indices in the table MaxIndex 682 720 683 721 %% adjust the first and last indices for the selected series, only if requested by the bounds … … 787 825 %% read timing and total frame number from the current file (movie files) if not already set by the xml file (prioritary) 788 826 InputTable=get(handles.InputTable,'Data'); 789 % FileBase=fullfile(InputTable{iview,1},InputTable{iview,3});790 827 791 828 % case of movies 792 % if strcmp(InputTable{iview,4},'*')793 829 if isempty(Time) 794 830 if ~isempty(VideoObject) … … 801 837 end 802 838 TimeSource='video'; 803 % set(han:dles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec804 % ColorType='truecolor';805 % elseif ~isempty(imformats(regexprep(InputTable{iview,5},'^.',''))) || isequal(InputTable{iview,5},'.vol')%&& isequal(NomType,'*')% multi-frame image806 % if ~isempty(InputTable{iview,2})807 % imainfo=imfinfo(fullfile(InputTable{iview,1},InputTable{iview,2},[InputTable{iview,3} InputTable{iview,5}]));808 % else809 % imainfo=imfinfo([FileBase InputTable{iview,5}]);810 % end811 % % ColorType=imainfo.ColorType;%='truecolor' for color images812 % % if length(imainfo) >1 %case of image with multiple frames813 % % nbfield=length(imainfo);814 % % nbfield_j=1;815 % % end816 839 end 817 840 end … … 820 843 if ~isempty(Time) 821 844 TimeTable=get(handles.TimeTable,'Data'); 822 % first_i=str2num(get(handles.num_first_i,'String'));823 % last_i=str2num(get(handles.num_last_i,'String'));824 % first_j=str2num(get(handles.num_first_j,'String'));825 % last_j=str2num(get(handles.num_last_j,'String'));826 % MinIndex_i=get(handles.MinIndex_i,'Data');827 % MinIndex_j=get(handles.MinIndex_j,'Data');828 % MaxIndex_i=get(handles.MaxIndex_i,'Data');829 % MaxIndex_j=get(handles.MaxIndex_j,'Data');830 845 TimeTable{iview,1}=Time(MinIndex_i+1,MinIndex_j+1); 831 846 if size(Time)>=[first_i+1 first_j+1] … … 840 855 set(handles.TimeTable,'Data',TimeTable) 841 856 end 842 843 857 844 858 %% update the series info in 'UserData' … … 1986 2000 %% Detect the types of input files 1987 2001 SeriesData=get(handles.series,'UserData'); 1988 nb_civ=0;nb_netcdf=0;2002 iview_civ=[];nb_netcdf=0; 1989 2003 if ~isempty(SeriesData) 1990 nb_civ=numel(find(strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType)));2004 iview_civ=find(strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType)); 1991 2005 nb_netcdf=numel(find(strcmp('netcdf',SeriesData.FileType))); 1992 2006 end 1993 if nb_civ>=1 1994 menu=set_veltype_display(SeriesData.FileInfo{1}.CivStage,SeriesData.FileType{1}); 2007 %menu={''}; 2008 if numel(iview_civ)>=1 2009 menu=set_veltype_display(SeriesData.FileInfo{iview_civ(1)}.CivStage,SeriesData.FileType{iview_civ(1)}); 1995 2010 set(handles.VelType,'String',[{'*'};menu]) 1996 if n b_civ>=21997 menu=set_veltype_display(SeriesData.FileInfo{ 2}.CivStage,SeriesData.FileType{2});2011 if numel(iview_civ)>=2 2012 menu=set_veltype_display(SeriesData.FileInfo{iview_civ(2)}.CivStage,SeriesData.FileType{iview_civ(2)}); 1998 2013 set(handles.VelType_1,'String',[{'*'};menu]) 1999 2014 end 2000 end 2001 2002 2015 end 2003 2016 2004 2017 %% Check whether alphabetical sorting of input Subdir is alowed by the Action fct (for multiples series entries) … … 2065 2078 if isfield(ParamOut,'VelType') 2066 2079 if strcmp( ParamOut.VelType,'one')||strcmp( ParamOut.VelType,'two') 2067 if n b_civ>=12080 if numel(iview_civ)>=1 2068 2081 VelTypeVisible='on'; 2069 2082 InputFieldsVisible='on'; … … 2071 2084 end 2072 2085 if strcmp( ParamOut.VelType,'two') 2073 if n b_civ>=22086 if numel(iview_civ)>=2 2074 2087 VelType_1Visible='on'; 2075 2088 end … … 2086 2099 if isfield(ParamOut,'FieldName') 2087 2100 if strcmp( ParamOut.FieldName,'one')||strcmp( ParamOut.FieldName,'two') 2088 if (n b_civ+nb_netcdf)>=12101 if (numel(iview_civ)+nb_netcdf)>=1 2089 2102 InputFieldsVisible='on'; 2090 2103 FieldNameVisible='on'; … … 2092 2105 end 2093 2106 if strcmp( ParamOut.FieldName,'two') 2094 if (n b_civ+nb_netcdf)>=12107 if (numel(iview_civ)+nb_netcdf)>=1 2095 2108 FieldName_1Visible='on'; 2096 2109 end … … 2360 2373 defaultname={''}; 2361 2374 end 2362 [FileName, PathName] = uigetfile( ... 2363 {'*.xml;*.mat', ' (*.xml,*.mat)'; 2364 '*.xml', '.xml files '; ... 2365 '*.mat', '.mat matlab files '}, ... 2366 'Pick an xml object file (or use uvmat to create it)',defaultname); 2367 fileinput=[PathName FileName];%complete file name 2368 sizf=size(fileinput); 2369 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end 2375 fileinput=uigetfile_uvmat('pick a xml object file (or use uvmat to create it)',defaultname,'.xml'); 2376 % [FileName, PathName] = uigetfile( ... 2377 % {'*.xml;*.mat', ' (*.xml,*.mat)'; 2378 % '*.xml', '.xml files '; ... 2379 % '*.mat', '.mat matlab files '}, ... 2380 % 'Pick an xml object file (or use uvmat to create it)',defaultname); 2381 % fileinput=[PathName FileName];%complete file name 2382 % sizf=size(fileinput); 2383 if isempty(fileinput),return;end 2370 2384 %read the file 2371 2385 data=xml2struct(fileinput); … … 2404 2418 function ViewObject_Callback(hObject, eventdata, handles) 2405 2419 2406 if get(handles.ViewObject,'Value')2407 set(handles.EditObject,'Value',0)2420 % if get(handles.ViewObject,'Value') 2421 % set(handles.EditObject,'Value',0) 2408 2422 UserData=get(handles.series,'UserData'); 2423 hset_object=findobj(allchild(0),'Tag','set_object'); 2424 if ~isempty(hset_object) 2425 delete(hset_object)% refresh set_object if already opened 2426 end 2409 2427 hset_object=set_object(UserData.ProjObject); 2410 2428 set(hset_object,'Name','view_object_series') 2411 else2412 hset_object=findobj(allchild(0),'Tag','set_object');2413 if ~isempty(hset_object)2414 delete(hset_object)2415 end2416 end2429 % else 2430 % hset_object=findobj(allchild(0),'Tag','set_object'); 2431 % if ~isempty(hset_object) 2432 % delete(hset_object) 2433 % end 2434 % end 2417 2435 2418 2436 %------------------------------------------------------------------------ … … 2428 2446 set(get(hset_object,'Children'),'Enable','on') 2429 2447 else 2430 hset_object=findobj(allchild(0),'Tag','set_object'); 2448 hset_object=findobj(allchild(0),'Tag','set_object'); 2431 2449 if ~isempty(hset_object) 2432 delete(hset_object)2450 set(get(hset_object,'Children'),'Enable','off') 2433 2451 end 2434 2452 end … … 2439 2457 function DeleteObject_Callback(hObject, eventdata, handles) 2440 2458 2441 if get(handles.DeleteObject,'Value')2459 % if get(handles.DeleteObject,'Value') 2442 2460 SeriesData=get(handles.series,'UserData'); 2443 2461 SeriesData.ProjObject=[]; … … 2445 2463 set(handles.ProjObject,'String','') 2446 2464 set(handles.CheckObject,'Value',0) 2465 set(handles.ViewObject,'Visible','off') 2466 set(handles.EditObject,'Visible','off') 2467 hset_object=findobj(allchild(0),'Tag','set_object'); 2468 if ~isempty(hset_object) 2469 delete(hset_object) 2470 end 2447 2471 set(handles.DeleteObject,'Visible','off') 2448 set(handles.ViewObject,'Visible','off') 2449 set(handles.DeleteObject,'Value',0) 2450 end 2451 2452 %-------------------------------------------------------------- 2472 % set(handles.DeleteObject,'Value',0) 2473 % end 2474 2475 %------------------------------------------------------------------------ 2476 % --- Executed when CheckMask is activated 2477 %------------------------------------------------------------------------ 2453 2478 function CheckMask_Callback(hObject, eventdata, handles) 2479 2454 2480 if get(handles.CheckMask,'Value') 2481 MaskData=get(handles.MaskTable,'Data'); 2455 2482 InputTable=get(handles.InputTable,'Data'); 2456 for iview=1:size(InputTable,1) 2483 nbview=size(InputTable,1); 2484 % MaskTable=cell(nbview,1); 2485 for iview=1:nbview 2457 2486 RootPath=InputTable{iview,1}; 2458 SubDir=InputTable{iview,2}; 2459 MaskSubDir=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.' 2460 MaskName=fullfile(RootPath,[MaskSubDir '.mask'],'mask_1.png'); 2461 if ~exist(MaskName,'file') 2462 msgbox_uvmat('WARNING',['mask file ' MaskName ' not found']) 2463 return 2464 end 2465 end 2466 end 2467 %-------------------------------------------------------------- 2487 if ~isempty(RootPath) 2488 if isempty(MaskData{iview}) 2489 SubDir=InputTable{iview,2}; 2490 MaskSubDir=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.' 2491 MaskName=fullfile(RootPath,[MaskSubDir '.mask'],'mask_1.png'); 2492 if ~exist(MaskName,'file') 2493 MaskName=uigetfile_uvmat('select a mask file:',RootPath,'image'); 2494 end 2495 MaskTable{iview,1}=MaskName ; 2496 ListMask{iview,1}=num2str(iview); 2497 end 2498 end 2499 end 2500 nbview=size(MaskTable,1); 2501 set(handles.MaskTable,'Data',MaskTable) 2502 % set(handles.MaskTable,'ColumnFormat',{MaskTable'}) 2503 set(handles.MaskTable,'Visible','on') 2504 set(handles.MaskBrowse,'Visible','on') 2505 set(handles.ListMask,'Visible','on') 2506 set(handles.ListMask,'String',ListMask) 2507 set(handles.ListMask,'Value',numel(ListMask)) 2508 else 2509 set(handles.MaskTable,'Visible','off') 2510 set(handles.MaskBrowse,'Visible','off') 2511 set(handles.ListMask,'Visible','off') 2512 end 2513 2514 %------------------------------------------------------------------------ 2515 % --- Executes on button press in MaskBrowse. 2516 %------------------------------------------------------------------------ 2517 function MaskBrowse_Callback(hObject, eventdata, handles) 2518 InputTable=get(handles.InputTable,'Data'); 2519 iview=get(handles.ListMask,'Value'); 2520 % MaskTable=cell(nbview,1); 2521 2522 RootPath=InputTable{iview,1}; 2523 % if ~isempty(RootPath) 2524 % SubDir=InputTable{iview,2}; 2525 % MaskSubDir=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.' 2526 % MaskName=fullfile(RootPath,[MaskSubDir '.mask'],'mask_1.png'); 2527 % if ~exist(MaskName,'file') 2528 MaskName=uigetfile_uvmat('select a mask file:',RootPath,'image'); 2529 % end 2530 if ~isempty(MaskName) 2531 MaskTable=get(handles.MaskTable,'Data'); 2532 MaskTable{iview,1}=MaskName ; 2533 % end 2534 set(handles.MaskTable,'Data',MaskTable) 2535 end 2536 % set(handles.MaskTable,'ColumnFormat',{MaskTable'}) 2537 2538 %------------------------------------------------------------------------ 2539 % --- Executes when selected cell(s) is changed in MaskTable. 2540 %------------------------------------------------------------------------ 2541 function MaskTable_CellSelectionCallback(hObject, eventdata, handles) 2542 2543 if numel(eventdata.Indices)>=1 2544 set(handles.ListMask,'Value',eventdata.Indices(1)) 2545 end 2468 2546 2469 2547 %------------------------------------------------------------------- 2470 %'uv_ncbrowser': interactively calls the netcdf file browser 'get_field.m'2471 function ncbrowser_uvmat(hObject, eventdata)2472 %-------------------------------------------------------------------2473 bla=get(gcbo,'String');2474 ind=get(gcbo,'Value');2475 filename=cell2mat(bla(ind));2476 blank=find(filename==' ');2477 filename=filename(1:blank-1);2478 get_field(filename)2479 2480 % ------------------------------------------------------------------2481 2548 function MenuHelp_Callback(hObject, eventdata, handles) 2482 2549 %------------------------------------------------------------------- … … 2624 2691 set(handles.PairString,'Unit','normalized') 2625 2692 set(handles.PairString,'ColumnWidth',{Pos(3)-5}) 2693 2694 %% MaskTable 2695 set(handles.MaskTable,'Unit','pixel') 2696 Pos=get(handles.MaskTable,'Position'); 2697 set(handles.MaskTable,'Unit','normalized') 2698 set(handles.MaskTable,'ColumnWidth',{Pos(3)-5}) 2626 2699 2627 2700 %------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.