Changeset 159 for trunk


Ignore:
Timestamp:
Dec 23, 2010, 8:09:20 AM (14 years ago)
Author:
sommeria
Message:

bug in civ corrected: civ2 was not lauched for Windows system
various bugs corrections and cleaning

Location:
trunk/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/check_field_structure.m

    r158 r159  
    112112        else % DimName is detected in the current list of dimension names
    113113            if ~isequal(Data.DimValue(iprev),sizvar(idim))
    114                         RangeTest(iprev)
    115             Data.DimValue(iprev)
    116114                if isequal(Data.DimValue(iprev),2)&& RangeTest(iprev)  % the dimension has been already detected as a range [min max]
    117115                    Data.DimValue(iprev)=sizvar(idim); %update with actual value
  • trunk/src/civ.m

    r153 r159  
    15971597index_first=min(index);
    15981598index_last=max(index);
    1599 box_used=box_test([index_first : index_last]);
     1599box_used=box_test(index_first : index_last);
    16001600[box_missing,ind_missing]=min(box_used);
    16011601if isequal(box_missing,0)
     
    18701870        filename_cmx=filecell.nc.civ1{ifile,j};%output netcdf file
    18711871        filename_cmx(end-1:end+1)='cmx';%name of cmx file
     1872        if batch
     1873            [Rootbat,Filebat,extbat]=fileparts(filename_cmx);
     1874            filename_bat=fullfile(Rootbat,['job_' Filebat extbat]);
     1875         else
     1876            filename_bat=filename_cmx;
     1877        end
     1878        filename_bat(end-2:end)='bat';
    18721879       
    18731880        %CIV1
     
    22112218        end
    22122219        % create the .bat file:
    2213         if batch
    2214             [Rootbat,Filebat,extbat]=fileparts(filename_cmx);
    2215             filename_bat=fullfile(Rootbat,['job_' Filebat extbat]);
    2216          else
    2217             filename_bat=filename_cmx;
    2218         end
    2219         filename_bat(end-2:end)='bat';
    2220         fid=fopen(filename_bat,'w');
     2220        [fid,message]=fopen(filename_bat,'w');
     2221        if isequal(fid,-1)
     2222            msgbox_uvmat('ERROR', ['creation of .bat file: ' message])
     2223            return
     2224        end
    22212225        fprintf(fid,cmd);
    22222226        fclose(fid);
     
    22462250
    22472251if ~batch
    2248     [Rootbat,Filebat,extbat]=fileparts(filename_cmx);
     2252    [Rootbat,Filebat,extbat]=fileparts(filename_bat);
    22492253    filename_superbat=fullfile(Rootbat,['job_list.bat']);
    22502254    fid=fopen(filename_superbat,'w');
  • trunk/src/geometry_calib.m

    r158 r159  
    10991099function MenuDetectGrid_Callback(hObject, eventdata, handles)
    11001100%------------------------------------------------------------------------
     1101%% initiate the grid
    11011102CalibData=get(handles.geometry_calib,'UserData');%get information stored on the GUI geometry_calib
    11021103grid_input=[];%default
     
    11051106end
    11061107[T,CalibData.grid,white_test]=create_grid(grid_input,'detect_grid');%display the GUI create_grid, read the set of phys coordinates T
    1107 
    11081108set(handles.geometry_calib,'UserData',CalibData)%store the phys grid parameters for later use
    11091109
    1110 %read the four last point coordinates in pixels
     1110%% read the four last point coordinates in pixels
    11111111Coord_cell=get(handles.ListCoord,'String');%read list of coordinates on geometry_calib
    11121112data=read_geometry_calib(Coord_cell);
    11131113nbpoints=size(data.Coord,1); %nbre of calibration points
    11141114if nbpoints~=4
    1115     msgbox_uvmat('ERROR','four points must be selected by the mouse, beginning by the new x axis, to delimitate the phs grid area')
     1115    msgbox_uvmat('ERROR','four points must have be selected by the mouse, beginning by the new x axis, to delimitate the phys grid area')
    11161116    return
    11171117end
     
    11301130end
    11311131
    1132 %read the current image, displayed in the GUI uvmat
     1132%% read the current image, displayed in the GUI uvmat
    11331133huvmat=findobj(allchild(0),'Name','uvmat');
    11341134UvData=get(huvmat,'UserData');
    11351135A=UvData.Field.A;
    11361136npxy=size(A);
    1137 %linear transform on the current image
    1138 X=[CalibData.grid.x_0 CalibData.grid.x_1 CalibData.grid.x_0 CalibData.grid.x_1]';%corner absissa in the phys coordinates
    1139 Y=[CalibData.grid.y_0 CalibData.grid.y_0 CalibData.grid.y_1 CalibData.grid.y_1]';%corner ordinates in the phys coordinates
    1140 
    1141 %calculate transform matrices:
     1137X=[CalibData.grid.x_0 CalibData.grid.x_1 CalibData.grid.x_0 CalibData.grid.x_1]';%corner absissa in the phys coordinates (cm)
     1138Y=[CalibData.grid.y_0 CalibData.grid.y_0 CalibData.grid.y_1 CalibData.grid.y_1]';%corner ordinates in the phys coordinates (cm)
     1139
     1140%calculate transform matrices for plane projection
    11421141% reference: http://alumni.media.mit.edu/~cwren/interpolator/ by Christopher R. Wren
    11431142B = [ X Y ones(size(X)) zeros(4,3)        -X.*corners_X -Y.*corners_X ...
     
    11461145D = [ corners_X , corners_Y ];
    11471146D = reshape (D', 8 , 1 );
    1148 %l = inv(B' * B) * B' * D;
    11491147l = (B' * B)\B' * D;
    11501148Amat = reshape([l(1:6)' 0 0 1 ],3,3)';
    11511149C = [l(7:8)' 1];
    11521150
    1153 %GeometryCalib.CalibrationType='tsai';
    1154 %GeometryCalib.CoordUnit=[];% default value, to be updated by the calling function
    1155 % GeometryCalib.f=1;
    1156 % GeometryCalib.dpx=1;
    1157 % GeometryCalib.dpy=1;
    1158 % GeometryCalib.sx=1;
    1159 % GeometryCalib.Cx=0;
    1160 % GeometryCalib.Cy=0;
    1161 % GeometryCalib.kappa1=0;
    1162 % GeometryCalib.Tx=Amat(1,3);
    1163 % GeometryCalib.Ty=Amat(2,3);
    1164 % GeometryCalib.Tz=1;
    1165 % GeometryCalib.R=[Amat(1,1),Amat(1,2),0;Amat(2,1),Amat(2,2),0;C(1),C(2),0];
    1166 %
    1167 % [Amod,Rangx,Rangy]=phys_Ima(A-min(min(A)),GeometryCalib,0);
    1168 
     1151% transform grid image into 'phys' coordinates
    11691152GeometryCalib.fx_fy=[1 1];
    11701153GeometryCalib.Tx_Ty_Tz=[Amat(1,3) Amat(2,3) 1];
    11711154GeometryCalib.R=[Amat(1,1),Amat(1,2),0;Amat(2,1),Amat(2,2),0;C(1),C(2),0];
     1155GeometryCalib.CoordUnit='cm';
    11721156path_uvmat=which('uvmat');% check the path detected for source file uvmat
    11731157path_UVMAT=fileparts(path_uvmat); %path to UVMAT
     
    11881172Rangx=DataOut.AX;
    11891173Rangy=DataOut.AY;
    1190 % GeometryCalib.dpx=1;
    1191 % GeometryCalib.dpy=1;
    1192 % GeometryCalib.sx=1;
    1193 % GeometryCalib.Cx=0;
    1194 % GeometryCalib.Cy=0;
    1195 % GeometryCalib.kappa1=0;
    1196 % GeometryCalib.Tx=Amat(1,3);
    1197 % GeometryCalib.Ty=Amat(2,3);
    1198 % GeometryCalib.Tz=1;
    1199 % GeometryCalib.R=[Amat(1,1),Amat(1,2),0;Amat(2,1),Amat(2,2),0;C(1),C(2),0];
    1200 %
    1201 % [Amod,Rangx,Rangy]=phys_Ima(A-min(min(A)),GeometryCalib,0);
    1202 
    12031174if white_test
    1204     Amod=double(Amod);%will look for image maxima
     1175    Amod=double(Amod);%case of white grid markers: will look for image maxima
    12051176else
    1206     Amod=-double(Amod);%will look for image minima
     1177    Amod=-double(Amod);%case of black grid markers: will look for image minima
    12071178end
    12081179% figure(12) %display corrected image
     
    12101181% image(Rangx,Rangy,uint8(255*Amod/Amax))
    12111182
     1183%% detection of local image extrema in each direction
    12121184Dx=(Rangx(2)-Rangx(1))/(npxy(2)-1); %x mesh in real space
    12131185Dy=(Rangy(2)-Rangy(1))/(npxy(1)-1); %y mesh in real space
     
    12301202    x_shift=0;
    12311203    y_shift=0;
    1232     %if ind_x_max+2<=2*ind_range_x+1 && ind_x_max-2>=1
    12331204    if ind_x_max+2<=numel(x_profile) && ind_x_max-2>=1
    12341205        Atop=x_profile(ind_x_max-2:ind_x_max+2);
  • trunk/src/proj_field.m

    r158 r159  
    13371337        % case with no rotation and interpolation
    13381338        if isequal(ProjMode,'projection') && isequal(Phi,0) && isequal(Theta,0) && isequal(Psi,0)
    1339             if test_direct(1)
    1340                 min_ind1=ceil((YMin-Coord{1}(1))/DYinit)+1;
    1341                 max_ind1=floor((YMax-Coord{1}(1))/DYinit)+1;
    1342                 Ybound(1)=Coord{1}(1)+DYinit*(min_ind1-1);
    1343                 Ybound(2)=Coord{1}(1)+DYinit*(max_ind1-1);
     1339            if ~testXMin && ~testXMax && ~testYMin && ~testYMax
     1340                ProjData=FieldData;
    13441341            else
    1345                 min_ind1=ceil((Coord{1}(1)-YMax)/DYinit)+1;
    1346                 max_ind1=floor((Coord{1}(1)-YMin)/DYinit)+1;
    1347                 Ybound(2)=Coord{1}(1)-DYinit*(max_ind1-1);
    1348                 Ybound(1)=Coord{1}(1)-DYinit*(min_ind1-1);
    1349             end             
    1350             if test_direct(2)==1
    1351                 min_ind2=ceil((XMin-Coord{2}(1))/DXinit)+1;
    1352                 max_ind2=floor((XMax-Coord{2}(1))/DXinit)+1;
    1353                 Xbound(1)=Coord{2}(1)+DXinit*(min_ind2-1);
    1354                 Xbound(2)=Coord{2}(1)+DXinit*(max_ind2-1);
    1355             else
    1356                 min_ind2=ceil((Coord{2}(1)-XMax)/DXinit)+1;
    1357                 max_ind2=floor((Coord{2}(1)-XMin)/DXinit)+1;
    1358                 Xbound(2)=Coord{2}(1)+DXinit*(max_ind2-1);
    1359                 Xbound(1)=Coord{2}(1)+DXinit*(min_ind2-1);
    1360             end
    1361             min_ind1=max(min_ind1,1);% deals with margin (bound lower than the first index)
    1362             min_ind2=max(min_ind2,1);
    1363             max_ind1=min(max_ind1,DimValue(1));
    1364             max_ind2=min(max_ind2,DimValue(2));
    1365             for ivar=VarIndex
    1366                 VarName=FieldData.ListVarName{ivar};
    1367                 ProjData.ListVarName=[ProjData.ListVarName VarName];
    1368                 ProjData.VarDimName=[ProjData.VarDimName {DimCell}];
    1369                 if isfield(FieldData,'VarAttribute') && length(FieldData.VarAttribute)>=ivar
    1370                     ProjData.VarAttribute{length(ProjData.ListVarName)}=FieldData.VarAttribute{ivar};
    1371                 end
    1372                 eval(['ProjData.' VarName '=FieldData.' VarName '(min_ind1:max_ind1,min_ind2:max_ind2) ;']);
    1373             end 
    1374             eval(['ProjData.' AYName '=FieldData.' AYName ';']) %record the new (projected ) y coordinates
    1375             eval(['ProjData.' AXName '=FieldData.' AXName ';']) %record the new (projected ) x coordinates
     1342                if test_direct(1)
     1343                    min_ind1=ceil((YMin-Coord{1}(1))/DYinit)+1;
     1344                    max_ind1=floor((YMax-Coord{1}(1))/DYinit)+1;
     1345                    Ybound(1)=Coord{1}(1)+DYinit*(min_ind1-1);
     1346                    Ybound(2)=Coord{1}(1)+DYinit*(max_ind1-1);
     1347                else
     1348                    min_ind1=ceil((Coord{1}(1)-YMax)/DYinit)+1;
     1349                    max_ind1=floor((Coord{1}(1)-YMin)/DYinit)+1;
     1350                    Ybound(2)=Coord{1}(1)-DYinit*(max_ind1-1);
     1351                    Ybound(1)=Coord{1}(1)-DYinit*(min_ind1-1);
     1352                end             
     1353                if test_direct(2)==1
     1354                    min_ind2=ceil((XMin-Coord{2}(1))/DXinit)+1;
     1355                    max_ind2=floor((XMax-Coord{2}(1))/DXinit)+1;
     1356                    Xbound(1)=Coord{2}(1)+DXinit*(min_ind2-1);
     1357                    Xbound(2)=Coord{2}(1)+DXinit*(max_ind2-1);
     1358                else
     1359                    min_ind2=ceil((Coord{2}(1)-XMax)/DXinit)+1;
     1360                    max_ind2=floor((Coord{2}(1)-XMin)/DXinit)+1;
     1361                    Xbound(2)=Coord{2}(1)+DXinit*(max_ind2-1);
     1362                    Xbound(1)=Coord{2}(1)+DXinit*(min_ind2-1);
     1363                end
     1364                min_ind1=max(min_ind1,1);% deals with margin (bound lower than the first index)
     1365                min_ind2=max(min_ind2,1);
     1366                max_ind1=min(max_ind1,DimValue(1));
     1367                max_ind2=min(max_ind2,DimValue(2));
     1368                for ivar=VarIndex
     1369                    VarName=FieldData.ListVarName{ivar};
     1370                    ProjData.ListVarName=[ProjData.ListVarName VarName];
     1371                    ProjData.VarDimName=[ProjData.VarDimName {DimCell}];
     1372                    if isfield(FieldData,'VarAttribute') && length(FieldData.VarAttribute)>=ivar
     1373                        ProjData.VarAttribute{length(ProjData.ListVarName)}=FieldData.VarAttribute{ivar};
     1374                    end
     1375                    eval(['ProjData.' VarName '=FieldData.' VarName '(min_ind1:max_ind1,min_ind2:max_ind2,:) ;']);
     1376                end 
     1377                eval(['ProjData.' AYName '=[Ybound(1) Ybound(2)];']) %record the new (projected ) y coordinates
     1378                eval(['ProjData.' AXName '=[Xbound(1) Xbound(2)];']) %record the new (projected ) x coordinates
     1379            end
    13761380        else       % case with rotation and/or interpolation
    13771381            if isempty(Coord_z) %2D case
  • trunk/src/read_civxdata.m

    r158 r159  
    11%'read_civxdata': reads civx data from netcdf files
    22%------------------------------------------------------------------
     3%
     4% function [Field,VelTypeOut]=read_civxdata(filename,FieldNames,VelType)
     5%
    36% OUTPUT:
    47% nb_coord,nb_dim,
  • trunk/src/set_object.m

    r158 r159  
    4646                   'gui_LayoutFcn',  [] , ...
    4747                   'gui_Callback',   []);
    48 if nargin & isstr(varargin{1})
     48if nargin & ischar(varargin{1})
    4949    gui_State.gui_Callback = str2func(varargin{1});
    5050end
     
    318318end
    319319if isequal(style,'line')
    320     if isequal(style_prev,'rectangle')|isequal(style_prev,'ellipse')
     320    if strcmp(style_prev,'rectangle')||strcmp(style_prev,'ellipse')
    321321        XMax=get(handles.XMax,'String');
    322322        YMax=get(handles.YMax,'String');
     
    328328    end
    329329elseif isequal(style,'polyline')
    330 elseif isequal(style,'rectangle')| isequal(style,'ellipse')
     330elseif strcmp(style,'rectangle')|| strcmp(style,'ellipse')
    331331     set(handles.XObject,'String',x_new)
    332332     set(handles.YObject,'String',y_new)
     
    387387    set(handles.YMax,'Visible','on')
    388388end
    389 if isequal(ObjectStyle,'rectangle')|isequal(ObjectStyle,'ellipse')
     389if strcmp(ObjectStyle,'rectangle')||strcmp(ObjectStyle,'ellipse')
    390390    set(handles.XMax,'Visible','on')
    391391else
     
    731731ListObject=get(hhuvmat.list_object_1,'String');%position in the objet list
    732732IndexObj_1=get(hhuvmat.list_object_1,'Value');
    733 IndexObj_2=get(hhuvmat.list_object_2,'Value');
     733if isequal(get(hhuvmat.list_object_2,'Visible'),'on')
     734    IndexObj_2=get(hhuvmat.list_object_2,'Value');
     735else
     736    IndexObj_2=[];
     737end
    734738testnew=0;
    735739PlotHandles=get_plot_handles(hhuvmat);
     
    741745    projview='uvmat';
    742746     plotaxes=hhuvmat.axes3;%handle of axes3 in view_field
    743 elseif IndexObj_2<=numel(ListObject)&& strcmp(ListObject{IndexObj_2},ObjectName)% we are editing the object whose projection is viewed in view_field
    744    
     747elseif ~isempty(IndexObj_2) && IndexObj_2<=numel(ListObject)&& strcmp(ListObject{IndexObj_2},ObjectName)% we are editing the object whose projection is viewed in view_field 
    745748    IndexObj=IndexObj_2;
    746749%     projview='view_field';
     
    756759end
    757760if strcmp(projview,'view_field')
    758     hview_field=findobj(allchild(0),'tag','view_field')
     761    hview_field=findobj(allchild(0),'tag','view_field');
    759762    if isempty(hview_field)
    760         hview_field=view_field
     763        hview_field=view_field;
    761764    end
    762765    PlotHandles=guidata(hview_field);
     
    792795
    793796%% update the object plot and projection field
    794 if testnew
     797if testnew 
    795798    set(hhuvmat.list_object_2,'Value',IndexObj)
    796799    ObjectData.DisplayHandle_uvmat=hhuvmat.axes3;
    797800    ObjectData.DisplayHandle_view_field=[];
    798 else % save the previous object graph handles
     801elseif ~isfield(UvData.Object{IndexObj},'DisplayHandle_uvmat')% save the previous object graph handles
    799802    ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj}.DisplayHandle_uvmat;
    800803    ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj}.DisplayHandle_view_field;
     804else
     805    ObjectData.DisplayHandle_uvmat=hhuvmat.axes3;
     806    ObjectData.DisplayHandle_view_field=[];
    801807end
    802808UvData.Object{IndexObj}=ObjectData;%update the current object properties
    803 IndexObj
    804 ObjectData
    805809UvData.Object=update_obj(UvData,IndexObj_1,IndexObj_2);
    806810
    807811%% plot the field projected on the object and store it the corresponding figue
    808812get(plotaxes,'tag')
    809 ProjData= proj_field(UvData.Field,ObjectData)%project the current interface field on ObjectData
     813ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData
    810814[PlotType,Object_out{IndexObj}.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotHandles);%update an existing field plot
    811815if strcmp(projview,'view_field')
     
    880884    def={fullfile(dir_save,[Object.Style '.xml'])};
    881885end
    882 options.Resize='on';
    883886displ_txt='save object as an .xml file';%default display
    884887menu=get(handles.ProjMode,'String');
     
    889892end
    890893answer=msgbox_uvmat('INPUT_TXT','save object as an .xml file',def);
    891 %answer=inputdlg('','save object in a new .xml file',1,def,'on');
    892894if ~isempty(answer)
    893895    t=struct2xml(Object);
  • trunk/src/update_obj.m

    r156 r159  
    4848
    4949%%  representation of the different objects in the plots uvmat and view_field
    50 %hfig=get(plotaxes,'parent');
    51 %tagfig=get(hfig,'tag');
    52 % if length(Object_set)<IndexObj
    53     %Object_set{IndexObj}=ObjectData;
    54 % end
    55 % plot the updated object in uvmat
    56 %  hobject=[];
    57 % if isfield(Object_set{IndexObj},'DisplayHandle_uvmat') && ~isempty(Object_set{IndexObj}.DisplayHandle_uvmat) && ishandle(Object_set{IndexObj}.DisplayHandle_uvmat)
    58 %     hobject=Object_set{IndexObj}.DisplayHandle_uvmat;
    59 % % else
    60 % %     hobject=plotaxes;
    61 % end
    62 % Object_out{IndexObj}.DisplayHandle_uvmat=plot_object(Object_set{IndexObj},Object_set{1},hobject,'m');%update the object representation
    6350
    64 % if strcmp(tagfig,'uvmat')%plot uvmat
     51%plot uvmat
    6552    for iobj=1:length(Object_out) %change the view of all existing objects on the updated current object #IndexObj_1
    6653         hobject=[];
    6754        if isfield(Object_out{iobj},'DisplayHandle_uvmat') && ~isempty(Object_out{iobj}.DisplayHandle_uvmat) && ishandle(Object_out{iobj}.DisplayHandle_uvmat)
    6855            hobject=Object_out{iobj}.DisplayHandle_uvmat;
    69 %         else
    70 %             hobject=plotaxes;
    7156        end
    7257        Object_out{iobj}.DisplayHandle_uvmat=plot_object(Object_out{iobj},Object_out{IndexObj_1},hobject,'m');%update the object representation
    7358    end
    74 % else%plot view_field
     59% plot view_field
     60if ~isempty(IndexObj_2)
    7561    for iobj=1:length(Object_out) %change the view of all existing objects on the updated current object #IndexObj_2
    7662        hobject=[];
     
    8268        Object_out{iobj}.DisplayHandle_view_field=plot_object(Object_out{iobj},Object_out{IndexObj_2},hobject,'m');%update the object representation
    8369    end
     70end
    8471%  end
    8572
  • trunk/src/uvmat.m

    r158 r159  
    3131%    'Strings' of all edit boxes and menus: get(handles.Tag,'String')
    3232%    'Values' of all menus and toggle buttons: get(handles.Tag,'Value')
    33 %     Matlab structure stored as 'UserData' of the figure uvmat.fig,(can be obtained by right mouse click on the interface).
     33%     Matlab structure called UvData stored as 'UserData' of the figure uvmat.fig,(can be obtained by right mouse click on the interface).
    3434%          It contains the following fields:
    3535%     - Fixed specifiacation of plotting figures and axes (defined bu uvmat_OpeningFcn)
     
    4747%           .FieldName_1:(char string) second field selected('image', 'velocity'...)
    4848%           .CName: (char string)name of the scalar used for vector colors
    49 %           .CoordType: (char string) coordinate transform: e.g. 'phys' or 'px'
    50 %           .MouseAction: store the current effect of mouse button (create or edit objects)
     49%          .MovieObject: movie object representing an input movie
     50%          .MovieObject_1: idem for a second input series (_1)
     51%          .filename_1 : last second input file name (to deal with a constant second input without reading again the file)
     52%          .VelType_1: last velocity type (civ1, civ2...) for the second input series
     53%          .FieldName_1: last field name(velocity, vorticity...) for the second input series
     54%          .NbDim: number of space dimensions of the input field
     55%          .ZMin, .ZMax: range of the z coordinate
     56%..... to complement
    5157%     - Information on  projection objects
    5258%           .Object: {[1x1 struct]}
     
    7985% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   DATA FLOW  (for run0_Callback) %%%%%%%%%%%%%%%%%%%%:
    8086%
     87% fields are opened and visualised by the sub-function refresh_field.m
     88% (called by uvmat_opening, RUN0, runp and runm)
     89% The function first reads the name of the input file from the edit boxes  of the GUI
     90% A second input file can be introduced for filed comparison
     91% It then reads the input file(s) with the appropriate function, read for
     92% images, read_civxdata.m for CIVx PIV data, nc2struct for other netcdf
     93% files.
    8194%               Main input open   second input open(_1)        second image (pair animation)
    82 % read_ncfield.m         |                 |                             
    83 % read image.m           |                 |                                               
     95%            |                 |                             
     96%            |                 |                                               
    8497%                     Field{1}         Field{2}               
    8598%                                                                         |
     
    20582071end
    20592072UvData=get(handles.uvmat,'UserData');
    2060 %UvData =structure containing information stored outside the uicontrol of uvmat
    2061 %      .NewSeries: =1 for a new series (new root fiel introduced), 0 else
    2062 %      .MovieObject: movie object representing an input movie
    2063 %      .MovieObject_1: idem for a second input series (_1)
    2064 %      .filename_1 : last second input file name (to deal with a constant second input without reading again the file)
    2065 %      .VelType_1: last velocity type (civ1, civ2...) for the second input series
    2066 %      .FieldName_1: last field name(velocity, vorticity...) for the second input series
    2067 %      .NbDim: number of space dimensions of the input field
    2068 %      .ZMin, .ZMax: range of the z coordinate
    2069 %..... to complement
     2073
    20702074
    20712075if ishandle(handles.UVMAT_title) %remove title panel on uvmat
     
    21352139    end
    21362140end
     2141
    21372142%% choose a second field if Subfield option is 'on'
    21382143FieldName_1=[];
     
    24932498[CellVarIndex,NbDim,VarType]=find_field_indices(UvData.Field);
    24942499[NbDim,imax]=max(NbDim);
    2495 if isempty(imax)
    2496 %    DimVarIndex=0;   
    2497     coord_x=[];
    2498 else
    2499 %     VarIndex=CellVarIndex{imax};
    2500     coord_x=VarType{imax}.coord_x;
    2501 end
    2502 if isfield(UvData,'NbDim') && ~isempty(UvData.NbDim)
    2503     NbDim=UvData.NbDim;
    2504 else 
    2505     UvData.NbDim=NbDim;
    2506 end
    2507 if ~isempty(CellVarIndex) && ~isempty(VarType{imax}.coord_x)  && ~isempty(VarType{imax}.coord_y)    %unstructured coordinate z
     2500% if isempty(imax)
     2501% %    DimVarIndex=0;   
     2502%     coord_x=[];
     2503% else
     2504% %     VarIndex=CellVarIndex{imax};
     2505%     coord_x=VarType{imax}.coord_x;
     2506% end
     2507% if isfield(UvData,'NbDim') && ~isempty(UvData.NbDim)
     2508%     NbDim=UvData.NbDim;
     2509% else 
     2510UvData.NbDim=NbDim;
     2511% end
     2512if ~isempty(VarType{imax}.coord_x)  && ~isempty(VarType{imax}.coord_y)    %unstructured coordinates
    25082513    XName=UvData.Field.ListVarName{VarType{imax}.coord_x};
    25092514    YName=UvData.Field.ListVarName{VarType{imax}.coord_y};
    2510     test_x=1;
    2511 elseif isfield(UvData.Field,'X') && isfield(UvData.Field,'Y')
    2512     XName='X';
    2513     YName='Y';
    2514     test_x=1;
    2515 end
    2516 if test_x
    2517     eval(['UvData.XMax=max(UvData.Field.' XName ');'])
    2518     eval(['UvData.XMin=min(UvData.Field.' XName ');'])
    2519     eval(['UvData.YMax=max(UvData.Field.' YName ');'])
    2520     eval(['UvData.YMin=min(UvData.Field.' YName ');'])
    2521     eval(['nbvec=length(UvData.Field.' XName ');'])
    2522     if NbDim==3%
    2523         if ~isempty(CellVarIndex) && ~isempty(VarType{imax}.coord_z)%unstructured coordinate z
    2524             ZName=UvData.Field.ListVarName{VarType{imax}.coord_z};
    2525             eval(['UvData.ZMax=max(UvData.Field.' ZName ');'])
    2526             eval(['UvData.ZMin=min(UvData.Field.' ZName ');'])
    2527             test_z=1;   
    2528         elseif isfield(UvData,'Z')% usual civ data
    2529             UvData.ZMax=max(UvData.Z);
    2530             UvData.ZMin=min(UvData.Z);
    2531             test_z=1;
    2532         end
    2533     end
    2534     if isequal(UvData.ZMin,UvData.ZMax)%no z dependency
     2515    eval(['nbvec=length(UvData.Field.' XName ');'])%nbre of measurement points (e.g. vectors)
     2516    test_x=1;%test for unstructured coordinates
     2517elseif NbDim==2
     2518    YName=UvData.Field.ListVarName{VarType{imax}.coord(1)}; %structured coordinates
     2519    XName=UvData.Field.ListVarName{VarType{imax}.coord(2)};
     2520elseif NbDim==3
     2521    ZName=UvData.Field.ListVarName{VarType{imax}.coord(1)};%structured coordinates in 3D
     2522    YName=UvData.Field.ListVarName{VarType{imax}.coord(2)};
     2523    XName=UvData.Field.ListVarName{VarType{imax}.coord(3)};
     2524end
     2525
     2526eval(['XMax=max(UvData.Field.' XName ');'])
     2527eval(['XMin=min(UvData.Field.' XName ');'])
     2528eval(['YMax=max(UvData.Field.' YName ');'])
     2529eval(['YMin=min(UvData.Field.' YName ');'])
     2530eval(['nbvec=length(UvData.Field.' XName ');'])
     2531if NbDim==3%
     2532    if ~isempty(CellVarIndex) && ~isempty(VarType{imax}.coord_z)%unstructured coordinate z
     2533%         ZName=UvData.Field.ListVarName{VarType{imax}.coord_z};
     2534        eval(['ZMax=max(UvData.Field.' ZName ');'])
     2535        eval(['ZMin=min(UvData.Field.' ZName ');'])
     2536        test_z=1;   
     2537    elseif isfield(UvData,'Z')% usual civ data
     2538        ZMax=max(UvData.Z);
     2539        ZMin=min(UvData.Z);
     2540        test_z=1;
     2541    end
     2542    if isequal(ZMin,ZMax)%no z dependency
    25352543        NbDim=2;
    25362544        test_z=0;
    2537     end   
     2545    end
     2546end
     2547if test_x
    25382548    if test_z
    2539          Field.Mesh=((UvData.XMax-UvData.XMin)*(UvData.YMax-UvData.YMin)*(UvData.ZMax-UvData.ZMin))/nbvec;% volume per vector
    2540          Field.Mesh=(Field.Mesh)^(1/3);
     2549        UvData.Field.Mesh=((XMax-XMin)*(YMax-YMin)*(ZMax-ZMin))/nbvec;% volume per vector
     2550        UvData.Field.Mesh=(UvData.Field.Mesh)^(1/3);
    25412551    else
    2542         Field.Mesh=sqrt((UvData.XMax-UvData.XMin)*(UvData.YMax-UvData.YMin)/nbvec);%2D
    2543     end
    2544 end
    2545 
    2546 %case of structured coordinates
    2547 'TESTfield'
    2548 UvData.Field
    2549 if isfield(UvData.Field,'AX') && isfield(UvData.Field,'AY')&& isfield(UvData.Field,'A')
    2550     UvData.XMax=max(UvData.Field.AX);
    2551     UvData.XMin=min(UvData.Field.AX);
    2552     UvData.YMax=max(UvData.Field.AY);
    2553     UvData.YMin=min(UvData.Field.AY);
    2554     np_A=size(UvData.Field.A);
    2555     Field.Mesh=sqrt((UvData.XMax-UvData.XMin)*(UvData.YMax-UvData.YMin)/((np_A(1)-1) * (np_A(2)-1))) ;
    2556 end
    2557 if  isempty(coord_x) && ~isempty(CellVarIndex)
     2552        UvData.Field.Mesh=sqrt((XMax-XMin)*(YMax-YMin)/nbvec);%2D
     2553    end
     2554else
    25582555    VarIndex=CellVarIndex{imax}; % list of variable indices
    25592556    DimIndex=UvData.Field.VarDimIndex{VarIndex(1)}; %list of dim indices for the variable
    2560     if NbDim==3
    2561         nbpoints=UvData.Field.DimValue(DimIndex(1));
    2562         if isfield(VarType{imax},'coord_3')&& ~isequal(VarType{imax}.coord_3,0) % z is a dimension variable
    2563             ZName=UvData.Field.ListVarName{VarType{imax}.coord_3};
    2564             eval(['UvData.ZMax=max(UvData.Field.' ZName ');'])
    2565             eval(['UvData.ZMin=min(UvData.Field.' ZName ');'])
    2566         else
    2567             testcoord_z=0;
    2568             if length(UvData.Field.VarAttribute)>=VarIndex(1)
    2569                 if isfield(UvData.Field.VarAttribute{VarIndex(1)},'Coord_1')%regular grid
    2570                     Coord_z=UvData.Field.VarAttribute{VarIndex(1)}.Coord_1;
    2571                     UvData.ZMax=max(Coord_z);
    2572                     UvData.ZMin=min(Coord_z);
    2573                     testcoord_z=1;
    2574                 end
    2575             end
    2576             if ~testcoord_z
    2577                   UvData.ZMin=1;
    2578                   UvData.ZMax=UvData.Field.DimValue(DimIndex(1));
    2579             end
    2580         end
    2581         Field.Mesh=(UvData.ZMax-UvData.ZMin)/(nbpoints-1);
    2582     elseif NbDim==2
    2583         nbpoints_y=UvData.Field.DimValue(DimIndex(1));       
    2584         Yvar=VarType{imax}.coord_y;
    2585         if Yvar~=0  % x is a dimension variable
    2586             YName=UvData.Field.ListVarName{Yvar};
    2587             eval(['UvData.YMax=max(UvData.Field.' YName ');'])
    2588             eval(['UvData.YMin=min(UvData.Field.' YName ');'])
    2589         else
    2590             testcoord_y=0;
    2591             if ~testcoord_y
    2592                   UvData.YMin=1;
    2593                   UvData.YMax=UvData.Field.DimValue(DimIndex(1));
    2594             end
    2595         end
    2596         DY=(UvData.YMax-UvData.YMin)/(nbpoints_y-1);
    2597         nbpoints_x=UvData.Field.DimValue(DimIndex(2));
    2598         Xvar=VarType{imax}.coord_x;
    2599         if Xvar~=0  % x is a dimension variable
    2600             XName=UvData.Field.ListVarName{Xvar};
    2601             eval(['UvData.XMax=max(UvData.Field.' XName ');'])
    2602             eval(['UvData.XMin=min(UvData.Field.' XName ');'])
    2603         else
    2604             testcoord_x=0;
    2605             if ~testcoord_x
    2606                   UvData.XMin=1;
    2607                   UvData.XMax=UvData.Field.DimValue(DimIndex(2));
    2608             end
    2609         end
    2610         DX=(UvData.XMax-UvData.XMin)/(nbpoints_x-1);
    2611         Field.Mesh= sqrt(DX*DY);
    2612     end
    2613 end
     2557    nbpoints_y=UvData.Field.DimValue(DimIndex(1));
     2558    nbpoints_x=UvData.Field.DimValue(DimIndex(2));
     2559    DX=(XMax-XMin)/nbpoints_x;
     2560    DY=(YMax-YMin)/nbpoints_y;
     2561    UvData.Field.Mesh=sqrt(DX*DY);
     2562end
     2563UvData.Field.XMax=XMax;
     2564UvData.Field.XMin=XMin;
     2565UvData.Field.YMax=XMax;
     2566UvData.Field.YMin=XMin;
     2567if test_z
     2568    UvData.Field.ZMax=ZMax;
     2569    UvData.Field.ZMin=ZMin;
     2570end
     2571
     2572%case of structured coordinates
     2573
     2574% if  isempty(coord_x) && ~isempty(CellVarIndex)
     2575%     VarIndex=CellVarIndex{imax}; % list of variable indices
     2576%     DimIndex=UvData.Field.VarDimIndex{VarIndex(1)}; %list of dim indices for the variable
     2577%     if NbDim==3
     2578%         nbpoints=UvData.Field.DimValue(DimIndex(1));
     2579%         if isfield(VarType{imax},'coord_3')&& ~isequal(VarType{imax}.coord_3,0) % z is a dimension variable
     2580%             ZName=UvData.Field.ListVarName{VarType{imax}.coord_3};
     2581%             eval(['UvData.ZMax=max(UvData.Field.' ZName ');'])
     2582%             eval(['UvData.ZMin=min(UvData.Field.' ZName ');'])
     2583%         else
     2584%             testcoord_z=0;
     2585%             if length(UvData.Field.VarAttribute)>=VarIndex(1)
     2586%                 if isfield(UvData.Field.VarAttribute{VarIndex(1)},'Coord_1')%regular grid
     2587%                     Coord_z=UvData.Field.VarAttribute{VarIndex(1)}.Coord_1;
     2588%                     UvData.ZMax=max(Coord_z);
     2589%                     UvData.ZMin=min(Coord_z);
     2590%                     testcoord_z=1;
     2591%                 end
     2592%             end
     2593%             if ~testcoord_z
     2594%                   UvData.ZMin=1;
     2595%                   UvData.ZMax=UvData.Field.DimValue(DimIndex(1));
     2596%             end
     2597%         end
     2598%         Field.Mesh=(UvData.ZMax-UvData.ZMin)/(nbpoints-1);
     2599%     elseif NbDim==2
     2600%         nbpoints_y=UvData.Field.DimValue(DimIndex(1));       
     2601%         Yvar=VarType{imax}.coord_y;
     2602%         if Yvar~=0  % x is a dimension variable
     2603%             YName=UvData.Field.ListVarName{Yvar};
     2604%             eval(['UvData.YMax=max(UvData.Field.' YName ');'])
     2605%             eval(['UvData.YMin=min(UvData.Field.' YName ');'])
     2606%         else
     2607%             testcoord_y=0;
     2608%             if ~testcoord_y
     2609%                   UvData.YMin=1;
     2610%                   UvData.YMax=UvData.Field.DimValue(DimIndex(1));
     2611%             end
     2612%         end
     2613%         DY=(UvData.YMax-UvData.YMin)/(nbpoints_y-1);
     2614%         nbpoints_x=UvData.Field.DimValue(DimIndex(2));
     2615%         Xvar=VarType{imax}.coord_x;
     2616%         if Xvar~=0  % x is a dimension variable
     2617%             XName=UvData.Field.ListVarName{Xvar};
     2618%             eval(['UvData.XMax=max(UvData.Field.' XName ');'])
     2619%             eval(['UvData.XMin=min(UvData.Field.' XName ');'])
     2620%         else
     2621%             testcoord_x=0;
     2622%             if ~testcoord_x
     2623%                   UvData.XMin=1;
     2624%                   UvData.XMax=UvData.Field.DimValue(DimIndex(2));
     2625%             end
     2626%         end
     2627%         DX=(UvData.XMax-UvData.XMin)/(nbpoints_x-1);
     2628%         Field.Mesh= sqrt(DX*DY);
     2629%     end
     2630% end
    26142631
    26152632%create a default projection menuplane
     
    26802697IndexObj_2=get(handles.list_object_2,'Value');%selected projection object for the second view
    26812698if isequal(get(handles.list_object_2,'Visible'),'on') && IndexObj_2 <= numel(UvData.Object)&& ~isempty(UvData.Object{IndexObj_2})
    2682     UvData.Object{IndexObj_2}
    26832699    IndexObj(2)=IndexObj_2;
    26842700    view_field_handle=findobj(allchild(0),'tag','view_field');%handles of the view_field GUI
     
    44194435list_str=get(handles.list_object_2,'String');
    44204436IndexObj=get(handles.list_object_2,'Value');
    4421 if strcmp(list_str{IndexObj},'...')
     4437if ischar(list_str) || strcmp(list_str{IndexObj},'...')
    44224438    hview_field=findobj(allchild(0),'Tag','view_field');
    44234439    if ~isempty(hview_field)
     
    46554671% ------------------------------------------------------------------
    46564672function MenuCalib_Callback(hObject, eventdata, handles)
    4657 %geometry_calib; %display the GUI as a  waiting display
    46584673
    46594674UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
     
    46624677set(handles.zoom,'Value',0)
    46634678set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7])
    4664 % set(handles.MenuMask,'enable','off')
    4665 % set(handles.MenuGrid,'enable','off')
    4666 % set(handles.MenuObject,'enable','off')
    4667 % set(handles.MenuEdit,'enable','off')
    46684679set(handles.list_object_1,'Value',1)     
    46694680% initiate display of GUI geometry_calib
     
    46824693    pos_cal(2)=pos_uvmat(2)+UvData.CalOrigin(2)*pos_uvmat(4);
    46834694    pos_cal(3:4)=UvData.CalSize .* pos_uvmat(3:4);
    4684     %set(UvData.hset_object,'Position',pos_cal)
    46854695end
    46864696geometry_calib(FileName,pos_cal);% call the geometry_calib interface   
    46874697set(handles.view_xml,'Backgroundcolor',[1 1 1])%indicate the end of reading of the current xml file by geometry_calib
    46884698set(handles.MenuCalib,'checked','on')% indicate that MenuCalib is activated, test used by mouse action
    4689 
    4690 %UvData.MouseAction='calib';
    4691 % set(handles.uvmat,'UserData',UvData);
    46924699
    46934700
     
    47214728                flagobj=1;
    47224729                testphys=0; %coordinates in pixels by default
    4723                 if isfield(ObjectData,'CoordType') && isequal(ObjectData.CoordType,'phys')
     4730                if isfield(ObjectData,'CoordUnit') && ~isequal(ObjectData.CoordUnit,'pixel')
    47244731                    if isfield(UvData,'XmlData')&& isfield(UvData.XmlData,'GeometryCalib')
    47254732                        Calib=UvData.XmlData.GeometryCalib;
Note: See TracChangeset for help on using the changeset viewer.