Changeset 781 for trunk/src/series/beam_forming.m
- Timestamp:
- May 29, 2014, 6:17:00 PM (11 years ago)
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.