Changeset 508


Ignore:
Timestamp:
Jul 31, 2012, 6:55:39 PM (9 years ago)
Author:
sommeria
Message:

various improvements

Location:
trunk/src
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/check_field_structure.m

    r406 r508  
    2828    nbfield=numel(Data.ListVarName);
    2929else
    30     errormsg='input field does not contain the cell array of variable names .ListVarNames';
     30    errormsg='input field does not contain the cell array of variable names .ListVarName';
    3131    return
    3232end
  • trunk/src/datatree_browser.m

    r507 r508  
    8080        set(handles.UpdateLink,'String','create_link')
    8181        set(handles.MarkupDir,'Visible','on')
    82 
     82       
    8383    else% opening by uvmat/Open
    8484        InputDir=regexprep(InputName,'.xml$','');
     
    9494                set(handles.MarkupDir,'String','CreateLink')
    9595            end
    96         end
    97                 FillExperiments(handles)
    98         set(handles.OK,'Visible','on')
    99         drawnow
    100        
     96        end     
    10197    end
     98    FillExperiments(handles)
     99    set(handles.OK,'Visible','on')
     100    drawnow
    102101end
    103102
     
    196195MirrorPath='';
    197196if strcmp(get(handles.LinkDir,'Visible'),'on')
    198 MirrorPath=get(handles.LinkDir,'String');
     197    MirrorPath=get(handles.LinkDir,'String');
    199198end
    200199ListExperiments=get(handles.ListExperiments,'String');
    201200if isequal(get(handles.ListExperiments,'Value'),1)
    202     ListExperiments=ListExperiments(2:end); %choose all experiments
     201    ListExperiments=ListExperiments(2:end); %choose all experiments if the first line '*' has been selected
    203202else
    204203    ListExperiments=ListExperiments(get(handles.ListExperiments,'Value'));
     
    206205ListDevices={};
    207206
     207%% loop on the list of selected experiments
    208208for iexp=1:numel(ListExperiments)
    209     hdir=dir(fullfile(SourcePath,ListExperiments{iexp})); %list files and dirs
     209   
     210    % update the directory of the sources and update the links in the case of a link dir
     211    hdir=dir(fullfile(SourcePath,ListExperiments{iexp})); %list files and folders in the source
    210212    for ilist=1:length(hdir)
    211213        Device=hdir(ilist).name;
     
    213215            if ~isempty(MirrorPath)% we list the links to the data directories of files
    214216                link=fullfile(MirrorPath,ListExperiments{iexp},Device);
    215                 if ~exist(link)
     217                if ~exist(link)% create a link if it does not exist
    216218                    source=fullfile(SourcePath,ListExperiments{iexp},Device);
    217219                    system(['ln -s ' source ' ' link])%TODO translate for DOS
     
    228230        end
    229231    end
    230 end
     232   
     233    % check for dir and files in the link dir which do not exist in the source dir
     234    if ~isempty(MirrorPath)
     235        hdir=dir(fullfile(MirrorPath,ListExperiments{iexp})); %list files and folders in the link dir
     236        for ilist=1:length(hdir)
     237            Device=hdir(ilist).name;
     238            if ~isequal(Device(1),'.')
     239                if hdir(ilist).isdir
     240                    Device=[Device '/'];
     241                end
     242                check_list=strcmp(Device,ListDevices) | strcmp(['@' Device],ListDevices);
     243                if isempty(find(check_list))
     244                    ListDevices=[ListDevices;Device];
     245                end
     246            end
     247        end
     248    end
     249end
     250
     251%% display the updated list, keeping track of the previously selected item
     252PreviousList=get(handles.ListDevices,'String');
     253NewValue=[];
     254if ~isempty(PreviousList)&&iscell(PreviousList)
     255    PreviousDevice=PreviousList{get(handles.ListDevices,'Value')};
     256    NewValue=find(strcmp(PreviousDevice,ListDevices));
     257end
     258if isempty(NewValue)
     259    NewValue=1;
     260end
     261set(handles.ListDevices,'Value',NewValue)
    231262set(handles.ListDevices,'String',ListDevices)
    232263
     
    237268%------------------------------------------------------------------------   
    238269list_val=get(handles.ListExperiments,'Value');
    239 if numel(list_val)~=1
    240     msgbox_uvmat('ERROR','select a single experiment')
     270if isequal(list_val,1) || numel(list_val)~=1
     271    msgbox_uvmat('ERROR','select a single experiment in the column ''Experiments''')
    241272    return
    242273end
     
    253284Device=ListDevices{get(handles.ListDevices,'Value')};
    254285Device=regexprep(Device,'^@','');
     286
     287%% open the selected file
     288% case of a directory, open a file inside
    255289if strcmp(Device(end),'/')
    256290    DataDir=fullfile(RootPath,Experiment,Device(1:end-1));
    257291    DirList=dir(DataDir);
    258292    for ilist=1:numel(DirList)
    259         [tild,tild,FileExt]=fileparts(DirList(ilist).name);
    260         FileExt=regexprep(FileExt,'^.','');
    261         if ~isempty(FileExt) && (~isempty(imformats(FileExt))||strcmp(lower(FileExt),'avi')||strcmp(lower(FileExt),'nc'))
    262             uvmat(fullfile(DataDir,DirList(ilist).name))
    263             return
     293        if ~DirList(ilist).isdir
     294            [tild,tild,FileExt]=fileparts(DirList(ilist).name);
     295            FileExt=regexprep(FileExt,'^.','');
     296            if ~isempty(FileExt) && (~isempty(imformats(FileExt))||strcmp(lower(FileExt),'avi')||strcmp(lower(FileExt),'nc'))
     297                uvmat(fullfile(DataDir,DirList(ilist).name))
     298                return
     299            end
    264300        end
    265301    end
    266 end
    267 %
    268 % set(handles.ListRecords,'Value',1)
    269 % set(handles.ListXml,'Value',1)
    270 % ListDevices=get(handles.ListDevices,'String');
    271 % list_val=get(handles.ListDevices,'Value');
    272 % if isequal(list_val,1)
    273 %     ListDevices=ListDevices(2:end);
    274 % else
    275 %     ListDevices=ListDevices(list_val);
    276 % end
    277 % [ListDevices,ListRecords,ListXml]=ListDir(CurrentPath,ListExperiments,ListDevices,{});
    278 % set(handles.ListRecords,'String',[{'*'};ListRecords'])
    279 % set(handles.ListXml,'String',[{'*'};ListXml'])
     302    % open browser if no valid input file has been detected
     303    [FileName, PathName] = uigetfile( ...
     304            { '*.*', 'All Files (*.*)'}, ...
     305            'Pick a mask file *.png',DataDir);
     306    if ~isempty(FileName)
     307        uvmat(fullfile(PathName,FileName));
     308        return
     309    end
     310else %case of a file
     311    uvmat(fullfile(RootPath,Experiment,Device))
     312    return
     313end
     314
    280315
    281316
  • trunk/src/editxml.m

    r248 r508  
    5555% set(handles.replicate,'String',['copy';'<---'])
    5656if nargin
    57     CurrentFile=varargin{1}
     57    CurrentFile=varargin{1};
    5858else
    5959    CurrentFile=[];
     
    330330    head_name=get(t,1,'name');
    331331    %Path to shemas:
    332     path_uvmat=which('editxml');% check the path detected for source file uvmat
    333     path_UVMAT=fileparts(path_uvmat); %path to UVMAT
     332    path_uvmat=fileparts(which('editxml'));% check the path detected for source file uvmat
     333    % path_UVMAT=fileparts(path_uvmat); %path to UVMAT
    334334    %     xmlparam=fullfile(path_UVMAT,'PARAM.xml');
    335     xmlparam='PARAM.xml'; %will find PARAM.xml whose path is set in priority
    336     if exist(xmlparam,'file')
    337         tparam=xmltree(xmlparam);
    338         sparam=convert(tparam);
    339         if isfield(sparam,'SchemaPath')
    340             schemafile=[fullfile(sparam.SchemaPath,head_name) '.xsd'];           
    341             if ~exist(schemafile,'file')
    342                 schemafile=fullfile(path_UVMAT,schemafile);%look for relative path definition
    343             end
    344             if exist(schemafile,'file')
    345                 xs=xmltree(schemafile);
    346             else
    347                 msgbox_uvmat('ERROR',['The needed xml schema  ' sparam.SchemaPath ' is not found, check the file PARAM.xml'])
    348                 [FileName, PathName]=uigetfile( ...
    349                     {'*.xsd', '(*.xsd)';
    350                     '*.xsd',  '.xsd files '; ...
    351                     '*.*',  'All Files (*.*)'}, ...
    352                     'Pick a .xsd schema' ,schemafile); %file browser
    353                 if ischar(PathName) && ischar(FileName) && exist(fullfile(PathName,FileName),'file')
    354                     DataIn.Schema=fullfile(PathName,FileName);
    355                     xs=xmltree(DataIn.Schema);%open the associated schema file
    356                 else
    357                     xs=[];
    358                 end
    359             end
    360         end
    361     end
     335    %     xmlparam='PARAM.xml'; %will find PARAM.xml whose path is set in priority
     336    %     if exist(xmlparam,'file')
     337    %         tparam=xmltree(xmlparam);
     338    %         sparam=convert(tparam);
     339    %         if isfield(sparam,'SchemaPath')
     340    schemafile=[fullfile(path_uvmat,'xml_shemas',head_name) '.xsd'];
     341    if ~exist(schemafile,'file')
     342        schemafile=fullfile(path_UVMAT,schemafile);%look for relative path definition
     343    end
     344    if exist(schemafile,'file')
     345        xs=xmltree(schemafile);
     346    else
     347        msgbox_uvmat('ERROR',['The needed xml schema  ' sparam.SchemaPath ' is not found, check the file PARAM.xml'])
     348        [FileName, PathName]=uigetfile( ...
     349            {'*.xsd', '(*.xsd)';
     350            '*.xsd',  '.xsd files '; ...
     351            '*.*',  'All Files (*.*)'}, ...
     352            'Pick a .xsd schema' ,schemafile); %file browser
     353        if ischar(PathName) && ischar(FileName) && exist(fullfile(PathName,FileName),'file')
     354            DataIn.Schema=fullfile(PathName,FileName);
     355            xs=xmltree(DataIn.Schema);%open the associated schema file
     356        else
     357            xs=[];
     358        end
     359    end
     360    %         end
     361    %     end
    362362end
    363363DataIn.CurrentUid=1;
  • trunk/src/set_object.m

    r491 r508  
    417417function PLOT_Callback(hObject, eventdata, handles)
    418418
     419set(handles.PLOT,'BackgroundColor',[1 1 0])
     420drawnow
     421
    419422%% read the object parameters in the GUI set_object
    420423ObjectData=read_GUI(handles.set_object);%read the parameters defining the object in the GUI set_object
     
    482485    PlotType='text';
    483486else
     487    % create tps coeff if needed for ProjMode 'filter'
     488    if strcmp(ObjectData.ProjMode,'filter')&&~isfield(UvData.Field,'Coord_tps')     
     489        UvData.Field=calc_tps(UvData.Field);
     490    end
    484491    [ProjData,errormsg]= proj_field(UvData.Field,ObjectData);%project the current field of uvmat on ObjectData
    485492    if ~isempty(errormsg)
    486493        msgbox_uvmat('ERROR', errormsg)
     494        set(handles.PLOT,'enable','on')
    487495        return
    488496    end   
     
    546554set(hhuvmat.edit_object,'BackgroundColor',[1 1 0]);% paint the edit text in yellow
    547555set(hhuvmat.ViewField,'Value',1)
    548 
     556% set(handles.PLOT,'enable','on')
     557set(handles.PLOT,'BackgroundColor',[1 0 0])
    549558%------------------------------------------------------------------------
    550559% --- Executes on button press in MenuCoord.
  • trunk/src/uvmat.m

    r507 r508  
    232232
    233233%% refresh projection plane
    234 set(handles.ListObject,'Value',1)% default: empty projection objectproj_field
    235 set(handles.ListObject,'String',{'plane'})
    236 set(handles.ListObject_1,'Value',1)% default: empty projection objectproj_field
    237 set(handles.ListObject_1,'String',{'plane'})
     234% set(handles.ListObject,'Value',1)% default: empty projection objectproj_field
     235% set(handles.ListObject,'String',{''})
     236% set(handles.ListObject_1,'Value',1)% default: empty projection objectproj_field
     237% set(handles.ListObject_1,'String',{''})
    238238set(handles.Fields,'Value',1)
    239239set(handles.Fields,'string',{''})
     
    685685    case 'xml'                % edit xml files
    686686        t=xmltree(fileinput);
     687        % the xml file marks a project or project link, open datatree_browser
    687688        if strcmp(get(t,1,'name'),'Project')&& exist(regexprep(fileinput,'.xml$',''),'dir')
    688689            datatree_browser(fileinput)
    689         else
     690        else % other xml file, open the xml editor
    690691            editxml(fileinput);
    691692        end
    692         %             if exist(regexprep(fileinput,'.project.xml$','.link'),'dir')
    693         %                 datatree_browser(regexprep(fileinput,'.project.xml$','.link'))
    694         %                 check_project=1;
    695         %         elseif exist(regexprep(fileinput,'.project.xml$',''),'dir')
    696         %                 datatree_browser(regexprep(fileinput,'.project.xml$',''))
    697         %                 check_project=1;
    698         %             end
    699         %         end
    700         %         if ~check_project
    701         %         editxml(fileinput);
    702     case 'xls'
     693    case 'xls'% Excel file opended by editxml
    703694        editxml(fileinput);
    704695    otherwise
     
    833824    return
    834825end
    835 % nbfield=[];%default
    836 % nbfield_j=[];%default
    837826
    838827%% read timing and total frame number from the current file (movie files) !! may be overrid by xml file
     
    849838    imainfo=get(VideoObject);
    850839    testima=1;
    851 %     nbfield_j=1;
    852840    TimeUnit='s';
    853841    if isempty(j1_series); %frame index along i
     
    987975            set(handles.transform_fct,'Value',2); % phys transform by default if fixedLimits is off
    988976        end
    989         if isfield(GeometryCalib,'SliceCoord')
    990            
     977        if isfield(GeometryCalib,'SliceCoord')           
    991978           siz=size(GeometryCalib.SliceCoord);
    992979           if siz(1)>1
     
    10991086end
    11001087
    1101 %% view the field 
    1102 run0_Callback([],[], handles); %view field
     1088%% apply the effect of the transform fct and view the field 
     1089transform_fct_Callback([],[],handles)
     1090%run0_Callback([],[], handles); %view field
    11031091mask_test=get(handles.CheckMask,'value');
    11041092if mask_test
     
    19351923
    19361924%% determine the main input file information for action
    1937 FileType=[];%default
     1925% UvData.FileType{1}=[];%default
    19381926if ~exist(FileName,'file')
    19391927    errormsg=['input file ' FileName ' does not exist'];
     
    19451933    NomType_1=get(handles.NomType_1,'String');
    19461934end
    1947 % NomType=get(handles.FileIndex,'UserData');
    19481935%update the z position index
    19491936nbslice_str=get(handles.num_NbSlice,'String');
     
    19721959    case {'civx','civdata','netcdf'};
    19731960        list_fields=get(handles.Fields,'String');% list menu fields
    1974 %          index_fields=get(handles.Fields,'Value');% selected string index
    19751961        FieldName= list_fields{get(handles.Fields,'Value')}; % selected field
    19761962        if ~strcmp(FieldName,'get_field...')
     
    22822268set(handles.abs_time,'String',num2str(abstime,5))
    22832269set(handles.abs_time_1,'String',num2str(abstime_1,5))
    2284 % if testimedoc && isfield(UvData,'dt')
    2285 %     dt=UvData.dt;
    2286 % end
    22872270if isempty(dt)||isequal(dt,0)
    22882271    set(handles.Dt_txt,'String','')
     
    23272310    end
    23282311end
    2329     %% check whether tps is needed, then calculate tps coefficients if needed
     2312
     2313%% check whether tps is needed, then calculate tps coefficients if needed
    23302314check_proj_tps=0;
    23312315if isfield(UvData,'Object')&& (strcmp(UvData.FileType{1},'civdata')||strcmp(UvData.FileType{1},'civx'))
     
    23392323check_tps=0;         
    23402324if strcmp(UvData.FileType{1},'civdata')&&~strcmp(ParamOut.FieldName,'velocity')&&~strcmp(ParamOut.FieldName,'get_field...')
    2341        check_tps=1;
     2325       check_tps=1;%tps needed to get the requested field
    23422326end
    23432327if (check_tps ||check_proj_tps)&&~isfield(Field{1},'Coord_tps')
    2344     SubDomain=1000; %default, estimated nbre of vectors in a subdomain used for tps
    2345     if isfield(Field{1},'SubDomain')
    2346         SubDomain=Field{1}.SubDomain;%
    2347     end
    2348     [Field{1}.SubRange,Field{1}.NbSites,Field{1}.Coord_tps,Field{1}.U_tps,Field{1}.V_tps,tild,U_smooth,V_smooth,W_smooth,FF] =...
    2349        filter_tps([Field{1}.X(Field{1}.FF==0) Field{1}.Y(Field{1}.FF==0)],Field{1}.U(Field{1}.FF==0),Field{1}.V(Field{1}.FF==0),[],SubDomain,0);
    2350     nbvar=numel(Field{1}.ListVarName);
    2351     Field{1}.ListVarName=[Field{1}.ListVarName {'SubRange','NbSites','Coord_tps','U_tps','V_tps'}];
    2352     Field{1}.VarDimName=[Field{1}.VarDimName {{'nb_coord','nb_bounds','nb_subdomain'},{'nb_subdomain'},...
    2353         {'nb_tps','nb_coord','nb_subdomain'},{'nb_tps','nb_subdomain'},{'nb_tps','nb_subdomain'}}];
    2354     Field{1}.VarAttribute{nbvar+3}.Role='coord_tps';
    2355     Field{1}.VarAttribute{nbvar+4}.Role='vector_x_tps';
    2356     Field{1}.VarAttribute{nbvar+5}.Role='vector_y_tps';
    2357     if isfield(Field{1},'ListDimName')%cleaning
    2358         Field{1}=rmfield(Field{1},'ListDimName');
    2359     end
    2360     if isfield(Field{1},'DimValue')%cleaning
    2361         Field{1}=rmfield(Field{1},'DimValue');
    2362     end
    2363 end
     2328    Field{1}=calc_tps(Field{1});
     2329end
     2330Field{1}.FieldList=[{ParamOut.FieldName} {ParamOut.ColorVar}];
    23642331
    23652332%% calculate scalar
    23662333if isstruct(ParamOut)&&~strcmp(ParamOut.FieldName,'get_field...')&& (strcmp(UvData.FileType{1},'civdata')||strcmp(UvData.FileType{1},'civx'))...
    23672334         &&~strcmp(ParamOut.FieldName,'velocity') && ~strcmp(ParamOut.FieldName,'get_field...')
    2368     if check_proj_tps
    2369         Field{1}.FieldList=[{ParamOut.FieldName} {ParamOut.ColorVar}];
    2370     else
     2335    if ~check_proj_tps
    23712336        Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1});
    23722337    end
     
    23822347
    23832348%% combine the two input fields (e.g. substract velocity fields)
    2384 %Field{1}.FieldList=[{ParamOut.FieldName} {ParamOut.ColorVar}];
    23852349if numel(Field)==2
    23862350   [UvData.Field,errormsg]=sub_field(Field{1},Field{2}); 
     
    25112475    end
    25122476    % default projection plane
    2513     if ~isfield(UvData,'Object')
     2477    if ~isfield(UvData,'Object')||isempty(UvData.Object{1})
    25142478        UvData.Object{1}.Type='plane';%main plotting plane
    25152479        UvData.Object{1}.ProjMode='projection';%main plotting plane
     
    25762540    [PlotType,PlotParamOut]=plot_field(UvData.Field,handles.axes3,read_GUI(handles.uvmat));
    25772541    write_plot_param(handles,PlotParamOut) %update the auto plot parameters
    2578 %     if isfield(Field,'Mesh')&&~isempty(Field.Mesh)
    2579 %         ObjectData.Mesh=Field.Mesh; % gives an estimated mesh size (useful for mouse action on the plot)
    2580 %     end
    25812542   
    25822543%% 2D or 3D fields are generally projected
     
    25902551    list_object=get(handles.ListObject_1,'String');
    25912552    if isequal(list_object,{''})%refresh list of objects if the menu is empty
    2592         UvData.Object={[]};
     2553        set(handles.ListObject,'Value',1)
     2554        set(handles.ListObject,'String',{'plane'})
     2555        UvData.Object{1}.Type='plane';%main plotting plane
     2556        UvData.Object{1}.ProjMode='projection';%main plotting plane
     2557        UvData.Object{1}.DisplayHandle.uvmat=[]; %plane not visible in uvmat
     2558        UvData.Object{1}.DisplayHandle.view_field=[]; %plane not visible in uvmat
    25932559        set(handles.ListObject_1,'Value',1)
     2560        set(handles.ListObject_1,'String',{'plane'})
    25942561    end
    25952562    IndexObj(1)=get(handles.ListObject_1,'Value');%selected projection object for main view
     
    26362603    for imap=1:numel(IndexObj)
    26372604        iobj=IndexObj(imap);
    2638         %      if imap==2 || check_proj==0  % field not yet projected) && ~isfield(UvData.Object{iobj},'Type')% case with no projection (only for the first empty object)
    2639         % %          [ObjectData,errormsg]=calc_field(UvData.Field.FieldList,UvData.Field);
    2640         % %      else
    26412605        [ObjectData,errormsg]=proj_field(UvData.Field,UvData.Object{iobj});% project field on the object
    2642         %      end
    26432606        if ~isempty(errormsg)
    26442607            return
     
    27062669                end
    27072670            end
    2708 %             if isequal(PlotType,'none')
    2709 %                 hget_field=findobj(allchild(0),'name','get_field');
    2710 %                 if isempty(hget_field)
    2711 %                     get_field(FileName)% the projected field cannot be automatically plotted: use get_field to specify the variablesdelete(hget_field)
    2712 %                 end
    2713 %                 errormsg='The field defined by get_field cannot be plotted';
    2714 %                 return
    2715 %             end
    27162671        end
    27172672    end
     
    34243379else
    34253380    set(handles.VOLUME,'BackgroundColor',[0 1 0])
    3426     UvData.MouseAction='none';
     3381%     UvData.MouseAction='none';
    34273382end
    34283383set(handles.uvmat,'UserData',UvData)
     
    34523407    set(handles.record,'Visible','off')
    34533408    set(handles.edit_vect,'BackgroundColor',[0.7 0.7 0.7])
    3454 %     UvData.MouseAction='none';
    3455 end
    3456 % set(handles.uvmat,'UserData',UvData)
     3409end
    34573410
    34583411%----------------------------------------------
     
    35463499%-------------------------------------------------------------
    35473500% --- Executes on selection change in transform_fct.
     3501
    35483502function transform_fct_Callback(hObject, eventdata, handles)
    35493503%-------------------------------------------------------------
    35503504UvData=get(handles.uvmat,'UserData');
    3551 menu=get(handles.transform_fct,'String');
     3505menu=get(handles.transform_fct,'String');refresh
    35523506ichoice=get(handles.transform_fct,'Value');%item number in the menu
    35533507transform_name=menu{ichoice};% choice of the transform fct
     
    35553509
    35563510%% add a new item to the menu if the option 'more...' has been selected
     3511prev_path=fullfile(get(handles.path_transform,'String'));
     3512if ~exist(prev_path,'dir')
     3513    prev_path=fullfile(fileparts(which('uvmat')),'transform_field');
     3514end
    35573515if strcmp(transform_name,'more...');
    35583516    [FileName, PathName] = uigetfile( ...
     
    35603518        '*.m',  '.m files '; ...
    35613519        '*.*', 'All Files (*.*)'}, ...
    3562         'Pick the transform function', get(handles.path_transform,'String'));
     3520        'Pick the transform function', prev_path);
    35633521    path_transform_fct =fullfile(PathName,FileName);
    35643522    if ~exist(path_transform_fct,'file')% cancel has been activated
     
    35773535    end
    35783536    list_path{ichoice}=PathName;%update the list fo fct paths
     3537    set(handles.transform_fct,'String',menu)
     3538    set(handles.transform_fct,'Value',ichoice)
    35793539   
    35803540    % save the new menu in the personal file 'uvmat_perso.mat'
     
    35843544        nb_builtin=UvData.OpenParam.NbBuiltin;% number of 'builtin' (basic) transform fcts in uvmat
    35853545        for ilist=nb_builtin+1:numel(list_path)
    3586             transform_fct{ilist-nb_builtin}=fullfile(list_path{ilist},menu{ilist});
     3546            transform_fct{ilist-nb_builtin}=[fullfile(list_path{ilist},menu{ilist}) '.m'];
    35873547        end
    35883548        save (profil_perso,'transform_fct','-append'); %store the root name for future opening of uvmat
     
    36033563    cd(current_dir)
    36043564end
     3565set(handles.path_transform,'String',list_path{ichoice})
    36053566set(handles.path_transform,'UserData',transform_handle)
    36063567
     
    36183579
    36193580%% adapt the GUI to the input/output conditions of the selected transform fct
    3620 if isempty(list_path{ichoice})% case of no selected fct
    3621     DataOut=[];
    3622 else
    3623     if nargin(transform_handle)>1
    3624         if isfield(UvData,'XmlData')&&~isempty(UvData.XmlData)
    3625             XmlData=UvData.XmlData{1};
    3626             DataOut=feval(transform_handle,'*',XmlData);
    3627         end
     3581DataOut=[];
     3582CoordUnit='';
     3583CoordUnitPrev='';
     3584if isfield(UvData,'Field')&&isfield(UvData.Field,'CoordUnit')
     3585    CoordUnitPrev=UvData.Field.CoordUnit;
     3586end
     3587if ~isempty(list_path{ichoice})
     3588    if nargin(transform_handle)>1 && isfield(UvData,'XmlData')&&~isempty(UvData.XmlData)
     3589        XmlData=UvData.XmlData{1};
     3590        DataOut=feval(transform_handle,'*',XmlData);
     3591        if isfield(DataOut,'CoordUnit')
     3592            CoordUnit=DataOut.CoordUnit;
     3593        end
     3594        if isfield(DataOut,'InputFieldType')
     3595            UvData.InputFieldType=DataOut.InputFieldType;
     3596        end
     3597    else
     3598        DataOut=feval(transform_handle,'*');
    36283599    end
    36293600end
     
    36323603set(handles.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7])
    36333604
    3634 %% execute the function to set input an output conditions
    3635 
    3636 
    3637 %% delete drawn objects
    3638 hother=findobj('Tag','proj_object');%find all the proj objects
    3639 for iobj=1:length(hother)
    3640     delete_object(hother(iobj))
    3641 end
    3642 hother=findobj('Tag','DeformPoint');%find all the proj objects
    3643 for iobj=1:length(hother)
    3644     delete_object(hother(iobj))
    3645 end
    3646 hh=findobj('Tag','calib_points');
    3647 if ~isempty(hh)
    3648     delete(hh)
    3649 end
    3650 hhh=findobj('Tag','calib_marker');
    3651 if ~isempty(hhh)
    3652     delete(hhh)
    3653 end
    3654 if isfield(UvData,'Object')
    3655      UvData.Object=UvData.Object(1);
    3656 end
    3657 set(handles.ListObject,'Value',1)
    3658 set(handles.ListObject,'String',{'plane'})
    3659 set(handles.ListObject_1,'Value',1)
    3660 set(handles.ListObject_1,'String',{'plane'})
    3661 
    3662 %delete mask if it is displayed
    3663 % if isequal(get(handles.CheckMask,'Value'),1)%if the mask option is on
    3664 %    UvData=rmfield(UvData,'MaskName'); %will impose mask refresh 
    3665 % end
     3605%% delete drawn objects if the output CooordUnit is different from the previous one
     3606if ~strcmp(CoordUnit,CoordUnitPrev)
     3607    hother=findobj('Tag','proj_object');%find all the proj objects
     3608    for iobj=1:length(hother)
     3609        delete_object(hother(iobj))
     3610    end
     3611    hother=findobj('Tag','DeformPoint');%find all the proj objects
     3612    for iobj=1:length(hother)
     3613        delete_object(hother(iobj))
     3614    end
     3615    hh=findobj('Tag','calib_points');
     3616    if ~isempty(hh)
     3617        delete(hh)
     3618    end
     3619    hhh=findobj('Tag','calib_marker');
     3620    if ~isempty(hhh)
     3621        delete(hhh)
     3622    end
     3623%     if isfield(UvData,'Object')
     3624%         UvData.Object=UvData.Object(1);
     3625%     end
     3626    set(handles.ListObject,'Value',1)
     3627    set(handles.ListObject,'String',{''})
     3628    set(handles.ListObject_1,'Value',1)
     3629    set(handles.ListObject_1,'String',{''})
     3630    set(handles.ViewObject,'value',0)
     3631    ViewObject_Callback(hObject, eventdata, handles)
     3632    set(handles.ViewField,'value',0)
     3633    ViewField_Callback(hObject, eventdata, handles)
     3634    set(handles.edit_object,'Value',0)
     3635    edit_object_Callback(hObject, eventdata, handles)
     3636    UvData.Object={[]};
     3637end
    36663638set(handles.uvmat,'UserData',UvData)
     3639
     3640%% refresh the current plot
    36673641run0_Callback(hObject, eventdata, handles)
    36683642
     
    43414315colorbar
    43424316
    4343 % %------------------------------------------------------
    4344 % % --- Executes on button press in Menu/Export/extract figure.
    4345 % %------------------------------------------------------
    4346 % function MenuExport_plot_Callback(hObject, eventdata, handles)
    4347 % huvmat=get(handles.MenuExport_plot,'parent');
    4348 % UvData=get(huvmat,'UserData');
    4349 % hfig=figure;
    4350 % newaxes=copyobj(handles.axes3,hfig);
    4351 % map=colormap(handles.axes3);
    4352 % colormap(map);%transmit the current colormap to the zoom fig
    4353 % colorbar
    4354 
    4355 %
    4356 % % --------------------------------------------------------------------
    4357 % function Insert_Callback(hObject, eventdata, handles)
    4358 %
     4317% --------------------------------------------------------------------
     4318function MenuExportAxis_Callback(hObject, eventdata, handles)
     4319answer=msgbox_uvmat('CONFIRMATION','select a figure/axis on which the current uvmat plot will be exported')
     4320if strcmp(answer,'Yes')
     4321hchild=get(handles.axes3,'children');
     4322copyobj(hchild,gca);
     4323end
    43594324
    43604325%------------------------------------------------------------------------
     
    48794844ProjectDir = uigetdir(fileparts(fileparts(RootPath)), 'select the project source directory');
    48804845datatree_browser(ProjectDir)
     4846
     4847
     4848
Note: See TracChangeset for help on using the changeset viewer.