Changeset 85 for trunk/src/uvmat.m


Ignore:
Timestamp:
Apr 25, 2010, 9:46:07 PM (14 years ago)
Author:
sommeria
Message:

uvmat;fig: cleaning out of buttons for mask record
view_field, write_plot_param: improve plot by view_field (projection)
uvmat: bug fixing for yellow coloring of buttons, improve switch from velocity to images
find_field_indices: bug fix for NbDim?
name_generator: help comments improved
civ: bugs corrected for BATCH button colouring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r84 r85  
    16221622% III - MAIN REFRESH FUNCTIONS : 'FRAME PLOT'
    16231623%-------------------------------------------------------------------
    1624 %-------------------------------------------------------------------
    1625 
    1626 %Executes on button press in runplus: make one step forward and call
    1627 %run0. The step forward is along the fields series 1 or 2 depending on
    1628 %the scan_i and scan_j check box (exclusive each other)
    1629 %-------------------------------------------------------------------
     1624
     1625%-------------------------------------------------------------------
     1626% --- Executes on button press in runplus: make one step forward and call
     1627% --- run0. The step forward is along the fields series 1 or 2 depending on
     1628% --- the scan_i and scan_j check box (exclusive each other)
    16301629function runplus_Callback(hObject, eventdata, handles)
     1630%-------------------------------------------------------------------
     1631set(handles.runplus,'BackgroundColor',[1 1 0])%paint the command button in yellow
     1632drawnow
    16311633increment=str2num(get(handles.increment_scan,'String')); %get the field increment d
    16321634runpm(hObject,eventdata,handles,increment)
    1633 
    1634 %-------------------------------------------------------------------
    1635 %Executes on button press in runmin: make one step backward and call
    1636 %run0. The step backward is along the fields series 1 or 2 depending on
    1637 %the scan_i and scan_j check box (exclusive each other)
    1638 %-------------------------------------------------------------------
     1635set(handles.runplus,'BackgroundColor',[1 0 0])%paint the command button in yellow
     1636
     1637%-------------------------------------------------------------------
     1638% --- Executes on button press in runmin: make one step backward and call
     1639% --- run0. The step backward is along the fields series 1 or 2 depending on
     1640% --- the scan_i and scan_j check box (exclusive each other)
    16391641function runmin_Callback(hObject, eventdata, handles)
     1642%-------------------------------------------------------------------
     1643set(handles.runmin,'BackgroundColor',[1 1 0])%paint the command button in yellow
     1644drawnow
    16401645increment=-str2num(get(handles.increment_scan,'String')); %get the field increment d
    16411646runpm(hObject,eventdata,handles,increment)
     1647set(handles.runmin,'BackgroundColor',[1 0 0])%paint the command button in yellow
    16421648
    16431649%-------------------------------------------------------------------
     
    17031709set(handles.MovieBackward,'BusyAction','Cancel')
    17041710set(handles.MenuExportMovie,'BusyAction','Cancel')
    1705 
     1711set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command buttonback to red
     1712set(handles.Movie,'BackgroundColor',[1 0 0])%paint the command buttonback to red
     1713set(handles.MovieBackward,'BackgroundColor',[1 0 0])%paint the command buttonback to red
    17061714
    17071715%------------------------------------------------------------------
     
    18361844    else
    18371845        msgbox_uvmat('ERROR','an image or movie must be first introduced as input')
     1846        set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red
    18381847        return
    18391848    end
     
    18471856    if isempty(num_i2)   
    18481857        msgbox_uvmat('ERROR', 'a second image index i2 or j2 is needed to show the pair as a movie')
     1858        set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red
    18491859        return
    18501860    else
     
    18581868if ~exist(imaname_1,'file')
    18591869      msgbox_uvmat('ERROR',['second input open (-)  ' imaname_1 ' not found']);
     1870      set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red
    18601871      return
    18611872end
    1862 % set(handles.i2,'String',''); % indicates that the second index i2 is not used
    1863 % set(handles.j2,'String',''); % indicates that the second index i2 is not used
    18641873
    18651874%read the second image
     
    19491958function run0_Callback(hObject, eventdata, handles)
    19501959%------------------------------------------------------------------------
     1960set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow
     1961drawnow
    19511962filename=read_file_boxes(handles);
    19521963
     
    19631974      msgbox_uvmat('ERROR',errormsg);
    19641975end   
    1965 
     1976set(handles.run0,'BackgroundColor',[1 0 0])
    19661977%------------------------------------------------------------------------
    19671978% --- read the input files and refresh all the plots, including projection.
     
    19781989
    19791990%initialisation
    1980 set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow
    1981 drawnow
     1991
    19821992errormsg=[]; % default error message
    19831993abstime=[];
     
    28152825    end
    28162826end
    2817 set(handles.run0,'BackgroundColor',[1 0 0])
     2827
    28182828
    28192829
     
    30513061FileName=[FileName FileIndices FileExt];
    30523062
    3053 %----------------------------------------------
    3054 %read the data displayed for the second input rootfile windows
    3055 %-------------------------------------------------
     3063%------------------------------------------------------------------------
     3064% ---- read the data displayed for the second input rootfile windows
    30563065function [FileName_1,RootPath_1,FileBase_1,FileIndices_1,FileExt_1,SubDir_1]=read_file_boxes_1(handles)
    3057 RootPath_1=get(handles.RootPath_1,'String'); % read the data from the file1_input window
    3058 if isequal(RootPath_1,'"'),RootPath_1=get(handles.RootPath,'String'); end;
     3066%------------------------------------------------------------------------
     3067RootPath_1=get(handles.RootPath_1,'String') % read the data from the file1_input window
     3068if isequal(get(handles.RootPath_1,'Visible'),'off') || isequal(RootPath_1,'"')
     3069    RootPath_1=get(handles.RootPath,'String');
     3070end;
    30593071FileName_1=RootPath_1; %default
    30603072SubDir_1=get(handles.SubDir_1,'String');
    3061 if isequal(SubDir_1,'"')
     3073if isequal(get(handles.SubDir_1,'Visible'),'off')|| isequal(SubDir_1,'"')
    30623074    SubDir_1=get(handles.SubDir,'String');
    30633075end
    3064 if ~isempty(SubDir_1) && ~isequal(SubDir_1,'')
     3076if numel(SubDir_1)>=1
    30653077    if (isequal(SubDir_1(1),'/')|| isequal(SubDir_1(1),'\'))
    30663078        SubDir_1(1)=[]; %suppress possible / or \ separator
     
    30693081end
    30703082RootFile_1=get(handles.RootFile_1,'String');
    3071 if isequal(RootFile_1,'"'),RootFile_1=get(handles.RootFile,'String'); end;
    3072 if ~isempty(RootFile_1) && ~isequal(RootFile_1,'')
     3083if isequal(get(handles.RootFile_1,'Visible'),'off') || isequal(RootFile_1,'"')
     3084    RootFile_1=get(handles.RootFile,'String');
     3085end
     3086if numel(RootFile_1)>=1
    30733087    if ~(isequal(RootFile_1(1),'/')|isequal(RootFile_1(1),'\'))
    30743088        RootFile_1(1)=[];%suppress possible / or \ separator
     
    30773091end
    30783092FileBase_1=fullfile(RootPath_1,RootFile_1);
    3079 FileIndices_1=get(handles.FileIndex_1,'String');
     3093if isequal(get(handles.FileIndex_1,'Visible'),'off')
     3094    FileIndices_1=get(handles.FileIndex,'String');
     3095else
     3096    FileIndices_1=get(handles.FileIndex_1,'String');
     3097end
    30803098FileExt_1=get(handles.FileExt_1,'String');
    30813099if isequal(FileExt_1,'"'),FileExt_1=get(handles.FileExt,'String'); end;
    30823100FileName_1=[FileName_1 FileIndices_1 FileExt_1];
    30833101
    3084 %---------------------------------------------------
     3102%------------------------------------------------------------------------
    30853103% --- Executes on menu selection Fields
    30863104function Fields_Callback(hObject, eventdata, handles)
    3087 %-------------------------------------------------
    3088 
     3105%------------------------------------------------------------------------
    30893106list_fields=get(handles.Fields,'String');% list menu fields
    30903107index_fields=get(handles.Fields,'Value');% selected string index
     
    31123129if isequal(field,'image')
    31133130    % transform netc type to the corresponding image type
    3114     if isequal(NomType,'_i1-i2_j')||isequal(NomType,'_i_j1-j2')|| isequal(NomType,'#_ab')|| isequal(NomType,'_i1-i2')
    3115         UvData.SubDir=get(handles.SubDir,'String'); %preserve the subdir in memory
    3116         if ~isempty(UvData.SubDir) && (isequal(UvData.SubDir(1),'/')||isequal(UvData.SubDir(1),'/'))
    3117             UvData.SubDir(1)=[];
    3118         end
    3119         set(handles.SubDir,'String','')
    3120         set(handles.FileExt,'String','.png');
     3131%     if isequal(NomType,'_i1-i2_j')||isequal(NomType,'_i_j1-j2')|| isequal(NomType,'#_ab')|| isequal(NomType,'_i1-i2')
     3132%         UvData.SubDir=get(handles.SubDir,'String'); %preserve the subdir in memory
     3133%         if ~isempty(UvData.SubDir) && (isequal(UvData.SubDir(1),'/')||isequal(UvData.SubDir(1),'/'))
     3134%             UvData.SubDir(1)=[];
     3135%         end
     3136%         set(handles.SubDir,'String','')
     3137%         set(handles.FileExt,'String','.png');
    31213138        if isequal(NomType,'_i1-i2_j')||isequal(NomType,'_i_j1-j2')
    31223139            NomTypeNew='_i_j';
     
    31253142        elseif isequal(NomType,'_i1-i2')
    31263143            NomTypeNew='_i';
    3127             % TODO: look for other types
    31283144        end 
    3129     end
    3130     veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];
    3131     set_veltype_display(veltype_handles,0) % unvisible civ buttons
     3145        imagename=name_generator(FileBase,str2double(str1),str2double(str_a),'.png',NomTypeNew,1,str2double(str2),str2double(str_b),'')
     3146        if ~exist(imagename,'file')
     3147                [FileName,PathName] = uigetfile( ...
     3148           {'*.png;*.jpg;*.tif;*.avi;*.AVI;*.vol', ' (*.png, .tif, *.avi,*.vol)';
     3149            '*.jpg',' jpeg image files'; ...
     3150            '*.png','.png image files'; ...
     3151            '*.tif','.tif image files'; ...
     3152            '*.avi;*.AVI','.avi movie files'; ...
     3153            '*.vol','.volume images (png)'; ...
     3154            '*.*',  'All Files (*.*)'}, ...
     3155            'Pick an image',imagename)           
     3156            % display the selected field and related information
     3157           imagename=[PathName FileName];
     3158        end
     3159        display_file_name(hObject, eventdata, handles,imagename)%display the image
     3160        return
     3161%     end
     3162%     veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];
     3163%     set_veltype_display(veltype_handles,0) % unvisible civ buttons
    31323164else
    31333165    ext=get(handles.FileExt,'String');
    31343166    if ~isequal(ext,'.nc') %find the new NomType if the previous display was not already a netcdf file
    3135          MenuBrowse_Callback(hObject, eventdata, handles)
     3167                [FileName,PathName] = uigetfile( ...
     3168           {'*.nc', ' (*.nc)';
     3169            '*.nc',' netcdf files'; ...
     3170            '*.*',  'All Files (*.*)'}, ...
     3171            'Pick a netcdf file',FileBase)           
     3172            % display the selected field and related information
     3173           filename=[PathName FileName];
     3174        display_file_name(hObject, eventdata, handles,filename)
     3175        return
     3176       %  MenuBrowse_Callback(hObject, eventdata, handles)
    31363177    end
    31373178    if isequal(field,'vort') || isequal(field,'div') || isequal(field,'strain')
     
    31633204    set(handles.npx,'Visible','on')
    31643205    set(handles.npy,'Visible','on')
    3165 %     set(handles.fix_pair,'Value',0)
    31663206else
    31673207    set(handles.npx_title,'Visible','off')% visible npx,pxcm... buttons
     
    31693209    set(handles.npx,'Visible','off')
    31703210    set(handles.npy,'Visible','off')
    3171 %     set(handles.fix_pair,'Value',1)
    31723211end
    31733212setfield(handles);% update the field structure ('civ1'....)
     
    31953234
    31963235%read the rootfile input display
    3197 FileExt_prev=get(handles.FileExt_1,'String');
     3236[FileName,RootPath,FileBase,FileIndices,FileExt_prev]=read_file_boxes_1(handles);
     3237[P,F,str1,str2,str_a,str_b,E,NomType]=name2display(['xxx' get(handles.FileIndex,'String') FileExt_prev]);
    31983238if isempty(FileExt_prev)|isequal(FileExt_prev,'')
    31993239    FileExt_1=get(handles.FileExt,'String');
     
    32393279if isequal(field_1,'image')
    32403280    % transform netc type to the corresponding image type
    3241     set(handles.FileExt_1,'String','.png');
     3281%     set(handles.FileExt_1,'String','.png');
    32423282    if isequal(NomType_1,'_i1-i2_j')|isequal(NomType_1,'_i_j1-j2')| isequal(NomType_1,'#_ab')| isequal(NomType_1,'_i1-i2')
    32433283        UvData.SubDir_1=get(handles.SubDir_1,'String'); %preserve the subdir in memory
    3244         set(handles.SubDir_1,'String','')
     3284%         set(handles.SubDir_1,'String','')
    32453285%         set(handles.FileExt_1,'String','.png');       
    32463286        if isequal(NomType_1,'_i1-i2_j')|isequal(NomType_1,'_i_j1-j2')
     
    32523292        end 
    32533293    end
    3254     veltype_handles=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1];
    3255     set_veltype_display(veltype_handles,0) % unvisible civ buttons
     3294    imagename=name_generator(FileBase,str2double(str1),str2double(str_a),'.png',NomTypeNew,1,str2double(str2),str2double(str_b),'');
     3295    if ~exist(imagename,'file')
     3296        [FileName,PathName] = uigetfile( ...
     3297            {'*.png;*.jpg;*.tif;*.avi;*.AVI;*.vol', ' (*.png, .tif, *.avi,*.vol)';
     3298            '*.jpg',' jpeg image files'; ...
     3299            '*.png','.png image files'; ...
     3300            '*.tif','.tif image files'; ...
     3301            '*.avi;*.AVI','.avi movie files'; ...
     3302            '*.vol','.volume images (png)'; ...
     3303            '*.*',  'All Files (*.*)'}, ...
     3304            'Pick an image',imagename)
     3305        % display the selected field and related information
     3306        imagename=[PathName FileName];
     3307    end
     3308    display_file_name_1(hObject, eventdata, handles,imagename)%display the image
     3309    return
     3310%     veltype_handles=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1];
     3311%     set_veltype_display(veltype_handles,0) % unvisible civ buttons
    32563312else
    32573313    set(handles.SubDir_1,'Visible','on')
     
    47174773edit_vect_Callback(hObject, eventdata, handles)
    47184774set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
    4719 set(handles.edit_vect,'Value',0) 
    4720 edit_vect_Callback(hObject, eventdata, handles)
    4721 set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
    47224775set(handles.list_object_1,'Value',1)     
    47234776
Note: See TracChangeset for help on using the changeset viewer.