Changeset 517 for trunk/src/uvmat.m


Ignore:
Timestamp:
Aug 17, 2012, 11:47:16 PM (9 years ago)
Author:
sommeria
Message:

various bugs corrected. get_field now used in a passive way from uvmat: variable names are transferred from get_field to uvmat.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r516 r517  
    180180UvData.OpenParam.PosColorbar=[0.805 0.022 0.019 0.445];
    181181UvData.OpenParam.PosSetObject=[-0.05 -0.03 0.3 0.7]; %position for set_object
    182 UvData.OpenParam.PosGeometryCalic=[0.95 -0.03 0.28 1 ];%position for geometry_calib (TO IMPROVE)
     182UvData.OpenParam.PosGeometryCalib=[0.95 -0.03 0.28 1 ];%position for geometry_calib (TO IMPROVE)
    183183% UvData.OpenParam.CalSize=[0.28 1];
    184184% UvData.PlotAxes=[];%initiate the record of plotted field
     
    990990
    991991%% set default options in menu 'Fields'
    992 if ~testima
    993     testcivx=0;
    994     if isfield(UvData,'FieldsString') && isequal(UvData.FieldsString,{'get_field...'})% field menu defined as input (from get_field)
     992switch FileType
     993    case {'civx','civdata'}
     994            [FieldList,ColorList]=calc_field;
     995            set(handles_Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data
     996            set(handles_Fields,'Value',2) % set menu to 'velocity
     997          %  col_vec=FieldList;
     998           % col_vec(1)=[];%remove 'velocity' option for vector color (must be a scalar)
     999           set(handles.ColorScalar,'Value',1)
     1000            set(handles.ColorScalar,'String',ColorList)
     1001            set(handles.Coord_x,'Value',1);
     1002           set(handles.Coord_x,'String',{'X'});
     1003           set(handles.Coord_y,'Value',1);
     1004           set(handles.Coord_y,'String',{'Y'});
     1005    case 'netcdf'
    9951006        set(handles_Fields,'Value',1)
    9961007        set(handles_Fields,'String',{'get_field...'})
    997         UvData=rmfield(UvData,'FieldsString');
    998     else
    999         Data=nc2struct(FileName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ');
    1000         if strcmp(Data.Conventions,'uvmat/civdata') ||( ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0))%if the new input is Civx
    1001             FieldList=calc_field;
    1002             set(handles_Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data
    1003             set(handles_Fields,'Value',2) % set menu to 'velocity'
    1004             col_vec=FieldList;
    1005             col_vec(1)=[];%remove 'velocity' option for vector color (must be a scalar)
    1006             testcivx=1;
    1007         end
    1008         if ~testcivx
    1009             set(handles_Fields,'Value',1) % set menu to 'get_field...
    1010             set(handles_Fields,'String',{'get_field...'})
    1011             col_vec={'get_field...'};
    1012         end
    1013         set(handles.ColorScalar,'String',col_vec)
    1014     end
     1008        hget_field=get_field(FileName);
     1009        hhget_field=guidata(hget_field);
     1010        get_field('RUN_Callback',hhget_field.RUN,[],hhget_field);
     1011%             set(handles_Fields,'Value',1) % set menu to 'get_field...
     1012%             set(handles_Fields,'String',{'get_field...'})
     1013%             col_vec={'get_field...'};
     1014%
     1015%         set(handles.ColorScalar,'String',col_vec)
     1016    otherwise
     1017        set(handles_Fields,'Value',1) % set menu to 'image'
     1018        set(handles_Fields,'String',{'image'})
     1019                    set(handles.Coord_x,'Value',1);
     1020           set(handles.Coord_x,'String',{'AX'});
     1021           set(handles.Coord_y,'Value',1);
     1022           set(handles.Coord_y,'String',{'AY'});
    10151023end
    10161024set(handles.uvmat,'UserData',UvData)
     
    20382046            end
    20392047        end
    2040         if strcmp(FieldName,'velocity')
     2048        if ~isempty(regexp(FieldName,'^vec('))
    20412049            list_code=get(handles.ColorCode,'String');% list menu fields
    20422050            index_code=get(handles.ColorCode,'Value');% selected string index
     
    20702078end
    20712079if isstruct (ParamIn)
    2072 ParamIn.FieldName=FieldName;
    2073 ParamIn.VelType=VelType;
    2074 ParamIn.GUIName='get_field';
    2075 end
    2076 check_tps=0;         
     2080    ParamIn.FieldName=FieldName;
     2081    ParamIn.VelType=VelType;
     2082    XNameMenu=get(handles.Coord_x,'String');
     2083    ParamIn.CoordName=XNameMenu{get(handles.Coord_x,'Value')};
     2084    YNameMenu=get(handles.Coord_y,'String');
     2085    ParamIn.CoordName={ParamIn.CoordName, YNameMenu{get(handles.Coord_y,'Value')}};
     2086end
     2087check_tps = 0;         
    20772088if strcmp(UvData.FileType{1},'civdata')&&~strcmp(ParamIn.FieldName,'velocity')&&~strcmp(ParamIn.FieldName,'get_field...')
    20782089       check_tps=1;%tps needed to get the requested field
     
    22152226end
    22162227% display the Fields menu from the input file and pick the selected one:
    2217 if isstruct(ParamOut)
    2218     field_index=strcmp(ParamOut.FieldName,ParamOut.FieldList);
    2219     set(handles.Fields,'String',ParamOut.FieldList); %update the field menu
    2220     set(handles.Fields,'Value',find(field_index,1))
    2221 end
     2228% if isstruct(ParamOut)
     2229%     field_index=strcmp(ParamOut.FieldName,ParamOut.FieldList);
     2230%     set(handles.Fields,'String',ParamOut.FieldList); %update the field menu
     2231%     set(handles.Fields,'Value',find(field_index,1))
     2232% end
    22222233
    22232234%% update the display menu for the second velocity type (second menuline)
    22242235test_veltype_1=0;
    22252236if isempty(FileName_1)
    2226     set(handles.Fields_1,'Value',1); %update the field menu
    2227     if isstruct(ParamOut)
    2228     set(handles.Fields_1,'String',[{''};ParamOut.FieldList]); %update the field menu
    2229     end
     2237%     set(handles.Fields_1,'Value',1); %update the field menu
     2238%     if isstruct(ParamOut)
     2239%     set(handles.Fields_1,'String',[{''};ParamOut.FieldList]); %update the field menu
     2240%     end
    22302241elseif ~test_keepdata_1
    22312242    if (~strcmp(UvData.FileType{2},'netcdf')&&~strcmp(UvData.FileType{2},'civdata')&&~strcmp(UvData.FileType{2},'civx'))|| isequal(FieldName_1,'get_field...')
     
    26252636        PlotParam{1}.Vectors.ColCode1=0.33;
    26262637        PlotParam{1}.Vectors.ColCode2=0.66;
    2627         PlotParam{1}.Vectors.ColorScalar={'ima_cor'};
     2638        PlotParam{1}.Vectors.ColorScalar={''};
    26282639        PlotParam{1}.Vectors.ColorCode= {'rgb'};
    26292640    end
     
    30823093    [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
    30833094    FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
    3084     %FileName=read_file_boxes(handles);
    30853095    hget_field=findobj(allchild(0),'name','get_field');
    30863096    if ~isempty(hget_field)
     
    30883098    end
    30893099    hget_field=get_field(FileName);
    3090     set(hget_field,'Name','get_field')
    3091     hhget_field=guidata(hget_field);
    3092     set(hhget_field.list_fig,'Value',1)
    3093     set(hhget_field.list_fig,'String',{'uvmat'})
     3100%     set(hget_field,'Name','get_field')
     3101%     hhget_field=guidata(hget_field);
     3102%     set(hhget_field.list_fig,'Value',1)
     3103%     set(hhget_field.list_fig,'String',{'uvmat'})
    30943104  %  set(handles.transform_fct,'Value',1)% no transform by default
    30953105  %  set(handles.path_transform,'String','')
    3096     return %no action
    3097 end
    3098 list_fields=get(handles.Fields_1,'String');% list menu fields
    3099 index_fields=get(handles.Fields_1,'Value');% selected string index
    3100 field_1= list_fields{index_fields(1)}; % selected string
     3106    return %no further action
     3107end
     3108
    31013109UvData=get(handles.uvmat,'UserData');
    31023110
     
    31483156
    31493157%common to Fields_1_Callback
     3158list_fields_1=get(handles.Fields_1,'String');% list menu fields
     3159field_1='';
     3160if ~isempty(list_fields_1)
     3161field_1= list_fields_1{get(handles.Fields_1,'Value')}; % selected string
     3162end
    31503163if isequal(field,'image')||isequal(field_1,'image')
    31513164    set(handles.TitleNpx,'Visible','on')% visible npx,pxcm... buttons
     
    46694682    data.CoordType=UvData.CoordType;
    46704683end
    4671 pos=get(handles.uvmat,'Position');
    4672 pos(1)=pos(1)+pos(3)-0.311+0.04; %0.311= width of the geometry_calib interface (units relative to the srcreen)
    4673 pos(2)=pos(2)-0.02;
     4684% pos=get(handles.uvmat,'Position');
     4685% pos(1)=pos(1)+pos(3)-0.311+0.04; %0.311= width of the geometry_calib interface (units relative to the srcreen)
     4686% pos(2)=pos(2)-0.02;
    46744687[RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles);
    46754688FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];
    46764689set(handles.view_xml,'Backgroundcolor',[1 1 0])%indicate the reading of the current xml file by geometry_calib
    4677 if isfield(UvData.OpenParam,'CalOrigin')
    4678     pos_uvmat=get(handles.uvmat,'Position');
    4679     pos_cal(1)=pos_uvmat(1)+UvData.OpenParam.PosGeometryCalib(1)*pos_uvmat(3);
    4680     pos_cal(2)=pos_uvmat(2)+UvData.OpenParam.PosGeometryCalib(2)*pos_uvmat(4);
    4681     pos_cal(3:4)=UvData.OpenParam.PosGeometryCalib(3:4).* pos_uvmat(3:4);
    4682 end
     4690pos_uvmat=get(handles.uvmat,'Position');
     4691pos_cal(1)=pos_uvmat(1)+UvData.OpenParam.PosGeometryCalib(1)*pos_uvmat(3);
     4692pos_cal(2)=pos_uvmat(2)+UvData.OpenParam.PosGeometryCalib(2)*pos_uvmat(4);
     4693pos_cal(3:4)=UvData.OpenParam.PosGeometryCalib(3:4).* pos_uvmat(3:4);
    46834694geometry_calib(FileName,pos_cal);% call the geometry_calib interface   
    46844695set(handles.view_xml,'Backgroundcolor',[1 1 1])%indicate the end of reading of the current xml file by geometry_calib
     
    49024913ProjectDir = uigetdir(fileparts(fileparts(RootPath)), 'select the project directory');
    49034914datatree_browser(ProjectDir)
     4915
     4916
     4917% --- Executes on selection change in Coord_y.
     4918function Coord_y_Callback(hObject, eventdata, handles)
     4919
     4920% --- Executes on selection change in Coord_x.
     4921function Coord_x_Callback(hObject, eventdata, handles)
Note: See TracChangeset for help on using the changeset viewer.