Changeset 822


Ignore:
Timestamp:
Oct 10, 2014, 10:11:30 AM (10 years ago)
Author:
sommeria
Message:

various

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/plot_field.m

    r811 r822  
    1414% function [PlotType,PlotParamOut,haxes]= plot_field(Data,haxes,PlotParam,PosColorbar)
    1515%
    16 % OUTPUT:
     16% OUPUT:
    1717% PlotType: type of plot: 'text','line'(curve plot),'plane':2D view,'volume'
    1818% PlotParamOut: structure, representing the updated  plotting parameters, in case of automatic scaling
    1919% haxes: handle of the plotting axis, when a new figure is created.
    2020%
    21 % INPUT:
     21%INPUT
    2222%    Data:   structure describing the field to plot
    2323%         (optional) .ListGlobalAttribute: cell listing the names of the global attributes
     
    8181%                expressed in figure relative unit (ex [0.821 0.471 0.019 0.445])
    8282
    83 %=======================================================================
    84 % Copyright 2008-2014, LEGI UMR 5519 / CNRS UJF G-INP, Grenoble, France
    85 %   http://www.legi.grenoble-inp.fr
    86 %   Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
    87 %
     83%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
     84%  Copyright 2008-2014, LEGI / CNRS UJF G-INP, Joel.Sommeria@legi.grenoble-inp.fr
     85%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    8886%     This file is part of the toolbox UVMAT.
    89 %
     87% 
    9088%     UVMAT is free software; you can redistribute it and/or modify
    91 %     it under the terms of the GNU General Public License as published
    92 %     by the Free Software Foundation; either version 2 of the license,
    93 %     or (at your option) any later version.
    94 %
     89%     it under the terms of the GNU General Public License as published by
     90%     the Free Software Foundation; either version 2 of the License, or
     91%     (at your option) any later version.
     92% 
    9593%     UVMAT is distributed in the hope that it will be useful,
    9694%     but WITHOUT ANY WARRANTY; without even the implied warranty of
    9795%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    98 %     GNU General Public License (see LICENSE.txt) for more details.
    99 %=======================================================================
     96%     GNU General Public License (file UVMAT/COPYING.txt) for more details.
     97%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    10098
    10199function [PlotType,PlotParamOut,haxes]= plot_field(Data,haxes,PlotParam)
     
    779777%%   image or scalar plot %%%%%%%%%%%%%%%%%%%%%%%%%%
    780778if test_ima
    781    
    782779    % distinguish B/W and color images
    783780    np=size(A);%size of image
     
    798795    end
    799796   
    800     %set the color map
     797    %set for grey scale setting
    801798    if isfield(PlotParam.Scalar,'CheckBW') && ~isempty(PlotParam.Scalar.CheckBW)
    802799        BW=PlotParam.Scalar.CheckBW; %BW=0 color imposed, else gray scale imposed.
     
    806803    end
    807804   
    808             % determine the plot option 'image' or 'contours'
     805    % determine the plot option 'image' or 'contours'
     806    CheckContour=0; %default
    809807    if isfield(PlotParam.Scalar,'ListContour')
    810808        CheckContour=strcmp(PlotParam.Scalar.ListContour,'contours');% =1 for contour plot option
    811     else
    812         CheckContour=0; %default
    813809    end
    814810   
    815811    %case of grey level images or contour plot
    816     if siz==2
    817         if ~isfield(PlotParam.Scalar,'CheckFixScalar')
    818             PlotParam.Scalar.CheckFixScalar=0;% free scalar threshold value scale (from min to max) by default
    819         end
    820         if ~isfield(PlotParam.Scalar,'MinA')
    821             PlotParam.Scalar.MinA=[];%no min scalar threshold value set
    822         end
    823         if ~isfield(PlotParam.Scalar,'MaxA')
    824             PlotParam.Scalar.MaxA=[];%no max scalar threshold value set
     812    if ~isfield(PlotParam.Scalar,'CheckFixScalar')
     813        PlotParam.Scalar.CheckFixScalar=0;% free scalar threshold value scale (from min to max) by default
     814    end
     815    if ~isfield(PlotParam.Scalar,'MinA')
     816        PlotParam.Scalar.MinA=[];%no min scalar threshold value set
     817    end
     818    if ~isfield(PlotParam.Scalar,'MaxA')
     819        PlotParam.Scalar.MaxA=[];%no max scalar threshold value set
     820    end
     821   
     822    % determine the min scalar value
     823    if PlotParam.Scalar.CheckFixScalar && ~isempty(PlotParam.Scalar.MinA) && isnumeric(PlotParam.Scalar.MinA)
     824        MinA=double(PlotParam.Scalar.MinA); % min value set as input
     825    else
     826        MinA=double(min(min(min(A)))); % min value set as min of non NaN scalar values
     827    end
     828   
     829    % error if the input scalar is NaN everywhere
     830    if isnan(MinA)
     831        errormsg='NaN input scalar or image in plot_field';
     832        return
     833    end
     834   
     835    % determine the max scalar value
     836    CheckFixScalar=0;
     837    if PlotParam.Scalar.CheckFixScalar && ~isempty(PlotParam.Scalar.MaxA) && isnumeric(PlotParam.Scalar.MaxA)
     838        MaxA=double(PlotParam.Scalar.MaxA); % max value set as input
     839        CheckFixScalar=1;
     840    else
     841        MaxA=double(max(max(max(A)))); % max value set as min of non NaN scalar values
     842    end
     843   
     844    PlotParamOut.Scalar.MinA=MinA;
     845    PlotParamOut.Scalar.MaxA=MaxA;
     846    PlotParamOut.Scalar.Npx=size(A,2);
     847    PlotParamOut.Scalar.Npy=size(A,1);
     848    %     if siz==2
     849    % case of contour plot
     850    if CheckContour
     851        if ~isempty(hima) && ishandle(hima)
     852            delete(hima) % delete existing image
    825853        end
    826854       
    827         % determine the min scalar value
    828         if PlotParam.Scalar.CheckFixScalar && ~isempty(PlotParam.Scalar.MinA) && isnumeric(PlotParam.Scalar.MinA) 
    829             MinA=double(PlotParam.Scalar.MinA); % min value set as input
    830         else
    831             MinA=double(min(min(A))); % min value set as min of non NaN scalar values
    832         end
     855        % set the contour values
     856        if ~isfield(PlotParam.Scalar,'IncrA')
     857            PlotParam.Scalar.IncrA=[];% automatic contour interval
     858        end
     859        if ~isempty(PlotParam.Scalar.IncrA) && isnumeric(PlotParam.Scalar.IncrA)
     860            interval=PlotParam.Scalar.IncrA;
     861        else % automatic contour interval
     862            cont=colbartick(MinA,MaxA);
     863            interval=cont(2)-cont(1);%default
     864            PlotParamOut.Scalar.IncrA=interval;% set the interval as output for display on the GUI
     865        end
     866        abscontmin=interval*floor(MinA/interval);
     867        abscontmax=interval*ceil(MaxA/interval);
     868        contmin=interval*floor(min(min(A))/interval);
     869        contmax=interval*ceil(max(max(A))/interval);
     870        cont_pos_plus=0:interval:contmax;% zero and positive contour values (plotted as solid lines)
     871        cont_pos_min=double(contmin):interval:-interval;% negative contour values (plotted as dashed lines)
     872        cont_pos=[cont_pos_min cont_pos_plus];% set of all contour values
    833873       
    834         % error if the input scalar is NaN everywhere
    835         if isnan(MinA)
    836                 errormsg='NaN input scalar or image in plot_field';
    837                 return
    838         end
     874        sizpx=(Coord_x(end)-Coord_x(1))/(np(2)-1);
     875        sizpy=(Coord_y(1)-Coord_y(end))/(np(1)-1);
     876        x_cont=Coord_x(1):sizpx:Coord_x(end); % pixel x coordinates for image display
     877        y_cont=Coord_y(1):-sizpy:Coord_y(end); % pixel x coordinates for image display
    839878       
    840         % determine the max scalar value
    841         if PlotParam.Scalar.CheckFixScalar && ~isempty(PlotParam.Scalar.MaxA) && isnumeric(PlotParam.Scalar.MaxA) 
    842             MaxA=double(PlotParam.Scalar.MaxA); % max value set as input
    843         else
    844             MaxA=double(max(max(A))); % max value set as min of non NaN scalar values
    845         end
     879        %axes(haxes)% set the input axes handle as current axis
    846880       
    847         PlotParamOut.Scalar.MinA=MinA;
    848         PlotParamOut.Scalar.MaxA=MaxA;
    849         PlotParamOut.Scalar.Npx=size(A,2);
    850         PlotParamOut.Scalar.Npy=size(A,1);
     881        % colormap(map);
     882        tag_axes=get(haxes,'Tag');% axes tag
     883        Opacity=1;
     884        if isfield(PlotParam.Scalar,'Opacity')&&~isempty(PlotParam.Scalar.Opacity)
     885            Opacity=PlotParam.Scalar.Opacity;
     886        end
     887        % fill the space between contours if opacity is undefined or =1
     888        if isequal(Opacity,1)
     889            [var,hcontour]=contour(haxes,x_cont,y_cont,A,cont_pos);% determine all contours
     890            set(hcontour,'Fill','on')% fill the space between contours
     891            set(hcontour,'LineStyle','none')
     892            hold on
     893        end
     894        [var_p,hcontour_p]=contour(haxes,x_cont,y_cont,A,cont_pos_plus,'k-');% draw the contours for positive values as solid lines
     895        hold on
     896        [var_m,hcontour_m]=contour(haxes,x_cont,y_cont,A,cont_pos_min,'--');% draw the contours for negative values as dashed lines
     897        if isequal(Opacity,1)
     898            set(hcontour_m,'LineColor',[1 1 1])% draw negative contours in white (better visibility in dark background)
     899        end
     900        set(haxes,'Tag',tag_axes);% restore axes tag (removed by the matlab fct contour !)
     901        hold off
    851902       
    852         % case of contour plot
    853         if CheckContour
    854             if ~isempty(hima) && ishandle(hima)
    855                 delete(hima) % delete existing image
    856             end
    857            
    858             % set the contour values
    859             if ~isfield(PlotParam.Scalar,'IncrA')
    860                 PlotParam.Scalar.IncrA=[];% automatic contour interval
    861             end
    862             if ~isempty(PlotParam.Scalar.IncrA) && isnumeric(PlotParam.Scalar.IncrA)
    863                 interval=PlotParam.Scalar.IncrA;
    864             else % automatic contour interval
    865                 cont=colbartick(MinA,MaxA);
    866                 interval=cont(2)-cont(1);%default
    867                 PlotParamOut.Scalar.IncrA=interval;% set the interval as output for display on the GUI
    868             end
    869             %B=A;
    870             abscontmin=interval*floor(MinA/interval);
    871             abscontmax=interval*ceil(MaxA/interval);
    872             contmin=interval*floor(min(min(A))/interval);
    873             contmax=interval*ceil(max(max(A))/interval);
    874             cont_pos_plus=0:interval:contmax;% zero and positive contour values (plotted as solid lines)
    875             cont_pos_min=double(contmin):interval:-interval;% negative contour values (plotted as dashed lines)
    876             cont_pos=[cont_pos_min cont_pos_plus];% set of all contour values
    877            
    878             sizpx=(Coord_x(end)-Coord_x(1))/(np(2)-1);
    879             sizpy=(Coord_y(1)-Coord_y(end))/(np(1)-1);
    880             x_cont=Coord_x(1):sizpx:Coord_x(end); % pixel x coordinates for image display
    881             y_cont=Coord_y(1):-sizpy:Coord_y(end); % pixel x coordinates for image display
    882            
    883             %axes(haxes)% set the input axes handle as current axis
    884 
    885            % colormap(map);
    886            tag_axes=get(haxes,'Tag');% axes tag
    887            Opacity=1;
    888            if isfield(PlotParam.Scalar,'Opacity')&&~isempty(PlotParam.Scalar.Opacity)
    889                Opacity=PlotParam.Scalar.Opacity;
    890            end
    891            % fill the space between contours if opacity is undefined or =1
    892            if isequal(Opacity,1)
    893                [var,hcontour]=contour(haxes,x_cont,y_cont,A,cont_pos);% determine all contours
    894                set(hcontour,'Fill','on')% fill the space between contours
    895                set(hcontour,'LineStyle','none')
    896                hold on
    897            end
    898            [var_p,hcontour_p]=contour(haxes,x_cont,y_cont,A,cont_pos_plus,'k-');% draw the contours for positive values as solid lines
    899            hold on
    900            [var_m,hcontour_m]=contour(haxes,x_cont,y_cont,A,cont_pos_min,'--');% draw the contours for negative values as dashed lines
    901            if isequal(Opacity,1)
    902                set(hcontour_m,'LineColor',[1 1 1])% draw negative contours in white (better visibility in dark background)
    903            end
    904            set(haxes,'Tag',tag_axes);% restore axes tag (removed by the matlab fct contour !)
    905            hold off
    906            
    907             %determine the color scale and map
    908             caxis([abscontmin abscontmax])
    909             if BW
    910                 vec=linspace(0,1,(abscontmax-abscontmin)/interval);%define a greyscale colormap with steps interval
    911                 map=[vec' vec' vec'];
    912                 colormap(map);
     903        %determine the color scale and map
     904        caxis([abscontmin abscontmax])
     905        if BW
     906            vec=linspace(0,1,(abscontmax-abscontmin)/interval);%define a greyscale colormap with steps interval
     907            map=[vec' vec' vec'];
     908            colormap(map);
     909        else
     910            colormap('default'); % default matlab colormap ('jet')
     911        end
     912       
     913        if isfield(PlotParam.Axes,'CheckFixAspectRatio') && isequal(PlotParam.Axes.CheckFixAspectRatio,1)
     914            set(haxes,'DataAspectRatioMode','manual')
     915            if isfield(PlotParam.Axes,'AspectRatio')
     916                set(haxes,'DataAspectRatio',[PlotParam.Axes.AspectRatio 1 1])
    913917            else
    914                 colormap('default'); % default matlab colormap ('jet')
    915             end
    916            
    917             if isfield(PlotParam.Axes,'CheckFixAspectRatio') && isequal(PlotParam.Axes.CheckFixAspectRatio,1)
    918                 set(haxes,'DataAspectRatioMode','manual')
    919                 if isfield(PlotParam.Axes,'AspectRatio')
    920                     set(haxes,'DataAspectRatio',[PlotParam.Axes.AspectRatio 1 1])
    921                 else
    922                     set(haxes,'DataAspectRatio',[1 1 1])
    923                 end
    924             end
    925         else     
     918                set(haxes,'DataAspectRatio',[1 1 1])
     919            end
     920        end
     921    else %usual images (no contour)
    926922        % set  colormap for  image display
    927             % rescale the grey levels with min and max, put a grey scale colorbar
    928 %             B=A;
    929             if BW
    930                 vec=linspace(0,1,255);%define a linear greyscale colormap
    931                 map=[vec' vec' vec'];
    932                 colormap(map);  %grey scale color map
    933             else
    934                 colormap('default'); % standard false colors for div, vort , scalar fields
    935             end
     923        if BW
     924            vec=linspace(0,1,255);%define a linear greyscale colormap
     925            map=[vec' vec' vec'];
     926            colormap(map);  %grey scale color map
     927            if siz==3% true color images visualized in BW
     928                A=uint16(sum(A,3));%sum the three color components for color images displayed with BW option
     929            end
     930        else
     931            if siz==3 && CheckFixScalar % true color images rescaled by MaxA
     932                  A=uint8(255*double(A)/double(MaxA));
     933            end
     934            colormap('default'); % standard false colors for div, vort , scalar fields
    936935        end
    937936       
    938         % case of color images
    939     else
    940         if BW
    941             A=uint16(sum(A,3));
    942         else
    943             A=uint8(A);
    944         end
    945         MinA=0;
    946         MaxA=255;
    947     end
    948    
    949     % display usual image
    950     if ~CheckContour
    951937        % interpolate field to increase resolution of image display
    952938        test_interp=0;
    953         if size(A,3)==1 % scalar of B/W image
     939        if size(A,3)==1 % scalar or B/W image
    954940            test_interp=1;
    955941            if max(np) <= 64
     
    10141000    %display the colorbar code for B/W images if Poscolorbar not empty
    10151001    if ~isempty(PosColorbar)
    1016         if siz==2 && exist('PosColorbar','var')
     1002        if size(A,3)==1 && exist('PosColorbar','var')
    10171003            if isempty(hcol)||~ishandle(hcol)
    10181004                hcol=colorbar;%create new colorbar
  • trunk/src/read_civdata.m

    r809 r822  
    105105    return
    106106end
     107% set the list of variables to read and their role
    107108[varlist,role,VelTypeOut]=varcivx_generator(ProjModeRequest,VelType,Data.CivStage);
    108109if isempty(varlist)
     
    125126            Field.SubDomain=Field.Patch1_SubDomain;
    126127            Field.ListGlobalAttribute=[Field.ListGlobalAttribute {'SubDomain'}];
    127         end 
     128        end
    128129        if isfield(Field,'Civ1_Dt')
    129         Field.Dt=Field.Civ1_Dt;
     130            Field.Dt=Field.Civ1_Dt;
    130131        end
    131132        if isfield(Field,'Civ1_Time')
    132         Field.Time=Field.Civ1_Time;
     133            Field.Time=Field.Civ1_Time;
    133134        end
    134135    case{'civ2','filter2'}
     
    154155    if strcmp(role{var_ind(ivar)},'vector_x')
    155156        Field.VarAttribute{ivar}.FieldName=FieldNames;
    156 %         Field.VarAttribute{ivar}.ProjModeRequest=ProjModeRequest;
    157157        ivar_U=ivar;
    158158    end
    159159    if strcmp(role{var_ind(ivar)},'vector_x_tps')
    160160        Field.VarAttribute{ivar}.FieldName=FieldNames;
    161 %         Field.VarAttribute{ivar}.ProjModeRequest=ProjModeRequest;
    162161        ivar_U_tps=ivar;
    163162    end
    164163    if strcmp(role{var_ind(ivar)},'vector_y')
    165164        Field.VarAttribute{ivar}.FieldName=FieldNames;
    166 %         Field.VarAttribute{ivar}.ProjModeRequest=ProjModeRequest;
    167165        ivar_V=ivar;
    168166    end
    169167    if strcmp(role{var_ind(ivar)},'vector_y_tps')
    170168        Field.VarAttribute{ivar}.FieldName=FieldNames;
    171 %         Field.VarAttribute{ivar}.ProjModeRequest=ProjModeRequest;
    172169        ivar_V_tps=ivar;
    173170    end
  • trunk/src/read_field.m

    r809 r822  
    8181        [Field,ParamOut.VelType,errormsg]=read_civdata(FileName,InputField,ParamIn.VelType);
    8282        if ~isempty(errormsg),errormsg=['read_civdata / ' errormsg];return,end
    83         if ~isempty(strcmp('C',ParamIn.FieldName))% if C image correlation is requested as field (not color visu)
    84             ScalarIndex=strcmp('C',Field.ListVarName);
    85             Field.VarAttribute{ScalarIndex}.Role='scalar';%put role as 'scalar' instead of ancillary
    86         end     
     83%         if ~isempty(strcmp('C',ParamIn.FieldName))% if C image correlation is requested as field (not color visu)
     84%             ScalarIndex=strcmp('C',Field.ListVarName);
     85%             Field.VarAttribute{ScalarIndex}.Role='scalar';%put role as 'scalar' instead of ancillary
     86%         end     
    8787        ParamOut.CivStage=Field.CivStage;
    8888    case 'civx'% old (obsolete) format for civ results
  • trunk/src/series.m

    r817 r822  
    19921992if FieldNameRequest && numel(iview_netcdf)>=1
    19931993    set(handles.InputFields,'Visible','on')
    1994 %     set(handles.FieldName,'Visible','on')
    19951994    if CheckList==0        % not civ input made
     1995        if isfield(SeriesData.FileInfo{iview_netcdf(1)},'ListVarName')
    19961996        ListVarName=SeriesData.FileInfo{iview_netcdf(1)}.ListVarName;
    19971997        ind_var=get(handles.FieldName,'Value');%indices of previously selected variables
     
    20492049        else
    20502050            set(handles.FieldName_1,'Visible','off')
     2051        end
    20512052        end
    20522053    else
  • trunk/src/series/civ_input.m

    r810 r822  
    473473
    474474handles.output.ActionInput=read_GUI(handles.civ_input);
     475% correct mask or grid name for Windows system (replace '\' by '/')
     476if isfield(handles.output.ActionInput,'Civ1')
     477    if isfield(handles.output.ActionInput.Civ1,'Mask')
     478        handles.output.ActionInput.Civ1.Mask=regexprep(handles.output.ActionInput.Civ1.Mask,'\','/');
     479    end
     480    if isfield(handles.output.ActionInput.Civ1,'Grid')
     481        handles.output.ActionInput.Civ1.Grid=regexprep(handles.output.ActionInput.Civ1.Grid,'\','/');
     482    end
     483end
     484if isfield(handles.output.ActionInput,'Civ2')
     485    if isfield(handles.output.ActionInput.Civ2,'Mask')
     486        handles.output.ActionInput.Civ2.Mask=regexprep(handles.output.ActionInput.Civ2.Mask,'\','/');
     487    end
     488    if isfield(handles.output.ActionInput.Civ2,'Grid')
     489        handles.output.ActionInput.Civ2.Grid=regexprep(handles.output.ActionInput.Civ2.Grid,'\','/');
     490    end
     491end
    475492guidata(hObject, handles);% Update handles structure
    476493uiresume(handles.civ_input);
  • trunk/src/series/civ_series.m

    r819 r822  
    7878if ischar(Param)
    7979    Param=xml2struct(Param);% read Param as input file (batch case)
    80     Param.InputTable{1}
    81     Param.InputTable{2}
    82      Param.InputTable{3}
    8380    checkrun=0;
    8481end
     
    153150                    [i1_series_Civ2,i2_series_Civ2,j1_series_Civ2,j2_series_Civ2,check_bounds,NomTypeNc]=...
    154151                        find_pair_indices(PairCiv2,i1_series{2},j1_series{2},MinIndex_i(2),MaxIndex_i(2),MinIndex_j(2),MaxIndex_j(2));
    155 %                     check_bounds=check_bounds | check_bounds_Civ2;
    156152                end
    157153            end
     
    204200            FrameIndex_A_Civ2=i1_series_Civ2;
    205201            FrameIndex_B_Civ2=i2_series_Civ2;
     202            j1_series_Civ2=ones(size(i1_series_Civ2));
     203            j2_series_Civ2=ones(size(i1_series_Civ2));
    206204        else
    207205            FrameIndex_A_Civ2=j1_series_Civ2;
     
    253251            return
    254252        end
    255         [FileType_A,FileInfo_A,VideoObject_A]=get_file_info(ImageName_A);
     253        [FileInfo_A,VideoObject_A]=get_file_info(ImageName_A);
     254        FileType_A=FileInfo_A.FileType;
    256255        [par_civ1.ImageA,VideoObject_A] = read_image(ImageName_A,FileInfo_A.FileType,VideoObject_A,FrameIndex_A_Civ2(1));
    257256        ImageName_B=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ2(1),[],j2_series_Civ2(1));
     
    264263        [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B_Civ2(1));
    265264        NbField=numel(i1_series_Civ2);
     265    else
     266        NbField=numel(i1_series_Civ1);% no image used (only fix or patch) TO CHECK
    266267    end
    267268catch ME
     
    280281Data.Program='civ_series';
    281282Data.CivStage=0;%default
    282 % ListVarCiv1={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_C','Civ1_F'}; %variables to read
    283 % ListVarFix1={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_C','Civ1_F','Civ1_FF'};
    284 % mask='';
    285283maskname='';%default
    286284check_civx=0;%default
    287 % check_civ1=0;%default
    288 % check_patch1=0;%default
    289285
    290286%% get timing from the ImaDoc file or input video
     287if iview_A~=0
    291288XmlFileName=find_imadoc(RootPath_A,SubDir_A,RootFile_A,FileExt_A);
    292289time=[];
     
    316313end
    317314if isempty(time)% time = index i +0.001 index j by default
    318     time=(MinIndex_i:MaxIndex_i)'*ones(1,MaxIndex_j-MinIndex_j+1);
    319     time=time+0.001*ones(MaxIndex_i-MinIndex_i+1,1)*(MinIndex_j:MaxIndex_j);
    320     time=[zeros(1,MaxIndex_j-MinIndex_j+1);time];% insert a first line of zeros
    321     time=[zeros(MaxIndex_i-MinIndex_i+2,1) time];% insert a first column of zeros
     315    %MinIndex_i=min(i1_series_Civ1);
     316    MaxIndex_i=max(i2_series_Civ1);
     317    %MinIndex_j=min(j1_series_Civ1);
     318    MaxIndex_j=max(j2_series_Civ1);
     319    time=(1:MaxIndex_i)'*ones(1,MaxIndex_j);
     320    time=time+0.001*ones(MaxIndex_i,1)*(1:MaxIndex_j);
     321    time=[zeros(1,MaxIndex_j);time];% insert a first line of zeros
     322    time=[zeros(MaxIndex_i+1,1) time];% insert a first column of zeros
    322323end
    323324   
     
    325326    nbfield=length(FileInfo_A);
    326327    nbfield_j=1;
     328end
    327329end
    328330
     
    334336        break
    335337    end
    336     if iview_A==1% if Civ1 is performed
    337         Civ1Dir=OutputDir;
     338    if iview_A==0
     339        ncfile=fullfile_uvmat(Param.InputTable{1,1},Param.InputTable{1,2},Param.InputTable{1,3},Param.InputTable{1,5},...
     340            NomTypeNc,i1_series_Civ1(ifield),i2_series_Civ1(ifield),j1_series_Civ1(ifield),j2_series_Civ1(ifield));
    338341    else
    339         Civ1Dir=Param.InputTable{1,2};
    340     end
    341     if strcmp(Param.ActionInput.ListCompareMode,'PIV')
    342         ncfile=fullfile_uvmat(RootPath_A,Civ1Dir,RootFile_A,'.nc',NomTypeNc,i1_series_Civ1(ifield),i2_series_Civ1(ifield),...
    343             j1_series_Civ1(ifield),j2_series_Civ1(ifield));
    344     else
    345         ncfile=fullfile_uvmat(RootPath_A,Civ1Dir,RootFile_A,'.nc',NomTypeNc,i2_series_Civ1(ifield),[],...
    346             j1_series_Civ1(ifield),j2_series_Civ1(ifield));
    347     end
    348 
     342        if iview_A==1% if Civ1 is performed
     343            Civ1Dir=OutputDir;
     344        else
     345            Civ1Dir=Param.InputTable{1,2};
     346        end
     347        if strcmp(Param.ActionInput.ListCompareMode,'PIV')
     348            ncfile=fullfile_uvmat(RootPath_A,Civ1Dir,RootFile_A,'.nc',NomTypeNc,i1_series_Civ1(ifield),i2_series_Civ1(ifield),...
     349                j1_series_Civ1(ifield),j2_series_Civ1(ifield));
     350        else
     351            ncfile=fullfile_uvmat(RootPath_A,Civ1Dir,RootFile_A,'.nc',NomTypeNc,i2_series_Civ1(ifield),[],...
     352                j1_series_Civ1(ifield),j2_series_Civ1(ifield));
     353        end
     354    end
    349355    %% Civ1
    350356    % if Civ1 computation is requested
     
    466472    %% Fix1
    467473    if isfield (Param.ActionInput,'Fix1')
     474        if ~isfield (Param.ActionInput,'Civ1')% if we use existing Civ1, remove previous data beyond Civ1
     475            Fix1_attr=find(strcmp('Fix1',Data.ListGlobalAttribute));
     476            Data.ListGlobalAttribute(Fix1_attr)=[];
     477            for ilist=1:numel(Fix1_attr)
     478                Data=rmfield(Data,Data.ListGlobalAttribute{Fix1_attr(ilist)});
     479            end
     480        end
    468481        ListFixParam=fieldnames(Param.ActionInput.Fix1);
    469482        for ilist=1:length(ListFixParam)
     
    615628        par_civ2.SearchBoxSize(1)=2*ibx2+9;% search ara +-4 pixels around the guess
    616629        par_civ2.SearchBoxSize(2)=2*iby2+9;
    617 %         i1=i1_series_Civ2(ifield);
    618 %         i2=i1;
    619 %         if ~isempty(i2_series_Civ2)
    620 %             i2=i2_series_Civ2(ifield);
    621 %         end
    622 %         j1=1;
    623 %         if ~isempty(j1_series_Civ2)
    624 %             j1=j1_series_Civ2(ifield);
    625 %         end
    626 %         j2=j1;
    627 %         if ~isempty(j2_series_Civ1)
    628 %             j2=j2_series_Civ2(ifield);
    629 %         end
    630630        Civ2_Dt=time(i2+1,j2+1)-time(i1+1,j1+1);
    631631        par_civ2.SearchBoxShift=(Civ2_Dt/Data.Civ1_Dt)*[Shiftx(nbval>=1)./nbval(nbval>=1) Shifty(nbval>=1)./nbval(nbval>=1)];
     
    693693            nbvar=length(Data.ListVarName);
    694694            Data.VarAttribute{nbvar}.Role='errorflag';
    695             Data.Civ2_FF=fix(Param.ActionInput.Fix2,Data.Civ2_F,Data.Civ2_C,Data.Civ2_U,Data.Civ2_V);
     695            Data.Civ2_FF=double(fix(Param.ActionInput.Fix2,Data.Civ2_F,Data.Civ2_C,Data.Civ2_U,Data.Civ2_V));
    696696            Data.CivStage=Data.CivStage+1;
    697697        end
  • trunk/src/tps_coeff_field.m

    r809 r822  
    66% DataOut: output field structure, reproducing the input field structure DataIn and adding the fields:
    77%         .Coord_tps
    8 %         .[VarName '_tps'] for each eligible input variable VarName (scalar ofr vector components)
     8%         .[VarName '_tps'] for each eligible input variable VarName (scalar or vector components)
    99% errormsg: error message, = '' by default
    1010%
    1111% INPUT:
    1212% DataIn: intput field structure
    13 % checkall:=1 if tps is needed for all fields (a projection mode interp_tps is needed), =0 otherwise
     13% checkall:=1 if tps is needed for all fields (a projection mode interp_tps has been chosen),
     14%          =0 otherwise (tps only needed to get spatial derivatives of scattered data)
    1415%
    1516% called functions:
     
    5354
    5455for icell=1:numel(CellInfo);
    55     if NbDimArray(icell)>=2 && strcmp(CellInfo{icell}.CoordType,'scattered')% %if the coordinates are scattered
     56    if NbDimArray(icell)>=2 && strcmp(CellInfo{icell}.CoordType,'scattered') %if the coordinates are scattered
    5657        NbCoord=NbDimArray(icell);% dimension of space
    5758        nbtps=nbtps+1;% indicate the number of tps coordinate sets in the field structure (in general =1)
    5859        X=DataIn.(DataIn.ListVarName{CellInfo{icell}.CoordIndex(end)});% value of x coordinate
    59         Y=DataIn.(DataIn.ListVarName{CellInfo{icell}.CoordIndex(end-1)});% value of x coordinate
     60        Y=DataIn.(DataIn.ListVarName{CellInfo{icell}.CoordIndex(end-1)});% value of y coordinate
    6061        check_interp_tps=false(numel(DataIn.ListVarName),1);
    61         %for ivar=1:numel(CellInfo{icell}.VarIndex)
    62         Index_interp=[];
    63         if isfield(CellInfo{icell},'VarIndex_scalar')
     62        Index_interp=[];% indices of variables to interpolate
     63        if isfield(CellInfo{icell},'VarIndex_scalar')%interpolate scalar
    6464            Index_interp=[Index_interp CellInfo{icell}.VarIndex_scalar];
    6565        end
    66         if isfield(CellInfo{icell},'VarIndex_vector_x')
     66        if isfield(CellInfo{icell},'VarIndex_vector_x')%interpolate vector x component
    6767            Index_interp=[Index_interp CellInfo{icell}.VarIndex_vector_x];
    6868        end
    69         if isfield(CellInfo{icell},'VarIndex_vector_y')
     69        if isfield(CellInfo{icell},'VarIndex_vector_y')%interpolate vector y component
    7070            Index_interp=[Index_interp CellInfo{icell}.VarIndex_vector_y];
    7171        end
     
    7676            end
    7777        end
    78        
    79         %VarIndexInterp=CellInfo{icell}.VarIndex(check_interp_tps);% indices of variables to interpolate through tps
    80         %         if ~isempty(VarIndexInterp)
    8178        ListVarInterp=DataIn.ListVarName(check_interp_tps);
    8279        VarIndexInterp=find(check_interp_tps);
     
    110107                DataOut.(['Coord_tps' term])(1:NbCentre(isub),1:2,isub)=[X(ind_sel) Y(ind_sel)];
    111108                DataOut.(['Coord_tps' term])(NbCentre(isub)+1:NbCentre(isub)+3,1:2,isub)=0;%matrix of zeros to complement the matrix Coord_tps (conveninent for file storage)
    112                 %fill=zeros(NbCoord+1,NbCoord,size(SubRange,3)); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage)
    113                 %                 fill=zeros(NbCoord+1,NbCoord+1,NbCoord); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage)
    114                 %                 Coord_tps=cat(1,Coord_tps,fill);
    115109            end
    116110            for ivar=1:numel(ListVarInterp)
     
    132126            DataOut.(['SubRange' term])=SubRange;
    133127            DataOut.(['NbCentre' term])=NbCentre;
    134             %             DataOut.(['Coord_tps' term])=Coord_tps;
    135128            for ilist=1:numel(VarIndexInterp)
    136                 %                 Var_tps=zeros(size(IndSelSubDomain)+[NbCoord+1 0]);%default spline
    137129                for isub=1:size(SubRange,3)
    138130                    ind_sel=IndSelSubDomain(1:NbCentre(isub),isub);% array indices selected for the subdomain
Note: See TracChangeset for help on using the changeset viewer.