Changeset 576 for trunk/src/uvmat.m


Ignore:
Timestamp:
Mar 4, 2013, 8:13:53 AM (11 years ago)
Author:
sommeria
Message:

grid improved for civ: computation done closer to the edge. set_grid improved.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r575 r576  
    216216
    217217%% load the list of previously browsed files in menus Open, Open_1 and transform_fct
    218  dir_perso=prefdir; % path to the directory .matlab for personal data
    219  profil_perso=fullfile(dir_perso,'uvmat_perso.mat');% personal data file uvmauvmat_perso.mat' in .matlab
     218 dir_perso=prefdir; % path to the directory .matlab containing the personal data of the current user
     219 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');% personal data file uvmat_perso.mat' in .matlab
    220220 if exist(profil_perso,'file')
    221221     h=load (profil_perso);
    222222     if isfield(h,'MenuFile')% load the menu of previously opened files
    223223         for ifile=1:min(length(h.MenuFile),5)
    224              eval(['set(handles.MenuFile_' num2str(ifile) ',''Label'',h.MenuFile{ifile});'])
    225              eval(['set(handles.MenuFile_' num2str(ifile) '_1,''Label'',h.MenuFile{ifile});'])
     224             set(handles.(['MenuFile_' num2str(ifile)]),'Label',h.MenuFile{ifile});
     225             set(handles.(['MenuFile_' num2str(ifile) '_1']),'Label',h.MenuFile{ifile});
    226226         end
     227     end
     228     if isfield(h,'RootPath')
     229         set(handles.RootPath,'UserData',h.RootPath); %store the previous campaign in the UserData of RootPath
    227230     end
    228231     if isfield(h,'transform_fct') && iscell(h.transform_fct) % load the menu of transform fct set by user
     
    335338[RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
    336339oldfile=fullfile(RootPath,SubDir);
    337 if isempty(oldfile)||isequal(oldfile,'') %loads the previously stored file name and set it as default in the file_input box
    338          dir_perso=prefdir;
    339          profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
    340          if exist(profil_perso,'file')
    341               h=load (profil_perso);
    342              if isfield(h,'MenuFile_1')
    343                   oldfile=h.MenuFile_1;
    344              end
    345          end
     340if isempty(oldfile) %loads the previously stored file name and set it as default in the file_input box
     341    oldfile=get(handles.RootPath,'UserData');
    346342end
    347343[FileName, PathName] = uigetfile({'*.*','All Files(*.*)'},'Pick a file',oldfile);
     
    357353function MenuBrowseCampaign_Callback(hObject, eventdata, handles)
    358354% -----------------------------------------------------------------------
    359 CampaignPath=fileparts(fileparts(get(handles.RootPath,'String')));
     355RootPath=get(handles.RootPath,'String');
     356if isempty(RootPath)
     357    RootPath=get(handles.RootPath,'UserData');%use Rootpath recored from the personal file at uvmat opening
     358end
     359CampaignPath=fileparts(fileparts(RootPath));
    360360DirFull = uigetdir(CampaignPath,'Select a Campaign dir, then press OK');
    361361if ~ischar(DirFull)|| ~exist(DirFull,'dir')
     
    447447set(handles.MenuFile_4_1,'Label',MenuFile_4)
    448448set(handles.MenuFile_5_1,'Label',MenuFile_5)
    449 dir_perso=prefdir;
    450 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
    451 if exist(profil_perso,'file')
    452     save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-append'); %store the file names for future opening of uvmat
    453 else
    454     txt=ver('MATLAB');
    455     Release=txt.Release;
    456     relnumb=str2double(Release(3:4));
    457     if relnumb >= 14
    458         save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-V6'); %store the file names for future opening of uvmat
    459     else
    460         save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5'); %store the file names for future opening of uvmat
    461     end
    462 end
     449% dir_perso=prefdir;
     450% profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
     451% if exist(profil_perso,'file')
     452%     save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-append'); %store the file names for future opening of uvmat
     453% else
     454%     txt=ver('MATLAB');
     455%     Release=txt.Release;
     456%     relnumb=str2double(Release(3:4));
     457%     if relnumb >= 14
     458%         save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-V6'); %store the file names for future opening of uvmat
     459%     else
     460%         save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5'); %store the file names for future opening of uvmat
     461%     end
     462% end
    463463
    464464% --------------------------------------------------------------------
     
    787787end
    788788for ifile=1:min(length(MenuFile),5)
    789     eval(['set(handles.MenuFile_' num2str(ifile) ',''Label'',MenuFile{ifile});'])
    790     eval(['set(handles.MenuFile_' num2str(ifile) '_1,''Label'',MenuFile{ifile});'])
     789    set(handles.(['MenuFile_' num2str(ifile)]),'Label',MenuFile{ifile});
     790    set(handles.(['MenuFile_' num2str(ifile) '_1']),'Label',MenuFile{ifile});
    791791end
    792792dir_perso=prefdir;
    793793profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
    794794if exist(profil_perso,'file')
    795     save (profil_perso,'MenuFile','-append'); %store the file names for future opening of uvmat
     795    save (profil_perso,'MenuFile','RootPath','-append'); %store the file names for future opening of uvmat
    796796else
    797     save (profil_perso,'MenuFile','-V6'); %store the file names for future opening of uvmat
     797    save (profil_perso,'MenuFile','RootPath','-V6'); %store the file names for future opening of uvmat
    798798end
    799799
     
    14111411        choice_value=get(handles.transform_fct,'Value');
    14121412        transform_name=menu_transform{choice_value};%name of the transform fct  given by the menu 'transform_fct'
    1413 %         transform_list=get(handles.transform_fct,'UserData');
    1414 %         transform=transform_list{choice_value};
    14151413        transform=get(handles.path_transform,'UserData');
    14161414        if  ~isequal(transform_name,'') && ~isequal(transform_name,'px')
     
    14411439            axes(handles.PlotAxes)
    14421440            hold on   
    1443             size(flagmask)
    1444            % MaskData.maskhandle=image(Mask.AX,Mask.AY,imflag,'Tag','mask','HitTest','off','AlphaData',0.6*flagmask);
    14451441            MaskData.maskhandle=image(Mask.AX,Mask.AY,imflag,'Tag','mask','HitTest','off','AlphaData',0.6*ones(size(flagmask)));
    1446 %             set(MaskData.maskhandle,'AlphaData',0.6*flagmask)
    14471442            set(handles.CheckMask,'UserData',MaskData)
    14481443        end
     
    19321927
    19331928%px to phys or other transform on field
    1934 % menu_transform=get(handles.transform_fct,'String');
    1935 % choice_value=get(handles.transform_fct,'Value');
    1936 % transform_name=menu_transform{choice_value};%name of the transform fct  given by the menu 'transform_fct'
    1937 % transform_list=get(handles.transform_fct,'UserData');
    19381929transform=get(handles.path_transform,'UserData');
    19391930if  ~isempty(transform)
     
    20672058        list_fields=get(handles.FieldName,'String');% list menu fields
    20682059        FieldName= list_fields{get(handles.FieldName,'Value')}; % selected field
     2060        % if get_field... is selected, the GUI get_field will be used to enter fields
    20692061        if ~strcmp(FieldName,'get_field...')
    20702062            if get(handles.FixVelType,'Value')
     
    20732065            end
    20742066        end
     2067        % case of input vector field, get the scalar used for vector color
    20752068        if ~isempty(regexp(FieldName,'^vec('))
    20762069            list_code=get(handles.ColorCode,'String');% list menu fields
     
    21322125end
    21332126Field{1}.ZIndex=z_index; %used for multiplane 3D calibration
    2134 % end
     2127
    21352128
    21362129%% choose and read a second field FileName_1 if defined
     
    24612454end
    24622455
     2456%UvData.Field=get_bounds(UvData.Field);
    24632457
    24642458%% get bounds and mesh (needed  to propose default options for projection objects)
     
    33913385%-------------------------------------------------------
    33923386%
    3393 % UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
    33943387if isequal(get(handles.edit_vect,'Value'),1)
    33953388    test_civ2=isequal(get(handles.civ2,'BackgroundColor'),[1 1 0]);
     
    34033396    set(handles.CheckZoom,'Value',0)
    34043397    set(handles.CheckZoom,'BackgroundColor',[0.7 0.7 0.7])
    3405 %     set(handles.create,'Value',0)
    3406 %     set(handles.create,'BackgroundColor',[0 1 0])
    34073398    set(handles.edit_object,'BackgroundColor',[0.7 0.7 0.7])
    34083399    set(gcf,'Pointer','arrow')
    3409 %     UvData.MouseAction='edit_vect';
    34103400else
    34113401    set(handles.record,'Visible','off')
     
    41434133function edit_object_Callback(hObject, eventdata, handles)
    41444134%-------------------------------------------------------------------
    4145 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
    41464135hset_object=findobj(allchild(0),'Tag','set_object');
    41474136if get(handles.edit_object,'Value')
     
    49034892[RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles);
    49044893FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];
    4905 CoordList=get(handles.transform_fct,'String');
    4906 val=get(handles.transform_fct,'Value');
    4907 set_grid(FileName,CoordList{val});% call the set_object interface
     4894UvData=get(handles.uvmat,'UserData');
     4895% CoordList=get(handles.transform_fct,'String');
     4896% val=get(handles.transform_fct,'Value');
     4897set_grid(FileName,UvData.Field);% call the set_object interface
    49084898
    49094899
Note: See TracChangeset for help on using the changeset viewer.