Changeset 581 for trunk/src/uvmat.m


Ignore:
Timestamp:
Mar 12, 2013, 12:52:13 PM (11 years ago)
Author:
sommeria
Message:

clean the transform field functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r580 r581  
    6868%                    --->transform fct<---             transform (e.g. phys.m) and combine input fieldname 
    6969%                            |                                   
    70 %                        (calc_tps.m)               calculate tps coefficients (for filter projection or spatial derivatives).
     70%                        (tps_coeff_field.m)               calculate tps coefficients (for filter projection or spatial derivatives).
    7171%                            |
    7272%                       UvData.Field-------------->histogram
     
    10221022switch FileType
    10231023    case {'civx','civdata'}
    1024         [FieldList,ColorList]=calc_field;
     1024%         [FieldList,ColorList]=calc_field;
     1025        [FieldList,ColorList]=set_field_list('U','V','C');
    10251026        set(handles_Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data
    10261027        set(handles_Fields,'Value',2) % set menu to 'velocity
     
    20462047if  (strcmp(UvData.FileType{1},'civdata')||strcmp(UvData.FileType{1},'civx'))
    20472048    for iobj=1:numel(UvData.Object)
    2048         if isfield(UvData.Object{iobj},'ProjMode')&& strcmp(UvData.Object{iobj}.ProjMode,'filter')
     2049        if isfield(UvData.Object{iobj},'ProjMode')&& strcmp(UvData.Object{iobj}.ProjMode,'interp_tps')
    20492050            check_proj_tps=1;
    20502051            break
     
    24382439
    24392440%% calculate tps coefficients if needed
    2440 UvData.Field=calc_tps(UvData.Field,check_proj_tps);
     2441UvData.Field=tps_coeff_field(UvData.Field,check_proj_tps);
    24412442
    24422443%% analyse input field
     
    30423043function FieldName_Callback(hObject, eventdata, handles)
    30433044%------------------------------------------------------------------------
     3045UvData=get(handles.uvmat,'UserData');
    30443046list_fields=get(handles.FieldName,'String');% list menu fields
    30453047index_fields=get(handles.FieldName,'Value');% selected string index
    30463048field= list_fields{index_fields(1)}; % selected string
     3049
     3050%% fill the coordinates and variables from selections in get_field
    30473051if isequal(field,'get_field...')
     3052    if strcmp(get(handles.VelType,'Visible'),'on')
     3053        % we use the civ choice as default input
     3054        ParamIn.SwitchVarIndexTime='attribute';
     3055        ListVelType=get(handles.VelType,'String');
     3056        VelType=ListVelType{get(handles.VelType,'Value')};
     3057        switch VelType
     3058            case 'civ1'
     3059                 ParamIn.TimeVarName='Civ1_Time';
     3060                 ParamIn.vector_x='Civ1_U';
     3061                 ParamIn.vector_y='Civ1_V';
     3062            case 'filter1'
     3063                 ParamIn.TimeVarName='Civ1_Time';
     3064                 ParamIn.vector_x='Civ1_U_smooth';
     3065                 ParamIn.vector_y='Civ1_V_smooth';
     3066            case 'civ2'
     3067                 ParamIn.TimeVarName='Civ2_Time';
     3068                 ParamIn.vector_x='Civ2_U';
     3069                 ParamIn.vector_y='Civ2_V';
     3070            case 'filter2'
     3071                 ParamIn.TimeVarName='Civ2_Time';
     3072                 ParamIn.vector_x='Civ2_U_smooth';
     3073                 ParamIn.vector_y='Civ2_V_smooth';
     3074        end
     3075    end
    30483076    set(handles.FixVelType,'visible','off')
    3049     set(handles.VelType,'visible','off')
    3050     set(handles.VelType_1,'visible','off')
     3077    set(handles.VelType,'Visible','off')
     3078    set(handles.VelType_1,'Visible','off')
    30513079    [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
    30523080    FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
    3053     hget_field=findobj(allchild(0),'name','get_field');
    3054     if ~isempty(hget_field)
    3055         delete(hget_field)
    3056     end
    3057     get_field(FileName);
     3081%     hget_field=findobj(allchild(0),'name','get_field');
     3082%     if ~isempty(hget_field)
     3083%         delete(hget_field)
     3084%     end
     3085    GetFieldData=get_field(FileName,ParamIn);
     3086    FieldList={};
     3087    VecColorList={};
     3088    XName='';
     3089    YName='';
     3090    if GetFieldData.CheckVector
     3091        UName=GetFieldData.PanelVectors.vector_x;
     3092        VName=GetFieldData.PanelVectors.vector_y;
     3093        XName=GetFieldData.PanelVectors.coord_x_vectors;
     3094        YName=GetFieldData.PanelVectors.coord_y_vectors;
     3095        CName=GetFieldData.PanelVectors.vec_color;
     3096        [FieldList,VecColorList]=set_field_list(UName,VName,CName);
     3097%         FieldList={['vec(' UName ',' VName ')'];...
     3098%             ['norm(' UName ',' VName ')'];...
     3099%             ['curl(' UName ',' VName ')'];...
     3100%             ['div(' UName ',' VName ')'];...
     3101%             ['strain(' UName ',' VName ')']};
     3102%         VecColorList={['norm(' UName ',' VName ')'];...
     3103%             UName;...
     3104%             VName};...
     3105%             if ~isempty(CName)
     3106%             VecColorList=[{CName};VecColorList];
     3107%             end
     3108    end
     3109    if GetFieldData.CheckScalar
     3110        AName=GetFieldData.PanelScalar.scalar;
     3111        XName=GetFieldData.PanelScalar.coord_x_scalar;
     3112        YName=GetFieldData.PanelScalar.coord_y_scalar;
     3113        FieldList={AName};
     3114    end
     3115    if GetFieldData.CheckPlot1D
     3116        XName=GetFieldData.CheckPlot1D.abscissa;
     3117        YName=GetFieldData.CheckPlot1D.ordinate;
     3118    end
     3119    set(handles.Coord_x,'String',{XName})
     3120    set(handles.Coord_y,'String',{YName})
     3121    set(handles.FieldName,'Value',1)
     3122    set(handles.FieldName,'String',[FieldList; {'get_field...'}]);
     3123    set(handles.ColorScalar,'Value',1)
     3124    set(handles.ColorScalar,'String',VecColorList);
     3125    UvData.FileType{1}='netcdf';
     3126    set(handles.uvmat,'UserData',UvData)
     3127    run0_Callback(hObject, eventdata, handles)
    30583128    return %no further action
    30593129end
    30603130
    3061 UvData=get(handles.uvmat,'UserData');
     3131
    30623132
    30633133%read the rootfile input display
     
    31073177indices=fullfile_uvmat('','','','',NomType,i1,i2,j1,j2);
    31083178set(handles.FileIndex,'String',indices)
    3109 % set(handles.NomType,'String',NomType)
    31103179
    31113180%common to Fields_1_Callback
     
    34133482%
    34143483if isequal(get(handles.edit_vect,'Value'),1)
    3415     test_civ2=isequal(get(handles.civ2,'BackgroundColor'),[1 1 0]);
    3416     test_civ1=isequal(get(handles.VelType,'BackgroundColor'),[1 1 0]);
    3417     if ~test_civ2 && ~test_civ1
     3484    VelTypeMenu=get(handles.VelType,'String');
     3485    VelType=VelTypeMenu{get(handles.VelType,'Value')};
     3486    if ~strcmp(VelType,'civ2') && ~strcmp(VelType,'civ1')
    34183487        msgbox_uvmat('ERROR','manual correction only possible for CIV1 or CIV2 velocity fields')
    34193488    end
     
    38143883function CheckDecimate4_Callback(hObject, eventdata, handles)
    38153884%------------------------------------------------------------------------
     3885if isequal(get(handles.CheckDecimate4,'Value'),1)
     3886    set(handles.CheckDecimate16,'Value',0)
     3887end
     3888update_plot(handles);
     3889
     3890%------------------------------------------------------------------------
     3891% --- Executes on selection change in CheckDecimate16 (nb_vec/16).
     3892function CheckDecimate16_Callback(hObject, eventdata, handles)
     3893%------------------------------------------------------------------------
     3894if isequal(get(handles.CheckDecimate16,'Value'),1)
     3895    set(handles.CheckDecimate4,'Value',0)
     3896end
    38163897update_plot(handles);
    38173898
     
    43414422% --------------------------------------------------------------------
    43424423function MenuExportAxis_Callback(hObject, eventdata, handles)
    4343 answer=msgbox_uvmat('CONFIRMATION','select a figure/axis on which the current uvmat plot will be exported')
    4344 if strcmp(answer,'Yes')
    4345 hchild=get(handles.PlotAxes,'children');
    4346 copyobj(hchild,gca);
    4347 end
     4424ListFig=findobj(allchild(0),'Type','figure');
     4425nb_option=0;
     4426menu={};
     4427for ilist=1:numel(ListFig)
     4428    FigName=get(ListFig(ilist),'name');
     4429    if isempty(FigName)
     4430        FigName=['figure ' num2str(ListFig(ilist))];
     4431    end
     4432    if ~strcmp(FigName,'uvmat')
     4433        ListAxes=findobj(ListFig(ilist),'Type','axes');
     4434        ListTags=get(ListAxes,'Tag');
     4435        if ~isempty(ListTags) && ~isempty(find(~strcmp('Colorbar',ListTags), 1))
     4436            ListAxes=ListAxes(~strcmp('Colorbar',ListTags));
     4437            if numel(ListAxes)==1
     4438                nb_option=nb_option+1;
     4439                menu{nb_option}=FigName ;
     4440                AxesHandle(nb_option)=ListAxes;
     4441            else
     4442                nb_axis=0;
     4443                for iaxes=1:numel(ListAxes)
     4444                    nb_axis=nb_axis+1;
     4445                    nb_option=nb_option+1;
     4446                    menu{nb_option}=[FigName '_' num2str(nb_axis)];
     4447                    AxesHandle(nb_option)=ListAxes(nb_axis);
     4448                end
     4449            end
     4450        end
     4451    end
     4452end
     4453if isempty(menu)
     4454    answer=msgbox_uvmat('INPUT_Y-N','no existing plotting axes available, create new figure?');
     4455    if strcmp(answer,'Yes')
     4456        hfig=figure;
     4457        copyobj(handles.PlotAxes,hfig);
     4458    else
     4459        return
     4460    end
     4461    map=colormap(handles.PlotAxes);
     4462    colormap(map);%transmit the current colormap to the zoom fig
     4463    colorbar
     4464else
     4465    answer=msgbox_uvmat('INPUT_MENU','select a figure/axis on which the current uvmat plot will be exported',menu);
     4466    if isempty(answer)
     4467        return
     4468    else
     4469        axes(AxesHandle(answer))
     4470        hold on
     4471        hchild=get(handles.PlotAxes,'children');
     4472        copyobj(hchild,gca);
     4473    end
     4474end
     4475
    43484476
    43494477%------------------------------------------------------------------------
     
    45054633%------------------------------------------------------------------------
    45064634data.Type='volume';
    4507 data.ProjMode='interp';%default
     4635data.ProjMode='interp_lin';%default
    45084636data.ProjModeMenu={};
    45094637% set(handles.create,'Visible','on')
     
    50195147% --- Executes on button press in CheckColorBar.
    50205148function CheckColorBar_Callback(hObject, eventdata, handles)
     5149
Note: See TracChangeset for help on using the changeset viewer.