- Timestamp:
- Jan 4, 2012, 12:49:29 PM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r353 r358 213 213 InputTable=get(handles.InputTable,'Data'); 214 214 RootPathCell=InputTable(:,1); 215 SubDirCell=InputTable(:, 1);216 RootFileCell=InputTable(:, 1);215 SubDirCell=InputTable(:,2); 216 RootFileCell=InputTable(:,3); 217 217 %RootPathCell=get(handles.RootPath,'String'); 218 218 %SubDirCell=get(handles.SubDir,'String'); … … 486 486 if isequal(lower(FileExt),'.avi') %.avi file 487 487 testima=1; 488 % info=aviinfo([FileBase FileExt]);489 % time=(0:1/info.FramesPerSecond:(info.NumFrames-1)/info.FramesPerSecond)';490 % num_MaxIndex_i=info.NumFrames;491 % num_MaxIndex_j=1;492 488 elseif ~isempty(imformats(FileExt(2:end))) 493 489 testima=1; 494 % if isequal(NomType,'*')% multi-frame image495 % imainfo=imfinfo([FileBase FileExt]);496 % if length(imainfo) >1 %case of image with multiple frames497 % num_MaxIndex_i=length(imainfo);498 % num_MaxIndex_j=1;499 % end500 % end501 490 elseif isequal(FileExt,'.vol') 502 491 testima=1; … … 507 496 % insert the current file series at the head of the list 508 497 InputTable=get(handles.InputTable,'Data'); 509 if addtest 510 % SeriesData=get(handles.series,'UserData'); 511 % % SeriesData.displ_num=[0 0 0 0;SeriesData.displ_num]; 512 % SeriesData.CurrentInputFile_1=SeriesData.CurrentInputFile; 513 % SeriesData.i1_series=[SeriesData.i1_series;{i1_series}]; 514 % SeriesData.i2_series=[SeriesData.i2_series;{i2_series}]; 515 % SeriesData.j1_series=[SeriesData.j1_series;{j1_series}]; 516 % SeriesData.j2_series=[SeriesData.j2_series;{j2_series}]; 517 InputTable=get(handles.InputTable,'Data'); 518 InputTable=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt};InputTable]; 519 % RootPathCell=[{RootPath}; InputTable{] ; 520 % SubDirCell=[{SubDir}; get(handles.SubDir,'String')]; 521 % RootFileCell=[{RootFile}; get(handles.RootFile,'String')]; 522 % NomTypeCell=[{NomType}; SeriesData.NomType]; 523 % FileExtCell=[{FileExt}; get(handles.FileExt,'String')]; 524 % FileTypeCell=[{FileType};SeriesData.FileType]; 525 % set(handles.NomType,'String',[{};get(handles.NomType,'String')]) 526 527 % or re-initialise the list of input file series 528 else 529 InputTable=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; 498 if addtest %insert the new data at the first line of the table 499 val=size(InputTable,1)+1; 500 InputTable(val,:)=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}]; 501 check_lines=get(handles.REFRESH_INDICES,'UserData'); 502 else % or re-initialise the list of input file series 503 val=1; 504 InputTable=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}] 505 set(handles.TimeTable,'Data',[{[]},{[]},{[]},{[]}]) 506 set(handles.MinIndex,'Data',[{[]},{[]}]) 507 set(handles.MaxIndex,'Data',[{[]},{[]}]) 530 508 end 531 509 set(handles.InputTable,'Data',InputTable) 532 % SeriesData=[];%re-initialisation 533 % % SeriesData.displ_num=[0 0 0 0]; 534 % % SeriesData.i1_series={i1_series}; 535 % % SeriesData.i2_series={i2_series}; 536 % % SeriesData.j1_series={j1_series}; 537 % % SeriesData.j2_series={j2_series}; 538 % RootPathCell={RootPath}; 539 % SubDirCell={SubDir}; 540 % RootFileCell={RootFile}; 541 % NomTypeCell={NomType}; 542 % FileExtCell={FileExt}; 543 % % FileTypeCell={FileType}; 544 % end 545 % SeriesData.NomType=NomTypeCell; 546 %SeriesData.FileType=FileTypeCell; 547 SeriesData.CurrentInputFile=fileinput; 548 % set(handles.RootPath,'String',RootPathCell); 549 % set(handles.SubDir,'String',SubDirCell); 550 % set(handles.RootFile,'String',RootFileCell); 551 % set(handles.NomType,'String',NomTypeCell); 552 % set(handles.FileExt,'String',FileExtCell); 553 %set(handles.InputTable,'Data',[RootPathCell SubDirCell RootFileCell NomTypeCell FileExtCell]) ; 554 update_indices(handles,fileinput,1) 555 556 557 % %% display times 558 % if addtest 559 % SeriesData.Time=[{time} SeriesData.Time]; 560 % else 561 % SeriesData.Time={time}; 562 % end 563 % set(handles.TimeUnit,'String',TimeUnit) 564 % set(handles.series,'UserData',SeriesData); 565 % time_display=[time(MinIndex_i,MinIndex_j) time(ref_i,ref_j) time(ref_i,ref_j) time(MaxIndex_i,MaxIndex_j);... 566 % time(MinIndex_i,MinIndex_j) time(ref_i,ref_j) time(ref_i,ref_j) time(MaxIndex_i,MaxIndex_j)]; 567 % set(handles.time_table,'Data',time_display) 568 569 510 check_lines(val)=1; %select the edited line for refresh 511 set(handles.REFRESH_INDICES,'UserData',check_lines); 512 REFRESH_INDICES_Callback([],[], handles) 570 513 571 514 %store the root name for future opening of uvmat … … 677 620 % handles structure with handles and user data (see GUIDATA) 678 621 eventdata 679 list_lines=get(handles.REFRESH_INDICES,'UserData');680 list_lines(eventdata.Indices(1))=1; %select the edited line for refresh681 set(handles.REFRESH_INDICES,'UserData', list_lines);622 check_lines=get(handles.REFRESH_INDICES,'UserData'); 623 check_lines(eventdata.Indices(1))=1; %select the edited line for refresh 624 set(handles.REFRESH_INDICES,'UserData',check_lines); 682 625 set(handles.REFRESH_INDICES,'Visible','on') 683 626 … … 692 635 mode_value=get(handles.mode,'Value'); 693 636 mode=mode_list{mode_value}; 694 NomType=[];637 % NomType=[]; 695 638 % test_find_pair=0; 696 639 % if isfield(SeriesData,'NomType') 697 NomTypeCell=SeriesData.NomType; 698 Val=get(handles.NomType,'Value'); 699 NomType=NomTypeCell{Val}; 700 check_pairs=~isempty(SeriesData.i2_series{Val})||~isempty(SeriesData.j2_series{Val}); 640 % NomTypeCell=SeriesData.NomType; 641 % Val=get(handles.NomType,'Value'); 642 % NomType=NomTypeCell{Val}; 643 % check_pairs=0; 644 % for 645 % check_pairs=~isempty(SeriesData.i2_series{Val})||~isempty(SeriesData.j2_series{Val}); 701 646 702 647 time=[]; … … 704 649 time=SeriesData.Time{1}; %get the set of times 705 650 end 706 siztime=size(time);707 nbfield=siztime(1);708 nbfield2=siztime(2);651 % siztime=size(time); 652 % nbfield=siztime(1); 653 % nbfield2=siztime(2); 709 654 % indchosen=1; %%first pair selected by default 710 655 if isequal(mode,'bursts') 711 656 enable_i(handles,'On') 712 657 enable_j(handles,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice) 713 elseif ~isempty(SeriesData.j2_series{Val})714 enable_i(handles,'On')715 enable_j(handles,'On') % allow both i and j index scanning658 % elseif ~isempty(SeriesData.j2_series{Val}) 659 % enable_i(handles,'On') 660 % enable_j(handles,'On') % allow both i and j index scanning 716 661 else 717 662 enable_i(handles,'On') … … 719 664 end 720 665 % set(handles.list_pair_civ,'Value',indchosen);%set the default choice of image pairs for civ1 721 set(handles.series,'UserData',SeriesData)666 % set(handles.series,'UserData',SeriesData) 722 667 723 668 %list pairs if relevant 724 if check_pairs725 find_netcpair_civ(handles ,Val)726 end669 % if check_pairs 670 find_netcpair_civ(handles) 671 % end 727 672 728 673 %------------------------------------- … … 732 677 set(handles.num_last_i,'Visible',state) 733 678 set(handles.num_incr_i,'Visible',state) 734 set(handles.num_MaxIndex_i,'Visible',state)679 % set(handles.num_MaxIndex_i,'Visible',state) 735 680 set(handles.ref_i,'Visible',state) 736 681 set(handles.ref_i_text,'Visible',state) … … 739 684 function enable_j(handles,state) 740 685 set(handles.j_txt,'Visible',state) 741 set(handles.num_MinIndex_j,'Visible',state)686 % set(handles.num_MinIndex_j,'Visible',state) 742 687 set(handles.num_first_j,'Visible',state) 743 688 set(handles.num_last_j,'Visible',state) 744 689 set(handles.num_incr_j,'Visible',state) 745 set(handles.num_MaxIndex_j,'Visible',state)690 % set(handles.num_MaxIndex_j,'Visible',state) 746 691 set(handles.ref_j,'Visible',state) 747 692 set(handles.ref_j_text,'Visible',state) … … 768 713 % with the reference indices ref_i and ref_j 769 714 %---------------------------------------------------------------- 770 function find_netcpair_civ(handles ,Val)715 function find_netcpair_civ(handles) 771 716 SeriesData=get(handles.series,'UserData'); 772 717 % NomTypeCell=get(handles.NomType,'String'); 773 NomTypeCell=SeriesData.NomType;774 NomType=NomTypeCell{Val};718 % NomTypeCell=SeriesData.NomType; 719 % NomType=NomTypeCell{Val}; 775 720 776 721 set(handles.Pairs,'Visible','on')% makes the panel "Pairs' visible 777 722 %nomenclature types 778 RootPathCell=get(handles.RootPath,'String');779 filepath=RootPathCell{Val};780 RootFileCell=get(handles.RootFile,'String');781 filename=RootFileCell{Val};782 filebase=fullfile(filepath,filename);783 SubDirCell=get(handles.SubDir,'String');784 subdir=SubDirCell{Val};785 if ~exist(fullfile(filepath,subdir),'dir')786 msgbox_uvmat('ERROR',['no civ file available: subdirectory ' subdir ' does not exist'])787 set(handles.list_pair_civ,'String',{''});788 return789 end723 % RootPathCell=get(handles.RootPath,'String'); 724 % filepath=RootPathCell{Val}; 725 % RootFileCell=get(handles.RootFile,'String'); 726 % filename=RootFileCell{Val}; 727 % filebase=fullfile(filepath,filename); 728 % SubDirCell=get(handles.SubDir,'String'); 729 % subdir=SubDirCell{Val}; 730 % if ~exist(fullfile(filepath,subdir),'dir') 731 % msgbox_uvmat('ERROR',['no civ file available: subdirectory ' subdir ' does not exist']) 732 % set(handles.list_pair_civ,'String',{''}); 733 % return 734 % end 790 735 mode_list=get(handles.mode,'String'); 791 736 mode_value=get(handles.mode,'Value'); … … 811 756 812 757 %% NEW 758 for Val=1:numel(SeriesData.i1_series) 759 813 760 i1_series=SeriesData.i1_series{Val}; 814 761 i2_series=SeriesData.i2_series{Val}; … … 869 816 end 870 817 end 871 818 end 872 819 %% display list of pairs 873 820 displ_pair_list=get(handles.list_pair_civ,'String'); … … 1869 1816 last_i=str2num(get(handles.num_last_i,'String')); 1870 1817 last_j=str2num(get(handles.num_last_j,'String')); 1871 NomType=SeriesData.NomType; 1818 InputTable=get(handles.InputTable,'Data'); 1819 NomType=InputTable(:,4); 1820 % NomType=SeriesData.NomType; 1872 1821 mode_list=get(handles.mode,'String'); 1873 1822 index_mode=get(handles.mode,'Value'); … … 2244 2193 2245 2194 % --- Executes on button press in REFRESH_INDICES. 2246 function REFRESH_INDICES_Callback(hObject, eventdata, handles) 2195 2196 2197 function REFRESH_INDICES_Callback(hObject, eventdata, handles) 2247 2198 % hObject handle to REFRESH_INDICES (see GCBO) 2248 2199 % eventdata reserved - to be defined in a future version of MATLAB … … 2250 2201 set(handles.REFRESH_INDICES,'BackgroundColor',[0.7 0.7 0.7]) 2251 2202 InputTable=get(handles.InputTable,'Data'); 2252 list_lines=get(handles.REFRESH_INDICES,'UserData');2203 check_lines=get(handles.REFRESH_INDICES,'UserData'); 2253 2204 2254 2205 %% check the indices and FileTypes for each series (limited to the new ones to save time) 2255 for ind_list=1:length( list_lines)2256 if list_lines(ind_list)2257 InputLine=InputTable( list_lines(ind_list),:);2206 for ind_list=1:length(check_lines) 2207 if check_lines(ind_list) 2208 InputLine=InputTable(ind_list,:); 2258 2209 detect_idem=strcmp('"',InputLine);% look for '" (repeat of previous data) 2259 if ~isempty(detect_idem)&& list_lines(ind_list)>1 2260 InputLine{detect_idem}=InputTable(list_lines(ind_list)-1,detect_idem); 2210 detect_idem=detect_idem(detect_idem>0); 2211 if ~isempty (detect_idem) 2212 InputLine(detect_idem)=InputTable(ind_list-1,detect_idem); 2261 2213 set(handles.InputTable,'Data',InputTable) 2262 2214 end 2263 fileinput=name_generator(fullfile(InputLine{1},InputLine{3}),1,1,InputLine{5},InputLine{4},1,2,2,InputLine{2}); 2215 fileinput=fullfile_uvmat(InputLine{1},InputLine{2},InputLine{3},InputLine{5},InputLine{4},1,2,1,2); 2216 %fileinput=name_generator(fullfile(InputLine{1},InputLine{3}),1,1,InputLine{5},InputLine{4},1,2,2,InputLine{2}) 2264 2217 %update file series defined by the selected line 2265 [InputTable{ list_lines(ind_list),1},InputTable{list_lines(ind_list),2},InputTable{list_lines(ind_list),4},errormsg]=update_indices(handles,fileinput,list_lines(ind_list));2218 [InputTable{ind_list,1},InputTable{ind_list,3},InputTable{(ind_list),4},errormsg]=update_indices(handles,fileinput,ind_list); 2266 2219 if ~isempty(errormsg) 2267 2220 msgbox_uvmat('ERROR',errormsg) … … 2276 2229 state_Pairs='off'; 2277 2230 state_InputFields='off'; 2231 val=get(handles.ListView,'Value'); 2232 ListViewString={''}; 2278 2233 if ~isempty(SeriesData) 2279 for ilist=1:size(InputTable,1) 2280 SeriesData.j1_series{ilist} 2281 if ~isempty(SeriesData.j1_series{ilist}) 2282 state_j='on'; 2283 end 2284 if ~isempty(SeriesData.i2_series{ilist})||~isempty(SeriesData.j2_series{ilist}) 2285 state_Pairs='on'; 2286 end 2287 if strcmp(SeriesData.FileType,'civx')||strcmp(SeriesData.FileType,'civdata') 2288 state_InputFields='on'; 2289 end 2290 end 2291 end 2292 set(handles.num_first_j,'Visible',state_j) 2293 set(handles.num_last_j,'Visible',state_j) 2294 set(handles.num_incr_j,'Visible',state_j) 2234 % ListViewString={}; 2235 for ilist=1:size(InputTable,1) 2236 if ~isempty(SeriesData.j1_series{ilist}) 2237 state_j='on'; 2238 end 2239 if ~isempty(SeriesData.i2_series{ilist})||~isempty(SeriesData.j2_series{ilist}) 2240 state_Pairs='on'; 2241 ListViewString{ilist}=num2str(ilist); 2242 if check_lines(ilist) 2243 val=ilist;%select the last pair if it is a new entry 2244 end 2245 end 2246 if strcmp(SeriesData.FileType,'civx')||strcmp(SeriesData.FileType,'civdata') 2247 state_InputFields='on'; 2248 end 2249 end 2250 end 2251 set(handles.ListView,'Value',val) 2252 set(handles.ListView,'String',ListViewString) 2253 if strcmp(state_Pairs,'on') 2254 ListView_Callback(hObject,eventdata,handles) 2255 end 2295 2256 set(handles.Pairs,'Visible',state_InputFields) 2296 2257 enable_j(handles,state_j) 2297 2258 set(handles.REFRESH_INDICES,'BackgroundColor',[1 0 0]) 2298 2259 set(handles.REFRESH_INDICES,'visible','off') 2299 2260 2300 2261 % update min and max indices for a series 2301 function [RootPath,RootFile,NomType,errormsg]=update_indices(handles,fileinput,i ndex)2262 function [RootPath,RootFile,NomType,errormsg]=update_indices(handles,fileinput,iview) 2302 2263 2303 2264 %% look for min and max indices existing in the file series and update SeriesData … … 2305 2266 [RootPath,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,Object]=find_file_series(fileinput); 2306 2267 if isempty(RootFile)&&isempty(i1_series) 2307 errormsg='no tinput file in the series';2268 errormsg='no input file in the series'; 2308 2269 return 2309 2270 end … … 2324 2285 MaxIndex_j=max(j1_series(j1_series>0)); 2325 2286 end 2326 MinIndex{i ndex,1}=MinIndex_i;2327 MinIndex{i ndex,2}=MinIndex_j;2328 MaxIndex{i ndex,1}=MaxIndex_i;2329 MaxIndex{i ndex,2}=MaxIndex_j;2287 MinIndex{iview,1}=MinIndex_i; 2288 MinIndex{iview,2}=MinIndex_j; 2289 MaxIndex{iview,1}=MaxIndex_i; 2290 MaxIndex{iview,2}=MaxIndex_j; 2330 2291 set(handles.MinIndex,'Data',MinIndex) 2331 2292 set(handles.MaxIndex,'Data',MaxIndex) 2332 2293 SeriesData=get(handles.series,'UserData'); 2333 SeriesData.i1_series{i ndex}=i1_series;2334 SeriesData.i2_series{i ndex}=i2_series;2335 SeriesData.j1_series{i ndex}=j1_series;2336 SeriesData.j2_series{i ndex}=j2_series;2337 SeriesData.FileType{i ndex}=FileType;2294 SeriesData.i1_series{iview}=i1_series; 2295 SeriesData.i2_series{iview}=i2_series; 2296 SeriesData.j1_series{iview}=j1_series; 2297 SeriesData.j2_series{iview}=j2_series; 2298 SeriesData.FileType{iview}=FileType; 2338 2299 2339 2300 %% represents the set of existing files as an image … … 2512 2473 % end 2513 2474 % show index pairs if files exist 2514 if isfield(SeriesData,'j1_series')&&(~isempty(SeriesData.i2_series{index})||~isempty(SeriesData.j2_series{index}))2515 testpair=1;2516 if ~isempty(SeriesData.i2_series{index}) %pairs with i index2517 set(handles.mode,'Value',1)2518 set(handles.mode,'String',{'series(Di)'})2519 else %pairs with j index2520 set(handles.mode,'Value',1)2521 set(handles.mode,'String',{'bursts';'series(Dj)'})2522 if nbfield2>10 || nbfield==12523 set(handles.mode,'Value',2);2524 else2525 set(handles.mode,'Value',1);2526 end2527 end2528 set(handles.mode,'Visible','on')2529 else2530 set(handles.mode,'Visible','off')2531 end2532 % if ~isempty(NomTypeCell)2533 % NomType=NomTypeCell{Val};2534 % switch NomType2535 % case {'_1-2_1', '_1-2'}2536 % set(handles.mode,'String',{'series(Di)'})2537 % set(handles.mode,'Value',1);2538 % set(handles.mode,'Visible','on')2539 % testpair=1;2540 % case {'#_ab'}2541 % set(handles.mode,'String',{'bursts'})2542 % set(handles.mode,'Value',1);2543 % testpair=1;2544 % case '_1_1-2'2545 % set(handles.mode,'String',{'bursts';'series(Dj)'})%multiple choice2546 % if ~isempty(nbfield) && ~isempty(nbfield2) && ((nbfield2>10) || (nbfield==1))2547 % set(handles.mode,'Value',2);2548 % else2549 % set(handles.mode,'Value',1);% advice 'bursts' for small bursts2550 % end2551 % set(handles.mode,'Visible','on')2552 % testpair=1;2553 % end2554 % switch NomType2555 % case {'_1_1','_1_1-2','_1-2_1','1_ab','01_ab'},% two navigation indices2556 % state_j='on';2557 % end2558 % end2559 2475 set(handles.series,'UserData',SeriesData) 2560 if testpair 2561 mode_Callback([],[], handles) 2562 else 2563 % set(handles.NomType,'String',NomTypeCell) 2564 % set(handles.j_txt,'Visible',state_j) 2565 % set(handles.num_MinIndex_j,'Visible',state_j) 2566 % set(handles.num_first_j,'Visible',state_j) 2567 % set(handles.num_incr_j,'Visible',state_j) 2568 % set(handles.num_last_j,'Visible',state_j) 2569 % set(handles.num_MaxIndex_j,'Visible',state_j) 2570 end 2476 2571 2477 2572 2478 … … 2607 2513 2608 2514 2515 % --- Executes on selection change in txt_Pairs 2516 function txt_Pairs_Callback(hObject, eventdata, handles) 2517 2518 %------------------------------------------------------------------------ 2519 % --- Executes on selection change in ListView. 2520 function ListView_Callback(hObject, eventdata, handles) 2521 %------------------------------------------------------------------------ 2522 ListViewString=get(handles.ListView,'String'); 2523 if isempty(ListViewString) 2524 ListViewString={''}; 2525 end 2526 ListViewValue=get(handles.ListView,'Value'); 2527 View=str2double(ListViewString{ListViewValue}); 2528 if isnan(View) 2529 set(handles.Pairs,'Visible','off') 2530 else 2531 set(handles.Pairs,'Visible','on') 2532 SeriesData=get(handles.series,'UserData'); 2533 if isfield(SeriesData,'j1_series')&&(~isempty(SeriesData.i2_series{View})||~isempty(SeriesData.j2_series{View})) 2534 if ~isempty(SeriesData.i2_series{View}) %pairs with i View 2535 set(handles.mode,'Value',1) 2536 set(handles.mode,'String',{'series(Di)'}) 2537 else %pairs with j View 2538 nbfield=size(SeriesData.j2_series{View},1); 2539 nbfield2=size(SeriesData.j2_series{View},2); 2540 set(handles.mode,'Value',1) 2541 set(handles.mode,'String',{'bursts';'series(Dj)'}) 2542 if nbfield2>10 || nbfield==1 2543 set(handles.mode,'Value',2); 2544 else 2545 set(handles.mode,'Value',1); 2546 end 2547 end 2548 end 2549 mode_Callback([],[], handles) 2550 end 2551 2552
Note: See TracChangeset
for help on using the changeset viewer.