Changeset 675 for trunk/src/series.m
- Timestamp:
- Aug 27, 2013, 11:25:21 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r672 r675 122 122 series_ResizeFcn(hObject, eventdata, handles)%resize table according to series GUI size 123 123 set(hObject,'WindowButtonDownFcn',{'mouse_down'})%allows mouse action with right button (zoom for uicontrol display) 124 set(handles.InputTable,'KeyPressFcn',{@key_press_fcn,handles})%set keyboard action function (allow action on uvmat when set_object is in front) 124 125 125 126 % check default input data … … 491 492 492 493 %------------------------------------------------------------------------ 494 % --- 'key_press_fcn:' function activated when a key is pressed on the keyboard 495 %------------------------------------------------------------------------ 496 function key_press_fcn(hObject,eventdata,handles) 497 498 xx=double(get(handles.series,'CurrentCharacter')); %get the keyboard character 499 if ismember(xx,[8 127 31])%backspace or delete, or downward 500 InputTable=get(handles.InputTable,'Data'); 501 iline=get(handles.InputTable,'UserData'); 502 if isequal(xx, 31) 503 if isequal(iline,size(InputTable,1))% arrow downward 504 InputTable=[InputTable;cell(1,size(InputTable,2))]; 505 end 506 else 507 InputTable(iline,:)=[];% suppress the current line 508 end 509 set(handles.InputTable,'Data',InputTable); 510 end 511 512 513 %------------------------------------------------------------------------ 493 514 % --- Executes on button press in REFRESH. 494 515 function REFRESH_Callback(hObject, eventdata, handles) … … 508 529 if ~exist(RootPath,'dir') 509 530 i1_series=[]; 510 RootPath=fileparts(RootPath); %will try the upped fo rlder531 RootPath=fileparts(RootPath); %will try the upped folder 511 532 else 512 533 [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,FileInfo,MovieObject]=... … … 526 547 end 527 548 set(handles.REFRESH,'Visible','off') 528 set(handles.REFRESH_title,'Visible','off') 529 % set(handles.REFRESH,'UserData',[]) 549 %set(handles.REFRESH_title,'Visible','off') 530 550 531 551 %------------------------------------------------------------------------ … … 1447 1467 [tild,msg1]=mkdir(OutputDir); 1448 1468 if ~strcmp(msg1,'') 1449 errormsg=['cannot create ' OutputDir ': ' msg1];%error message for directory creation1469 msgbox_uvmat('ERROR',['cannot create ' OutputDir ': ' msg1]);%error message for directory creation 1450 1470 return 1451 1471 end … … 1831 1851 set(handles.RUN, 'Value',0) 1832 1852 1833 % %------------------------------------------------------------------------1834 % % --- Executes on button press in BIN.1835 % function BIN_Callback(hObject, eventdata, handles)1836 % %------------------------------------------------------------------------1837 % cmd=['#!/bin/bash \n '...1838 % '#$ -cwd \n '...1839 % 'hostname && date \n '...1840 % 'umask 002 \n'...1841 % Param.xml.CivmBin ' ' Param.xml.RunTime ' ' filename_xml ' ' OutputFile '.nc'];1842 %1843 %------------------------------------------------------------------------1844 % --- Main launch command, called by RUN and BATCH1845 1853 1846 1854 %------------------------------------------------------------------------ … … 2423 2431 function ViewObject_Callback(hObject, eventdata, handles) 2424 2432 2425 % if get(handles.ViewObject,'Value') 2426 % set(handles.EditObject,'Value',0) 2427 UserData=get(handles.series,'UserData'); 2428 hset_object=findobj(allchild(0),'Tag','set_object'); 2429 if ~isempty(hset_object) 2430 delete(hset_object)% refresh set_object if already opened 2431 end 2432 hset_object=set_object(UserData.ProjObject); 2433 set(hset_object,'Name','view_object_series') 2434 % else 2435 % hset_object=findobj(allchild(0),'Tag','set_object'); 2436 % if ~isempty(hset_object) 2437 % delete(hset_object) 2438 % end 2439 % end 2433 UserData=get(handles.series,'UserData'); 2434 hset_object=findobj(allchild(0),'Tag','set_object'); 2435 if ~isempty(hset_object) 2436 delete(hset_object)% refresh set_object if already opened 2437 end 2438 hset_object=set_object(UserData.ProjObject); 2439 set(hset_object,'Name','view_object_series') 2440 2440 2441 2441 2442 %------------------------------------------------------------------------ … … 2484 2485 2485 2486 if get(handles.CheckMask,'Value') 2486 MaskData=get(handles.MaskTable,'Data');2487 2487 InputTable=get(handles.InputTable,'Data'); 2488 2488 nbview=size(InputTable,1); 2489 % MaskTable=cell(nbview,1);2490 2489 MaskTable=cell(nbview,1);%default 2491 2490 ListMask=cell(nbview,1);%default 2491 MaskData=get(handles.MaskTable,'Data'); 2492 MaskData(size(MaskData,1):nbview,1)=cell(size(MaskData,1):nbview,1);%complement if undefined lines 2492 2493 for iview=1:nbview 2493 2494 ListMask{iview,1}=num2str(iview); … … 2496 2497 if isempty(MaskData{iview}) 2497 2498 SubDir=InputTable{iview,2}; 2498 MaskSubDir=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.' 2499 MaskName=fullfile(RootPath,[MaskSubDir '.mask'],'mask_1.png'); 2500 if ~exist(MaskName,'file') 2499 MaskPath=fullfile(RootPath,[regexprep(SubDir,'\..*','') '.mask']);%take the root part of SubDir, before the first dot '.' 2500 if exist(MaskPath,'dir') 2501 ListStruct=dir(MaskPath);%look for a mask file 2502 ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray 2503 check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files 2504 ListFiles=ListCells(1,:);%list of file and dri names 2505 ListFiles=ListFiles(~check_dir);%list of file names (excluding dir) 2506 mdetect=0; 2507 if ~isempty(ListFiles) 2508 for ifile=1:numel(ListFiles) 2509 [tild,tild,MaskFile{ifile},i1_series,i2_series,j1_series,j2_series,MaskNomType,MaskFileType]=find_file_series(MaskPath,ListFiles{ifile},0); 2510 if strcmp(MaskFileType,'image') && isempty(i2_series) && isempty(j2_series) 2511 mdetect=1; 2512 MaskName=ListFiles{ifile}; 2513 end 2514 if ~strcmp(MaskFile{ifile},MaskFile{1}) 2515 mdetect=0;% cancel detection test in case of multiple masks, use the brower for selection 2516 break 2517 end 2518 end 2519 end 2520 if mdetect==1 2521 MaskName=fullfile(MaskPath,'mask_1.png'); 2522 else 2523 MaskName=uigetfile_uvmat('select a mask file:',MaskPath,'image'); 2524 end 2525 else 2501 2526 MaskName=uigetfile_uvmat('select a mask file:',RootPath,'image'); 2502 2527 end … … 2506 2531 end 2507 2532 end 2508 %nbview=size(MaskTable,1);2509 2533 set(handles.MaskTable,'Data',MaskTable) 2510 % set(handles.MaskTable,'ColumnFormat',{MaskTable'})2511 2534 set(handles.MaskTable,'Visible','on') 2512 2535 set(handles.MaskBrowse,'Visible','on') … … 2524 2547 %------------------------------------------------------------------------ 2525 2548 function MaskBrowse_Callback(hObject, eventdata, handles) 2549 2526 2550 InputTable=get(handles.InputTable,'Data'); 2527 2551 iview=get(handles.ListMask,'Value'); 2528 % MaskTable=cell(nbview,1);2529 2530 2552 RootPath=InputTable{iview,1}; 2531 % if ~isempty(RootPath)2532 % SubDir=InputTable{iview,2};2533 % MaskSubDir=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.'2534 % MaskName=fullfile(RootPath,[MaskSubDir '.mask'],'mask_1.png');2535 % if ~exist(MaskName,'file')2536 2553 MaskName=uigetfile_uvmat('select a mask file:',RootPath,'image'); 2537 % end2538 2554 if ~isempty(MaskName) 2539 2555 MaskTable=get(handles.MaskTable,'Data'); 2540 MaskTable{iview,1}=MaskName ; 2541 % end 2542 set(handles.MaskTable,'Data',MaskTable) 2543 end 2544 % set(handles.MaskTable,'ColumnFormat',{MaskTable'}) 2556 MaskTable{iview,1}=MaskName ; 2557 set(handles.MaskTable,'Data',MaskTable) 2558 end 2545 2559 2546 2560 %------------------------------------------------------------------------ … … 2639 2653 InputTable=get(handles.InputTable,'Data'); 2640 2654 filexml=uigetfile_uvmat('pick a xml parameter file',InputTable{1,1},'.xml'); 2641 % [FileName, PathName] = uigetfile( ...2642 % {'*.xml', ' (*.xml)';2643 % '*.xml', '.xml files '; ...2644 % '*.*', 'All Files (*.*)'}, ...2645 % 'Pick a file',InputTable{1,1});2646 % filexml=[PathName FileName];%complete file name2647 2655 if ~isempty(filexml)%abandon if no file is introduced by the browser 2648 2656 Param=xml2struct(filexml); 2649 2657 fill_GUI(Param,handles.series) 2658 REFRESH_Callback([],[],handles)% refresh data relative to the input files 2659 SeriesData=get(handles.series,'UserData'); 2650 2660 if isfield(Param,'ActionInput') 2651 set(handles.ActionInput,'Visible','on') 2652 set(handles.ActionInput_title,'Visible','on') 2653 set(handles.ActionInputView,'Visible','on') 2654 set(handles.ActionInputView,'Value',0) 2655 %set(handles.ActionInput,'String',ActionName) 2656 % ParamOut.ActionInput.Program=ActionName; % record the program in ActionInput 2657 SeriesData=get(handles.series,'UserData'); 2658 SeriesData.ActionInput=Param.ActionInput; 2661 set(handles.ActionInput,'Visible','on') 2662 set(handles.ActionInput_title,'Visible','on') 2663 set(handles.ActionInputView,'Visible','on') 2664 set(handles.ActionInputView,'Value',0) 2665 SeriesData.ActionInput=Param.ActionInput; 2666 end 2667 if isfield(Param,'ProjObject') 2668 SeriesData.ProjObject=Param.ProjObject; 2669 end 2659 2670 set(handles.series,'UserData',SeriesData) 2660 end2661 2671 ActionName_Callback([],[],handles) 2662 2672 end
Note: See TracChangeset
for help on using the changeset viewer.