[598] | 1 | %'civ_series': PIV function activated by the general GUI series |
---|
| 2 | % --- call the sub-functions: |
---|
| 3 | % civ: PIV function itself |
---|
[1143] | 4 | % detect_false: put a flag to false vectors after detection by various criteria |
---|
[1169] | 5 | % filter_tps: make interpolation-smoothing |
---|
[597] | 6 | %------------------------------------------------------------------------ |
---|
[855] | 7 | % function [Data,errormsg,result_conv]= civ_series(Param) |
---|
[597] | 8 | % |
---|
| 9 | %OUTPUT |
---|
[598] | 10 | % Data=structure containing the PIV results and information on the processing parameters |
---|
[995] | 11 | % errormsg=error message char string, decd ..fault='' |
---|
[598] | 12 | % resul_conv: image inter-correlation function for the last grid point (used for tests) |
---|
[597] | 13 | % |
---|
| 14 | %INPUT: |
---|
[855] | 15 | % Param: Matlab structure of input parameters |
---|
| 16 | % Param contains info of the GUI series using the fct read_GUI. |
---|
[1169] | 17 | % Param.Action.RUN = 0 (to set the status of the GUI series) or =1 to RUN the computation |
---|
[855] | 18 | % Param.InputTable: sets the input file(s) |
---|
| 19 | % if absent, the fct looks for input data in Param.ActionInput (test mode) |
---|
| 20 | % Param.OutputSubDir: sets the folder name of output file(s, |
---|
| 21 | % if absent no file is produced, result in the output structure Data (test mode) |
---|
[859] | 22 | % Param.ActionInput: substructure with the parameters provided by the GUI civ_input |
---|
[1131] | 23 | % .Civ1: parameters for civ1cc |
---|
[1143] | 24 | % .Fix1: parameters for detect_false1 |
---|
[859] | 25 | % .Patch1: |
---|
[855] | 26 | % .Civ2: for civ2 |
---|
[859] | 27 | % .Fix2: |
---|
[855] | 28 | % .Patch2: |
---|
| 29 | |
---|
[924] | 30 | %======================================================================= |
---|
[1126] | 31 | % Copyright 2008-2024, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France |
---|
[924] | 32 | % http://www.legi.grenoble-inp.fr |
---|
[1127] | 33 | % Joel.Sommeria - Joel.Sommeria (A) univ-grenoble-alpes.fr |
---|
[859] | 34 | % |
---|
[924] | 35 | % This file is part of the toolbox UVMAT. |
---|
| 36 | % |
---|
[598] | 37 | % UVMAT is free software; you can redistribute it and/or modify |
---|
[924] | 38 | % it under the terms of the GNU General Public License as published |
---|
| 39 | % by the Free Software Foundation; either version 2 of the license, |
---|
| 40 | % or (at your option) any later version. |
---|
[859] | 41 | % |
---|
[598] | 42 | % UVMAT is distributed in the hope that it will be useful, |
---|
| 43 | % but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 44 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
[924] | 45 | % GNU General Public License (see LICENSE.txt) for more details. |
---|
| 46 | %======================================================================= |
---|
[597] | 47 | |
---|
[724] | 48 | function [Data,errormsg,result_conv]= civ_series(Param) |
---|
[598] | 49 | errormsg=''; |
---|
[763] | 50 | |
---|
[606] | 51 | %% set the input elements needed on the GUI series when the action is selected in the menu ActionName or InputTable refreshed |
---|
[859] | 52 | if isstruct(Param) && isequal(Param.Action.RUN,0)% function activated from the GUI series but not RUN |
---|
[763] | 53 | path_series=fileparts(which('series')); |
---|
| 54 | addpath(fullfile(path_series,'series')) |
---|
[598] | 55 | Data=civ_input(Param);% introduce the civ parameters using the GUI civ_input |
---|
[1148] | 56 | % TODO: change from guide to App: modify the input procedure, adapt read_GUI function |
---|
| 57 | %App=civ_input_App |
---|
[1089] | 58 | %Data=civ_input_App(Param);% introduce the civ parameters using the GUI civ_input |
---|
[1148] | 59 | % if isempty(App) |
---|
| 60 | % Data=Param;% if civ_input has been cancelled, keep previous parameters |
---|
| 61 | % end |
---|
[606] | 62 | Data.Program=mfilename;%gives the name of the current function |
---|
| 63 | Data.AllowInputSort='off';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default) |
---|
| 64 | Data.WholeIndexRange='off';% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default) |
---|
| 65 | Data.NbSlice='off'; %nbre of slices ('off' by default) |
---|
| 66 | Data.VelType='off';% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) |
---|
[781] | 67 | Data.FieldName='on';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) |
---|
[606] | 68 | Data.FieldTransform = 'off';%can use a transform function |
---|
| 69 | Data.ProjObject='off';%can use projection object(option 'off'/'on', |
---|
| 70 | Data.Mask='off';%can use mask option (option 'off'/'on', 'off' by default) |
---|
| 71 | Data.OutputDirExt='.civ';%set the output dir extension |
---|
[711] | 72 | Data.OutputSubDirMode='last'; %select the last subDir in the input table as root of the output subdir name (option 'all'/'first'/'last', 'all' by default) |
---|
[645] | 73 | Data.OutputFileMode='NbInput_i';% one output file expected per value of i index (used for waitbar) |
---|
[904] | 74 | Data.CheckOverwriteVisible='on'; % manage the overwrite of existing files (default=1) |
---|
[1170] | 75 | if isfield(Data,'ActionInput') && isfield(Data.ActionInput,'PairIndices') && isequal(Data.ActionInput.PairIndices.ListPairMode,'pair j1-j2') |
---|
[1156] | 76 | Data.IndexRange_j='off';%no j index display in series |
---|
| 77 | else |
---|
| 78 | Data.IndexRange_j='on';% j index display in series if relevant |
---|
[993] | 79 | end |
---|
[598] | 80 | return |
---|
[597] | 81 | end |
---|
| 82 | |
---|
| 83 | %% read input parameters from an xml file if input is a file name (batch mode) |
---|
| 84 | checkrun=1; |
---|
| 85 | if ischar(Param) |
---|
| 86 | Param=xml2struct(Param);% read Param as input file (batch case) |
---|
| 87 | checkrun=0; |
---|
| 88 | end |
---|
[855] | 89 | |
---|
| 90 | %% test input |
---|
[668] | 91 | if ~isfield(Param,'ActionInput') |
---|
[859] | 92 | disp_uvmat('ERROR','no parameter set for PIV',checkrun) |
---|
| 93 | return |
---|
[668] | 94 | end |
---|
[1169] | 95 | %iview_A=0;%default values |
---|
[855] | 96 | NbField=1; |
---|
| 97 | RUNHandle=[]; |
---|
[1169] | 98 | % CheckInputFile=isfield(Param,'InputTable');%= 1 in test use for TestCiv (no nc file involved) |
---|
| 99 | % CheckOutputFile=isfield(Param,'OutputSubDir');%= 1 in test use for TestPatch (no nc file produced) |
---|
[597] | 100 | |
---|
[855] | 101 | %% input files and indexing (skipped in Test mode) |
---|
[1169] | 102 | hseries=findobj(allchild(0),'Tag','series'); |
---|
| 103 | RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series |
---|
| 104 | WaitbarHandle=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series |
---|
| 105 | MaxIndex_i=Param.IndexRange.MaxIndex_i; |
---|
| 106 | MinIndex_i=Param.IndexRange.MinIndex_i; |
---|
| 107 | MaxIndex_j=ones(size(MaxIndex_i));MinIndex_j=ones(size(MinIndex_i)); |
---|
| 108 | if isfield(Param.IndexRange,'MaxIndex_j')&& isfield(Param.IndexRange,'MinIndex_j') |
---|
| 109 | MaxIndex_j=Param.IndexRange.MaxIndex_j; |
---|
| 110 | MinIndex_j=Param.IndexRange.MinIndex_j; |
---|
| 111 | end |
---|
| 112 | if isfield(Param,'InputTable') |
---|
| 113 | [filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param); |
---|
| 114 | % iview_A=0;% series index (iview) for the first image series |
---|
| 115 | iview_B=0;% series index (iview) for the second image series (only non zero for option 'shift' comparing two image series ) |
---|
| 116 | if Param.ActionInput.CheckCiv1 |
---|
| 117 | iview_A=1;% usual PIV, the image series is on the first line of the table |
---|
| 118 | else % Civ1 has been already stored in a netcdf file input |
---|
| 119 | iview_A=2;% the second line is used for the input images |
---|
[609] | 120 | end |
---|
[1169] | 121 | % if iview_A~=0 |
---|
| 122 | RootPath_A=Param.InputTable{iview_A,1}; |
---|
| 123 | RootFile_A=Param.InputTable{iview_A,3}; |
---|
| 124 | SubDir_A=Param.InputTable{iview_A,2}; |
---|
| 125 | NomType_A=Param.InputTable{iview_A,4}; |
---|
| 126 | FileExt_A=Param.InputTable{iview_A,5}; |
---|
| 127 | if iview_B==0 |
---|
| 128 | iview_B=iview_A;% the second image series is the same as the first |
---|
| 129 | end |
---|
| 130 | RootPath_B=Param.InputTable{iview_B,1}; |
---|
| 131 | RootFile_B=Param.InputTable{iview_B,3}; |
---|
| 132 | SubDir_B=Param.InputTable{iview_B,2}; |
---|
| 133 | NomType_B=Param.InputTable{iview_B,4}; |
---|
| 134 | FileExt_B=Param.InputTable{iview_B,5}; |
---|
| 135 | PairCiv2=''; |
---|
| 136 | |
---|
| 137 | switch Param.ActionInput.ListCompareMode |
---|
| 138 | case 'PIV' |
---|
| 139 | PairCiv1=Param.ActionInput.PairIndices.ListPairCiv1; |
---|
| 140 | if isfield(Param.ActionInput.PairIndices,'ListPairCiv2') |
---|
| 141 | PairCiv2=Param.ActionInput.PairIndices.ListPairCiv2;%string which determines the civ2 pair |
---|
[758] | 142 | end |
---|
[1169] | 143 | if iview_A==1% if Civ1 is performed |
---|
| 144 | [i1_series_Civ1,i2_series_Civ1,j1_series_Civ1,j2_series_Civ1,check_bounds,NomTypeNc]=... |
---|
| 145 | find_pair_indices(PairCiv1,i1_series{1},j1_series{1},MinIndex_i,MaxIndex_i,MinIndex_j,MaxIndex_j); |
---|
| 146 | if ~isempty(PairCiv2) |
---|
| 147 | [i1_series_Civ2,i2_series_Civ2,j1_series_Civ2,j2_series_Civ2,check_bounds_Civ2]=... |
---|
| 148 | find_pair_indices(PairCiv2,i1_series{1},j1_series{1},MinIndex_i(1),MaxIndex_i(1),MinIndex_j(1),MaxIndex_j(1)); |
---|
| 149 | check_bounds=check_bounds | check_bounds_Civ2; |
---|
[761] | 150 | end |
---|
[1169] | 151 | else% we start from an existing Civ1 file |
---|
| 152 | i1_series_Civ1=i1_series{1}; |
---|
| 153 | i2_series_Civ1=i2_series{1}; |
---|
| 154 | j1_series_Civ1=j1_series{1}; |
---|
| 155 | j2_series_Civ1=j2_series{1}; |
---|
| 156 | NomTypeNc=Param.InputTable{1,4}; |
---|
| 157 | if ~isempty(PairCiv2) |
---|
| 158 | [i1_series_Civ2,i2_series_Civ2,j1_series_Civ2,j2_series_Civ2,check_bounds,NomTypeNc]=... |
---|
| 159 | find_pair_indices(PairCiv2,i1_series{2},j1_series{2},MinIndex_i(2),MaxIndex_i(2),MinIndex_j(2),MaxIndex_j(2)); |
---|
[761] | 160 | end |
---|
[1169] | 161 | end |
---|
| 162 | case 'displacement' |
---|
| 163 | if isfield(Param.ActionInput,'OriginIndex') |
---|
[855] | 164 | i1_series_Civ1=Param.ActionInput.OriginIndex*ones(size(i1_series{1})); |
---|
[1169] | 165 | else |
---|
| 166 | i1_series_Civ1=ones(size(i1_series{1})); |
---|
[1020] | 167 | end |
---|
[1169] | 168 | i1_series_Civ2=i1_series_Civ1; |
---|
| 169 | i2_series_Civ1=i1_series{1}; |
---|
| 170 | i2_series_Civ2=i1_series{1}; |
---|
| 171 | j1_series_Civ1=[];% no j index variation for the ref image |
---|
| 172 | j1_series_Civ2=[]; |
---|
| 173 | if isempty(j1_series{1}) |
---|
| 174 | j2_series_Civ1=ones(size(i1_series_Civ1)); |
---|
[855] | 175 | else |
---|
[1169] | 176 | j2_series_Civ1=j1_series{1};% if j index exist |
---|
[855] | 177 | end |
---|
[1169] | 178 | j2_series_Civ2=j2_series_Civ1; |
---|
| 179 | NomTypeNc='_1'; |
---|
| 180 | end |
---|
| 181 | %determine frame indices for input with movie or other multiframe input file |
---|
| 182 | if isempty(j1_series_Civ1)% simple movie with index i |
---|
| 183 | FrameIndex_A_Civ1=i1_series_Civ1; |
---|
| 184 | FrameIndex_B_Civ1=i2_series_Civ1; |
---|
| 185 | j1_series_Civ1=ones(size(i1_series_Civ1)); |
---|
| 186 | if strcmp(Param.ActionInput.ListCompareMode,'PIV') |
---|
| 187 | j2_series_Civ1=ones(size(i1_series_Civ1)); |
---|
[758] | 188 | end |
---|
[1169] | 189 | else % movie for each burst or volume (index j) |
---|
| 190 | FrameIndex_A_Civ1=j1_series_Civ1; |
---|
| 191 | FrameIndex_B_Civ1=j2_series_Civ1; |
---|
[855] | 192 | end |
---|
[1169] | 193 | if isempty(PairCiv2) |
---|
| 194 | FrameIndex_A_Civ2=FrameIndex_A_Civ1; |
---|
| 195 | FrameIndex_B_Civ2=FrameIndex_B_Civ1; |
---|
| 196 | else |
---|
| 197 | if isempty(j1_series_Civ2) |
---|
| 198 | FrameIndex_A_Civ2=i1_series_Civ2; |
---|
| 199 | FrameIndex_B_Civ2=i2_series_Civ2; |
---|
| 200 | j1_series_Civ2=ones(size(i1_series_Civ2)); |
---|
| 201 | if strcmp(Param.ActionInput.ListCompareMode,'PIV') |
---|
| 202 | j2_series_Civ2=ones(size(i1_series_Civ2)); |
---|
| 203 | end |
---|
[819] | 204 | else |
---|
[1169] | 205 | FrameIndex_A_Civ2=j1_series_Civ2; |
---|
| 206 | FrameIndex_B_Civ2=j2_series_Civ2; |
---|
[781] | 207 | end |
---|
[758] | 208 | end |
---|
[1169] | 209 | if isempty(i1_series_Civ1)||(~isempty(PairCiv2) && isempty(i1_series_Civ2)) |
---|
| 210 | disp_uvmat('ERROR','no image pair for civ in the input file index range',checkrun) |
---|
| 211 | return |
---|
| 212 | end |
---|
[758] | 213 | end |
---|
| 214 | |
---|
[1169] | 215 | %% check the first image pair |
---|
| 216 | if Param.ActionInput.CheckCiv1% Civ1 is performed |
---|
| 217 | NbField=numel(i1_series_Civ1); |
---|
| 218 | elseif Param.ActionInput.CheckCiv2 % Civ2 is performed without Civ1 |
---|
| 219 | NbField=numel(i1_series_Civ2); |
---|
| 220 | else |
---|
| 221 | NbField=numel(i1_series_Civ1);% no image used (only detect_false or patch) TO CHECK |
---|
| 222 | end |
---|
| 223 | |
---|
[855] | 224 | %% prepare output Data |
---|
[1169] | 225 | OutputDir=[Param.OutputSubDir Param.OutputDirExt]; |
---|
[886] | 226 | ListGlobalAttribute={'Conventions','Program','CivStage'}; |
---|
[605] | 227 | Data.Conventions='uvmat/civdata';% states the conventions used for the description of field variables and attributes |
---|
| 228 | Data.Program='civ_series'; |
---|
[1154] | 229 | if isfield(Param,'UvmatRevision') |
---|
| 230 | Data.Program=[Data.Program ', uvmat r' Param.UvmatRevision]; |
---|
| 231 | end |
---|
[605] | 232 | Data.CivStage=0;%default |
---|
| 233 | |
---|
[606] | 234 | %% get timing from the ImaDoc file or input video |
---|
[1169] | 235 | % if iview_A~=0 |
---|
| 236 | XmlFileName=find_imadoc(RootPath_A,SubDir_A); |
---|
| 237 | Time=[]; |
---|
| 238 | if ~isempty(XmlFileName) |
---|
| 239 | XmlData=imadoc2struct(XmlFileName);%read the time from XmlFileName |
---|
| 240 | if isfield(XmlData,'Time') |
---|
| 241 | Time=XmlData.Time; |
---|
| 242 | end |
---|
| 243 | if isfield(XmlData,'Camera') |
---|
| 244 | if isfield(XmlData.Camera,'NbSlice')&& ~isempty(XmlData.Camera.NbSlice) |
---|
| 245 | NbSlice_calib{iview}=XmlData.Camera.NbSlice;% Nbre of slices for Zindex in phys transform |
---|
| 246 | if ~isequal(NbSlice_calib{iview},NbSlice_calib{1}) |
---|
| 247 | msgbox_uvmat('WARNING','inconsistent number of Z indices for the two field series'); |
---|
[609] | 248 | end |
---|
| 249 | end |
---|
[1169] | 250 | if isfield(XmlData.Camera,'TimeUnit')&& ~isempty(XmlData.Camera.TimeUnit) |
---|
| 251 | TimeUnit=XmlData.Camera.TimeUnit; |
---|
| 252 | end |
---|
[833] | 253 | end |
---|
[610] | 254 | end |
---|
[1169] | 255 | % end |
---|
[609] | 256 | |
---|
[598] | 257 | %%%%% MAIN LOOP %%%%%% |
---|
[1010] | 258 | maskoldname='';% initiate the mask name |
---|
[997] | 259 | FileType_A=''; |
---|
| 260 | FileType_B=''; |
---|
[904] | 261 | CheckOverwrite=1;%default |
---|
| 262 | if isfield(Param,'CheckOverwrite') |
---|
| 263 | CheckOverwrite=Param.CheckOverwrite; |
---|
| 264 | end |
---|
[598] | 265 | for ifield=1:NbField |
---|
[1131] | 266 | tstart=tic; |
---|
| 267 | time_civ1=0; |
---|
[1164] | 268 | time_patch1=0; |
---|
| 269 | time_civ2=0; |
---|
| 270 | time_patch2=0; |
---|
[855] | 271 | if ~isempty(RUNHandle)% update the waitbar in interactive mode with GUI series (checkrun=1) |
---|
| 272 | update_waitbar(WaitbarHandle,ifield/NbField) |
---|
[905] | 273 | if checkrun && ~strcmp(get(RUNHandle,'BusyAction'),'queue') |
---|
[855] | 274 | disp('program stopped by user') |
---|
| 275 | break |
---|
| 276 | end |
---|
[624] | 277 | end |
---|
[1169] | 278 | % % if CheckInputFile |
---|
| 279 | % if CheckOutputFile |
---|
| 280 | OutputPath=fullfile(Param.OutputPath,Param.Experiment,Param.Device); |
---|
| 281 | % if iview_A==0 % no nc file has been entered |
---|
| 282 | % ncfile=fullfile_uvmat(OutputPath,Param.InputTable{1,2},Param.InputTable{1,3},Param.InputTable{1,5},... |
---|
| 283 | % NomTypeNc,i1_series_Civ1(ifield),i2_series_Civ1(ifield),j1_series_Civ1(ifield),j2_series_Civ1(ifield)); |
---|
| 284 | % else% an existing nc file has been entered |
---|
| 285 | % if iview_A==1% if Civ1 is performed |
---|
| 286 | % Civ1Dir=OutputDir; |
---|
| 287 | % else |
---|
| 288 | % Civ1Dir=Param.InputTable{1,2}; |
---|
| 289 | % end |
---|
| 290 | if strcmp(Param.ActionInput.ListCompareMode,'PIV') |
---|
| 291 | ncfile=fullfile_uvmat(OutputPath,OutputDir,RootFile_A,'.nc',NomTypeNc,i1_series_Civ1(ifield),i2_series_Civ1(ifield),... |
---|
| 292 | j1_series_Civ1(ifield),j2_series_Civ1(ifield)); |
---|
| 293 | else |
---|
| 294 | ncfile=fullfile_uvmat(OutputPath,OutputDir,RootFile_A,'.nc',NomTypeNc,i2_series_Civ1(ifield),[],... |
---|
| 295 | j1_series_Civ1(ifield),j2_series_Civ1(ifield)); |
---|
| 296 | end |
---|
| 297 | % end |
---|
| 298 | ncfile_out=ncfile;% by default |
---|
| 299 | |
---|
| 300 | if isfield (Param.ActionInput,'Civ2') |
---|
| 301 | i1_civ2=i1_series_Civ2(ifield); |
---|
| 302 | i2_civ2=i1_civ2; |
---|
| 303 | if ~isempty(i2_series_Civ2) |
---|
| 304 | i2_civ2=i2_series_Civ2(ifield); |
---|
[822] | 305 | end |
---|
[1169] | 306 | j1_civ2=1; |
---|
| 307 | if ~isempty(j1_series_Civ2) |
---|
| 308 | j1_civ2=j1_series_Civ2(ifield); |
---|
[904] | 309 | end |
---|
[1169] | 310 | j2_civ2=i1_civ2; |
---|
| 311 | if ~isempty(j2_series_Civ2) |
---|
| 312 | j2_civ2=j2_series_Civ2(ifield); |
---|
[912] | 313 | end |
---|
[1169] | 314 | if strcmp(Param.ActionInput.ListCompareMode,'PIV') |
---|
| 315 | ncfile_out=fullfile_uvmat(OutputPath,OutputDir,RootFile_A,'.nc',NomTypeNc,i1_civ2,i2_civ2,j1_civ2,j2_civ2); |
---|
| 316 | else % displacement |
---|
| 317 | ncfile_out=fullfile_uvmat(OutputPath,OutputDir,RootFile_A,'.nc',NomTypeNc,i2_civ2,[],j2_civ2); |
---|
| 318 | end |
---|
[761] | 319 | end |
---|
[1169] | 320 | if ~CheckOverwrite && exist(ncfile_out,'file') |
---|
| 321 | disp(['existing output file ' ncfile_out ' already exists, skip to next field']) |
---|
| 322 | continue% skip iteration if the mode overwrite is desactivated and the result file already exists |
---|
| 323 | end |
---|
| 324 | % end |
---|
[1122] | 325 | ImageName_A='';ImageName_B='';%default |
---|
| 326 | VideoObject_A=[];VideoObject_B=[]; |
---|
[1143] | 327 | |
---|
[598] | 328 | %% Civ1 |
---|
[707] | 329 | % if Civ1 computation is requested |
---|
[1164] | 330 | if Param.ActionInput.CheckCiv1 |
---|
[1169] | 331 | disp('civ1 started') |
---|
[1020] | 332 | par_civ1=Param.ActionInput.Civ1;% parameters for civ1 |
---|
[1169] | 333 | %if CheckInputFile % read input images (except in mode Test where it is introduced directly in Param.ActionInput.Civ1.ImageNameA and B) |
---|
| 334 | try |
---|
| 335 | if strcmp(Param.ActionInput.ListCompareMode,'displacement') |
---|
| 336 | ImageName_A=Param.ActionInput.RefFile; |
---|
| 337 | else |
---|
| 338 | ImageName_A=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_series_Civ1(ifield),[],j1_series_Civ1(ifield)); |
---|
| 339 | end |
---|
| 340 | if strcmp(FileExt_A,'.nc')% case of input images in format netcdf |
---|
| 341 | FieldName_A=Param.InputFields.FieldName; |
---|
| 342 | [DataIn,~,~,errormsg]=nc2struct(ImageName_A,{FieldName_A}); |
---|
| 343 | par_civ1.ImageA=DataIn.(FieldName_A); |
---|
| 344 | else % usual image formats for image A |
---|
| 345 | if isempty(FileType_A)% open the image object if not already done in case of movie input |
---|
| 346 | [FileInfo_A,VideoObject_A]=get_file_info(ImageName_A); |
---|
| 347 | FileType_A=FileInfo_A.FileType; |
---|
[1170] | 348 | if isempty(Time) && ~isempty(find(strcmp(FileType_A,{'mmreader','video','cine_phantom','telopsIR'}), 1))% case of video input |
---|
| 349 | Time=zeros(FileInfo_A.NumberOfFrames+1,2); |
---|
[1169] | 350 | Time(:,2)=(0:1/FileInfo_A.FrameRate:(FileInfo_A.NumberOfFrames)/FileInfo_A.FrameRate)'; |
---|
[1170] | 351 | if ~isempty(j1_series_Civ1) && j1_series_Civ1~=1 |
---|
| 352 | Time=Time'; |
---|
| 353 | end |
---|
[997] | 354 | end |
---|
[1169] | 355 | if ~isempty(FileType_A) && isempty(Time)% Time = index i +0.001 index j by default |
---|
| 356 | MaxIndex_i=max(i2_series_Civ1); |
---|
| 357 | MaxIndex_j=max(j2_series_Civ1); |
---|
| 358 | Time=(1:MaxIndex_i)'*ones(1,MaxIndex_j); |
---|
| 359 | Time=Time+0.001*ones(MaxIndex_i,1)*(1:MaxIndex_j); |
---|
| 360 | Time=[zeros(1,MaxIndex_j);Time];% insert a first line of zeros |
---|
| 361 | Time=[zeros(MaxIndex_i+1,1) Time];% insert a first column of zeros |
---|
[997] | 362 | end |
---|
[855] | 363 | end |
---|
[1169] | 364 | if isempty(regexp(ImageName_A,'(^http://)|(^https://)', 'once')) && ~exist(ImageName_A,'file') |
---|
| 365 | disp([ImageName_A ' missing']) |
---|
[1164] | 366 | continue |
---|
| 367 | end |
---|
[1169] | 368 | tsart_input=tic; |
---|
| 369 | [par_civ1.ImageA,VideoObject_A] = read_image(ImageName_A,FileType_A,VideoObject_A,FrameIndex_A_Civ1(ifield)); |
---|
| 370 | time_input=toc(tsart_input); |
---|
[781] | 371 | end |
---|
[1169] | 372 | ImageName_B=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ1(ifield),[],j2_series_Civ1(ifield)); |
---|
| 373 | if isempty(FileType_B)% determine the image type for the first field |
---|
| 374 | [FileInfo_B,VideoObject_B]=get_file_info(ImageName_B); |
---|
| 375 | FileType_B=FileInfo_B.FileType; |
---|
[781] | 376 | end |
---|
[1169] | 377 | if isempty(regexp(ImageName_B,'(^http://)|(^https://)', 'once')) && ~exist(ImageName_B,'file') |
---|
| 378 | disp([ImageName_B ' missing']) |
---|
| 379 | continue |
---|
[758] | 380 | end |
---|
[1169] | 381 | [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B_Civ1(ifield)); |
---|
| 382 | catch ME % display errors in reading input images |
---|
| 383 | if ~isempty(ME.message) |
---|
| 384 | disp_uvmat('ERROR', ['error reading input image: ' ME.message],checkrun) |
---|
| 385 | continue |
---|
[855] | 386 | end |
---|
[1169] | 387 | end |
---|
| 388 | |
---|
| 389 | % par_civ1.ImageWidth=size(par_civ1.ImageA,2); |
---|
| 390 | % par_civ1.ImageHeight=size(par_civ1.ImageA,1); |
---|
| 391 | list_param=(fieldnames(Param.ActionInput.Civ1))'; |
---|
| 392 | list_param(strcmp('TestCiv1',list_param))=[];% remove the parameter TestCiv1 from the list |
---|
| 393 | Civ1_param=regexprep(list_param,'^.+','Civ1_$0');% insert 'Civ1_' before each string in list_param |
---|
| 394 | Civ1_param=[{'Civ1_ImageA','Civ1_ImageB','Civ1_Time','Civ1_Dt'} Civ1_param]; %insert the names of the two input images |
---|
| 395 | %indicate the values of all the global attributes in the output data |
---|
| 396 | Data.Civ1_ImageA=ImageName_A; |
---|
| 397 | Data.Civ1_ImageB=ImageName_B; |
---|
| 398 | i1=i1_series_Civ1(ifield); |
---|
| 399 | i2=i1; |
---|
| 400 | if ~isempty(i2_series_Civ1) |
---|
| 401 | i2=i2_series_Civ1(ifield); |
---|
| 402 | end |
---|
| 403 | j1=1; |
---|
| 404 | if ~isempty(j1_series_Civ1) |
---|
| 405 | j1=j1_series_Civ1(ifield); |
---|
| 406 | end |
---|
| 407 | j2=j1; |
---|
| 408 | if ~isempty(j2_series_Civ1) |
---|
| 409 | j2=j2_series_Civ1(ifield); |
---|
| 410 | end |
---|
| 411 | if strcmp(Param.ActionInput.ListCompareMode,'displacement') |
---|
| 412 | Data.Civ1_Time=Time(i2+1,j2+1);% the Time is the Time of the second image |
---|
| 413 | Data.Civ1_Dt=1;% Time interval is 1, to yield displacement instead of velocity=displacement/Dt at reading |
---|
[1097] | 414 | else |
---|
[1169] | 415 | Data.Civ1_Time=(Time(i2+1,j2+1)+Time(i1+1,j1+1))/2;% the Time is the Time at the middle of the image pair |
---|
| 416 | Data.Civ1_Dt=Time(i2+1,j2+1)-Time(i1+1,j1+1); |
---|
[597] | 417 | end |
---|
[1169] | 418 | for ilist=1:length(list_param) |
---|
| 419 | Data.(Civ1_param{4+ilist})=Param.ActionInput.Civ1.(list_param{ilist}); |
---|
| 420 | end |
---|
| 421 | Data.ListGlobalAttribute=[ListGlobalAttribute Civ1_param]; |
---|
| 422 | Data.CivStage=1; |
---|
| 423 | |
---|
[598] | 424 | % set the list of variables |
---|
[1144] | 425 | Data.ListVarName={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_C','Civ1_FF'};% cell array containing the names of the fields to record |
---|
[598] | 426 | Data.VarDimName={'nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1','nb_vec_1'}; |
---|
| 427 | Data.VarAttribute{1}.Role='coord_x'; |
---|
| 428 | Data.VarAttribute{2}.Role='coord_y'; |
---|
| 429 | Data.VarAttribute{3}.Role='vector_x'; |
---|
| 430 | Data.VarAttribute{4}.Role='vector_y'; |
---|
[1144] | 431 | Data.VarAttribute{5}.Role='ancillary'; |
---|
| 432 | Data.VarAttribute{6}.Role='errorflag'; |
---|
[1164] | 433 | |
---|
[1010] | 434 | % case of mask |
---|
[856] | 435 | if par_civ1.CheckMask&&~isempty(par_civ1.Mask) |
---|
[1163] | 436 | [RootPath_mask,SubDir_mask,RootFile_mask,~,~,~,~,Ext_mask]=fileparts_uvmat(Param.ActionInput.Civ1.Mask); |
---|
| 437 | j1=1; |
---|
| 438 | if ~isempty(j1_series_Civ1) |
---|
| 439 | j1=j1_series_Civ1(ifield); |
---|
| 440 | end |
---|
| 441 | if ~isempty(i2_series_Civ1)% case of volume,masks act on different j levels |
---|
| 442 | maskname=fullfile_uvmat(RootPath_mask,SubDir_mask,RootFile_mask,Ext_mask,'_1',j1); |
---|
| 443 | elseif isfield(par_civ1,'NbSlice') |
---|
[1010] | 444 | i1_mask=mod(i1-1,par_civ1.NbSlice)+1; |
---|
| 445 | maskname=fullfile_uvmat(RootPath_mask,SubDir_mask,RootFile_mask,Ext_mask,'_1',i1_mask); |
---|
[1164] | 446 | if strcmp(Param.ActionInput.PairIndices.ListPairMode,'series(Di)')% case of volume, mask index refers to j index |
---|
| 447 | par_civ1.NbSlice_j=par_civ1.NbSlice; |
---|
| 448 | end |
---|
[1165] | 449 | else |
---|
| 450 | maskname=Param.ActionInput.Civ1.Mask; |
---|
[1010] | 451 | end |
---|
[1165] | 452 | if strcmp(maskoldname,maskname)% mask exist, not already read in civ1 |
---|
| 453 | par_civ1.Mask=mask; %use mask already opened |
---|
| 454 | else |
---|
| 455 | if ~isempty(regexp(maskname,'(^http://)|(^https://)', 'once'))|| exist(maskname,'file') |
---|
| 456 | try |
---|
| 457 | par_civ1.Mask=imread(maskname);%update the mask, an store it for future use |
---|
| 458 | catch ME |
---|
| 459 | if ~isempty(ME.message) |
---|
| 460 | errormsg=['error reading input image: ' ME.message]; |
---|
| 461 | disp_uvmat('ERROR',errormsg,checkrun) |
---|
| 462 | return |
---|
| 463 | end |
---|
[861] | 464 | end |
---|
[1165] | 465 | else |
---|
| 466 | par_civ1.Mask=[]; |
---|
[861] | 467 | end |
---|
[1165] | 468 | mask=par_civ1.Mask; |
---|
| 469 | maskoldname=maskname; |
---|
[856] | 470 | end |
---|
| 471 | end |
---|
[1164] | 472 | |
---|
[1163] | 473 | % case of input grid |
---|
| 474 | if par_civ1.CheckGrid &&~isempty(par_civ1.Grid) |
---|
| 475 | GridData=nc2struct(Param.ActionInput.Civ1.Grid); |
---|
| 476 | par_civ1.Grid=GridData.Grid; |
---|
| 477 | par_civ1.CorrBoxSize=GridData.CorrBox; |
---|
[597] | 478 | end |
---|
[1164] | 479 | |
---|
| 480 | % caluclate velocity data |
---|
[1163] | 481 | [Data.Civ1_X,Data.Civ1_Y,Data.Civ1_U,Data.Civ1_V,Data.Civ1_C,Data.Civ1_FF, result_conv, errormsg] = civ (par_civ1); |
---|
| 482 | if ~isempty(errormsg) |
---|
| 483 | disp_uvmat('ERROR',errormsg,checkrun) |
---|
| 484 | return |
---|
| 485 | end |
---|
[597] | 486 | end |
---|
| 487 | |
---|
[1169] | 488 | |
---|
[598] | 489 | %% Fix1 |
---|
| 490 | if isfield (Param.ActionInput,'Fix1') |
---|
[1143] | 491 | disp('detect_false1 started') |
---|
[822] | 492 | if ~isfield (Param.ActionInput,'Civ1')% if we use existing Civ1, remove previous data beyond Civ1 |
---|
| 493 | Fix1_attr=find(strcmp('Fix1',Data.ListGlobalAttribute)); |
---|
| 494 | Data.ListGlobalAttribute(Fix1_attr)=[]; |
---|
| 495 | for ilist=1:numel(Fix1_attr) |
---|
| 496 | Data=rmfield(Data,Data.ListGlobalAttribute{Fix1_attr(ilist)}); |
---|
| 497 | end |
---|
[859] | 498 | end |
---|
[852] | 499 | list_param=fieldnames(Param.ActionInput.Fix1)'; |
---|
| 500 | Fix1_param=regexprep(list_param,'^.+','Fix1_$0');% insert 'Fix1_' before each string in ListFixParam |
---|
[859] | 501 | %indicate the values of all the global attributes in the output data |
---|
[852] | 502 | for ilist=1:length(list_param) |
---|
| 503 | Data.(Fix1_param{ilist})=Param.ActionInput.Fix1.(list_param{ilist}); |
---|
[598] | 504 | end |
---|
[852] | 505 | Data.ListGlobalAttribute=[Data.ListGlobalAttribute Fix1_param]; |
---|
[1144] | 506 | Data.Civ1_FF=uint8(detect_false(Param.ActionInput.Fix1,Data.Civ1_C,Data.Civ1_U,Data.Civ1_V,Data.Civ1_FF)); |
---|
[859] | 507 | Data.CivStage=2; |
---|
[597] | 508 | end |
---|
[598] | 509 | %% Patch1 |
---|
[1169] | 510 | if Param.ActionInput.CheckPatch1 && isfield (Param.ActionInput,'Patch1') |
---|
[896] | 511 | disp('patch1 started') |
---|
[1169] | 512 | tstart_patch1=tic; |
---|
| 513 | |
---|
[855] | 514 | % record the processing parameters of Patch1 as global attributes in the result nc file |
---|
[852] | 515 | list_param=fieldnames(Param.ActionInput.Patch1)'; |
---|
[855] | 516 | list_param(strcmp('TestPatch1',list_param))=[];% remove 'TestPatch1' from the list of parameters |
---|
| 517 | Patch1_param=regexprep(list_param,'^.+','Patch1_$0');% insert 'Patch1_' before each parameter name |
---|
[852] | 518 | for ilist=1:length(list_param) |
---|
| 519 | Data.(Patch1_param{ilist})=Param.ActionInput.Patch1.(list_param{ilist}); |
---|
| 520 | end |
---|
[855] | 521 | Data.CivStage=3;% record the new state of processing |
---|
[852] | 522 | Data.ListGlobalAttribute=[Data.ListGlobalAttribute Patch1_param]; |
---|
[598] | 523 | |
---|
[855] | 524 | % list the variables to record |
---|
[598] | 525 | nbvar=length(Data.ListVarName); |
---|
| 526 | Data.ListVarName=[Data.ListVarName {'Civ1_U_smooth','Civ1_V_smooth','Civ1_SubRange','Civ1_NbCentres','Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps'}]; |
---|
| 527 | Data.VarDimName=[Data.VarDimName {'nb_vec_1','nb_vec_1',{'nb_coord','nb_bounds','nb_subdomain_1'},'nb_subdomain_1',... |
---|
| 528 | {'nb_tps_1','nb_coord','nb_subdomain_1'},{'nb_tps_1','nb_subdomain_1'},{'nb_tps_1','nb_subdomain_1'}}]; |
---|
| 529 | Data.VarAttribute{nbvar+1}.Role='vector_x'; |
---|
| 530 | Data.VarAttribute{nbvar+2}.Role='vector_y'; |
---|
| 531 | Data.VarAttribute{nbvar+5}.Role='coord_tps'; |
---|
| 532 | Data.VarAttribute{nbvar+6}.Role='vector_x'; |
---|
| 533 | Data.VarAttribute{nbvar+7}.Role='vector_y'; |
---|
[855] | 534 | Data.Civ1_U_smooth=Data.Civ1_U; % zeros(size(Data.Civ1_X)); |
---|
| 535 | Data.Civ1_V_smooth=Data.Civ1_V; %zeros(size(Data.Civ1_X)); |
---|
[598] | 536 | if isfield(Data,'Civ1_FF') |
---|
| 537 | ind_good=find(Data.Civ1_FF==0); |
---|
[597] | 538 | else |
---|
[598] | 539 | ind_good=1:numel(Data.Civ1_X); |
---|
[597] | 540 | end |
---|
[1115] | 541 | if isempty(ind_good) |
---|
[1169] | 542 | disp_uvmat('ERROR','all vectors of civ1 are bad, check input parameters' ,checkrun) |
---|
| 543 | return |
---|
[1115] | 544 | end |
---|
[1169] | 545 | |
---|
[859] | 546 | % perform Patch calculation using the UVMAT fct 'filter_tps' |
---|
[1163] | 547 | [Data.Civ1_SubRange,Data.Civ1_NbCentres,Data.Civ1_Coord_tps,Data.Civ1_U_tps,Data.Civ1_V_tps,~,Ures, Vres,~,FFres]=... |
---|
[598] | 548 | filter_tps([Data.Civ1_X(ind_good) Data.Civ1_Y(ind_good)],Data.Civ1_U(ind_good),Data.Civ1_V(ind_good),[],Data.Patch1_SubDomainSize,Data.Patch1_FieldSmooth,Data.Patch1_MaxDiff); |
---|
[949] | 549 | Data.Civ1_U_smooth(ind_good)=Ures;% take the interpolated (smoothed) velocity values for good vectors, keep civ1 data for the other |
---|
[598] | 550 | Data.Civ1_V_smooth(ind_good)=Vres; |
---|
[1155] | 551 | Data.Civ1_FF(ind_good)=uint8(4*FFres);%set FF to value =4 for vectors eliminated by filter_tps |
---|
[1131] | 552 | time_patch1=toc(tstart_patch1); |
---|
[896] | 553 | disp('patch1 performed') |
---|
[597] | 554 | end |
---|
| 555 | |
---|
[598] | 556 | %% Civ2 |
---|
| 557 | if isfield (Param.ActionInput,'Civ2') |
---|
[896] | 558 | disp('civ2 started') |
---|
[1131] | 559 | tstart_civ2=tic; |
---|
[598] | 560 | par_civ2=Param.ActionInput.Civ2; |
---|
[1169] | 561 | % if CheckInputFile % read input images (except in mode Test where it is introduced directly in Param.ActionInput.Civ1.ImageNameA and B) |
---|
| 562 | par_civ2.ImageA=[]; |
---|
| 563 | par_civ2.ImageB=[]; |
---|
| 564 | if strcmp(Param.ActionInput.ListCompareMode,'displacement') |
---|
| 565 | ImageName_A_Civ2=Param.ActionInput.RefFile; |
---|
| 566 | else |
---|
| 567 | ImageName_A_Civ2=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_civ2,[],j1_civ2); |
---|
[597] | 568 | end |
---|
[1169] | 569 | if strcmp(ImageName_A_Civ2,ImageName_A) && isequal(FrameIndex_A_Civ1(ifield),FrameIndex_A_Civ2(ifield)) |
---|
| 570 | par_civ2.ImageA=par_civ1.ImageA; |
---|
| 571 | else |
---|
| 572 | [par_civ2.ImageA,VideoObject_A] = read_image(ImageName_A_Civ2,FileType_A,VideoObject_A,FrameIndex_A_Civ2(ifield)); |
---|
| 573 | end |
---|
| 574 | ImageName_B_Civ2=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_civ2,[],j2_civ2); |
---|
| 575 | if strcmp(ImageName_B_Civ2,ImageName_B) && isequal(FrameIndex_B_Civ1(ifield),FrameIndex_B_Civ2) |
---|
| 576 | par_civ2.ImageB=par_civ1.ImageB; |
---|
| 577 | else |
---|
| 578 | [par_civ2.ImageB,VideoObject_B] = read_image(ImageName_B_Civ2,FileType_B,VideoObject_B,FrameIndex_B_Civ2(ifield)); |
---|
| 579 | end |
---|
| 580 | % [FileInfo_A,VideoObject_A]=get_file_info(ImageName_A_Civ2); |
---|
| 581 | npy_ima=size(par_civ2.ImageA,1); |
---|
| 582 | npx_ima=size(par_civ2.ImageA,2); |
---|
| 583 | if par_civ2.CheckGrid &&~isempty(par_civ2.Grid) % case of input grid |
---|
| 584 | GridData=nc2struct(Param.ActionInput.Civ2.Grid); |
---|
| 585 | par_civ2.Grid=GridData.Grid; |
---|
| 586 | par_civ2.CorrBoxSize=GridData.CorrBox; |
---|
| 587 | else% automatic grid |
---|
| 588 | nbinterv_x=floor((npx_ima-1)/par_civ2.Dx); |
---|
| 589 | gridlength_x=nbinterv_x*par_civ2.Dx; |
---|
| 590 | minix=ceil((npx_ima-gridlength_x)/2); |
---|
| 591 | nbinterv_y=floor((npy_ima-1)/par_civ2.Dy); |
---|
| 592 | gridlength_y=nbinterv_y*par_civ2.Dy; |
---|
| 593 | miniy=ceil((npy_ima-gridlength_y)/2); |
---|
| 594 | [GridX,GridY]=meshgrid(minix:par_civ2.Dx:npx_ima-1,miniy:par_civ2.Dy:npy_ima-1); |
---|
| 595 | par_civ2.Grid=zeros(numel(GridX),2); |
---|
| 596 | par_civ2.Grid(:,1)=reshape(GridX,[],1); |
---|
| 597 | par_civ2.Grid(:,2)=reshape(GridY,[],1);% increases with array index |
---|
| 598 | end |
---|
| 599 | |
---|
[856] | 600 | % get the guess from patch1 or patch2 (case 'CheckCiv3') |
---|
[1169] | 601 | if iview_A==2 && isfield (par_civ2,'CheckCiv3') && strcmp(par_civ2.CheckCiv3,'iterate(civ3)') %get the guess from patch2% Civ1 data read in a netcdf file |
---|
| 602 | [DataIn,~,~,errormsg]=nc2struct(filecell{1,ifield}); |
---|
| 603 | if ~isempty(errormsg) |
---|
| 604 | disp(errormsg) |
---|
| 605 | return |
---|
| 606 | end |
---|
| 607 | SubRange= DataIn.Civ2_SubRange; |
---|
| 608 | NbCentres=DataIn.Civ2_NbCentres; |
---|
| 609 | Coord_tps=DataIn.Civ2_Coord_tps; |
---|
| 610 | U_tps=DataIn.Civ2_U_tps; |
---|
| 611 | V_tps=DataIn.Civ2_V_tps; |
---|
| 612 | %CivStage=DataIn.CivStage;%store the current CivStage |
---|
| 613 | Civ1_Dt=DataIn.Civ2_Dt; |
---|
[1163] | 614 | Data=[];%reinitialise the result structure Data |
---|
| 615 | Data.ListGlobalAttribute={'Conventions','Program','CivStage'}; |
---|
| 616 | Data.Conventions='uvmat/civdata';% states the conventions used for the description of field variables and attributes |
---|
| 617 | Data.Program='civ_series'; |
---|
[1169] | 618 | % Data.CivStage=CivStage+1;%update the current civStage after reinitialisation of Data |
---|
[859] | 619 | Data.ListVarName={}; |
---|
| 620 | Data.VarDimName={}; |
---|
[1163] | 621 | else % get the guess from patch1 |
---|
| 622 | SubRange= Data.Civ1_SubRange; |
---|
| 623 | NbCentres=Data.Civ1_NbCentres; |
---|
| 624 | Coord_tps=Data.Civ1_Coord_tps; |
---|
| 625 | U_tps=Data.Civ1_U_tps; |
---|
| 626 | V_tps=Data.Civ1_V_tps; |
---|
| 627 | Civ1_Dt=Data.Civ1_Dt; |
---|
[1169] | 628 | % Data.CivStage=4; |
---|
[851] | 629 | end |
---|
[1169] | 630 | Data.CivStage=4; |
---|
| 631 | % SubRange= par_civ2.Civ1_SubRange; |
---|
| 632 | % NbCentres=par_civ2.Civ1_NbCentres; |
---|
| 633 | % Coord_tps=par_civ2.Civ1_Coord_tps; |
---|
| 634 | % U_tps=par_civ2.Civ1_U_tps; |
---|
| 635 | % V_tps=par_civ2.Civ1_V_tps; |
---|
| 636 | % Civ1_Dt=par_civ2.Civ1_Dt; |
---|
| 637 | % Civ2_Dt=par_civ2.Civ1_Dt; |
---|
| 638 | % Data.ListVarName={}; |
---|
| 639 | % Data.VarDimName={}; |
---|
| 640 | % end |
---|
| 641 | Shiftx=zeros(size(par_civ2.Grid,1),1);% initialise the shift expected from civ1 data |
---|
[856] | 642 | Shifty=zeros(size(par_civ2.Grid,1),1); |
---|
| 643 | nbval=zeros(size(par_civ2.Grid,1),1);% nbre of interpolated values at each grid point (from the different patch subdomains) |
---|
[862] | 644 | if par_civ2.CheckDeformation |
---|
| 645 | DUDX=zeros(size(par_civ2.Grid,1),1); |
---|
| 646 | DUDY=zeros(size(par_civ2.Grid,1),1); |
---|
| 647 | DVDX=zeros(size(par_civ2.Grid,1),1); |
---|
| 648 | DVDY=zeros(size(par_civ2.Grid,1),1); |
---|
| 649 | end |
---|
[856] | 650 | NbSubDomain=size(SubRange,3); |
---|
[761] | 651 | for isub=1:NbSubDomain% for each sub-domain of Patch1 |
---|
[851] | 652 | nbvec_sub=NbCentres(isub);% nbre of Civ vectors in the subdomain |
---|
| 653 | ind_sel=find(par_civ2.Grid(:,1)>=SubRange(1,1,isub) & par_civ2.Grid(:,1)<=SubRange(1,2,isub) &... |
---|
[862] | 654 | par_civ2.Grid(:,2)>=SubRange(2,1,isub) & par_civ2.Grid(:,2)<=SubRange(2,2,isub));% grid points in the subdomain |
---|
[859] | 655 | if ~isempty(ind_sel) |
---|
[862] | 656 | epoints = par_civ2.Grid(ind_sel,:);% coordinates of interpolation sites (measurement grids) |
---|
[859] | 657 | ctrs=Coord_tps(1:nbvec_sub,:,isub) ;%(=initial points) ctrs |
---|
[862] | 658 | EM = tps_eval(epoints,ctrs);% thin plate spline (tps) coefficient |
---|
[1163] | 659 | CentreX=(SubRange(1,1,isub)+SubRange(1,2,isub))/2; %x posiion of the subdomain center |
---|
| 660 | CentreY=(SubRange(2,1,isub)+SubRange(2,2,isub))/2; %y posiion of the subdomain center |
---|
| 661 | xwidth=(SubRange(1,2,isub)-SubRange(1,1,isub))/pi; |
---|
| 662 | ywidth=(SubRange(2,2,isub)-SubRange(2,1,isub))/pi; |
---|
| 663 | x_dist=(epoints(:,1)-CentreX)/xwidth; |
---|
| 664 | y_dist=(epoints(:,2)-CentreY)/ywidth; |
---|
| 665 | weight=cos(x_dist).*cos(y_dist);%weighting fct =1 at the rectangle center and 0 at edge |
---|
| 666 | nbval(ind_sel)=nbval(ind_sel)+weight;% records the number of values for each interpolation point (in case of subdomain overlap) |
---|
| 667 | Shiftx(ind_sel)=Shiftx(ind_sel)+weight.*(EM*U_tps(1:nbvec_sub+3,isub));%velocity shift estimated by tps from civ1 |
---|
| 668 | Shifty(ind_sel)=Shifty(ind_sel)+weight.*(EM*V_tps(1:nbvec_sub+3,isub)); |
---|
[859] | 669 | if par_civ2.CheckDeformation |
---|
| 670 | [EMDX,EMDY] = tps_eval_dxy(epoints,ctrs);%2D matrix of distances between extrapolation points epoints and spline centres (=site points) ctrs |
---|
[1163] | 671 | DUDX(ind_sel)=DUDX(ind_sel)+weight.*(EMDX*U_tps(1:nbvec_sub+3,isub)); |
---|
| 672 | DUDY(ind_sel)=DUDY(ind_sel)+weight.*(EMDY*U_tps(1:nbvec_sub+3,isub)); |
---|
| 673 | DVDX(ind_sel)=DVDX(ind_sel)+weight.*(EMDX*V_tps(1:nbvec_sub+3,isub)); |
---|
| 674 | DVDY(ind_sel)=DVDY(ind_sel)+weight.*(EMDY*V_tps(1:nbvec_sub+3,isub)); |
---|
[859] | 675 | end |
---|
[597] | 676 | end |
---|
| 677 | end |
---|
[1163] | 678 | Shiftx(nbval>0)=Shiftx(nbval>0)./nbval(nbval>0); |
---|
| 679 | Shifty(nbval>0)=Shifty(nbval>0)./nbval(nbval>0); |
---|
[1169] | 680 | |
---|
[1163] | 681 | % introduce mask |
---|
| 682 | if par_civ2.CheckMask && ~isempty(par_civ2.Mask) |
---|
| 683 | [RootPath_mask,SubDir_mask,RootFile_mask,~,~,~,~,Ext_mask]=fileparts_uvmat(Param.ActionInput.Civ2.Mask); |
---|
| 684 | if ~isempty(i2_series_Civ2) % we do PIV among indices i, at given indices j (volume scan), mask depends on position j |
---|
| 685 | j1=1; |
---|
| 686 | if ~isempty(j1_series_Civ2) |
---|
| 687 | j1=j1_series_Civ1(ifield); |
---|
| 688 | end |
---|
| 689 | maskname=fullfile_uvmat(RootPath_mask,SubDir_mask,RootFile_mask,Ext_mask,'_1',j1); |
---|
| 690 | elseif isfield(par_civ2,'NbSlice') |
---|
| 691 | i1=i1_series_Civ2(ifield); |
---|
[1010] | 692 | i1_mask=mod(i1-1,par_civ2.NbSlice)+1; |
---|
| 693 | maskname=fullfile_uvmat(RootPath_mask,SubDir_mask,RootFile_mask,Ext_mask,'_1',i1_mask); |
---|
[1164] | 694 | if strcmp(Param.ActionInput.PairIndices.ListPairMode,'series(Di)')% case of volume, mask index refers to j index |
---|
| 695 | par_civ2.NbSlice_j=par_civ2.NbSlice; |
---|
| 696 | end |
---|
[1010] | 697 | else |
---|
| 698 | maskname=Param.ActionInput.Civ2.Mask; |
---|
| 699 | end |
---|
| 700 | if strcmp(maskoldname,maskname)% mask exist, not already read in civ1 |
---|
[856] | 701 | par_civ2.Mask=mask; %use mask already opened |
---|
| 702 | else |
---|
[1062] | 703 | if exist(maskname,'file') |
---|
[1163] | 704 | try |
---|
| 705 | par_civ2.Mask=imread(maskname);%update the mask, an store it for future use |
---|
| 706 | catch ME |
---|
| 707 | if ~isempty(ME.message) |
---|
| 708 | errormsg=['error reading input image: ' ME.message]; |
---|
| 709 | disp_uvmat('ERROR',errormsg,checkrun) |
---|
| 710 | return |
---|
| 711 | end |
---|
[1010] | 712 | end |
---|
[1062] | 713 | else |
---|
| 714 | par_civ2.Mask=[]; |
---|
| 715 | end |
---|
[856] | 716 | mask=par_civ2.Mask; |
---|
[1010] | 717 | maskoldname=maskname; |
---|
[856] | 718 | end |
---|
[598] | 719 | end |
---|
[1169] | 720 | |
---|
| 721 | |
---|
| 722 | if strcmp(Param.ActionInput.ListCompareMode,'displacement') |
---|
| 723 | Civ1_Dt=1; |
---|
| 724 | Civ2_Dt=1; |
---|
| 725 | else |
---|
| 726 | Civ2_Dt=Time(i2_civ2+1,j2_civ2+1)-Time(i1_civ2+1,j1_civ2+1); |
---|
[856] | 727 | end |
---|
[1163] | 728 | par_civ2.SearchBoxShift=zeros(size(par_civ2.Grid)); |
---|
[1169] | 729 | par_civ2.SearchBoxShift(:,1)=(Civ2_Dt/Civ1_Dt)*Shiftx;%rescale the shift in case of Dt different for Civ1 and Civ2 |
---|
[1163] | 730 | par_civ2.SearchBoxShift(:,2)=(Civ2_Dt/Civ1_Dt)*Shifty; |
---|
[1169] | 731 | |
---|
[598] | 732 | if par_civ2.CheckDeformation |
---|
[1163] | 733 | par_civ2.DUDX(nbval>0)=DUDX(nbval>0)./nbval(nbval>0); |
---|
| 734 | par_civ2.DUDY(nbval>0)=DUDY(nbval>0)./nbval(nbval>0); |
---|
| 735 | par_civ2.DVDX(nbval>0)=DVDX(nbval>0)./nbval(nbval>0); |
---|
| 736 | par_civ2.DVDY(nbval>0)=DVDY(nbval>0)./nbval(nbval>0); |
---|
[598] | 737 | end |
---|
[1169] | 738 | |
---|
[862] | 739 | % calculate velocity data (y and v in image indices, reverse to y component) |
---|
[1169] | 740 | |
---|
[1163] | 741 | [Data.Civ2_X,Data.Civ2_Y,Data.Civ2_U,Data.Civ2_V,Data.Civ2_C,Data.Civ2_FF,~, errormsg] = civ (par_civ2); |
---|
[1169] | 742 | |
---|
[598] | 743 | list_param=(fieldnames(Param.ActionInput.Civ2))'; |
---|
[859] | 744 | list_param(strcmp('TestCiv2',list_param))=[];% remove the parameter TestCiv2 from the list |
---|
[606] | 745 | Civ2_param=regexprep(list_param,'^.+','Civ2_$0');% insert 'Civ2_' before each string in list_param |
---|
| 746 | Civ2_param=[{'Civ2_ImageA','Civ2_ImageB','Civ2_Time','Civ2_Dt'} Civ2_param]; %insert the names of the two input images |
---|
[856] | 747 | %indicate the values of all the global attributes in the output data |
---|
| 748 | if exist('ImageName_A','var') |
---|
[859] | 749 | Data.Civ2_ImageA=ImageName_A; |
---|
| 750 | Data.Civ2_ImageB=ImageName_B; |
---|
[997] | 751 | if strcmp(Param.ActionInput.ListCompareMode,'displacement') |
---|
[950] | 752 | Data.Civ2_Time=Time(i2_civ2+1,j2_civ2+1);% the Time is the Time of the secodn image |
---|
| 753 | Data.Civ2_Dt=1;% Time interval is 1, to yield displacement instead of velocity=displacement/Dt at reading |
---|
[997] | 754 | else |
---|
| 755 | Data.Civ2_Time=(Time(i2_civ2+1,j2_civ2+1)+Time(i1_civ2+1,j1_civ2+1))/2; |
---|
| 756 | Data.Civ2_Dt=Civ2_Dt; |
---|
| 757 | end |
---|
[856] | 758 | end |
---|
[598] | 759 | for ilist=1:length(list_param) |
---|
[606] | 760 | Data.(Civ2_param{4+ilist})=Param.ActionInput.Civ2.(list_param{ilist}); |
---|
[598] | 761 | end |
---|
[606] | 762 | Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ2_param]; |
---|
[1169] | 763 | |
---|
[598] | 764 | nbvar=numel(Data.ListVarName); |
---|
[859] | 765 | % define the Civ2 variable (if Civ2 data are not replaced from previous calculation) |
---|
| 766 | if isempty(find(strcmp('Civ2_X',Data.ListVarName),1)) |
---|
[1144] | 767 | Data.ListVarName=[Data.ListVarName {'Civ2_X','Civ2_Y','Civ2_U','Civ2_V','Civ2_C','Civ2_FF'}];% cell array containing the names of the fields to record |
---|
[859] | 768 | Data.VarDimName=[Data.VarDimName {'nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2','nb_vec_2'}]; |
---|
| 769 | Data.VarAttribute{nbvar+1}.Role='coord_x'; |
---|
| 770 | Data.VarAttribute{nbvar+2}.Role='coord_y'; |
---|
| 771 | Data.VarAttribute{nbvar+3}.Role='vector_x'; |
---|
| 772 | Data.VarAttribute{nbvar+4}.Role='vector_y'; |
---|
[1144] | 773 | Data.VarAttribute{nbvar+5}.Role='ancillary'; |
---|
| 774 | Data.VarAttribute{nbvar+6}.Role='errorflag'; |
---|
[859] | 775 | end |
---|
[896] | 776 | disp('civ2 performed') |
---|
[1131] | 777 | time_civ2=toc(tstart_civ2); |
---|
[860] | 778 | elseif ~isfield(Data,'ListVarName') % we start there, using existing Civ2 data |
---|
| 779 | if exist('ncfile','var') |
---|
| 780 | CivFile=ncfile; |
---|
[1169] | 781 | [Data,~,~,errormsg]=nc2struct(CivFile);%read civ1 and detect_false1 data in the existing netcdf file |
---|
[860] | 782 | if ~isempty(errormsg) |
---|
| 783 | disp_uvmat('ERROR',errormsg,checkrun) |
---|
| 784 | return |
---|
[997] | 785 | end |
---|
[860] | 786 | end |
---|
[598] | 787 | end |
---|
[1169] | 788 | |
---|
[598] | 789 | %% Fix2 |
---|
[1169] | 790 | if Param.ActionInput.CheckFix2 && isfield (Param.ActionInput,'Fix2')% if Fix2 computation is requested |
---|
[1143] | 791 | disp('detect_false2 started') |
---|
[856] | 792 | list_param=fieldnames(Param.ActionInput.Fix2)'; |
---|
[852] | 793 | Fix2_param=regexprep(list_param,'^.+','Fix2_$0');% insert 'Fix1_' before each string in ListFixParam |
---|
[859] | 794 | %indicate the values of all the global attributes in the output data |
---|
[852] | 795 | for ilist=1:length(list_param) |
---|
| 796 | Data.(Fix2_param{ilist})=Param.ActionInput.Fix2.(list_param{ilist}); |
---|
[598] | 797 | end |
---|
[1163] | 798 | Data.ListGlobalAttribute=[Data.ListGlobalAttribute Fix2_param]; |
---|
[1144] | 799 | Data.Civ2_FF=double(detect_false(Param.ActionInput.Fix2,Data.Civ2_C,Data.Civ2_U,Data.Civ2_V,Data.Civ2_FF)); |
---|
| 800 | Data.CivStage=Data.CivStage+1; |
---|
[598] | 801 | end |
---|
| 802 | |
---|
| 803 | %% Patch2 |
---|
[1169] | 804 | if Param.ActionInput.CheckPatch2 && isfield (Param.ActionInput,'Patch2')% if Patch2 computation is requested |
---|
| 805 | |
---|
[896] | 806 | disp('patch2 started') |
---|
[1131] | 807 | tstart_patch2=tic; |
---|
[859] | 808 | list_param=fieldnames(Param.ActionInput.Patch2)'; |
---|
| 809 | list_param(strcmp('TestPatch2',list_param))=[];% remove the parameter TestCiv1 from the list |
---|
[852] | 810 | Patch2_param=regexprep(list_param,'^.+','Patch2_$0');% insert 'Fix1_' before each string in ListFixParam |
---|
[859] | 811 | %indicate the values of all the global attributes in the output data |
---|
[852] | 812 | for ilist=1:length(list_param) |
---|
| 813 | Data.(Patch2_param{ilist})=Param.ActionInput.Patch2.(list_param{ilist}); |
---|
| 814 | end |
---|
| 815 | Data.ListGlobalAttribute=[Data.ListGlobalAttribute Patch2_param]; |
---|
| 816 | |
---|
[598] | 817 | nbvar=length(Data.ListVarName); |
---|
| 818 | Data.ListVarName=[Data.ListVarName {'Civ2_U_smooth','Civ2_V_smooth','Civ2_SubRange','Civ2_NbCentres','Civ2_Coord_tps','Civ2_U_tps','Civ2_V_tps'}]; |
---|
| 819 | Data.VarDimName=[Data.VarDimName {'nb_vec_2','nb_vec_2',{'nb_coord','nb_bounds','nb_subdomain_2'},{'nb_subdomain_2'},... |
---|
| 820 | {'nb_tps_2','nb_coord','nb_subdomain_2'},{'nb_tps_2','nb_subdomain_2'},{'nb_tps_2','nb_subdomain_2'}}]; |
---|
| 821 | |
---|
| 822 | Data.VarAttribute{nbvar+1}.Role='vector_x'; |
---|
| 823 | Data.VarAttribute{nbvar+2}.Role='vector_y'; |
---|
| 824 | Data.VarAttribute{nbvar+5}.Role='coord_tps'; |
---|
| 825 | Data.VarAttribute{nbvar+6}.Role='vector_x'; |
---|
| 826 | Data.VarAttribute{nbvar+7}.Role='vector_y'; |
---|
[997] | 827 | Data.Civ2_U_smooth=Data.Civ2_U; |
---|
| 828 | Data.Civ2_V_smooth=Data.Civ2_V; |
---|
[598] | 829 | if isfield(Data,'Civ2_FF') |
---|
| 830 | ind_good=find(Data.Civ2_FF==0); |
---|
[597] | 831 | else |
---|
[598] | 832 | ind_good=1:numel(Data.Civ2_X); |
---|
[597] | 833 | end |
---|
[1169] | 834 | if isempty(ind_good) |
---|
| 835 | disp_uvmat('ERROR','all vectors of civ2 are bad, check input parameters' ,checkrun) |
---|
| 836 | return |
---|
| 837 | end |
---|
| 838 | |
---|
[949] | 839 | [Data.Civ2_SubRange,Data.Civ2_NbCentres,Data.Civ2_Coord_tps,Data.Civ2_U_tps,Data.Civ2_V_tps,tild,Ures,Vres,tild,FFres]=... |
---|
[598] | 840 | filter_tps([Data.Civ2_X(ind_good) Data.Civ2_Y(ind_good)],Data.Civ2_U(ind_good),Data.Civ2_V(ind_good),[],Data.Patch2_SubDomainSize,Data.Patch2_FieldSmooth,Data.Patch2_MaxDiff); |
---|
| 841 | Data.Civ2_U_smooth(ind_good)=Ures; |
---|
| 842 | Data.Civ2_V_smooth(ind_good)=Vres; |
---|
[1154] | 843 | Data.Civ2_FF(ind_good)=uint8(4*FFres); |
---|
[598] | 844 | Data.CivStage=Data.CivStage+1; |
---|
[1131] | 845 | time_patch2=toc(tstart_patch2); |
---|
[896] | 846 | disp('patch2 performed') |
---|
[597] | 847 | end |
---|
[598] | 848 | |
---|
[1169] | 849 | %% write result in a netcdf file |
---|
| 850 | errormsg=struct2nc(ncfile_out,Data); |
---|
| 851 | if isempty(errormsg) |
---|
| 852 | disp([ncfile_out ' written']) |
---|
| 853 | else |
---|
| 854 | disp(errormsg) |
---|
[598] | 855 | end |
---|
[1169] | 856 | time_total=toc(tstart); |
---|
| 857 | disp(['ellapsed time ' num2str(time_total/60,2) ' minutes']) |
---|
| 858 | disp(['time civ1 ' num2str(time_civ1,2) ' s']) |
---|
| 859 | disp(['time patch1 ' num2str(time_patch1,2) ' s']) |
---|
| 860 | disp(['time civ2 ' num2str(time_civ2,2) ' s']) |
---|
| 861 | disp(['time patch2 ' num2str(time_patch2,2) ' s']) |
---|
| 862 | if exist('time_input','var') |
---|
| 863 | disp(['time image reading ' num2str(time_input,2) ' s']) |
---|
| 864 | disp(['time other ' num2str((time_total-time_input-time_civ1-time_patch1-time_civ2-time_patch2),2) ' s']) |
---|
| 865 | end |
---|
[597] | 866 | end |
---|
| 867 | |
---|
[1169] | 868 | |
---|
| 869 | |
---|
[598] | 870 | %------------------------------------------------------------------------ |
---|
| 871 | % --- determine the list of index pairs of processing file |
---|
| 872 | function [i1_series,i2_series,j1_series,j2_series,check_bounds,NomTypeNc]=... |
---|
[635] | 873 | find_pair_indices(str_civ,i_series,j_series,MinIndex_i,MaxIndex_i,MinIndex_j,MaxIndex_j) |
---|
[598] | 874 | %------------------------------------------------------------------------ |
---|
[610] | 875 | i1_series=i_series;% set of first image indexes |
---|
[598] | 876 | i2_series=i_series; |
---|
[819] | 877 | j1_series=j_series;%ones(size(i_series));% set of first image numbers |
---|
| 878 | j2_series=j_series;%ones(size(i_series)); |
---|
[610] | 879 | r=regexp(str_civ,'^\D(?<ind>[i|j])=( -| )(?<num1>\d+)\|(?<num2>\d+)','names'); |
---|
[598] | 880 | if ~isempty(r) |
---|
| 881 | mode=['D' r.ind]; |
---|
| 882 | ind1=str2num(r.num1); |
---|
| 883 | ind2=str2num(r.num2); |
---|
| 884 | else |
---|
[668] | 885 | mode='j1-j2'; |
---|
[598] | 886 | r=regexp(str_civ,'^j= (?<num1>[a-z])-(?<num2>[a-z])','names'); |
---|
| 887 | if ~isempty(r) |
---|
| 888 | NomTypeNc='_1ab'; |
---|
| 889 | else |
---|
| 890 | r=regexp(str_civ,'^j= (?<num1>[A-Z])-(?<num2>[A-Z])','names'); |
---|
| 891 | if ~isempty(r) |
---|
| 892 | NomTypeNc='_1AB'; |
---|
[597] | 893 | else |
---|
[598] | 894 | r=regexp(str_civ,'^j= (?<num1>\d+)-(?<num2>\d+)','names'); |
---|
| 895 | if ~isempty(r) |
---|
| 896 | NomTypeNc='_1_1-2'; |
---|
[859] | 897 | end |
---|
[597] | 898 | end |
---|
| 899 | end |
---|
[598] | 900 | if isempty(r) |
---|
| 901 | display('wrong pair mode input option') |
---|
| 902 | else |
---|
[859] | 903 | ind1=stra2num(r.num1); |
---|
| 904 | ind2=stra2num(r.num2); |
---|
[598] | 905 | end |
---|
[597] | 906 | end |
---|
[819] | 907 | switch mode |
---|
| 908 | case 'Di' |
---|
| 909 | i1_series=i_series-ind1;% set of first image numbers |
---|
| 910 | i2_series=i_series+ind2; |
---|
| 911 | check_bounds=i1_series<MinIndex_i | i2_series>MaxIndex_i; |
---|
| 912 | if isempty(j_series) |
---|
| 913 | NomTypeNc='_1-2'; |
---|
| 914 | else |
---|
| 915 | j1_series=j_series; |
---|
| 916 | j2_series=j_series; |
---|
| 917 | NomTypeNc='_1-2_1'; |
---|
| 918 | end |
---|
| 919 | case 'Dj' |
---|
| 920 | j1_series=j_series-ind1; |
---|
| 921 | j2_series=j_series+ind2; |
---|
| 922 | check_bounds=j1_series<MinIndex_j | j2_series>MaxIndex_j; |
---|
| 923 | NomTypeNc='_1_1-2'; |
---|
| 924 | otherwise %bursts |
---|
| 925 | i1_series=i_series(1,:);% do not sweep the j index |
---|
| 926 | i2_series=i_series(1,:); |
---|
| 927 | j1_series=ind1*ones(1,size(i_series,2));% j index is fixed by pair choice |
---|
| 928 | j2_series=ind2*ones(1,size(i_series,2)); |
---|
| 929 | check_bounds=zeros(size(i1_series));% no limitations due to min-max indices |
---|
[598] | 930 | end |
---|
[597] | 931 | |
---|
[1169] | 932 | %------------------------------------------------------------------------ |
---|
| 933 | % --- set the flag for false vectors |
---|
[1163] | 934 | function FF=detect_false(Param,C,U,V,FFIn) |
---|
| 935 | FF=FFIn;%default, good vectors |
---|
| 936 | % FF=1, for correlation max at edge, not set in this function |
---|
| 937 | % FF=2, for too small correlation |
---|
| 938 | % FF=3, for velocity outside bounds |
---|
| 939 | % FF=4 for exclusion by difference with the smoothed field, set by call to function filter_tps |
---|
[598] | 940 | |
---|
[1163] | 941 | if isfield (Param,'MinCorr') |
---|
| 942 | FF(C<Param.MinCorr & FFIn==0)=2; |
---|
| 943 | end |
---|
| 944 | if (isfield(Param,'MinVel')&&~isempty(Param.MinVel))||(isfield (Param,'MaxVel')&&~isempty(Param.MaxVel)) |
---|
| 945 | Umod= U.*U+V.*V; |
---|
| 946 | if isfield (Param,'MinVel')&&~isempty(Param.MinVel) |
---|
| 947 | U2Min=Param.MinVel*Param.MinVel; |
---|
| 948 | FF(Umod<U2Min & FFIn==0)=3; |
---|
| 949 | end |
---|
| 950 | if isfield (Param,'MaxVel')&&~isempty(Param.MaxVel) |
---|
| 951 | U2Max=Param.MaxVel*Param.MaxVel; |
---|
| 952 | FF(Umod>U2Max & FFIn==0)=3; |
---|
| 953 | end |
---|
| 954 | end |
---|
[598] | 955 | |
---|
| 956 | |
---|
[1163] | 957 | |
---|