Changeset 781 for trunk/src/series
- Timestamp:
- May 29, 2014, 6:17:00 PM (11 years ago)
- Location:
- trunk/src/series
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/beam_forming.m
r780 r781 4 4 if isstruct(Param) && isequal(Param.Action.RUN,0) 5 5 ParamOut.AllowInputSort='off';% allow alphabetic sorting of the list of input file SubDir (options 'off'/'on', 'off' by default) 6 ParamOut.WholeIndexRange='o ff';% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default)6 ParamOut.WholeIndexRange='on';% prescribes the file index ranges from min to max (options 'off'/'on', 'off' by default) 7 7 ParamOut.NbSlice='off'; %nbre of slices ('off' by default) 8 8 ParamOut.VelType='off';% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) … … 12 12 ParamOut.ProjObject='off';%can use projection object(option 'off'/'on', 13 13 ParamOut.Mask='off';%can use mask option (option 'off'/'on', 'off' by default) 14 ParamOut.OutputDirExt='.p_formed_1';%set the output dir extension 14 index=msgbox_uvmat('INPUT_TXT','index of the series to process (1 to 5)');%choose the i index of the dat files 15 ParamOut.OutputDirExt=['.p_formed_' index];%set the output dir extension 16 hseries=findobj(allchild(0),'Tag','series'); 17 hhseries=guidata(hseries); 18 set(hhseries.num_last_i,'String',index) 19 set(hhseries.num_first_i,'String',index) 15 20 ParamOut.OutputFileMode='NbInput';% '=NbInput': 1 output file per input file index, '=NbInput_i': 1 file per input file index i, '=NbSlice': 1 file per slice 16 21 %check the input files … … 29 34 30 35 ParamOut=[]; %default output 36 %% read input parameters from an xml file if input is a file name (batch mode) 37 checkrun=1; 38 if ischar(Param) 39 Param=xml2struct(Param);% read Param as input file (batch case) 40 checkrun=0; 41 end 31 42 hseries=findobj(allchild(0),'Tag','series'); 32 43 RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series … … 84 95 % close all 85 96 % read_data=1; 86 affichage= 1;97 affichage=0; 87 98 % soustraction=0; 88 89 % test_fin_fichier=1;90 pas_fichier=1;91 numero_tir_fin_old=1;92 99 93 100 %%%%%% Prepare output 94 101 load (fullfile(RootPath,SubDir,[RootFile '.mat'])) 95 Data.ListVarName={'Coord_x','Coord_z','Pressure'}; 96 Data.VarDimName={'Coord_x','Coord_z',{'Coord_z','Coord_x'}}; 97 Data.Coord_x=5*(nbvoie_reception-0.5)/numel(nbvoie_reception); % totql length of e 98 Data.Coord_z=(1:A)/133 ;% to check from input parameter .... 102 Data.ListGlobalAttribute={'CoordUnit'}; %%TODO: add also time, how to get it ????? 103 Data.CoordUnit='pixel'; 104 Data.ListVarName={'AX','AY','A'}; 105 Data.VarDimName={'AX','AY',{'AY','AX'}}; 106 %Data.Coord_x=5*(nbvoie_reception-0.5)/numel(nbvoie_reception); % totql length of e 107 Data.AX=1:65; 108 %Data.Coord_z=(1:A)/133 ;% to check from input parameter .... 109 Data.AY=1:332; 99 110 %%%%%% 100 111 % … … 104 115 %name='test';%%%%%%%%%%%%%%%%% 105 116 % number=2; 106 number=1; %subsequence index (from 1 to 5) 107 OutputDirExt=['.p_formed_' num2str(number)]; %TODO: loop on 'number' from 1 to 5 108 numero_tir_fin_old=1; 109 pas_fichier=20;% nbre of successive shoots to read (to account for computer memory limit) 110 Nmoy=20; %%%%% value 20 FOR TEST : to shift to VALUE 8000 set by the .mat file 117 number=str2num(Param.OutputDirExt(11:end));%extract the subsequence index (from 1 to 5) 118 numero_tir_fin_old=1%%%%%%% =0 ????? 119 pas_fichier=20;% %20;% nbre of successive shots to read (to account for computer memory limit) 120 Nmoy=800; %%%%% value 20 FOR TEST : to shift to VALUE 8000 set by the .mat file 111 121 112 122 test_fin_fichier=1;% test to stop input file reading 113 123 while test_fin_fichier>0 114 124 numero_tir_debut=1; 115 numero_tir_fin=numero_tir_ debut+pas_fichier;125 numero_tir_fin=numero_tir_fin_old+pas_fichier-1; 116 126 117 127 % eval(['load ' directory '\' name '.mat']) … … 123 133 for ii=1:length(nbvoie_reception)%=64 124 134 %eval(['fid=fopen(''E:\ManipLGITLecoeur\' directory '\' name '_' num2str(number) '_' num2str(nbvoie_reception(ii)) '.dat'',''r'');']); 125 filename=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,number,[],ii); 135 filename=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,number,[],ii); % input file name 126 136 fid=fopen(filename); 127 137 toto=zeros(Nsequence*A*numero_tir_fin+31,1);% Nsequence=1 128 toto=fread(fid,numero_tir_fin*A*Nsequence+31,'int16','ieee-le') ; 138 toto=fread(fid,numero_tir_fin*A*Nsequence+31,'int16','ieee-le') ;% why shift by 31 ????? 129 139 toto=double(bitxor(uint16(toto),uint16(2048))); 130 140 toto(1:31)=[];toto(numero_tir_fin*A*Nsequence)=mean(toto); … … 136 146 end 137 147 138 matrice_finale(:,:,numero_tir_debut:numero_tir_fin_old)=[]; 139 numero_tir_fin=numero_tir_fin-1; 140 matrice_finale=reshape(filtfilt(BB,AA,matrice_finale(:,:)),size(matrice_finale)); 148 % matrice_finale(:,:,numero_tir_debut:numero_tir_fin_old)=[];%%%%%%% first field removed (when numero_tir_fin_old=1) ????? 149 matrice_finale(:,:,numero_tir_debut:numero_tir_fin_old-1)=[];%%%%%%% 150 % numero_tir_fin=numero_tir_fin-1; ????? 151 matrice_finale=reshape(filtfilt(BB,AA,matrice_finale(:,:)),size(matrice_finale));% low pass filtered input signal,along first (time) index? 141 152 142 153 % if soustraction==1 … … 149 160 150 161 %%%%%%%%%%%%%%Imagerie 151 fe=rsf*1e6;% acquisition frequency162 fe=rsf*1e6;% sampling frequency for receptor (in Hz) 152 163 cc=1475;%speed of sound 153 164 hanning_window=25; … … 176 187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 177 188 for kk=1:size(matrice_finale,3) 178 kk 179 tir=kk; 180 signal=squeeze(matrice_finale(interval,:,tir)); 181 tata_fft=zeros(size(signal,1),size(signal,2)); 182 tata_fft=fft(signal,[],1); 183 184 if kk==1 185 189 disp(kk) 190 signal=squeeze(matrice_finale(interval,:,kk)); 191 tata_fft=fft(signal,[],1);%FFT of the time signal size=(2650,64) 192 if kk==1 186 193 matrice_freq_mean=mean(abs(fft(signal,[],1)),2); 187 194 X=[freq1*1e6 freq2*1e6]; … … 193 200 194 201 for ii=1:length(image_r) 195 [ii kk]196 202 for jj=1:length(image_z) 197 203 … … 250 256 %%%%%%% TO ADAPT 251 257 for iii=1:size(image_fin,3) 252 Data. Pressure=image_fin(:,:,iii);258 Data.A=image_fin(:,:,iii);% time lapse decreasesas z coordinate increases. 253 259 FileIndex=numero_tir_fin - pas_fichier+iii;%%%%%%TO CHECK!!!!! 254 260 %%%%%%%%%% 255 261 %eval(['save analyse_' name '_' num2str(number) '_' num2str(numero_tir_fin_old) '_' num2str(numero_tir_fin) '.mat']) 256 OutputDir=[Param.OutputSubDir OutputDirExt];% subdirectory for output files 257 OutputFile=fullfile_uvmat(OutputDir,'','signal','.nc','_00001',FileIndex); 262 OutputFile=fullfile_uvmat(RootPath,OutputDir,'signal','.nc','_00001',FileIndex); 258 263 error=struct2nc(OutputFile,Data);%save result file 259 264 if isempty(error) … … 263 268 end 264 269 end 265 numero_tir_fin_old=numero_tir_fin+1 ;266 if (numero_tir_fin_old+pas_fichier)>Nmoy270 numero_tir_fin_old=numero_tir_fin+1% first index for next bloc reading 271 if (numero_tir_fin_old+pas_fichier-1)>Nmoy 267 272 test_fin_fichier=-1; 268 273 end -
trunk/src/series/civ_input.m
r776 r781 97 97 NomTypeNc=''; 98 98 switch FileType 99 case {'image','multimage','video','mmreader' }99 case {'image','multimage','video','mmreader','netcdf'} 100 100 NomTypeImaA=NomTypeInput; 101 101 iview_image=1;%line # for the input images … … 134 134 return 135 135 otherwise 136 msgbox_uvmat('ERROR','civ_series needs images or civ data as input')136 msgbox_uvmat('ERROR','civ_series needs images, scalar fields in netcdf format, or civ data as input') 137 137 return 138 138 end -
trunk/src/series/civ_series.m
r774 r781 57 57 Data.NbSlice='off'; %nbre of slices ('off' by default) 58 58 Data.VelType='off';% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 59 Data.FieldName='o ff';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default)59 Data.FieldName='on';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 60 60 Data.FieldTransform = 'off';%can use a transform function 61 61 Data.ProjObject='off';%can use projection object(option 'off'/'on', … … 221 221 end 222 222 [FileType_A,FileInfo_A,VideoObject_A]=get_file_type(ImageName_A); 223 if strcmp(FileInfo_A.FileType,'netcdf') 224 FieldName_A=Param.InputFields.FieldName; 225 [DataIn,tild,tild,errormsg]=nc2struct(ImageName_A,{FieldName_A}); 226 par_civ1.ImageA=DataIn.(FieldName_A); 227 else 223 228 [par_civ1.ImageA,VideoObject_A] = read_image(ImageName_A,FileType_A,VideoObject_A,FrameIndex_A_Civ1(1)); 229 end 224 230 ImageName_B=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ1(1),[],j2_series_Civ1(1)); 225 231 if ~exist(ImageName_B,'file') … … 228 234 end 229 235 [FileType_B,FileInfo_B,VideoObject_B]=get_file_type(ImageName_B); 230 [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B_Civ1(1)); 236 if strcmp(FileInfo_B.FileType,'netcdf') 237 FieldName_B=Param.InputFields.FieldName; 238 [DataIn,tild,tild,errormsg]=nc2struct(ImageName_B,{FieldName_B}); 239 par_civ1.ImageB=DataIn.(FieldName_B); 240 else 241 [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,Param.InputFields,FrameIndex_B_Civ1(1)); 242 end 231 243 NbField=numel(i1_series_Civ1); 232 244 elseif Param.ActionInput.CheckCiv2 % Civ2 is performed without Civ1 … … 237 249 end 238 250 [FileType_A,FileInfo_A,VideoObject_A]=get_file_type(ImageName_A); 239 [par_civ1.ImageA,VideoObject_A] = read_image(ImageName_A,File Type_A,VideoObject_A,FrameIndex_A_Civ2(1));251 [par_civ1.ImageA,VideoObject_A] = read_image(ImageName_A,FileInfo_A.FileType,VideoObject_A,FrameIndex_A_Civ2(1)); 240 252 ImageName_B=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ2(1),[],j2_series_Civ2(1)); 241 253 if ~exist(ImageName_B,'file') … … 335 347 try 336 348 ImageName_A=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_series_Civ1(ifield),[],j1_series_Civ1(ifield)); 337 [par_civ1.ImageA,VideoObject_A] = read_image(ImageName_A,FileType_A,VideoObject_A,FrameIndex_A_Civ1(ifield)); 349 if strcmp(FileInfo_A.FileType,'netcdf') 350 FieldName_A=Param.InputFields.FieldName; 351 [DataIn,tild,tild,errormsg]=nc2struct(ImageName_A,{FieldName_A}); 352 par_civ1.ImageA=DataIn.(FieldName_A); 353 else 354 [par_civ1.ImageA,VideoObject_A] = read_image(ImageName_A,FileType_A,VideoObject_A,FrameIndex_A_Civ1(ifield)); 355 end 338 356 ImageName_B=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ1(ifield),[],j2_series_Civ1(ifield)); 339 [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B_Civ1(ifield)); 357 if strcmp(FileInfo_B.FileType,'netcdf') 358 FieldName_B=Param.InputFields.FieldName; 359 [DataIn,tild,tild,errormsg]=nc2struct(ImageName_B,{FieldName_B}); 360 par_civ1.ImageB=DataIn.(FieldName_B); 361 else 362 [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B_Civ1(ifield)); 363 end 340 364 catch ME 341 365 if ~isempty(ME.message) … … 344 368 end 345 369 end 346 par_civ1.ImageWidth= FileInfo_A.Width;347 par_civ1.ImageHeight= FileInfo_A.Height;370 par_civ1.ImageWidth=size(par_civ1.ImageA,2);%FileInfo_A.Width; 371 par_civ1.ImageHeight=size(par_civ1.ImageA,1);%FileInfo_A.Height; 348 372 list_param=(fieldnames(Param.ActionInput.Civ1))'; 349 373 Civ1_param=regexprep(list_param,'^.+','Civ1_$0');% insert 'Civ1_' before each string in list_param
Note: See TracChangeset
for help on using the changeset viewer.