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