Changeset 159 for trunk/src/uvmat.m


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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.