Changeset 769


Ignore:
Timestamp:
May 3, 2014, 10:40:25 AM (10 years ago)
Author:
sommeria
Message:

corrections to be able to process image correlation in series

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/read_field.m

    r748 r769  
    6363        [Field,ParamOut.VelType,errormsg]=read_civdata(FileName,InputField,ParamIn.VelType);
    6464        if ~isempty(errormsg),errormsg=['read_civdata / ' errormsg];return,end
     65        if ~isempty(strcmp('C',ParamIn.FieldName))% if C image correlation is requested as field (not color visu)
     66            ScalarIndex=strcmp('C',Field.ListVarName);
     67            Field.VarAttribute{ScalarIndex}.Role='scalar';%put role as 'scalar' instead of ancillary
     68        end     
    6569        ParamOut.CivStage=Field.CivStage;
    6670    case 'civx'% old (obsolete) format for civ results
     
    175179            ind_var_U=find(strcmp(UName,ListVar));%check previous listing of variable r.UName
    176180            ind_var_V=find(strcmp(VName,ListVar));%check previous listing of variable r.VName
    177              if ~checkU && ~checkV
    178                     Field.ListVarName([ind_var_U+2 ind_var_V+2])=[];
    179                     Field.VarDimName([ind_var_U+2 ind_var_V+2])=[];
    180                     Field.VarAttribute([ind_var_U+2 ind_var_V+2])=[];
    181                 elseif ~checkU
    182                     Field.ListVarName(ind_var_U+2)=[];
    183                     Field.VarDimName(ind_var_U+2)=[];
    184                     Field.VarAttribute(ind_var_U+2 )=[];
    185                 elseif ~checkV
    186                     Field.ListVarName(ind_var_V+2)=[];
    187                     Field.VarDimName(ind_var_V+2)=[];
    188                     Field.VarAttribute(ind_var_V+2 )=[];
    189              end
     181            if ~checkU && ~checkV
     182                Field.ListVarName([ind_var_U+2 ind_var_V+2])=[];
     183                Field.VarDimName([ind_var_U+2 ind_var_V+2])=[];
     184                Field.VarAttribute([ind_var_U+2 ind_var_V+2])=[];
     185            elseif ~checkU
     186                Field.ListVarName(ind_var_U+2)=[];
     187                Field.VarDimName(ind_var_U+2)=[];
     188                Field.VarAttribute(ind_var_U+2 )=[];
     189            elseif ~checkV
     190                Field.ListVarName(ind_var_V+2)=[];
     191                Field.VarDimName(ind_var_V+2)=[];
     192                Field.VarAttribute(ind_var_V+2 )=[];
     193            end
    190194        end
    191195    case 'video'
  • trunk/src/series.m

    r767 r769  
    253253        display_file_name(handles,Param.FileName,'one')%refresh the input table
    254254    end
     255else
     256    set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color to indicate that input refresh is needed
    255257end 
    256258if isfield(Param,'incr_i')
     
    260262    set(handles.num_incr_j,'String',num2str(Param.incr_j))
    261263end
    262 set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color to indicate that input refresh is needed
    263264
    264265%------------------------------------------------------------------------
     
    10221023switch FileType
    10231024    case {'civx','civdata'}
    1024         FieldList=set_field_list('U','V','C');
    1025         set(handles.FieldName,'String',[FieldList;{'get_field...'}]);%standard menu for civx data
     1025        FieldList=set_field_list('U','V');
     1026        set(handles.FieldName,'String',[FieldList;{'C'};{'get_field...'}]);%standard menu for civx data
    10261027        set(handles.FieldName,'Value',1) % set menu to 'velocity
    10271028        set(handles.Coord_x,'Value',1);
     
    14041405function RUN_Callback(hObject, eventdata, handles)
    14051406
     1407%% read the data on the GUI series
     1408Param=read_GUI_series(handles);%displayed parameters
     1409SeriesData=get(handles.series,'UserData');%hidden parameters
     1410if isfield(Param,'InputFields')&& isequal(Param.InputFields.FieldName,'get_field...')
     1411    msgbox_uvmat('ERROR','input field name(s) not defined, select get_field...')
     1412    return
     1413end
     1414
    14061415%% settings of the button RUN
    14071416set(handles.RUN,'BusyAction','queue');% activation of STOP button will set BusyAction to 'cancel'
     
    14121421status_Callback(hObject, eventdata, handles)
    14131422
    1414 %% read the data on the GUI series
    1415 Param=read_GUI_series(handles);%displayed parameters
    1416 SeriesData=get(handles.series,'UserData');%hidden parameters
    1417 
    1418 
    1419 
    14201423%% select the Action mode, 'local', 'background' or 'cluster' (if available)
    14211424RunMode='local';%default (needed for first opening of the GUI series)
    14221425if isfield(Param.Action,'RunMode')
    14231426    RunMode=Param.Action.RunMode;
     1427    Param.Action=rmfield(Param.Action,'RunMode');%remove from the recorded xml file to avoid interference during ImportConfig
    14241428end
    14251429ActionExt='.m';%default
    14261430if isfield(Param.Action,'ActionExt')
    14271431    ActionExt=Param.Action.ActionExt;% '.m' or '.sh' (compiled)
     1432    Param.Action=rmfield(Param.Action,'ActionExt');%remove from the recorded xml file to avoid interference during ImportConfig
    14281433end
    14291434ActionName=Param.Action.ActionName;
    14301435ActionPath=Param.Action.ActionPath;
     1436
    14311437path_series=fileparts(which('series'));
    14321438
     
    14831489
    14841490%% If a compiled version has been selected (ext .sh) check weather it needs to be recompiled
    1485 % ActionExtList=get(handles.ActionExt,'String');
    1486 % ActionExt=ActionExtList{get(handles.ActionExt,'Value')};
    1487 % ActionList=get(handles.ActionName,'String');
    1488 % ActionName=ActionList{get(handles.ActionName,'Value')};
    1489 % TransformPath='';
    1490 % if ~isempty(get(handles.ActionExt,'UserData'))
    1491 %     TransformPath=get(handles.ActionExt,'UserData');
    1492 % end
    14931491if strcmp(ActionExt,'.sh')
    14941492    TransformPath='';
     
    15061504            currentdir=pwd;
    15071505            cd(get(handles.ActionPath,'String'))% go to the directory of Action
    1508             %  addpath(get(handles.TransformPath,'String'))
    15091506            addpath(path_uvmat)% add the path to uvmat to run the fct 'compile'
    1510            % addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile'
    15111507            compile(ActionName,TransformPath)
    15121508            cd(currentdir)
     
    15231519                currentdir=pwd;
    15241520                cd(get(handles.ActionPath,'String'))% go to the directory of Action
    1525                 %  addpath(get(handles.TransformPath,'String'))
    15261521                addpath(path_uvmat)% add the path to uvmat to run the fct 'compile'
    15271522                addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile'
     
    23302325                set(handles.VelType,'visible','on')
    23312326        end
     2327        set(handles.FieldName,'Value',1)
     2328        set(handles.FieldName,'String',[FieldList; {'get_field...'}]);
    23322329        if ~strcmp(GetFieldData.FieldOption,'civdata...')
     2330            set(handles.FieldName,'Value',[1:numel(FieldList)])%select all input fields by default
    23332331            set(handles.VelType,'visible','off')
    23342332            XName=GetFieldData.Coordinates.Coord_x;
     
    23532351            end
    23542352        end
    2355         set(handles.Coord_x,'String',{XName})
     2353                set(handles.Coord_x,'String',{XName})
    23562354        set(handles.Coord_y,'String',YName)
    2357         set(handles.FieldName,'Value',1)
    2358         set(handles.FieldName,'String',[FieldList; {'get_field...'}]);
    23592355    end
    23602356end
     
    28022798    fill_GUI(Param,handles.series)% fill the elements of the GUI series with the input parameters
    28032799    SeriesData=get(handles.series,'UserData');
     2800    if isfield(Param,'InputFields')
     2801        ListField=Param.InputFields.FieldName;
     2802        set(handles.FieldName,'String',[ListField;{'get-field...'}])
     2803         set(handles.FieldName,'Value',1:numel(ListField))
     2804    end       
    28042805    if isfield(Param,'ActionInput')%  introduce  parameters specific to an Action fct, for instance PIV parameters
    28052806        set(handles.ActionInput,'Visible','on')
  • trunk/src/set_field_list.m

    r588 r769  
    44%
    55% OUTPUT:
    6 % Scal: matlab vector representing the scalar values (length nbvec defined by var_read)
    7 %      if no input, Scal=list of programmed scalar names (to put in menus)
    8 %      if only the field name is put as input, vec_A=type of scalar, which can be:
    9 %                   'discrete': related to the individual velocity vectors, not interpolated by patch
    10 %                   'vel': scalar calculated solely from velocity components
    11 %                   'der': needs spatial derivatives
    12 %                   'var': the scalar name directly corresponds to a field name in the netcdf files
    13 % error: error flag
    14 %      error = 0; OK
    15 %      error = 1; the prescribed scalar cannot be read or calculated from available fields
     6% FieldList: list (cell column) of the fields to propose in the menu FieldName
     7% VecColorList: list (cell column) of the fields to propose in the menu for vector color
    168%
    179% INPUT:
    18 % FieldList: cell array of strings representing the name(s) of the field(s) to calculate
    19 % DataIn: structure representing the field, as defined in check_field_srtructure.m
    20 % Coord_interp(:,nb_coord) optional set of coordinates to interpolate the field (use with thin plate shell)
     10% UName: name of the x vector component
     11% VName: name of the y vector component
     12% CName: name of an additional scalar for color
    2113%
    2214% FUNCTION related
    2315% varname_generator.m: determines the field names to read in the netcdf
    2416% file, depending on the scalar
     17
    2518function [FieldList,VecColorList]=set_field_list(UName,VName,CName)
    26 %function [DataOut,errormsg]=calc_field(FieldList,DataIn,Coord_interp)
    27 
    28 %list of defined scalars to display in menus (in addition to 'ima_cor').
    29 % a type is associated to each scalar:
    30 %              'discrete': related to the individual velocity vectors, not interpolated by patch
    31 %              'vel': calculated from velocity components, continuous field (interpolated with velocity)
    32 %              'der': needs spatial derivatives
    33 %              'var': the scalar name corresponds to a field name in the netcdf files
    34 % a specific variable name for civ1 and civ2 fields are also associated, if
    35 % the scalar is calculated from other fields, as explicited below
    3619
    3720FieldList={['vec(' UName ',' VName ')'];...
     
    4528    UName;...
    4629    VName};...
    47     if ~isempty(CName)
     30if exist('CName','var') && ~isempty(CName)
    4831    VecColorList=[{CName};VecColorList];
    49     end
     32end
    5033
    5134
    52 
    53 % %% list of field options implemented
    54 % FieldList={'vec(U,V)';...%image correlation corresponding to a vel vector
    55 %     'C';...%image correlation corresponding to a vel vector
    56 %     'norm(U,V)';...%norm of the velocity
    57 %     'curl(U,V)';...%vorticity
    58 %     'div(U,V)';...%divergence
    59 %     'strain(U,V)';...%rate of strain
    60 %     'U';... %u velocity component
    61 %     'V';... %v velocity component
    62 %     'W';... %w velocity component
    63 %     'W_normal';... %w velocity component normal to the plane
    64 %     'error'}; %error associated to a vector (for stereo or patch)
    65 % ColorList={'C';...%image correlation corresponding to a vel vector
    66 %     'norm(U,V)';...%norm of the velocity
    67 %     'U';... %u velocity component
    68 %     'V';... %v velocity component
    69 %     }
    70 
Note: See TracChangeset for help on using the changeset viewer.