Changeset 675 for trunk/src/series.m


Ignore:
Timestamp:
Aug 27, 2013, 11:25:21 PM (11 years ago)
Author:
sommeria
Message:

various bugs corrected

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r672 r675  
    122122series_ResizeFcn(hObject, eventdata, handles)%resize table according to series GUI size
    123123set(hObject,'WindowButtonDownFcn',{'mouse_down'})%allows mouse action with right button (zoom for uicontrol display)
     124set(handles.InputTable,'KeyPressFcn',{@key_press_fcn,handles})%set keyboard action function (allow action on uvmat when set_object is in front)
    124125
    125126% check default input data
     
    491492
    492493%------------------------------------------------------------------------
     494% --- 'key_press_fcn:' function activated when a key is pressed on the keyboard
     495%------------------------------------------------------------------------
     496function key_press_fcn(hObject,eventdata,handles)
     497
     498xx=double(get(handles.series,'CurrentCharacter')); %get the keyboard character
     499if 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);
     510end
     511
     512
     513%------------------------------------------------------------------------
    493514% --- Executes on button press in REFRESH.
    494515function REFRESH_Callback(hObject, eventdata, handles)
     
    508529    if ~exist(RootPath,'dir')
    509530        i1_series=[];
    510         RootPath=fileparts(RootPath); %will try the upped forlder
     531        RootPath=fileparts(RootPath); %will try the upped folder
    511532    else
    512533        [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,FileInfo,MovieObject]=...
     
    526547end
    527548set(handles.REFRESH,'Visible','off')
    528 set(handles.REFRESH_title,'Visible','off')
    529 % set(handles.REFRESH,'UserData',[])
     549%set(handles.REFRESH_title,'Visible','off')
    530550
    531551%------------------------------------------------------------------------
     
    14471467        [tild,msg1]=mkdir(OutputDir);
    14481468        if ~strcmp(msg1,'')
    1449             errormsg=['cannot create ' OutputDir ': ' msg1];%error message for directory creation
     1469            msgbox_uvmat('ERROR',['cannot create ' OutputDir ': ' msg1]);%error message for directory creation
    14501470            return
    14511471        end
     
    18311851set(handles.RUN, 'Value',0)
    18321852
    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 BATCH
    18451853
    18461854%------------------------------------------------------------------------
     
    24232431function ViewObject_Callback(hObject, eventdata, handles)
    24242432
    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
     2433UserData=get(handles.series,'UserData');
     2434hset_object=findobj(allchild(0),'Tag','set_object');
     2435if ~isempty(hset_object)
     2436    delete(hset_object)% refresh set_object if already opened
     2437end
     2438hset_object=set_object(UserData.ProjObject);
     2439set(hset_object,'Name','view_object_series')
     2440
    24402441
    24412442%------------------------------------------------------------------------
     
    24842485
    24852486if get(handles.CheckMask,'Value')
    2486     MaskData=get(handles.MaskTable,'Data');
    24872487    InputTable=get(handles.InputTable,'Data');
    24882488    nbview=size(InputTable,1);
    2489     %     MaskTable=cell(nbview,1);
    24902489    MaskTable=cell(nbview,1);%default
    24912490    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
    24922493    for iview=1:nbview
    24932494        ListMask{iview,1}=num2str(iview);
     
    24962497            if isempty(MaskData{iview})
    24972498                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
    25012526                    MaskName=uigetfile_uvmat('select a mask file:',RootPath,'image');
    25022527                end
     
    25062531        end
    25072532    end
    2508     %nbview=size(MaskTable,1);
    25092533    set(handles.MaskTable,'Data',MaskTable)
    2510     %     set(handles.MaskTable,'ColumnFormat',{MaskTable'})
    25112534    set(handles.MaskTable,'Visible','on')
    25122535    set(handles.MaskBrowse,'Visible','on')
     
    25242547%------------------------------------------------------------------------
    25252548function MaskBrowse_Callback(hObject, eventdata, handles)
     2549
    25262550InputTable=get(handles.InputTable,'Data');
    25272551iview=get(handles.ListMask,'Value');
    2528 %     MaskTable=cell(nbview,1);
    2529 
    25302552RootPath=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')
    25362553MaskName=uigetfile_uvmat('select a mask file:',RootPath,'image');
    2537 %         end
    25382554if ~isempty(MaskName)
    25392555    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)
     2558end
    25452559
    25462560%------------------------------------------------------------------------
     
    26392653InputTable=get(handles.InputTable,'Data');
    26402654filexml=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 name
    26472655if ~isempty(filexml)%abandon if no file is introduced by the browser
    26482656    Param=xml2struct(filexml);
    26492657    fill_GUI(Param,handles.series)
     2658    REFRESH_Callback([],[],handles)% refresh data relative to the input files
     2659    SeriesData=get(handles.series,'UserData');
    26502660    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
    26592670    set(handles.series,'UserData',SeriesData)
    2660     end
    26612671    ActionName_Callback([],[],handles)
    26622672end
Note: See TracChangeset for help on using the changeset viewer.