Changeset 606 for trunk/src/series/civ_series.m
- Timestamp:
- Apr 7, 2013, 10:14:45 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/civ_series.m
r605 r606 42 42 path_series=fileparts(which('series')); 43 43 addpath(fullfile(path_series,'series')) 44 %% set the input elements needed on the GUI series when the action is selected in the menu ActionName 44 %% set the input elements needed on the GUI series when the action is selected in the menu ActionName or InputTable refreshed 45 45 if isstruct(Param) && isequal(Param.Action.RUN,0) 46 46 Data=civ_input(Param);% introduce the civ parameters using the GUI civ_input 47 Data.Program=mfilename; 48 Data.AllowInputSort='off';...% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default) 49 Data.WholeIndexRange='off';...% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default) 50 Data.NbSlice='off'; ...%nbre of slices ('off' by default) 51 Data.VelType='off';...% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 52 Data.FieldName='off';...% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 53 Data.FieldTransform = 'off';...%can use a transform function 54 Data.ProjObject='off';...%can use projection object(option 'off'/'on', 55 Data.Mask='off';...%can use mask option (option 'off'/'on', 'off' by default) 56 Data.OutputDirExt='.civ';%set the output dir extension 57 47 Data.Program=mfilename;%gives the name of the current function 48 Data.AllowInputSort='off';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default) 49 Data.WholeIndexRange='off';% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default) 50 Data.NbSlice='off'; %nbre of slices ('off' by default) 51 Data.VelType='off';% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 52 Data.FieldName='off';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 53 Data.FieldTransform = 'off';%can use a transform function 54 Data.ProjObject='off';%can use projection object(option 'off'/'on', 55 Data.Mask='off';%can use mask option (option 'off'/'on', 'off' by default) 56 Data.OutputDirExt='.civ';%set the output dir extension 57 filecell=get_file_series(Param);%check existence of the first input file 58 if ~exist(filecell{1,1},'file') 59 msgbox_uvmat('WARNING','the first input file does not exist') 60 end 58 61 return 59 62 end … … 115 118 116 119 NbField=numel(i1_series_Civ1); 117 ImageTypeOptions={'image','multimage','mmreader','video'};118 120 [FileType_A,FileInfo,MovieObject_A]=get_file_type(filecell{1,1}); 119 121 FileType_B=FileType_A; … … 121 123 if size(filecell,1)>=2 && ~strcmp(filecell{1,1},filecell{2,1}) 122 124 [FileType_B,FileInfo,MovieObject_B]=get_file_type(filecell{2,1}); 123 CheckImage_B=~isempty(find(strcmp(FileType,ImageTypeOptions)));% =1 for images124 125 end 125 126 end … … 141 142 check_patch1=0;%default 142 143 143 144 145 146 144 %% get timing from the ImaDoc file or input video 145 [XmlData,NbSlice_calib,time,errormsg]=read_multimadoc(RootPath,SubDir,RootFile,FileExt,i1_series,i2_series,j1_series,j2_series); 146 %TODO: get time_A and time_B 147 % case of movies TODO TODO TODO 148 if isempty(time) && (strcmp(FileType,'video') || strcmp(FileType,'mmreader')) 149 set(handles.ListPairMode,'Value',1); 150 dt=1/get(MovieObject,'FrameRate');%time interval between successive frames 151 if strcmp(NomTypeIma,'*') 152 set(handles.ListPairMode,'String',{'series(Di)'}) 153 MaxIndex_i=get(MovieObject,'NumberOfFrames'); 154 time=(dt*(0:MaxIndex_i-1))';%list of image times 155 else 156 set(handles.ListPairMode,'String',[{'series(Dj)'};{'series(Di)'}]) 157 MaxIndex_i=max(i1_series(i1_series>0)); 158 MaxIndex_j=get(MovieObject,'NumberOfFrames'); 159 time=ones(MaxIndex_i,1)*(dt*(0:MaxIndex_j-1));%list of image times 160 enable_j(handles,'on') 161 end 162 TimeUnit='s'; 147 163 %%%%% MAIN LOOP %%%%%% 148 164 … … 164 180 end 165 181 else 166 % if ~isfield(Param.Civ1,'ImageA')167 182 ImageName_A=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i1_series_Civ1(ifield),[],j1_series_Civ1(ifield)); 168 183 [par_civ1.ImageA,MovieObject_A] = read_image(ImageName_A,FileType_A,MovieObject_A,FrameIndex_A_Civ1(ifield)); 169 % elseif ischar(Param.Civ1.ImageA)170 % Param.Civ1.ImageA=regexprep(Param.Civ1.ImageA,'''','\');171 % [par_civ1.ImageA,VideoObject] = read_image(Param.Civ1.ImageA,par_civ1.FileTypeA,MovieObject_A,par_civ1.FrameIndexA);172 % end173 % if ~isfield(Param.Civ1,'ImageB')174 184 ImageName_B=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i2_series_Civ1(ifield),[],j2_series_Civ1(ifield)); 175 185 [par_civ1.ImageB,MovieObject_B] = read_image(ImageName_B,FileType_B,MovieObject_B,FrameIndex_B_Civ1(ifield)); 176 % elseif isfield(Param.Civ1,'ImageB')&& ischar(Param.Civ1.ImageB)177 % Param.Civ1.ImageB=regexprep(Param.Civ1.ImageB,'''','\');178 % if strcmp(Param.Civ1.ImageA,Param.Civ1.ImageB)% use the same movie object179 % [par_civ1.ImageB,VideoObject] = read_image(Param.Civ1.ImageB,par_civ1.FileTypeB,VideoObject,par_civ1.FrameIndexB);180 % else181 % [par_civ1.ImageB,VideoObject] = read_image(Param.Civ1.ImageB,par_civ1.FileTypeB,par_civ1.ImageB,par_civ1.FrameIndexB);182 % end183 % end184 186 end 185 187 ncfile=fullfile_uvmat(RootPath,OutputDir,RootFile,'.nc',NomTypeNc,i1_series_Civ1(ifield),i2_series_Civ1(ifield),... … … 188 190 par_civ1.ImageHeight=FileInfo.Height; 189 191 list_param=(fieldnames(Param.ActionInput.Civ1))'; 190 Civ1_param=list_param;%default 191 192 %set the values of all the global attributes in list_param 192 Civ1_param=regexprep(list_param,'^.+','Civ1_$0');% insert 'Civ1_' before each string in list_param 193 Civ1_param=[{'Civ1_ImageA','Civ1_ImageB','Civ1_Time','Civ1_Dt'} Civ1_param]; %insert the names of the two input images 194 %indicate the values of all the global attributes in the output data 195 Data.Civ1_ImageA=ImageName_A; 196 Data.Civ1_ImageB=ImageName_B; 197 Data.Civ1_Time=((time(i2_civ1(ifile)+1,j2_civ1(j)+1)+time(i1_civ1(ifile)+1,j1_civ1(j)+1))/2); 198 Data.Civ1_Dt=(time(i2_civ1(ifile)+1,j2_civ1(j)+1)-time(i1_civ1(ifile)+1,j1_civ1(j)+1)); 193 199 for ilist=1:length(list_param) 194 Civ1_param{ilist}=['Civ1_' list_param{ilist}]; 195 Data.(['Civ1_' list_param{ilist}])=Param.ActionInput.Civ1.(list_param{ilist}); 200 Data.(Civ1_param{4+ilist})=Param.ActionInput.Civ1.(list_param{ilist}); 196 201 end 197 202 Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ1_param]; … … 391 396 ibx2=ceil(par_civ2.CorrBoxSize(1)/2); 392 397 iby2=ceil(par_civ2.CorrBoxSize(2)/2); 393 % isx2=ibx2+4;% search ara +-4 pixels around the guess394 % isy2=iby2+4;395 398 par_civ2.SearchBoxSize(1)=2*ibx2+9;% search ara +-4 pixels around the guess 396 399 par_civ2.SearchBoxSize(2)=2*iby2+9; 397 %par_civ2.SearchBoxSize(1)=2*isx2+1;398 %par_civ2.SearchBoxSize(2)=2*isy2+1;399 400 par_civ2.SearchBoxShift=[Shiftx(nbval>=1)./nbval(nbval>=1) Shifty(nbval>=1)./nbval(nbval>=1)]; 400 401 par_civ2.Grid=[GridX(nbval>=1)-par_civ2.SearchBoxShift(:,1)/2 GridY(nbval>=1)-par_civ2.SearchBoxShift(:,2)/2];% grid taken at the extrapolated origin of the displacement vectors … … 409 410 410 411 list_param=(fieldnames(Param.ActionInput.Civ2))'; 411 list_remove={'pxcmx','pxcmy','npx','npy','gridflag','maskflag','term_a','term_b','T0'};412 for ilist=1:length(list_remove)413 index=strcmp(list_remove{ilist},list_param);414 if ~isempty(find(index,1))415 list_param(index)=[];416 end417 end412 Civ2_param=regexprep(list_param,'^.+','Civ2_$0');% insert 'Civ2_' before each string in list_param 413 Civ2_param=[{'Civ2_ImageA','Civ2_ImageB','Civ2_Time','Civ2_Dt'} Civ2_param]; %insert the names of the two input images 414 %indicate the values of all the global attributes in the output data 415 Data.Civ2_ImageA=ImageName_A; 416 Data.Civ2_ImageB=ImageName_B; 417 Data.Civ2_Time=1; 418 Data.Civ2_Dt=1; 418 419 for ilist=1:length(list_param) 419 Civ2_param{ilist}=['Civ2_' list_param{ilist}]; 420 eval(['Data.Civ2_' list_param{ilist} '=Param.ActionInput.Civ2.' list_param{ilist} ';']) 421 end 422 if isfield(Data,'Civ2_gridname') && strcmp(Data.Civ1_gridname(1:6),'noFile') 423 Data.Civ1_gridname=''; 424 end 425 if isfield(Data,'Civ2_maskname') && strcmp(Data.Civ1_maskname(1:6),'noFile') 426 Data.Civ2_maskname=''; 427 end 428 Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ2_param {'Civ2_Time','Civ2_Dt'}]; 420 Data.(Civ2_param{4+ilist})=Param.ActionInput.Civ2.(list_param{ilist}); 421 end 422 Data.ListGlobalAttribute=[Data.ListGlobalAttribute Civ2_param]; 423 429 424 nbvar=numel(Data.ListVarName); 430 425 Data.ListVarName=[Data.ListVarName {'Civ2_X','Civ2_Y','Civ2_U','Civ2_V','Civ2_F','Civ2_C'}];% cell array containing the names of the fields to record
Note: See TracChangeset
for help on using the changeset viewer.