Changeset 667


Ignore:
Timestamp:
Jul 15, 2013, 2:50:08 PM (11 years ago)
Author:
sommeria
Message:

a few bugs corrected.
multimask introduced in series
displ_uvmat transformed into disp_uvmat

Location:
trunk/src
Files:
1 added
1 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/calc_field_interp.m

    r654 r667  
    8888            case 'vec'
    8989                if exist('XI','var')
    90                     if check_interp
     90                    if check_interp(ilist)
    9191                    VarVal{nbvar+1}=F.(UName{ilist})(XI,YI);
    9292                    VarVal{nbvar+2}=F.(VName{ilist})(XI,YI);
     
    102102            case 'norm'
    103103                if exist('XI','var')
    104                     if check_interp
     104                    if check_interp(ilist)
    105105                    U2=F.(UName{ilist})(XI,YI).*F.(UName{ilist})(XI,YI);
    106106                    V2=F.(VName{ilist})(XI,YI).*F.(VName{ilist})(XI,YI);
     
    115115            case {'curl','div','strain'}
    116116                if exist('XI','var')
    117                     if check_interp
     117                    if check_interp(ilist)
    118118                    VarVal{nbvar+1}=F.(UName{ilist})(XI,YI);
    119119                    end
     
    126126                if ~isempty(FieldName{ilist})
    127127                    if exist('XI','var')
    128                         if check_interp
     128                        if check_interp(ilist)
    129129                        VarVal{nbvar+1}=F.(FieldName{ilist})(XI,YI);
    130130                        end
     
    141141%% put an error flag to indicate NaN data
    142142if exist('XI','var')&&~isempty(VarVal)
    143     nbvar=numel(ListVarName);
     143    nbvar=numel(VarVal);
    144144    ListVarName{nbvar+1}='FF';
    145145    VarVal{nbvar+1}=isnan(VarVal{nbvar});
  • trunk/src/check_files.m

    r660 r667  
    4848    'create_grid';...% called by the GUI geometry_calib to create a physical grid
    4949    'create_grid.fig';...% GUI corresponding to create_grid.m
    50     'displ_uvmat';...% display a message using  msgbox_uvmat or on the log file in batch mode
     50    'disp_uvmat';...% display a message using  msgbox_uvmat or on the log file in batch mode
    5151    'editxml';...% display and edit xml files using a xls schema
    5252    'editxml.fig';...% interface for editxml
  • trunk/src/fill_GUI.m

    r664 r667  
    2525UserData=get(GUI_handle,'UserData');
    2626fields=fieldnames(Param);%list of fields in Param
    27 % loop on the elements of the input structure Param
     27
     28%--------------------------------------------------------------------------------------
     29%----------------- loop on the elements of the input structure Param ------------------
     30%--------------------------------------------------------------------------------------
    2831for ifield=1:numel(fields)
    29     % case of a sub-structure --> fill a panel
    3032    if isstruct(Param.(fields{ifield}))% case of a sub-structure
     33    %% case of a sub-structure --> fill a panel
    3134        if isfield(handles,fields{ifield})
    3235            set(handles.(fields{ifield}),'Visible','on')
    33             errormsg=fill_GUI(Param.(fields{ifield}),handles.(fields{ifield}));% apply the function to the substructure
     36            errormsg=fill_GUI(Param.(fields{ifield}),handles.(fields{ifield}));% recursively apply the function to the substructure
    3437        elseif isfield(UserData,fields{ifield})&& isfield(handles,fields{ifield})&&isfield(Param.(fields{ifield}),'Name')
    3538            UserData.(fields{ifield})=Param.(fields{ifield});
    3639            set(handles.(fields{ifield}),'String',Param.(fields{ifield}).Name)
    3740        end
    38         % case of an element
    3941    else
     42    %% case of an element
    4043        hh=[];
    4144        input_data=Param.(fields{ifield});
    4245        check_done=0;
    4346        if isfield(handles,fields{ifield})
     47        % a GUI element has a tag name equal to the key name in the element of Param
    4448            hh=handles.(fields{ifield});
    4549            if strcmp(get(hh,'Type'),'uitable')
     50            % case of a table
    4651                set(hh,'Visible','on')
    4752                if ischar(input_data)
     
    5257            end
    5358        elseif isnumeric(input_data)
    54             if numel(input_data)>1
    55                 %deals with array displayed in multiple boxes labeled by an index
     59        % for numeric input element, look for a GUI element with the same tag name preceded by 'num_'
     60            if numel(input_data)>1 % deals with array displayed in multiple boxes labeled by an index
    5661                for ibox=1:numel(input_data)
    5762                    if isfield(handles,['num_' fields{ifield} '_' num2str(ibox)])
     
    6671        end
    6772        for ibox=1:numel(hh)
     73        % finalise the update of GUI uicontrol filled by the input element
    6874            if ~isempty(hh(ibox))&& ~check_done
    69                 set(hh(ibox),'Visible','on')
    70                 %             input_data
     75                set(hh(ibox),'Visible','on')% make the filled GUI element visible
    7176                if isfield(get(hh(ibox)),'Style')
    7277                    switch get(hh(ibox),'Style')
  • trunk/src/find_field_bounds.m

    r654 r667  
    1212
    1313function FieldOut=find_field_bounds(Field)
     14
    1415FieldOut=Field;%default
    1516%% analyse input field
     
    2526    NbDim=double(Field.NbDim);% deal with plane fields containing z coordinates
    2627end
     28FieldOut.NbDim=NbDim;
     29if  NbDim<=1; return; end% stop here for 1D fields
    2730
    2831%% get bounds and mesh (needed  to propose default options for projection objects)
  • trunk/src/find_file_series.m

    r635 r667  
    2020% RootPath: path to the directory to be scanned
    2121% fileinput: name (without path) of the input file sample
     22% checkxml: =1(default) take into account xml file existence to possibly include indexes in RootFile
     23%           =0: do not take into account xml file existence
    2224%
    2325%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
     
    3739%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    3840
    39 function [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,FileInfo,MovieObject,i1_input,i2_input,j1_input,j2_input]=find_file_series(FilePath,fileinput)
     41function [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileType,FileInfo,MovieObject,i1_input,i2_input,j1_input,j2_input]=find_file_series(FilePath,fileinput,checkxml)
    4042%------------------------------------------------------------------------
    4143
     
    6264    end
    6365else
    64     %% possibly include the first index in the root name, if there exists a corresponding xml file
    65     r=regexp(NomType,'^(?<tiretnum>_|\d+)','names');%look for a number or _1 at the beginning of NomType
    66     if ~isempty(r) %if NomType begins by a number or _1
    67         fileinput_end=regexprep(fileinput,['^' RootFile],'');%remove RootFile at the beginning of fileinput
    68         if isempty(regexp(r.tiretnum,'^_','once'))% if a separator '_' is not  detected
    69             rr=regexp(fileinput_end,'^(?<i1>\d+)','names');
    70         else% if a separator '_' is  detected
    71             rr=regexp(fileinput_end,'^(?<i1>_\d+)','names');
    72         end
    73         if ~isempty(rr)
    74             RootFile_i=[RootFile rr.i1];% new root file
    75             %look for an xml file correspoonding to the new root name
    76             if exist(fullfile(RootPath,SubDir,[RootFile_i '.xml']),'file') || (strcmp(FileExt,'.nc') && exist(fullfile(RootPath,[RootFile_i '.xml']),'file'))
    77                 RootFile=RootFile_i;
    78                 NomTypePref=r.tiretnum;
    79                 NomType=regexprep(NomType,['^'  NomTypePref],'');
    80                 i1_input=j1_input;
    81                 i2_input=j2_input;
    82                 j1_input=[];
    83                 j2_input=[];
    84             end       
     66    %% if checkxml=1, possibly include the first index in the root name, if there exists a corresponding xml file
     67    if ~exist('checkxml','var')||checkxml
     68        r=regexp(NomType,'^(?<tiretnum>_|\d+)','names');%look for a number or _1 at the beginning of NomType
     69        if ~isempty(r) %if NomType begins by a number or _1
     70            fileinput_end=regexprep(fileinput,['^' RootFile],'');%remove RootFile at the beginning of fileinput
     71            if isempty(regexp(r.tiretnum,'^_','once'))% if a separator '_' is not  detected
     72                rr=regexp(fileinput_end,'^(?<i1>\d+)','names');
     73            else% if a separator '_' is  detected
     74                rr=regexp(fileinput_end,'^(?<i1>_\d+)','names');
     75            end
     76            if ~isempty(rr)
     77                RootFile_i=[RootFile rr.i1];% new root file
     78                %look for an xml file correspoonding to the new root name
     79                if exist(fullfile(RootPath,SubDir,[RootFile_i '.xml']),'file') || (strcmp(FileExt,'.nc') && exist(fullfile(RootPath,[RootFile_i '.xml']),'file'))
     80                    RootFile=RootFile_i;
     81                    NomTypePref=r.tiretnum;
     82                    NomType=regexprep(NomType,['^'  NomTypePref],'');
     83                    i1_input=j1_input;
     84                    i2_input=j2_input;
     85                    j1_input=[];
     86                    j2_input=[];
     87                end
     88            end
    8589        end
    8690    end
  • trunk/src/mask_proj.m

    r646 r667  
    7070                [XMask,YMask]=meshgrid(XMask,YMask);
    7171                Mask = interp2(XMask,YMask,MaskData.A,XArray,YArray','nearest');
    72                 figure(1)
    73                 image(MaskData.A)
     72%                 figure(1)
     73%                 image(MaskData.A)
    7474                Mask=Mask>200;
    7575                if ~isfield(FieldData,'FF')
  • trunk/src/read_field.m

    r654 r667  
    7474                ListVar=[ListVar InputField(ilist)];
    7575                if check_colorvar(ilist)
    76                                     Role{numel(ListVar)}='ancillary';% not projected with interpolation
    77                 ProjModeRequest{numel(ListVar)}='';
     76                    Role{numel(ListVar)}='ancillary';% not projected with interpolation
     77                    ProjModeRequest{numel(ListVar)}='';
    7878                else
    79                 Role{numel(ListVar)}='scalar';
    80                 ProjModeRequest{numel(ListVar)}='interp_lin';%scalar field (requires interpolation for plot)
     79                    Role{numel(ListVar)}='scalar';
     80                    ProjModeRequest{numel(ListVar)}='interp_lin';%scalar field (requires interpolation for plot)
    8181                end
    8282            else  % an operator 'vec' or 'norm' is used
     
    8484                Role{numel(ListVar)}='vector_y';
    8585                Role{numel(ListVar)-1}='vector_x';
    86                       if ~check_colorvar(ilist) && strcmp(r.Operator,'norm')
    87                                     ProjModeRequest{numel(ListVar)-1}='interp_lin';%scalar field (requires interpolation for plot)
    88                                     ProjModeRequest{numel(ListVar)}='interp_lin';
    89                       else
    90                                    ProjModeRequest{numel(ListVar)-1}='';
    91                                    ProjModeRequest{numel(ListVar)}='';
    92                             end
     86                if ~check_colorvar(ilist) && strcmp(r.Operator,'norm')
     87                    ProjModeRequest{numel(ListVar)-1}='interp_lin';%scalar field (requires interpolation for plot)
     88                    ProjModeRequest{numel(ListVar)}='interp_lin';
     89                else
     90                    ProjModeRequest{numel(ListVar)-1}='';
     91                    ProjModeRequest{numel(ListVar)}='';
     92                end
    9393            end
    9494        end
     
    9696            [Field,var_detect,ichoice]=nc2struct(FileName,'TimeDimName',ParamIn.TimeDimName,num,[ParamIn.Coord_x (ParamIn.Coord_y) ListVar]);
    9797        else
    98         [Field,var_detect,ichoice]=nc2struct(FileName,[ParamIn.Coord_x (ParamIn.Coord_y) ListVar]);
     98            [Field,var_detect,ichoice]=nc2struct(FileName,[ParamIn.Coord_x (ParamIn.Coord_y) ListVar]);
    9999        end
    100100        if isfield(Field,'Txt')
     
    108108            end
    109109            Field.VarAttribute{ivar+2}.ProjModeRequest=ProjModeRequest{ivar};
    110         end       
     110        end
    111111    case 'video'
    112112        if strcmp(class(ParamIn),'VideoReader')
  • trunk/src/series.m

    r664 r667  
    7575RescaleFactor=min((ScreenSize(3)-80)/Width,(ScreenSize(4)-80)/Height);
    7676if RescaleFactor>1
    77     %RescaleFactor=RescaleFactor/2+1/2; %reduce the rescale factor to provide an increased margin for a big screen
    7877    RescaleFactor=min(RescaleFactor,1);
    7978end
     
    8988set(handles.MinIndex_i,'ColumnEditable',false)
    9089set(handles.MinIndex_i,'ColumnName',{'i min'})
     90set(handles.MinIndex_i,'Data',[])% initiate Data to double (not cell)
    9191
    9292% settings of table MinIndex_j
     
    9494set(handles.MinIndex_j,'ColumnEditable',false)
    9595set(handles.MinIndex_j,'ColumnName',{'j min'})
     96set(handles.MinIndex_j,'Data',[])% initiate Data to double (not cell)
    9697
    9798% settings of table MaxIndex_i
     
    99100set(handles.MaxIndex_i,'ColumnEditable',false)
    100101set(handles.MaxIndex_i,'ColumnName',{'i max'})
     102set(handles.MaxIndex_i,'Data',[])% initiate Data to double (not cell)
    101103
    102104% settings of table MaxIndex_j
     
    104106set(handles.MaxIndex_j,'ColumnEditable',false)
    105107set(handles.MaxIndex_j,'ColumnName',{'j max'})
     108set(handles.MaxIndex_j,'Data',[])% initiate Data to double (not cell)
    106109
    107110% settings of table PairString
    108111set(handles.PairString,'ColumnName',{'pairs'})
     112set(handles.PairString,'ColumnEditable',false)
     113set(handles.PairString,'ColumnFormat',{'char'})
     114set(handles.PairString,'Data',{''})
     115
     116% settings of table MaskTable
     117set(handles.MaskTable,'ColumnName',{'mask name'})
    109118set(handles.PairString,'ColumnEditable',false)
    110119set(handles.PairString,'ColumnFormat',{'char'})
     
    154163        for ifile=1:min(length(h.MenuFile),5)
    155164            set(handles.(['MenuFile_' num2str(ifile)]),'Label',h.MenuFile{ifile});
     165            set(handles.(['MenuFile_' num2str(ifile+5)]),'Label',h.MenuFile{ifile});
    156166        end
    157167    end
     
    306316fileinput=uigetfile_uvmat('pick a file to append in the input table',oldfile);
    307317if ~isempty(fileinput)
    308     if get(handles.CheckAppend,'Value')
     318%     if get(handles.CheckAppend,'Value')
     319%         display_file_name(handles,fileinput,'append')
     320%     else
     321        display_file_name(handles,fileinput,'one')
     322%     end
     323end
     324
     325% --------------------------------------------------------------------
     326function MenuBrowseAppend_Callback(hObject, eventdata, handles)
     327
     328%% look for the previously opened file 'oldfile'
     329InputTable=get(handles.InputTable,'Data');
     330RootPathCell=InputTable(:,1);
     331if isempty(RootPathCell{1})% no input file in the table
     332     MenuBrowse_Callback(hObject, eventdata, handles)%refresh the input table, not append
     333     return
     334end
     335SubDirCell=InputTable(:,2);
     336% oldfile=''; %default
     337% if ~(isempty(RootPathCell) || isequal(RootPathCell,{''}))%loads the previously stored file name and set it as default in the file_input box
     338    oldfile=fullfile(RootPathCell{1},SubDirCell{1});
     339% end
     340
     341%% use a file name stored in prefdir
     342dir_perso=prefdir;
     343profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
     344if exist(profil_perso,'file')
     345    h=load (profil_perso);
     346    if isfield(h,'RootPath') && ischar(h.RootPath)
     347        oldfile=h.RootPath;
     348    end
     349end
     350
     351%% launch the browser
     352fileinput=uigetfile_uvmat('pick a file to append in the input table',oldfile);
     353if ~isempty(fileinput)
    309354        display_file_name(handles,fileinput,'append')
    310     else
    311         display_file_name(handles,fileinput,'one')
    312     end
    313355end
    314356
     
    318360function MenuFile_Callback(hObject, eventdata, handles)
    319361
    320 fileinput=get(hObject,'Label');
    321 if get(handles.CheckAppend,'Value')
    322     display_file_name(handles,fileinput,'append')
     362display_file_name(handles,get(hObject,'Label'),'one')
     363
     364%------------------------------------------------------------------------
     365% --- fct activated by selecting a previous file under the menu Open/append
     366%------------------------------------------------------------------------
     367function MenuFile_append_Callback(hObject, eventdata, handles)
     368
     369InputTable=get(handles.InputTable,'Data');
     370if isempty(InputTable{1,1})% no input file in the table
     371    display_file_name(handles,get(hObject,'Label'),'one') %refresh the input table, not append
    323372else
    324     display_file_name(handles,fileinput,'one')
     373    display_file_name(handles,get(hObject,'Label'),'append')% append the selected file to the current list of InputTable
    325374end
    326375
     
    424473%------------------------------------------------------------------------
    425474set(handles.REFRESH,'Visible','on')
    426 set(handles.REFRESH_title,'Visible','on')
     475% set(handles.REFRESH_title,'Visible','on')
    427476iview=eventdata.Indices(1);
    428477view_set=get(handles.REFRESH,'UserData');
     
    489538% iview: line index in the input table
    490539%       or 'one': refresh the list
    491 %       'checkappend': add a new line to the list
     540%         'append': add a new line to the input table
    492541
    493542%% get the input root name, indices, file extension and nomenclature NomType
     
    581630ref_j=floor((j1+j2)/2);% reference image number corresponding to the file
    582631set(handles.num_ref_j,'String',num2str(ref_j));
    583 % set(handles.num_ref_j,'UserData',[j1 j2]);%store the indices for future opening
    584632
    585633%% update the list of recent files in the menubar and save it for future opening
     
    629677    ref_i=squeeze(max(i1_series(1,:,:),[],2));% select ref_j index for each ref_i
    630678    ref_j=squeeze(max(j1_series(1,:,:),[],3));% select ref_i index for each ref_j
    631 %     [ref_j,ref_i]=find(squeeze(i1_series(1,:,:)));
    632 %     [ref_j,ref_i]=find(squeeze(i1_series(1,:,:)))
    633679     MinIndex_i=min(find(ref_i))-1;
    634680     MaxIndex_i=max(find(ref_i))-1;
    635 %         MinIndex_j=min(ref_j)-1;
    636681     MaxIndex_j=max(find(ref_j))-1;
    637 %     MinIndex_j=min(find(j1_series_j))-1;
    638 %     MaxIndex_j=max(find(j1_series_j))-1;
    639 %     MaxIndex_i=max(i1_series_i)-1;
    640 %     MinIndex_j=min(i1_series_j)-1;
    641 %     MaxIndex_j=max(i1_series_j)-1;
    642 %     MaxIndex_i=max(ref_i)-1;
    643682     MinIndex_j=min(find(ref_j))-1;
    644 %     MaxIndex_j=max(ref_j)-1;
    645683    diff_j_max=diff(ref_j);
    646684    diff_i_max=diff(ref_i);
     
    668706    MinIndex_j=0;
    669707end
    670 MinIndex_i_cell=get(handles.MinIndex_i,'Data');%retrieve the min indices in the table MinIndex
    671 MinIndex_j_cell=get(handles.MinIndex_j,'Data');%retrieve the min indices in the table MinIndex
    672 MaxIndex_i_cell=get(handles.MaxIndex_i,'Data');%retrieve the min indices in the table MinIndex
    673 MaxIndex_j_cell=get(handles.MaxIndex_j,'Data');%retrieve the min indices in the table MinIndex
    674 MinIndex_i_cell(iview,1)=MinIndex_i;
    675 MinIndex_j_cell(iview,1)=MinIndex_j;
    676 MaxIndex_i_cell(iview,1)=MaxIndex_i;
    677 MaxIndex_j_cell(iview,1)=MaxIndex_j;
    678 set(handles.MinIndex_i,'Data',MinIndex_i_cell)%display the min indices in the table MinIndex
    679 set(handles.MinIndex_j,'Data',MinIndex_j_cell)%display the max indices in the table MaxIndex
    680 set(handles.MaxIndex_i,'Data',MaxIndex_i_cell)%display the min indices in the table MinIndex
    681 set(handles.MaxIndex_j,'Data',MaxIndex_j_cell)%display the max indices in the table MaxIndex
     708MinIndex_i_table=get(handles.MinIndex_i,'Data');%retrieve the min indices in the table MinIndex
     709MinIndex_j_table=get(handles.MinIndex_j,'Data');%retrieve the min indices in the table MinIndex
     710MaxIndex_i_table=get(handles.MaxIndex_i,'Data');%retrieve the min indices in the table MinIndex
     711MaxIndex_j_table=get(handles.MaxIndex_j,'Data');%retrieve the min indices in the table MinIndex
     712MinIndex_i_table(iview,1)=MinIndex_i;
     713MinIndex_j_table(iview,1)=MinIndex_j;
     714MaxIndex_i_table(iview,1)=MaxIndex_i;
     715MaxIndex_j_table(iview,1)=MaxIndex_j;
     716set(handles.MinIndex_i,'Data',MinIndex_i_table)%display the min indices in the table MinIndex
     717set(handles.MinIndex_j,'Data',MinIndex_j_table)%display the max indices in the table MaxIndex
     718set(handles.MaxIndex_i,'Data',MaxIndex_i_table)%display the min indices in the table MinIndex
     719set(handles.MaxIndex_j,'Data',MaxIndex_j_table)%display the max indices in the table MaxIndex
    682720
    683721%% adjust the first and last indices for the selected series, only if requested by the bounds
     
    787825%% read timing and total frame number from the current file (movie files) if not already set by the xml file (prioritary)
    788826InputTable=get(handles.InputTable,'Data');
    789 % FileBase=fullfile(InputTable{iview,1},InputTable{iview,3});
    790827
    791828% case of movies
    792 % if strcmp(InputTable{iview,4},'*')
    793829if isempty(Time)
    794830    if ~isempty(VideoObject)
     
    801837        end
    802838        TimeSource='video';
    803         % set(han:dles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FrameRate) 'ms']);%display the elementary time interval in millisec
    804         %     ColorType='truecolor';
    805 %     elseif ~isempty(imformats(regexprep(InputTable{iview,5},'^.',''))) || isequal(InputTable{iview,5},'.vol')%&& isequal(NomType,'*')% multi-frame image
    806 %         if ~isempty(InputTable{iview,2})
    807 %             imainfo=imfinfo(fullfile(InputTable{iview,1},InputTable{iview,2},[InputTable{iview,3} InputTable{iview,5}]));
    808 %         else
    809 %             imainfo=imfinfo([FileBase InputTable{iview,5}]);
    810 %         end
    811 %         %     ColorType=imainfo.ColorType;%='truecolor' for color images
    812 % %         if length(imainfo) >1 %case of image with multiple frames
    813 % %             nbfield=length(imainfo);
    814 % %             nbfield_j=1;
    815 % %         end
    816839    end
    817840end
     
    820843if ~isempty(Time)
    821844    TimeTable=get(handles.TimeTable,'Data');
    822     %     first_i=str2num(get(handles.num_first_i,'String'));
    823     %     last_i=str2num(get(handles.num_last_i,'String'));
    824     %     first_j=str2num(get(handles.num_first_j,'String'));
    825     %     last_j=str2num(get(handles.num_last_j,'String'));
    826     %     MinIndex_i=get(handles.MinIndex_i,'Data');
    827     %     MinIndex_j=get(handles.MinIndex_j,'Data');
    828     %     MaxIndex_i=get(handles.MaxIndex_i,'Data');
    829     %     MaxIndex_j=get(handles.MaxIndex_j,'Data');
    830845    TimeTable{iview,1}=Time(MinIndex_i+1,MinIndex_j+1);
    831846    if size(Time)>=[first_i+1 first_j+1]
     
    840855    set(handles.TimeTable,'Data',TimeTable)
    841856end
    842    
    843857
    844858%% update the series info in 'UserData'
     
    19862000%% Detect the types of input files
    19872001SeriesData=get(handles.series,'UserData');
    1988 nb_civ=0;nb_netcdf=0;
     2002iview_civ=[];nb_netcdf=0;
    19892003if ~isempty(SeriesData)
    1990     nb_civ=numel(find(strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType)));
     2004    iview_civ=find(strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType));
    19912005    nb_netcdf=numel(find(strcmp('netcdf',SeriesData.FileType)));
    19922006end
    1993 if nb_civ>=1
    1994     menu=set_veltype_display(SeriesData.FileInfo{1}.CivStage,SeriesData.FileType{1});
     2007%menu={''};
     2008if numel(iview_civ)>=1
     2009    menu=set_veltype_display(SeriesData.FileInfo{iview_civ(1)}.CivStage,SeriesData.FileType{iview_civ(1)});
    19952010    set(handles.VelType,'String',[{'*'};menu])
    1996     if nb_civ>=2
    1997         menu=set_veltype_display(SeriesData.FileInfo{2}.CivStage,SeriesData.FileType{2});
     2011    if numel(iview_civ)>=2
     2012        menu=set_veltype_display(SeriesData.FileInfo{iview_civ(2)}.CivStage,SeriesData.FileType{iview_civ(2)});
    19982013        set(handles.VelType_1,'String',[{'*'};menu])
    19992014    end
    2000 end
    2001        
    2002    
     2015end       
    20032016
    20042017%% Check whether alphabetical sorting of input Subdir is alowed by the Action fct  (for multiples series entries)
     
    20652078if isfield(ParamOut,'VelType')
    20662079    if strcmp( ParamOut.VelType,'one')||strcmp( ParamOut.VelType,'two')
    2067         if nb_civ>=1
     2080        if numel(iview_civ)>=1
    20682081            VelTypeVisible='on';
    20692082            InputFieldsVisible='on';
     
    20712084    end
    20722085    if strcmp( ParamOut.VelType,'two')
    2073         if nb_civ>=2
     2086        if numel(iview_civ)>=2
    20742087            VelType_1Visible='on';
    20752088        end
     
    20862099if isfield(ParamOut,'FieldName')
    20872100    if strcmp( ParamOut.FieldName,'one')||strcmp( ParamOut.FieldName,'two')
    2088         if (nb_civ+nb_netcdf)>=1
     2101        if (numel(iview_civ)+nb_netcdf)>=1
    20892102            InputFieldsVisible='on';
    20902103            FieldNameVisible='on';
     
    20922105    end
    20932106    if strcmp( ParamOut.FieldName,'two')
    2094         if (nb_civ+nb_netcdf)>=1
     2107        if (numel(iview_civ)+nb_netcdf)>=1
    20952108            FieldName_1Visible='on';
    20962109        end
     
    23602373                defaultname={''};
    23612374            end
    2362             [FileName, PathName] = uigetfile( ...
    2363                 {'*.xml;*.mat', ' (*.xml,*.mat)';
    2364                 '*.xml',  '.xml files '; ...
    2365                 '*.mat',  '.mat matlab files '}, ...
    2366                 'Pick an xml object file (or use uvmat to create it)',defaultname);
    2367             fileinput=[PathName FileName];%complete file name
    2368             sizf=size(fileinput);
    2369             if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end
     2375            fileinput=uigetfile_uvmat('pick a xml object file (or use uvmat to create it)',defaultname,'.xml');
     2376%             [FileName, PathName] = uigetfile( ...
     2377%                 {'*.xml;*.mat', ' (*.xml,*.mat)';
     2378%                 '*.xml',  '.xml files '; ...
     2379%                 '*.mat',  '.mat matlab files '}, ...
     2380%                 'Pick an xml object file (or use uvmat to create it)',defaultname);
     2381%             fileinput=[PathName FileName];%complete file name
     2382%             sizf=size(fileinput);
     2383            if isempty(fileinput),return;end
    23702384            %read the file
    23712385            data=xml2struct(fileinput);
     
    24042418function ViewObject_Callback(hObject, eventdata, handles)
    24052419
    2406 if get(handles.ViewObject,'Value')
    2407     set(handles.EditObject,'Value',0)
     2420% if get(handles.ViewObject,'Value')
     2421   % set(handles.EditObject,'Value',0)
    24082422        UserData=get(handles.series,'UserData');
     2423    hset_object=findobj(allchild(0),'Tag','set_object');
     2424    if ~isempty(hset_object)
     2425        delete(hset_object)% refresh set_object if already opened
     2426    end
    24092427    hset_object=set_object(UserData.ProjObject);
    24102428    set(hset_object,'Name','view_object_series')
    2411 else
    2412     hset_object=findobj(allchild(0),'Tag','set_object');
    2413     if ~isempty(hset_object)
    2414         delete(hset_object)
    2415     end
    2416 end
     2429% else
     2430%     hset_object=findobj(allchild(0),'Tag','set_object');
     2431%     if ~isempty(hset_object)
     2432%         delete(hset_object)
     2433%     end
     2434% end
    24172435
    24182436%------------------------------------------------------------------------
     
    24282446    set(get(hset_object,'Children'),'Enable','on')
    24292447else
    2430     hset_object=findobj(allchild(0),'Tag','set_object');
     2448    hset_object=findobj(allchild(0),'Tag','set_object'); 
    24312449    if ~isempty(hset_object)
    2432         delete(hset_object)
     2450        set(get(hset_object,'Children'),'Enable','off')
    24332451    end
    24342452end
     
    24392457function DeleteObject_Callback(hObject, eventdata, handles)
    24402458
    2441 if get(handles.DeleteObject,'Value')
     2459% if get(handles.DeleteObject,'Value')
    24422460        SeriesData=get(handles.series,'UserData');
    24432461    SeriesData.ProjObject=[];
     
    24452463    set(handles.ProjObject,'String','')
    24462464    set(handles.CheckObject,'Value',0)
     2465    set(handles.ViewObject,'Visible','off')
     2466    set(handles.EditObject,'Visible','off')
     2467    hset_object=findobj(allchild(0),'Tag','set_object');
     2468    if ~isempty(hset_object)
     2469        delete(hset_object)
     2470    end
    24472471    set(handles.DeleteObject,'Visible','off')
    2448     set(handles.ViewObject,'Visible','off')
    2449     set(handles.DeleteObject,'Value',0)
    2450 end
    2451 
    2452 %--------------------------------------------------------------
     2472%     set(handles.DeleteObject,'Value',0)
     2473% end
     2474
     2475%------------------------------------------------------------------------
     2476% --- Executed when CheckMask is activated
     2477%------------------------------------------------------------------------
    24532478function CheckMask_Callback(hObject, eventdata, handles)
     2479
    24542480if get(handles.CheckMask,'Value')
     2481    MaskData=get(handles.MaskTable,'Data');
    24552482    InputTable=get(handles.InputTable,'Data');
    2456     for iview=1:size(InputTable,1)
     2483    nbview=size(InputTable,1);
     2484    %     MaskTable=cell(nbview,1);
     2485    for iview=1:nbview
    24572486        RootPath=InputTable{iview,1};
    2458         SubDir=InputTable{iview,2};
    2459         MaskSubDir=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.'
    2460         MaskName=fullfile(RootPath,[MaskSubDir '.mask'],'mask_1.png');
    2461         if ~exist(MaskName,'file')
    2462             msgbox_uvmat('WARNING',['mask file '  MaskName ' not found'])
    2463             return
    2464         end
    2465     end
    2466 end
    2467 %--------------------------------------------------------------
     2487        if ~isempty(RootPath)
     2488            if isempty(MaskData{iview})
     2489                SubDir=InputTable{iview,2};
     2490                MaskSubDir=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.'
     2491                MaskName=fullfile(RootPath,[MaskSubDir '.mask'],'mask_1.png');
     2492                if ~exist(MaskName,'file')
     2493                    MaskName=uigetfile_uvmat('select a mask file:',RootPath,'image');
     2494                end
     2495                MaskTable{iview,1}=MaskName ;
     2496                ListMask{iview,1}=num2str(iview);
     2497            end
     2498        end
     2499    end
     2500    nbview=size(MaskTable,1);
     2501    set(handles.MaskTable,'Data',MaskTable)
     2502    %     set(handles.MaskTable,'ColumnFormat',{MaskTable'})
     2503    set(handles.MaskTable,'Visible','on')
     2504    set(handles.MaskBrowse,'Visible','on')
     2505    set(handles.ListMask,'Visible','on')
     2506    set(handles.ListMask,'String',ListMask)
     2507    set(handles.ListMask,'Value',numel(ListMask))
     2508else
     2509    set(handles.MaskTable,'Visible','off')
     2510    set(handles.MaskBrowse,'Visible','off')
     2511    set(handles.ListMask,'Visible','off')
     2512end
     2513
     2514%------------------------------------------------------------------------
     2515% --- Executes on button press in MaskBrowse.
     2516%------------------------------------------------------------------------
     2517function MaskBrowse_Callback(hObject, eventdata, handles)
     2518InputTable=get(handles.InputTable,'Data');
     2519iview=get(handles.ListMask,'Value');
     2520%     MaskTable=cell(nbview,1);
     2521
     2522RootPath=InputTable{iview,1};
     2523%         if ~isempty(RootPath)
     2524%         SubDir=InputTable{iview,2};
     2525%         MaskSubDir=regexprep(SubDir,'\..*','');%take the root part of SubDir, before the first dot '.'
     2526%         MaskName=fullfile(RootPath,[MaskSubDir '.mask'],'mask_1.png');
     2527%         if ~exist(MaskName,'file')
     2528MaskName=uigetfile_uvmat('select a mask file:',RootPath,'image');
     2529%         end
     2530if ~isempty(MaskName)
     2531    MaskTable=get(handles.MaskTable,'Data');
     2532MaskTable{iview,1}=MaskName ;
     2533%         end
     2534set(handles.MaskTable,'Data',MaskTable)
     2535end
     2536   % set(handles.MaskTable,'ColumnFormat',{MaskTable'})
     2537
     2538%------------------------------------------------------------------------
     2539% --- Executes when selected cell(s) is changed in MaskTable.
     2540%------------------------------------------------------------------------
     2541function MaskTable_CellSelectionCallback(hObject, eventdata, handles)
     2542
     2543if numel(eventdata.Indices)>=1
     2544set(handles.ListMask,'Value',eventdata.Indices(1))
     2545end
    24682546
    24692547%-------------------------------------------------------------------
    2470 %'uv_ncbrowser': interactively calls the netcdf file browser 'get_field.m'
    2471 function ncbrowser_uvmat(hObject, eventdata)
    2472 %-------------------------------------------------------------------
    2473      bla=get(gcbo,'String');
    2474      ind=get(gcbo,'Value');
    2475      filename=cell2mat(bla(ind));
    2476       blank=find(filename==' ');
    2477       filename=filename(1:blank-1);
    2478      get_field(filename)
    2479 
    2480 % ------------------------------------------------------------------
    24812548function MenuHelp_Callback(hObject, eventdata, handles)
    24822549%-------------------------------------------------------------------
     
    26242691set(handles.PairString,'Unit','normalized')
    26252692set(handles.PairString,'ColumnWidth',{Pos(3)-5})
     2693
     2694%% MaskTable
     2695set(handles.MaskTable,'Unit','pixel')
     2696Pos=get(handles.MaskTable,'Position');
     2697set(handles.MaskTable,'Unit','normalized')
     2698set(handles.MaskTable,'ColumnWidth',{Pos(3)-5})
    26262699
    26272700%------------------------------------------------------------------------
  • trunk/src/set_object.m

    r657 r667  
    211211if ~isempty(hseries)
    212212    hhseries=guidata(hseries);
    213     set(hhseries.ViewObject,'Value',0)
     213    set(hhseries.EditObject,'Value',0)
    214214end
    215215
     
    618618function SAVE_Callback(hObject, eventdata, handles)
    619619% ------------------------------------------------------
    620 %Object=read_set_object(handles);
    621620Object=read_GUI(handles.set_object);
    622621huvmat=findobj('Tag','uvmat');
    623 % UvData=get(huvmat,'UserData');
    624622if isempty(huvmat)
    625623    huvmat=findobj(allchild(0),'Name','series');
     
    636634end
    637635title={'object name'};
    638 dir_save=uigetdir(RootPath);
    639 ObjectName=get(handles.Name,'String');
    640 if ~isempty(ObjectName)&&~strcmp(ObjectName,'')
    641     def={fullfile(dir_save,[ObjectName '.xml'])};
    642 else
    643     def={fullfile(dir_save,[Object.Style '.xml'])};
    644 end
    645 displ_txt='save object as an .xml file';%default display
    646 menu=get(handles.ProjMode,'String');
    647 value=get(handles.ProjMode,'Value');
    648 ProjMode=menu{value};
    649 if strcmp(ProjMode,'mask_inside')||strcmp(ProjMode,'mask_outside')
    650     displ_txt='save mask contour as an .xml file: to create a mask image, use save_mask on the GUI uvmat (lower right)';
    651 end
    652 answer=msgbox_uvmat('INPUT_TXT','save object as an .xml file',def);
    653 if ~isempty(answer)
    654     t=struct2xml(Object);
    655     t=set(t,1,'name','ProjObject');
    656     save(t,answer{1})
    657 end
    658 msgbox_uvmat('CONFIRMATION',[answer{1}  ' saved'])
     636dir_save=uigetfile_uvmat('select the folder for the new xml object file:',RootPath,'uigetdir');
     637if ~isempty(dir_save)
     638    % dir_save=uigetdir(RootPath);
     639    ObjectName=get(handles.Name,'String');
     640    if ~isempty(ObjectName)&&~strcmp(ObjectName,'')
     641        def={fullfile(dir_save,[ObjectName '.xml'])};
     642    else
     643        def={fullfile(dir_save,[Object.Style '.xml'])};
     644    end
     645    displ_txt='save object as an .xml file';%default display
     646    menu=get(handles.ProjMode,'String');
     647    value=get(handles.ProjMode,'Value');
     648    ProjMode=menu{value};
     649    if strcmp(ProjMode,'mask_inside')||strcmp(ProjMode,'mask_outside')
     650        displ_txt='save mask contour as an .xml file: to create a mask image, use save_mask on the GUI uvmat (lower right)';
     651    end
     652    answer=msgbox_uvmat('INPUT_TXT','save object as an .xml file',def);
     653    if ~isempty(answer)
     654        t=struct2xml(Object);
     655        t=set(t,1,'name','ProjObject');
     656        save(t,answer{1})
     657    end
     658    msgbox_uvmat('CONFIRMATION',[answer{1}  ' saved'])
     659end
    659660
    660661%------------------------------------------------------------------------
  • trunk/src/uvmat.m

    r660 r667  
    985985    end
    986986end
    987 if (isfield(XmlData,'Time')&& ~isempty(XmlData.Time))
     987if (strcmp(FileType,'civdata')||strcmp(FileType,'civx')) && ((isfield(XmlData,'Time')&& ~isempty(XmlData.Time)))
    988988    if index==1
    989989    set(handles.TimeName,'String','xml')
     
    11821182%------------------------------------------------------------------------
    11831183% --- switch file index scanning options scan_i and scan_j in an exclusive way
     1184%------------------------------------------------------------------------
    11841185function scan_i_Callback(hObject, eventdata, handles)
    1185 %------------------------------------------------------------------------
     1186
    11861187if get(handles.scan_i,'Value')==1
    1187 %     set(handles.scan_i,'BackgroundColor',[1 1 0])
    11881188    set(handles.scan_j,'Value',0)
    11891189else
    1190 %     set(handles.scan_i,'BackgroundColor',[0.831 0.816 0.784])
    11911190    set(handles.scan_j,'Value',1)
    11921191end
     
    11951194%------------------------------------------------------------------------
    11961195% --- switch file index scanning options scan_i and scan_j in an exclusive way
     1196%------------------------------------------------------------------------
    11971197function scan_j_Callback(hObject, eventdata, handles)
    1198 %------------------------------------------------------------------------
     1198
    11991199if get(handles.scan_j,'Value')==1
    1200 %     set(handles.scan_j,'BackgroundColor',[1 1 0])
    12011200    set(handles.scan_i,'Value',0)
    1202 %     set(handles.scan_i,'BackgroundColor',[0.831 0.816 0.784])
    1203 %     NomType=get(handles.NomType,'String');
    1204 %     switch NomType
    1205 %     case {'_1_1-2','#_ab','%3dab'},% pair with j index
    1206 %         set(handles.CheckFixPair,'Visible','on')% option fixed pair on/off made visible (choice of avaible pair with buttons + and - if ='off')
    1207 %     otherwise
    1208 %         set(handles.CheckFixPair,'Visible','off')
    1209 %     end
    12101201else
    1211 %     set(handles.scan_j,'BackgroundColor',[0.831 0.816 0.784])
    12121202    set(handles.scan_i,'Value',1)
    1213 %     set(handles.scan_i,'BackgroundColor',[1 1 0])
    12141203    set(handles.CheckFixPair,'Visible','off')
    12151204end
     
    13451334        ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray
    13461335        check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files
    1347         ListFiles=ListCells(1,:);%list of file names
    1348         ListFiles=ListFiles(~check_dir);
     1336        ListFiles=ListCells(1,:);%list of file and dri names
     1337        ListFiles=ListFiles(~check_dir);%list of file names (excluding dir)
    13491338        if ~isempty(ListFiles)
    13501339            [tild,tild,MaskExt]=fileparts(ListFiles{1});
    1351             [tild,tild,MaskFile,i1_series,i2_series,j1_series,j2_series,MaskNomType,MaskFileType]=find_file_series(MaskPath,ListFiles{1});
     1340            [tild,tild,MaskFile,i1_series,i2_series,j1_series,j2_series,MaskNomType,MaskFileType]=find_file_series(MaskPath,ListFiles{1},0);
    13521341            if strcmp(MaskFileType,'image') && isempty(i2_series) && isempty(j2_series)
    13531342                mdetect=1;
     
    13561345    end
    13571346    if mdetect==0
    1358         MaskFullName=uigetfile_uvmat('pick a mask image file:',fullfile(RootPath,SubDir),'image');
     1347        MaskFullName=uigetfile_uvmat('pick a mask image file:',RootPath,'image');
    13591348        if isempty(MaskFullName)
    13601349            set(handles.CheckMask,'Value',0)
    13611350        end
    13621351        [MaskPath,MaskName,MaskExt]=fileparts(MaskFullName);
    1363         [tild,tild,MaskFile,i1_series,i2_series,j1_series,j2_series,MaskNomType]=find_file_series(MaskPath,[MaskName MaskExt]);
     1352        [tild,tild,MaskFile,i1_series,i2_series,j1_series,j2_series,MaskNomType]=find_file_series(MaskPath,[MaskName MaskExt],0);
    13641353        if ~(isempty(i2_series) && isempty(j2_series))
    13651354            MaskNomType='*';
     
    21492138    set(handles.num_Npy,'String',num2str(ParamOut.Npy));
    21502139end
    2151 %
    2152 % if isfield(ParamOut,'TimeIndex')% case of time obtained from get_field
    2153 %     set(handles.i1,'String',num2str(ParamOut.TimeIndex))
    2154 % end
    2155 % if isfield(ParamOut,'TimeValue')
    2156 %     Field{1}.Time=ParamOut.TimeValue;% case of time obtained from get_field
    2157 % end
    21582140Field{1}.ZIndex=z_index; %used for multiplane 3D calibration
    2159 
    21602141
    21612142%% choose and read a second field FileName_1 if defined
     
    22752256    set(handles.VelType,'Visible','off')
    22762257end
    2277 % display the FieldName menu from the input file and pick the selected one:
    2278 % if isstruct(ParamOut)
    2279 %     field_index=strcmp(ParamOut.FieldName,ParamOut.FieldList);
    2280 %     set(handles.FieldName,'String',ParamOut.FieldList); %update the field menu
    2281 %     set(handles.FieldName,'Value',find(field_index,1))
    2282 % end
    22832258
    22842259%% update the display menu for the second velocity type (second menuline)
     
    23022277    % update the second field menu: the same quantity
    23032278    if isstruct(ParamOut_1)
    2304 %        set(handles.FieldName_1,'String',[{''};ParamOut_1.FieldList]); %update the field menu
    23052279        % display the FieldName menu from the input file and pick the selected one:
    23062280        FieldList=get(handles.FieldName_1,'String');
     
    23162290    set(handles.FixVelType,'Visible','off')
    23172291end
    2318 
    2319 % field_index=strcmp(ParamOut_1.FieldName,ParamOut_1.FieldList);
    2320 % set(handles.FieldName,'String',ParamOut.FieldList); %update the field menu
    2321 % set(handles.FieldName,'Value',find(field_index,1))
    23222292   
    23232293%% introduce w as background image by default for a new series (only for nbdim=2)
     
    23872357    end
    23882358end
    2389 % if isfield(Field{1},'Time')
    2390 %     abstime=Field{1}.Time;%time read from the netcdf input file
    2391 % end
    2392 % if numel(Field)==2 && isfield(Field{2},'Time')
    2393 %     abstime_1=Field{2}.Time;%time read from the netcdf input file
    2394 % end
    2395 
    2396 % look for timing in the input file if not defined in a xml file or movie
     2359
     2360%% look for timing in the input file if not defined in a xml file or movie
    23972361if isempty(abstime)
    23982362    TimeName=get(handles.TimeName,'String');
     
    24112375        end
    24122376    end
    2413 end
    2414 % if ~isequal(numel(abstime),1)
    2415 %     abstime=[];
    2416 % end
    2417 % if ~isequal(numel(abstime_1),1)
    2418 %       abstime_1=[];
    2419 % end 
     2377end
    24202378set(handles.TimeValue,'String',num2str(abstime))
    24212379abstime_1=[];
     
    24342392    end
    24352393end
    2436 
    24372394
    24382395%% store the current open names, fieldname and vel types in uvmat interface
     
    24802437UvData.Field=tps_coeff_field(UvData.Field,check_proj_tps);
    24812438
    2482 %% analyse input field
    2483 % [CellInfo,NbDimArray,errormsg]=find_field_cells(UvData.Field);% analyse  the input field structure
    2484 % if ~isempty(errormsg)
    2485 %     errormsg=['uvmat /refresh_field / find_field_cells / ' errormsg];% display error
    2486 %     return
    2487 % end
    2488 %
    2489 % NbDim=max(NbDimArray);% spatial dimension of the input field
    2490 % imax=find(NbDimArray==NbDim);% indices of field cells to consider
    2491 % if isfield(UvData.Field,'NbDim')
    2492 %     NbDim=double(UvData.Field.NbDim);% deal with plane fields containing z coordinates
    2493 % end
    2494 %
    2495 % %% get bounds and mesh (needed  to propose default options for projection objects)
    2496 % if NbDim>1
    2497 %     CoordMax=zeros(numel(imax),NbDim);
    2498 %     CoordMin=zeros(numel(imax),NbDim);
    2499 %     Mesh=zeros(1,numel(imax));
    2500 %     for ind=1:numel(imax)
    2501 %         if strcmp(CellInfo{imax(ind)}.CoordType,'tps')
    2502 %             CoordName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex};% X,Y coordinates in a single variable
    2503 %             CoordMax(ind,NbDim)=max(max(UvData.Field.(CoordName)(1:end-3,1,:),[],1),[],3);% max of x component (2D case)
    2504 %             CoordMax(ind,NbDim-1)=max(max(UvData.Field.(CoordName)(1:end-3,2,:),[],1),[],3);% max of y component (2D case)
    2505 %             CoordMin(ind,NbDim)=min(min(UvData.Field.(CoordName)(1:end-3,1,:),[],1),[],3);
    2506 %             CoordMin(ind,NbDim-1)=min(min(UvData.Field.(CoordName)(1:end-3,2,:),[],1),[],3);% min of y component (2D case)
    2507 %         else
    2508 %             XName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(end)};
    2509 %             YName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(end-1)};
    2510 %             CoordMax(ind,NbDim)=max(max(UvData.Field.(XName)));
    2511 %             CoordMin(ind,NbDim)=min(min(UvData.Field.(XName)));
    2512 %             CoordMax(ind,NbDim-1)=max(max(UvData.Field.(YName)));
    2513 %             CoordMin(ind,NbDim-1)=min(min(UvData.Field.(YName)));
    2514 %             %         test_x=1;%test for unstructured coordinates
    2515 %             if NbDim==3
    2516 %                 ZName=UvData.Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(1)};
    2517 %                 CoordMax(imax(ind),1)=max(max(UvData.Field.(ZName)));
    2518 %                 CoordMin(ind,1)=min(min(UvData.Field.(ZName)));
    2519 %             end
    2520 %         end
    2521 %         switch CellInfo{imax(ind)}.CoordType
    2522 %             
    2523 %             case {'scattered','tps'} %unstructured coordinates
    2524 %                 NbPoints=CellInfo{imax(ind)}.CoordSize;% total nbre of points
    2525 %                 Mesh(ind)=(prod(CoordMax(ind,:)-CoordMin(ind,:))/NbPoints)^(1/NbDim); %(volume or area per point)^(1/NbDim)
    2526 %             case 'grid'%structured coordinate
    2527 %                 NbPoints=CellInfo{imax(ind)}.CoordSize;% nbre of points in each direction
    2528 %                 Mesh(ind)=min((CoordMax(ind,:)-CoordMin(ind,:))./(NbPoints-1));               
    2529 %         end
    2530 %     end
    2531 %     UvData.Field.CoordMesh=min(Mesh);
    2532 %     UvData.Field.XMax=max(CoordMax(:,end));
    2533 %     UvData.Field.XMin=min(CoordMin(:,end));
    2534 %     UvData.Field.YMax=max(CoordMax(:,end-1));
    2535 %     UvData.Field.YMin=min(CoordMin(:,end-1));
    2536 %     if NbDim==3
    2537 %         UvData.Field.ZMax=max(CoordMax(ind,1));
    2538 %         UvData.Field.ZMin=max(CoordMin(ind,1));
    2539 %     end
    2540 %     % adjust the mesh to a value 1, 2 , 5 *10^n
    2541 %     ord=10^(floor(log10(UvData.Field.CoordMesh)));%order of magnitude
    2542 %     if UvData.Field.CoordMesh/ord>=5
    2543 %         UvData.Field.CoordMesh=5*ord;
    2544 %     elseif UvData.Field.CoordMesh/ord>=2
    2545 %         UvData.Field.CoordMesh=2*ord;
    2546 %     else
    2547 %         UvData.Field.CoordMesh=ord;
    2548 %     end
    2549 if ~isfield(UvData.Field,'NbDim')
    2550     UvData.Field.NbDim=1;
    2551 end
     2439%% get bounds and dimensions of the input field
     2440UvData.Field=find_field_bounds(UvData.Field);
     2441
    25522442if UvData.Field.NbDim>1
    2553     UvData.Field=find_field_bounds(UvData.Field);
    25542443    % default projection plane
    25552444    if isempty(UvData.ProjObject{1})
     
    48364725%------------------------------------------------------------------------
    48374726%get the object file
    4838 [FileName, PathName, filterindex] = uigetfile( ...
    4839        {'*.xml;*.mat', ' (*.xml,*.mat)';
    4840        '*.xml',  '.xml files '; ...
    4841         '*.mat',  '.mat matlab files '}, ...
    4842         'Pick an xml Object file',get(handles.RootPath,'String'));
    4843 fileinput=[PathName FileName];%complete file name
    4844 sizf=size(fileinput);
    4845 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end
    4846 
    4847 %read the file
    4848 [data,heading]=xml2struct(fileinput);
    4849 if ~strcmp(heading,'ProjObject')
    4850     msgbox_uvmat('WARNING','The xml file does not have the heading ProjObject for projection objects')
    4851 end
    4852 [tild,data.Name]=fileparts(FileName);% object name set as file name
    4853 ListObject=get(handles.ListObject,'String');
    4854 if ~strcmp(ListObject{end},'')
    4855     ListObject=[ListObject;{''}]; %append a blank to the list (if not already done) to indicate the creation of a new object
    4856     set(handles.ListObject,'String',ListObject)
    4857 end
    4858 IndexObj=length(ListObject);
    4859 
    4860 UvData=get(handles.uvmat,'UserData');
    4861 UvData.ProjObject{IndexObj}=[]; %create a new empty object
    4862 UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=[]; %no plot handle before plot_field operation
    4863 UvData.ProjObject{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation
    4864 set(handles.uvmat,'UserData',UvData)
    4865 set(handles.ListObject,'Value',IndexObj)
    4866 hset_object=set_object(data);% call the set_object interface
    4867 set(get(hset_object,'children'),'enable','on')% enable edit action on elements on GUI set_object
    4868 set(handles.CheckEditObject,'Value',0); %suppress the object edit mode
    4869 CheckEditObject_Callback([],[],handles)
    4870 % set(handles.CheckEditObject,'BackgroundColor',[0.7,0.7,0.7]) 
    4871 set(handles.DeleteObject,'Visible','on')
    4872 
     4727fileinput=uigetfile_uvmat('pick an xml object file:',get(handles.RootPath,'String'),'.xml');
     4728
     4729if ~isempty(fileinput)
     4730    %read the file
     4731    [data,heading]=xml2struct(fileinput);
     4732    if ~strcmp(heading,'ProjObject')
     4733        msgbox_uvmat('WARNING','The xml file does not have the heading ProjObject for projection objects')
     4734    end
     4735   % [tild,data.Name]=fileparts(fileinput);% object name set as file name
     4736    ListObject=get(handles.ListObject,'String');
     4737   
     4738%     if ~strcmp(ListObject{end},'')
     4739%         ListObject=[ListObject;{''}]; %append a blank to the list (if not already done) to indicate the creation of a new object
     4740%         set(handles.ListObject,'String',ListObject)
     4741%     end
     4742ListObject=[ListObject;{data.Name}];
     4743    IndexObj=length(ListObject); 
     4744    UvData=get(handles.uvmat,'UserData');
     4745    UvData.ProjObject{IndexObj}=[]; %create a new empty object
     4746    UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=[]; %no plot handle before plot_field operation
     4747    UvData.ProjObject{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation
     4748    set(handles.uvmat,'UserData',UvData)
     4749%     set(handles.ListObject,'String',ListObject)
     4750%     set(handles.ListObject,'Value',IndexObj)
     4751    set(handles.CheckViewObject,'Value',1)
     4752    set(handles.CheckViewField,'Value',1)
     4753    hset_object=set_object(data);% call the set_object interface
     4754    hhset_object=guidata(hset_object);
     4755    set_object('PLOT_Callback',hObject,eventdata,hhset_object);% plot projection
     4756    %set(get(hset_object,'children'),'enable','on')% enable edit action on elements on GUI set_object
     4757    set(handles.CheckEditObject,'Value',0); %suppress the object edit mode
     4758    CheckEditObject_Callback([],[],handles)
     4759    set(handles.DeleteObject,'Visible','on')
     4760end
    48734761
    48744762% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracChangeset for help on using the changeset viewer.