Changeset 387


Ignore:
Timestamp:
Apr 4, 2012, 3:31:30 PM (12 years ago)
Author:
sommeria
Message:

several bugs corrected: mask, color image...

Location:
trunk/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r386 r387  
    10951095        Param.xml=s.RunParam;
    10961096    else
    1097         msgbox_uvmat('ERROR','no run civ binaries defined in PARAM.xml')
     1097        errormsg='no run civ binaries defined in PARAM.xml';
    10981098        return
    10991099    end
     
    11101110    [s,w]=system(test_command);
    11111111    if ~isequal(s,0)
    1112         msgbox_uvmat('ERROR',[batch_mode ' batch system not available'])
     1112        errormsg=[batch_mode ' batch system not available'];
    11131113        return
    11141114    end
     
    11371137                Param.xml.(bin_name{1})=fullname;
    11381138            else
    1139                 msgbox_uvmat('ERROR',['Binary ' Param.xml.(bin_name{1}) ' defined in PARAM.xml does not exist'])
     1139                errormsg=['Binary ' Param.xml.(bin_name{1}) ' defined in PARAM.xml does not exist'];
    11401140                return
    11411141            end
     
    12391239%                         Param.Civ1.Grid=[filecell.filebase '_' name_generator(Param.Civ1.Grid,i1_grid,1,'.grid','_i')];
    12401240                        if ~exist(Param.Civ1.GridName,'file')
    1241                             msgbox_uvmat('ERROR','grid file absent for civ1')
     1241                            errormsg='grid file absent for civ1';
     1242                            return
    12421243                        end
    12431244                    elseif ~exist(Param.Civ1.Grid,'file')
    1244                         msgbox_uvmat('ERROR','grid file absent for civ1')
     1245                        errormsg='grid file absent for civ1';
     1246                        return
    12451247                    end
    12461248                end
     
    12501252            switch CivMode
    12511253                case 'CivX'
    1252                     cmd=[cmd...
    1253                         cmd_civ1(filecell.nc.civ1{ifile,j},Param) '\n'];
     1254                    [cmd_civ,errormsg]=cmd_civ1(filecell.nc.civ1{ifile,j},Param);
     1255                    cmd=[cmd cmd_civ '\n'];
    12541256                    if ~isempty(errormsg)
    1255                         msgbox_uvmat('ERROR',errormsg)
    12561257                        return
    12571258                    end
     
    13181319%                                 patch1.gridPatch=[filecell.filebase '_' name_generator(gridname,i1_grid,1,'.grid','_i')];
    13191320                                if ~exist(patch1.gridPatch,'file')
    1320                                     msgbox_uvmat('ERROR','grid file absent for patch1')
     1321                                    errormsg='grid file absent for patch1';
     1322                                    return
    13211323                                end
    13221324                            elseif exist(gridname,'file')
    13231325                                patch1.gridPatch=gridname;
    13241326                            else
    1325                                 msgbox_uvmat('ERROR','grid file absent for patch1')
     1327                                errormsg='grid file absent for patch1';
     1328                                return
    13261329                            end
    13271330                        end
     
    14561459%                                 patch2.gridPatch=[filecell.filebase '_' name_generator(gridname,i1_grid,1,'.grid','_i')];
    14571460                                if ~exist(patch2.gridPatch,'file')
    1458                                     msgbox_uvmat('ERROR','grid file absent for patch2')
     1461                                    errormsg='grid file absent for patch2';
     1462                                    return
    14591463                                end
    14601464                            elseif exist(gridname,'file')
    14611465                                patch2.gridPatch=gridname;
    14621466                            else
    1463                                 msgbox_uvmat('ERROR','grid file absent for patch2')
     1467                                errormsg='grid file absent for patch2';
     1468                                return
    14641469                            end
    14651470                        end
     
    14951500                [fid,message]=fopen(filename_bat,'w');
    14961501                if isequal(fid,-1)
    1497                     msgbox_uvmat('ERROR', ['creation of .bat file: ' message])
     1502                    errormsg=['creation of .bat file: ' message];
    14981503                    return
    14991504                end
     
    15161521                        [fid,message]=fopen(filename_bat,'w');
    15171522                        if isequal(fid,-1)
    1518                             msgbox_uvmat('ERROR', ['creation of .bat file: ' message])
     1523                            errormsg= ['creation of .bat file: ' message];
    15191524                            return
    15201525                        end
     
    15371542                        if isempty(errormsg)
    15381543                            display([filecell.nc.civ1{ifile,j} ' written'])
    1539                         else
    1540                             msgbox_uvmat('ERROR',errormsg)
     1544%                         else
     1545%                             msgbox_uvmat('ERROR',errormsg)
    15411546                        end
    15421547                    end
     
    30313036else %case civ2 alone
    30323037    if ~get(handles.CheckCiv2,'Value') && ~get(handles.CheckCiv1,'Value') && ~get(handles.CheckFix1,'Value') && ~get(handles.CheckPatch1,'Value')
    3033         if ~exist(fullfile(filepath,subdir_civ2,ext_dir),'dir')
     3038        if ~exist(fullfile(RootPath,subdir_civ2,ext_dir),'dir')
    30343039            errordlg(['no civ2 file available: subdirectory ' subdir_civ2 ' does not exist'])
    30353040            set(handles.ListPairCiv2,'Value',1);
     
    36373642    end
    36383643end
    3639 %------------------------------------------------------------------------
    3640 % --- Executes on button press in CheckMask.
     3644
     3645%------------------------------------------------------------------------
     3646% --- Executes on button press in CheckMask: common to all panels (civ1, Civ2..)
    36413647function CheckMask_Callback(hObject, eventdata, handles)
    36423648%------------------------------------------------------------------------
     
    36453651parent_tag=get(hparent,'Tag');
    36463652hchildren=get(hparent,'children');
    3647 handle_txtbox=findobj(hchildren,'tag','txt_Mask');
    3648 % handle_dx=findobj(hchildren,'tag','num_Dx');
    3649 % handle_dy=findobj(hchildren,'tag','num_Dy');
     3653handle_txtbox=findobj(hchildren,'tag','Mask');% look for the mask name box in the same panel
    36503654testmask=0;
    36513655if value
     
    36733677end
    36743678if testmask
    3675 %     stage=4;%default
    36763679    if strcmp(parent_tag,'Civ1')
    3677             set(handles.Mask,'Visible','on')
     3680        set(handles.Mask,'Visible','on')
    36783681        set(handles.Mask,'String',filemask)
    36793682    set(handles.CheckMask,'Value',1)
     
    39073910    Data.VarDimName= {'ny','nx',{'ny','nx'}};
    39083911    Data.A=imread(filecell.ima1.civ1{1});
     3912    if ndims(Data.A)==3 %case of color image
     3913        Data.VarDimName= {'ny','nx',{'ny','nx','rgb'}};
     3914    end
    39093915    Data.ny=[size(Data.A,1) 1];
    39103916    Data.nx=[1 size(Data.A,2)];
     
    39153921    Param.Civ1=par_civ1;
    39163922    Grid=civ_matlab(Param);% get the grid of x, y positions set for PIV
    3917     hview_field=view_field(Data);
     3923    hview_field=view_field(Data); %view the image in the GUI view_field
    39183924    set(0,'CurrentFigure',hview_field)
    39193925    hhview_field=guihandles(hview_field);
     
    39603966
    39613967%------------------------------------------------------------------------
    3962 function cmd=cmd_civ1(filename,Param)
     3968function [cmd,errormsg]=cmd_civ1(filename,Param)
    39633969%------------------------------------------------------------------------
    39643970%pixels per cm and matrix of the image times, read from the .civ file by uvmat
    39653971%changes : filename_cmx -> filename ( no extension )
    39663972cmd='';
    3967 errormsg=''; %default
    39683973filename=regexprep(filename,'.nc',''); %file name for the result
    39693974if isequal(Param.Civ1.Dt,0)
     
    39723977Param.Civ1.ImageA=regexprep(Param.Civ1.ImageA,'.png','');
    39733978Param.Civ1.ImageB=regexprep(Param.Civ1.ImageB,'.png','');
    3974 fid=fopen([filename '.civ1.cmx'],'w');
     3979[fid,errormsg]=fopen([filename '.civ1.cmx'],'w');
    39753980if isequal(fid,-1)
    3976     display(['cmd file ' filename ' cannot be created'])
     3981    errormsg=['cmd file ' filename ' cannot be created: ' errormsg];
    39773982    return
    39783983end
     
    40544059filename=regexprep(filename,'.nc','');
    40554060MaskName_string='';%default
    4056 % if Param.(fixname).CheckMask
    4057 %     MaskName_string=[' -maskName "' Param.(fixname).Mask '"'];
    4058 % end
    40594061MaxVel_string='';%default
    40604062if ~isempty(Param.(fixname).MaxVel)
     
    40954097%------------------------------------------------------------------------
    40964098% --- CheckCiv2  CheckCiv2  CheckCiv2 CheckCiv2
    4097 function cmd=cmd_civ2(filename,Param)
     4099function [cmd,errormsg]=cmd_civ2(filename,Param)
    40984100%------------------------------------------------------------------------
    40994101%pixels per cm and matrix of the image times, read from the .civ file by uvmat
    41004102% global civ2Bin sge%name of the executable for checkciv1 calculation
     4103 cmd='';
    41014104filename=regexprep(filename,'.nc','');
    41024105if isequal(Param.Civ2.Dt,'0')
     
    41074110[fid,errormsg]=fopen([filename '.civ2.cmx'],'w');
    41084111if isequal(fid,-1)
    4109     msgbox_uvmat('ERROR',errormsg)
    4110     cmd='';
    41114112    return
    41124113end
  • trunk/src/civ_matlab.m

    r386 r387  
    1414%INPUT:
    1515% Param: input images and processing parameters
     16%     .Civ1: for civ1
     17%     .Fix1:
     18%     .Patch1:
     19%     .Civ2: for civ2
     20%     .Fix2:
     21%     .Patch2:
    1622% ncfile: name of a netcdf file to be created for the result (extension .nc)
    1723%
     
    4753
    4854if ischar(Param)
    49     Param=xml2struct(Param);
     55    Param=xml2struct(Param); %if Param is the name of an xml file, read this file as a Matlab structure
    5056end
    5157
     
    6672        end
    6773    else
    68         if ischar(par_civ1.ImageA)
     74        if isfield(par_civ1,'ImageA') && ischar(par_civ1.ImageA) % case with no image: only the PIV grid is calculated
    6975            par_civ1.ImageA=sum(imread(par_civ1.ImageA),3);
    7076        end
    71         if ischar(par_civ1.ImageB)
     77        if isfield(par_civ1,'ImageB')&& ischar(par_civ1.ImageB)
    7278            par_civ1.ImageB=sum(imread(par_civ1.ImageB),3);
    7379        end
     
    245251    end
    246252    mask='';
    247     if par_civ2.CheckMask&&~isempty(par_civ2.maskname)&& ~strcmp(maskname,par_civ2.maskname)% mask exist, not already read in civ1
    248         mask=imread(par_civ2.maskname);
     253    if par_civ2.CheckMask&&~isempty(par_civ2.Mask)&& ~strcmp(maskname,par_civ2.Mask)% mask exist, not already read in civ1
     254        mask=imread(par_civ2.Mask);
    249255    end
    250256    par_civ2.Searchx=2*isx2+1;
  • trunk/src/filter_tps.m

    r382 r387  
    7373            % if too few selected vectors, increase the subrange for next iteration
    7474        elseif numel(ind_sel)<SubDomain/4 && ~isequal( ind_sel,ind_sel_previous);
    75             SubRange(:,1,isub)=SubRange(:,1,isub)-Siz/4;
    76             SubRange(:,2,isub)=SubRange(:,2,isub)+Siz/4;
     75            SubRange(:,1,isub)=SubRange(:,1,isub)-Siz'/4;
     76            SubRange(:,2,isub)=SubRange(:,2,isub)+Siz'/4;
    7777%             SubRangy(isub,1)=SubRangy(isub,1)-Siz(2)/4;
    7878%             SubRangy(isub,2)=SubRangy(isub,2)+Siz(2)/4;
     
    8989            ind_ind_sel=find(FF(ind_sel)==0); % select the indices of ind_sel corresponding to the remaining vectors
    9090            end
    91             % no value exceeds threshold, the result is recorded
     91            % if no value exceeds threshold, the result is recorded
    9292            if isequal(numel(ind_ind_sel),numel(ind_sel))
    9393                U_smooth(ind_sel)=U_smooth(ind_sel)+U_smooth_sub;
    9494                V_smooth(ind_sel)=V_smooth(ind_sel)+V_smooth_sub;
    9595                NbSites(isub)=numel(ind_sel);
    96 %                 Indices_tps(1:NbSites(isub),isub)=ind_sel;
    9796                Coord_tps(1:NbSites(isub),:,isub)=Coord(ind_sel,:);
    98 %                 Y_tps(1:NbSites(isub),:,isub)=Coord(ind_sel,2);
    9997                U_tps(1:NbSites(isub)+3,isub)=U_tps_sub;
    10098                V_tps(1:NbSites(isub)+3,isub)=V_tps_sub;         
    10199                nb_select(ind_sel)=nb_select(ind_sel)+1;
    102                  display('good')
     100                display('good')
    103101                break
    104                 % too few selected vectors, increase the subrange for next iteration
     102            % if too few selected vectors, increase the subrange for next iteration
    105103            elseif numel(ind_ind_sel)<SubDomain/4 && ~isequal( ind_sel,ind_sel_previous);
    106                 SubRange(:,1,isub)=SubRange(:,1,isub)-Siz/4;
    107                 SubRange(:,2,isub)=SubRange(:,2,isub)+Siz/4;
    108 %                 SubRange(2,isub,1)=SubRangy(2,isub,1)-Siz(2)/4;
    109 %                 SubRange(2,isub,2)=SubRangy(2,isub,2)+Siz(2)/4;
    110 %                 display('fewsmooth')
    111                 % interpolation-smoothing is done again with the selected vectors
     104                SubRange(:,1,isub)=SubRange(:,1,isub)-Siz'/4;
     105                SubRange(:,2,isub)=SubRange(:,2,isub)+Siz'/4;
     106            % else interpolation-smoothing is done again with the selected vectors
    112107            else
    113                 [U_smooth_sub,U_tps_sub]=tps_coeff(Coord(ind_sel(ind_ind_sel)),U(ind_sel(ind_ind_sel)),rho);
    114                 [V_smooth_sub,V_tps_sub]=tps_coeff(Coord(ind_sel(ind_ind_sel)),V(ind_sel(ind_ind_sel)),rho);
     108                [U_smooth_sub,U_tps_sub]=tps_coeff(Coord(ind_sel(ind_ind_sel),:),U(ind_sel(ind_ind_sel)),rho);
     109                [V_smooth_sub,V_tps_sub]=tps_coeff(Coord(ind_sel(ind_ind_sel),:),V(ind_sel(ind_ind_sel)),rho);
    115110                U_smooth(ind_sel(ind_ind_sel))=U_smooth(ind_sel(ind_ind_sel))+U_smooth_sub;
    116111                V_smooth(ind_sel(ind_ind_sel))=V_smooth(ind_sel(ind_ind_sel))+V_smooth_sub;
  • trunk/src/get_file_type.m

    r386 r387  
    4040                Data=nc2struct(fileinput,'ListGlobalAttribute','absolut_time_T0','Conventions',...
    4141                    'CivStage','patch2','fix2','civ2','patch','fix');
    42                 if ~isempty(Data.Txt)
     42                if isfield(Data,'Txt') && ~isempty(Data.Txt)
    4343                    error_nc=1;
    4444                else
     
    6969            end
    7070            if error_nc
     71                try
    7172                    if exist('VideoReader','file')%recent version of Matlab
    7273                        Object=VideoReader(fileinput);
     
    7677                    FileType='video';
    7778                    FileInfo.NbFrame=get(Object,'NumberOfFrames');
     79                end
    7880            end
    7981        end
  • trunk/src/mouse_down.m

    r379 r387  
    311311            list_str=get(hhuvmat.ListObject,'String');
    312312            IndexObj_old=get(hhuvmat.ListObject,'Value');
    313             set(hhuvmat.ListObject,'Value',[IndexObj_old(1) IndexObj] );
     313%             set(hhuvmat.ListObject,'Value',[IndexObj_old(1) IndexObj] );
    314314            UvData.Object{IndexObj}.DisplayHandle_uvmat=AxeData.CurrentObject;
    315315            object_name=ObjectData.Name;
     
    322322            end
    323323            set(hhuvmat.ListObject,'String',list_str)
     324            set(hhuvmat.ListObject,'Value',[IndexObj_old(1) IndexObj] );
    324325            UvData.Object{IndexObj}.DisplayHandle_view_field=AxeData.CurrentObject;
    325             %list_str{end+1}='...';
    326 %             set(hhuvmat.list_object_2,'String',list_str)
    327 %             if strcmp(fig_tag,'view_field')%we are in view_field plot
    328 %                   set(hhuvmat.list_object_1,'Value',IndexObj)% the projection field will be plotted in uvmat frame
    329 %                   UvData.Object{IndexObj}.DisplayHandle_uvmat=[];
    330 %                   UvData.Object{IndexObj}.DisplayHandle_view_field=AxeData.CurrentObject;       
    331 %             else%we are in uvmat plot
    332 %                 set(hhuvmat.list_object_2,'Value',IndexObj)
    333 %                 UvData.Object{IndexObj}.DisplayHandle_uvmat=AxeData.CurrentObject;
    334 %                 UvData.Object{IndexObj}.DisplayHandle_view_field=[];
    335 %             end
    336326            set(huvmat,'UserData',UvData)
    337327            PlotData=get(AxeData.CurrentObject,'UserData');
  • trunk/src/mouse_motion.m

    r379 r387  
    245245                        end
    246246                        [Data,errormsg,result_conv]= civ_matlab(Param);
    247                         rangx(1)=-(isx2-ibx2)+shiftx;
    248                         rangx(2)=isx2-ibx2+shiftx;
    249                         rangy(1)=-(isy2-iby2)-shifty;
    250                         rangy(2)=(isy2-iby2)-shifty;
    251                         hcorr=[];
    252                         if isfield(AxeData,'CurrentCorrImage')
    253                             hcorr=AxeData.CurrentCorrImage;
    254                             if ~ishandle(hcorr)
    255                                 hcorr=[];
     247                        if ~isempty(errormsg)
     248                            text_displ_4=errormsg;
     249                        else
     250                            rangx(1)=-(isx2-ibx2)+shiftx;
     251                            rangx(2)=isx2-ibx2+shiftx;
     252                            rangy(1)=-(isy2-iby2)-shifty;
     253                            rangy(2)=(isy2-iby2)-shifty;
     254                            hcorr=[];
     255                            if isfield(AxeData,'CurrentCorrImage')
     256                                hcorr=AxeData.CurrentCorrImage;
     257                                if ~ishandle(hcorr)
     258                                    hcorr=[];
     259                                end
    256260                            end
    257                         end
    258                         if isempty(hcorr)
    259                             corrfig=findobj(allchild(0),'tag','corrfig');
    260                             if ~isempty(corrfig)
    261                                 set(0,'CurrentFigure',corrfig(1))
    262                                 AxeData.CurrentCorrImage=imagesc(rangx,-rangy,result_conv,[0 1]);
    263                                 AxeData.CurrentVector=line([0 Data.Civ1_U],[0 Data.Civ1_V],'Tag','vector');               
    264                                 colorbar
    265                                 set(haxes,'UserData',AxeData)
    266                                 set(get(AxeData.CurrentCorrImage,'parent'),'YDir','normal')
     261                            if isempty(hcorr)
     262                                corrfig=findobj(allchild(0),'tag','corrfig');
     263                                if ~isempty(corrfig)
     264                                    set(0,'CurrentFigure',corrfig(1))
     265                                    AxeData.CurrentCorrImage=imagesc(rangx,-rangy,result_conv,[0 1]);
     266                                    AxeData.CurrentVector=line([0 Data.Civ1_U],[0 Data.Civ1_V],'Tag','vector');
     267                                    colorbar
     268                                    set(haxes,'UserData',AxeData)
     269                                    set(get(AxeData.CurrentCorrImage,'parent'),'YDir','normal')
     270                                end
     271                            else
     272                                set(AxeData.CurrentCorrImage,'CData',result_conv)
     273                                set(AxeData.CurrentCorrImage,'XData',rangx)
     274                                set(AxeData.CurrentCorrImage,'YData',-rangy)
     275                                set(AxeData.CurrentVector,'XData',[0 Data.Civ1_U],'YData',[0 Data.Civ1_V])
    267276                            end
    268                         else
    269                             set(AxeData.CurrentCorrImage,'CData',result_conv)
    270                             set(AxeData.CurrentCorrImage,'XData',rangx)
    271                             set(AxeData.CurrentCorrImage,'YData',-rangy)
    272                             set(AxeData.CurrentVector,'XData',[0 Data.Civ1_U],'YData',[0 Data.Civ1_V])
    273277                        end
    274278                    end
  • trunk/src/set_object.m

    r379 r387  
    9797        set(handles.z_slider,'Visible','off')
    9898    end
     99    if isfield(data,'TypeMenu')
     100        set(handles.Type,'String',data.TypeMenu)
     101    end
     102    if isfield(data,'ProjModeMenu')
     103%         set(handles.ProjMode,'String',data.ProjModeMenu) % data.ProjModeMenu as projMode menu
     104        set(handles.ProjMode,'UserData',data.ProjModeMenu)% data.ProjModeMenu as default menu (used in Type_Callback)
     105    end
    99106    errormsg=fill_GUI(data,handles);
    100 %     if isfield(data,'StyleMenu')
    101 %         set(handles.Type,'String',data.StyleMenu);
    102 %     end
    103 %     if isfield(data,'Type')
    104 %         menu=get(handles.Type,'String');
    105 %         for iline=1:length(menu)
    106 %             if isequal(menu{iline},data.Style)
    107 %                 set(handles.Type,'Value',iline)
    108 %                 break
    109 %             end
    110 %         end
    111 %     end
    112     Type_Callback(hObject, eventdata, handles)
    113 %     if isfield(data,'ProjMenu')
    114 %         set(handles.ProjMode,'String',data.ProjMenu);%overset the standard menu
    115 %     end
    116 %     if isfield(data,'ProjMode')
    117 %         menu=get(handles.ProjMode,'String');
    118 %         for iline=1:length(menu)
    119 %             if isequal(menu{iline},data.ProjMode)
    120 %                 set(handles.ProjMode,'Value',iline)
    121 %                 break
    122 %             end
    123 %         end
    124 %     end
    125 %    ProjMode_Callback(hObject, eventdata, handles)
    126 %     if isfield(data,'Coord')
    127 %         if ischar(data.Coord)
    128 %             data.Coord=str2num(data.Coord);
    129 %         elseif iscell(data.Coord)
    130 %             CoordCell=data.Coord;
    131 %             data.Coord=zeros(numel(CoordCell),3);
    132 %             data.Coord(:,3)=zeros(numel(CoordCell),1); % z component set to 0 by default
    133 %             for iline=1:numel(CoordCell)
    134 %                 line_vec=str2num(CoordCell{iline});
    135 %                 if numel(line_vec)==2
    136 %                     data.Coord(iline,1:2)=str2num(CoordCell{iline});
    137 %                 else
    138 %                     data.Coord(iline,:)=str2num(CoordCell{iline});
    139 %                 end
    140 %             end
    141 %         end
    142 %         if size(data.Coord,2)>=2
    143 %             sizcoord=size(data.Coord);
    144 %             for i=1:sizcoord(1)
    145 %                 XObject{i}=num2str(data.Coord(i,1),4);
    146 %                 YObject{i}=num2str(data.Coord(i,2),4);
    147 %             end
    148 % %             set(handles.XObject,'String',XObject)
    149 % %             set(handles.YObject,'String',YObject)
    150 %             if sizcoord(2)>3
    151 %                 for i=1:sizcoord(1)
    152 %                     ZObject{i}=num2str(data.Coord(i,3),4);
    153 %                 end
    154 %                 set(handles.ZObject,'String',ZObject)
    155 %             end
    156 %         end
    157 %     end
    158 %     if isfield(data,'DX')
    159 %         if ~ischar(handles.num_DX)
    160 %             data.DX=num2str(data.DX,3);
    161 %         end
    162 %         set(handles.num_DX,'String',data.DX)
    163 %     end
    164 %     if isfield(data,'DY')
    165 %         if ~ischar(handles.num_DY)
    166 %             data.DY=num2str(data.DY,3);
    167 %         end
    168 %         set(handles.num_DY,'String',data.DX)
    169 %     end
     107    Type_Callback(hObject, eventdata, handles)% update the GUI set_object depending on the object type   
     108
    170109    if isfield(data,'RangeZ') && length(ZBounds) >= 2
    171110        set(handles.num_RangeZ_2,'String',num2str(max(data.RangeZ),3))
     
    209148         set(handles.num_Angle_3,'String',num2str(data.Angle(3)))
    210149    end
    211 %     if isfield(data,'DZ')
    212 %         if ~ischar(handles.num_DZ)
    213 %             data.DY=num2str(data.DZ,3);
    214 %         end
    215 %         set(handles.num_DZ,'String',data.DZ)
    216 %     end
    217 %     if isfield(data,'CoordUnit')
    218 %         set(handles.CoordUnit,'String',data.CoordUnit)
    219 %     end
    220150end
    221151if enable_plot
     
    234164end
    235165
    236 
    237166%------------------------------------------------------------------------
    238167% --- Outputs from this function are returned to the command line.
     
    252181% make correspondance between different object styles
    253182Coord=get(handles.Coord,'Data');
    254 %
    255 % Xcolumn=get(handles.XObject,'String');
    256 % Ycolumn=get(handles.YObject,'String');
    257 % if ischar(Xcolumn)
    258 %     sizchar=size(Xcolumn);
    259 %     for icol=1:sizchar(1)
    260 %         Xcolumn_cell{icol}=Xcolumn(icol,:);
    261 %     end
    262 %     Xcolumn=Xcolumn_cell;
    263 % end
    264 % if ischar(Ycolumn)
    265 %     sizchar=size(Ycolumn);
    266 %     for icol=1:sizchar(1)
    267 %         Ycolumn_cell{icol}=Ycolumn(icol,:);
    268 %     end
    269 %     Ycolumn=Ycolumn_cell;
    270 % end
    271 % Zcolumn={};%default
    272 % z_new={};
    273 % if isequal(get(handles.ZObject,'Visible'),'on')
    274 %     %data.NbDim=3; %test 3D object
    275 %     Zcolumn=get(handles.ZObject,'String');
    276 %     if ischar(Zcolumn)
    277 %         Zcolumn={Zcolumn};
    278 %     end
    279 % end
    280 % x_new{1}=Xcolumn{1};
    281 % y_new{1}=Ycolumn{1};
    282 % x_new{1}=Coord(1,1);
    283 % y_new{1}=Coord(1,2);
    284 % z_new{1}=Coord(1,3);
    285 % if ~isempty(Zcolumn)
    286 %     z_new{1}=Zcolumn{1};
    287 % end
    288 % if isequal(style,'line')
    289 %     if strcmp(style_prev,'rectangle')||strcmp(style_prev,'ellipse')
    290 %         num_RangeX_2=get(handles.num_RangeX_2,'String');
    291 %         num_RangeY_2=get(handles.num_RangeY_2,'String');
    292 %         x_new{2}=num2str(num_RangeX_2,4);
    293 %         y_new{2}=num2str(num_RangeY_2,4);
    294 %         set(handles.XObject,'String',x_new)
    295 %         set(handles.YObject,'String',y_new)
    296 %         set(handles.ZObject,'String',z_new)
    297 %     end
    298 % elseif isequal(style,'polyline')
    299 % elseif strcmp(style,'rectangle')|| strcmp(style,'ellipse')
    300 %      set(handles.XObject,'String',x_new)
    301 %      set(handles.YObject,'String',y_new)
    302 %      set(handles.ZObject,'String',z_new)
    303 % end
    304183
    305184%% set the number of lines in the Coord table depending on object type
     
    321200
    322201%% set the projection menu and the corresponding options
    323 switch Type
    324     case {'points','line','polyline','plane'}
    325         menu_proj={'projection';'interp';'filter';'none'};
    326     case {'polygon','rectangle','ellipse'}
    327         menu_proj={'inside';'outside';'mask_inside';'mask_outside'};
    328     case 'volume'
    329         menu_proj={'interp';'none'};
    330     otherwise
    331         menu_proj={'projection';'interp';'filter';'none'};%default
    332 end   
     202if isempty(get(handles.ProjMode,'UserData'))
     203    switch Type
     204        case {'points','line','polyline','plane'}
     205            menu_proj={'projection';'interp';'filter';'none'};
     206        case {'polygon','rectangle','ellipse'}
     207            menu_proj={'inside';'outside';'mask_inside';'mask_outside'};
     208        case 'volume'
     209            menu_proj={'interp';'none'};
     210        otherwise
     211            menu_proj={'projection';'interp';'filter';'none'};%default
     212    end
     213else
     214    menu_proj=get(handles.ProjMode,'UserData');
     215end
    333216proj_index=get(handles.ProjMode,'Value');
    334 if proj_index<numel(menu_proj)
     217if proj_index>numel(menu_proj)
    335218    set(handles.ProjMode,'Value',1);% value index must not exceed the menu length
    336219end
  • trunk/src/uvmat.m

    r386 r387  
    26472647        end
    26482648        siz=size(UvData.XmlData{2}.Time);
    2649         if siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2)
     2649        if ~isempty(num_i1) && siz(1)>=max(num_i1,num_i2) && siz(2)>=max(num_j1,num_j2)
    26502650            abstime_1=(UvData.XmlData{2}.Time(num_i1,num_j1)+UvData.XmlData{2}.Time(num_i2,num_j2))/2;%overset the time read from files
    26512651        end
     
    42034203                    end
    42044204                end
    4205                 if isfield(ObjectData,'Coord')&& isfield(ObjectData,'Style')
     4205                if isfield(ObjectData,'Coord')&& isfield(ObjectData,'Type')
    42064206                    if isequal(ObjectData.Type,'polygon')
    42074207                        X=ObjectData.Coord(:,1);
     
    42484248    masknumber=num2str(length(list));
    42494249    maskindex=get(handles.masklevel,'Value');
    4250     mask_name=fullfile_uvmat(RootPath,SubDir,[RootFile '_' masknumber 'mask'],'.png','_1',maskindex);
     4250    mask_name=fullfile_uvmat(RootPath,'',[RootFile '_' masknumber 'mask'],'.png','_1',maskindex);
    42514251    %mask_name=name_generator([filebase '_' masknumber 'mask'],maskindex,1,'.png','_i');
    42524252    imflag=uint8(255*(0.392+0.608*flag));% =100 for flag=0 (vectors not computed when 20<imflag<200)
     
    42704270    end
    42714271    set(handles.ListObject,'Value',1)
    4272     set(handles.ListObject,'Max',1)
     4272%     set(handles.ListObject,'Max',1)
    42734273end
    42744274
     
    44214421data.TypeMenu={'polygon'};
    44224422data.ProjMode='mask_inside';%default
    4423 data.ProjMenu={'mask_inside';'mask_outside'};
     4423data.ProjModeMenu={'mask_inside';'mask_outside'};
    44244424create_object(data,handles)
    44254425
  • trunk/src/view_field.m

    r356 r387  
    7373if ~isempty(huvmat)
    7474    hhuvmat=guidata(huvmat);
    75 %     set(hhuvmat.list_object_2,'Visible','on')
    76 %     set(hhuvmat.view_field_title,'Visible','on')
    77     % handles_mouse.create=hhuvmat.create;
    7875    handles_mouse.edit=hhuvmat.edit_object;
    7976    pos_view_field=get(hObject,'Position');
Note: See TracChangeset for help on using the changeset viewer.