Changeset 1182
- Timestamp:
- Oct 20, 2025, 4:38:10 PM (7 weeks ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
-
cluster_command.m (modified) (1 diff)
-
series.m (modified) (3 diffs)
-
series/bed_scan.m (modified) (8 diffs)
-
uvmat.m (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/cluster_command.m
r1179 r1182 35 35 % corestring='cpu=1/core=4'; %increases the allowed memory in case of single core job 36 36 % else 37 corestring=['{cluster=''calcul8''}/core=' num2str(max(NbCore,4))]; 37 % corestring=['{cluster=''calcul6''}/core=' num2str(max(NbCore,4))];% calcul6 faster 38 corestring=['core=' num2str(max(NbCore,4))]; 38 39 % end 39 40 cmd=['oarsub -n UVmat_' ActionFullName ' '... -
trunk/src/series.m
r1180 r1182 609 609 %% update MinIndex_i and MaxIndex_i if the input table content has been reduced in line nbre 610 610 MinIndex_i_table=get(handles.MinIndex_i,'Data'); % retrieve the min indices in the table MinIndex 611 if ~isempty(MinIndex_i_table) 611 612 set(handles.MinIndex_i,'Data',MinIndex_i_table(1:nbview,:)); 613 end 612 614 MinIndex_j_table=get(handles.MinIndex_j,'Data'); % retrieve the min indices in the table MinIndex 615 if ~isempty(MinIndex_j_table) 613 616 set(handles.MinIndex_j,'Data',MinIndex_j_table(1:nbview,:)); 617 end 614 618 MaxIndex_i_table=get(handles.MaxIndex_i,'Data'); % retrieve the min indices in the table MinIndex 615 619 if ~isempty(MaxIndex_i_table) 616 620 set(handles.MaxIndex_i,'Data',MaxIndex_i_table(1:nbview,:)); 621 end 617 622 MaxIndex_j_table=get(handles.MaxIndex_j,'Data'); % retrieve the min indices in the table MinIndex 623 if ~isempty(MaxIndex_j_table) 618 624 set(handles.MaxIndex_j,'Data',MaxIndex_j_table(1:nbview,:)); 625 end 619 626 PairString=get(handles.PairString,'Data'); % retrieve the min indices in the table MinIndex 627 if ~isempty(PairString) 620 628 set(handles.PairString,'Data',PairString(1:nbview,:)); 629 end 621 630 TimeTable=get(handles.TimeTable,'Data'); % retrieve the min indices in the table MinIndex 631 if ~isempty(TimeTable) 622 632 set(handles.TimeTable,'Data',TimeTable(1:nbview,:)); 633 end 623 634 624 635 %% set length of waitbar … … 977 988 XmlData=[]; 978 989 check_calib=0; 990 979 991 XmlFileName=find_imadoc(InputTable{iview,1},InputTable{iview,2}); 980 992 if ~isempty(XmlFileName) … … 984 996 end 985 997 % read time if available 986 if isfield(XmlData,'Time') 998 if isfield(XmlData,'Time') && strcmp(FileInfo.FieldType,'image') 987 999 Time=XmlData.Time; 988 1000 TimeName='xml'; -
trunk/src/series/bed_scan.m
r1127 r1182 1 %'bed_scan': get the bed shape from laser ipact 1 %'bed_scan': get the bed shape from laser impact 2 % firts line input files = active images 3 % second line, reference images for the initial bed 2 4 3 5 %------------------------------------------------------------------------ … … 85 87 FileInfo=get_file_info(filecell{1,1}); 86 88 FileType=FileInfo.FileType; 87 if isempty(find(strcmp(FileType,{'image','multimage','mmreader','video'}))) ;% =1 for images89 if isempty(find(strcmp(FileType,{'image','multimage','mmreader','video'})))% =1 for images 88 90 msgbox_uvmat('ERROR',['bad input file type for ' mfilename ': an image is needed']) 89 91 end … … 108 110 109 111 %% root input file names and nomenclature type (cell arrays with one element) 110 RootPath=Param.InputTable{2,1}; 111 % RootFile=Param.InputTable(:,3); 112 % SubDir=Param.InputTable(:,2); 113 % NomType=Param.InputTable(:,4); 114 % FileExt=Param.InputTable(:,5); 112 RootPath=Param.InputTable{1,1}; 113 115 114 116 115 %% directory for output files … … 127 126 nbfield_i=size(i1_series{1},2); %nb of fields for the i index 128 127 129 %% frame index for movie or multimage file input 128 %% set of y positions 129 ycalib=[-51 -1 49];% calibration planes 130 y_scan=-51+(100/400)*(i1_series{1}-1);% transverse position given by the translating system: first view at y=-51, view 400 at y=+49 131 Mfiltre=ones(2,10)/20;%filter matrix for imnages 130 132 131 133 %% calibration data and timing: read the ImaDoc files 132 %not relevant for this function 133 134 %% check coincidence in time for several input file series 134 XmlData_A=xml2struct(fullfile(RootPath,'planeA.xml')); 135 XmlData_B=xml2struct(fullfile(RootPath,'planeB.xml')); 136 XmlData_C=xml2struct(fullfile(RootPath,'planeC.xml')); 137 ycalib=[-51 -1 49];% the three y positions for calibration 138 fx(1)=XmlData_A.GeometryCalib.fx_fy(1); 139 fx(2)=XmlData_B.GeometryCalib.fx_fy(1); 140 fx(3)=XmlData_C.GeometryCalib.fx_fy(1); 141 fy(1)=XmlData_A.GeometryCalib.fx_fy(2); 142 fy(2)=XmlData_B.GeometryCalib.fx_fy(2); 143 fy(3)=XmlData_C.GeometryCalib.fx_fy(2); 144 Tx(1)=XmlData_A.GeometryCalib.Tx_Ty_Tz(1); 145 Tx(2)=XmlData_B.GeometryCalib.Tx_Ty_Tz(1); 146 Tx(3)=XmlData_C.GeometryCalib.Tx_Ty_Tz(1); 147 Ty(1)=XmlData_A.GeometryCalib.Tx_Ty_Tz(2); 148 Ty(2)=XmlData_B.GeometryCalib.Tx_Ty_Tz(2); 149 Ty(3)=XmlData_C.GeometryCalib.Tx_Ty_Tz(2); 150 R11(1)=XmlData_A.GeometryCalib.R(1,1); 151 R11(2)=XmlData_B.GeometryCalib.R(1,1); 152 R11(3)=XmlData_C.GeometryCalib.R(1,1); 153 R12(1)=XmlData_A.GeometryCalib.R(1,2); 154 R12(2)=XmlData_B.GeometryCalib.R(1,2); 155 R12(3)=XmlData_C.GeometryCalib.R(1,2); 156 R21(1)=XmlData_A.GeometryCalib.R(2,1); 157 R21(2)=XmlData_B.GeometryCalib.R(2,1); 158 R21(3)=XmlData_C.GeometryCalib.R(2,1); 159 R22(1)=XmlData_A.GeometryCalib.R(2,2); 160 R22(2)=XmlData_B.GeometryCalib.R(2,2); 161 R22(3)=XmlData_C.GeometryCalib.R(2,2); 162 pfx=polyfit(ycalib,fx,1);%get the linear interpolation of each parameter of the three calibrations 163 pfy=polyfit(ycalib,fy,1); 164 pTx=polyfit(ycalib,Tx,1); 165 pTy=polyfit(ycalib,Ty,1); 166 p11=polyfit(ycalib,R11,1); 167 p12=polyfit(ycalib,R12,1); 168 p21=polyfit(ycalib,R21,1); 169 p22=polyfit(ycalib,R22,1); 170 %get the calibration parameters at each position y by interpolation of the 3 calibration parameters 171 for img=1:nbfield_i 172 Calib(img).fx_fy(1)=pfx(1)*y_scan(img)+pfx(2); 173 Calib(img).fx_fy(2)=pfy(1)*y_scan(img)+pfy(2); 174 Calib(img).Tx_Ty_Tz(1)=pTx(1)*y_scan(img)+pTx(2); 175 Calib(img).Tx_Ty_Tz(2)=pTy(1)*y_scan(img)+pTy(2); 176 Calib(img).Tx_Ty_Tz(3)=1; 177 Calib(img).R=zeros(3,3); 178 Calib(img).R(3,3)=-1; 179 Calib(img).R(1,2)=p12(1)*y_scan(img)+p12(2); 180 Calib(img).R(1,1)=p11(1)*y_scan(img)+p11(2); 181 Calib(img).R(1,2)=p12(1)*y_scan(img)+p12(2); 182 Calib(img).R(2,1)=p21(1)*y_scan(img)+p21(2); 183 Calib(img).R(2,2)=p22(1)*y_scan(img)+p22(2); 184 end 185 186 %% check coincdence in time for several input file series 135 187 %not relevant for this function 136 188 … … 141 193 % EDIT FROM HERE 142 194 143 %% Extension and indexing nomenclature for output file144 145 % name=('EXP18OS_bed_init/im/');146 % name2=('EXP18OS_end/im/');147 % path_proj=['/.fsnet/project/coriolis/2018/18ADDUCE/SEDIM_SCANSIDE/'];148 149 %nimages=1800;150 151 195 %% Load the init bed scan 152 153 y=90.05-0.05*i1_series{1};154 Mfiltre=ones(2,10)/20;%filter matrix for imnages155 196 tic 156 % y=zeros(1,nimages); 157 % X_new=zeros(4096,nimages); 158 x=1:4096; 159 % img=1; 160 %filecell{1,img}= list of the images _init 161 %filecell{2,img}= list of the images _end 162 for img=1:nbfield_i 197 nb_scan=10; 198 nb_scan=10; 199 for img=1:nb_scan 163 200 img 164 image=flipud(imread(filecell{2,img})); 165 a=image(700:1900,:); 201 a=flipud(imread(filecell{1,img}));%image of the initial bed 202 if img==1 203 x=1:size(a,2);%image absissa in pixel coordinates 204 end 166 205 % filtering 167 a=filter2(Mfiltre,a); 168 [imax,iy]=max(a); 169 Z=squeeze(iy); 170 iy(imax<50)=NaN; 171 Z_s(:,img)=smooth(Z,40,'rloess'); 172 % y(img)=y0-(0.05.*step); 173 % y0=y(img); 174 X_new(:,img)=phys_scan(x,y(img)); 206 a=filter2(Mfiltre,a);%smoothed image 207 [imax,iy]=max(a);% find the max along the first coordinate y, max values imax and the corresponding y index iy along the first coordinate y 208 Z_s(img,:)=smooth(iy,40,'rloess');%smooth Z, the image index of max luminosity (dependning on x) 209 Yima=y_scan(img)*ones(size(x));%positions Y transformed into a vector 210 X_new(img,:)=phys_XYZ(Calib(img),x,Yima,1); 211 %X_new(:,img)=phys_scan(x,y(img)); 175 212 end 176 213 177 214 toc 178 215 179 nimages2=size(Z_s,2); 180 %% 181 y_y=1:size(a,1); 182 183 % [Xx,Yy]=meshgrid(x,y_y); 184 [X,Y]=meshgrid(x,y); 185 186 % index=1; 187 % [imax,iy]=max(a); 188 % 189 % Z=squeeze(iy); 190 191 %% smooth bed init 192 % for i=2:dim(2) 193 % if iy(i)<300 194 % imax(i)=imax(i-1); 195 % end 196 % end 197 198 % for i=1:nimages2 199 % Z_s(:,i)=smooth(Z(:,i),50,'rloess'); 200 % % Z_s_new(:,i)=phys_scanz(x,Z_s(:,i)',y(i)); 201 % 202 % end 203 204 %% Load the transit bed scan 205 for img=1:nbfield_i 206 img 207 image=flipud(imread(filecell{1,img})); 208 b=image(700:1900,:); 209 % filtering 210 b=filter2(Mfiltre,b); 216 [X,Y]=meshgrid(x,y_scan); 217 218 219 %% Load the current bed scan 220 for img=1:nb_scan 221 b=flipud(imread(filecell{2,img}));%image of the current bed 222 b=filter2(Mfiltre,b); % filtering 211 223 [imaxb,iyb]=max(b); 212 Zb=squeeze(iyb); 213 iyb(imaxb<50)=NaN; 214 Z_sb(:,img)=smooth(Zb,20,'rloess'); 215 end 216 224 Z_sb(img,:)=smooth(iyb,20,'rloess'); 225 end 217 226 218 227 %% bed change 219 dZ=Z_s-Z_sb; 220 dZ_new=zeros(4096,nimages2); 221 for img=1:nimages2 222 dZ_new(:,img)=phys_scanz(dZ(:,img),y(img)); 228 dZ=Z_s-Z_sb;% displacement between current position and initial 229 dZ_new=zeros(nb_scan,size(dZ,2)); 230 for img=1:nb_scan 231 Yima=y_scan(img)*ones(1,size(dZ,2)); 232 [~,dZ_new(img,:)]=phys_XYZ(Calib(img),dZ(img,:),Yima,1); 233 % dZ_new(:,img)=phys_scanz(dZ(:,img),y(img)); 223 234 end 224 235 225 236 226 237 %% PLOTS 227 coord_x=X_new( 1,end):0.1:X_new(end,end);228 [Y_m,X_m]=meshgrid(y (1,:),coord_x);229 Y_new=Y';230 dZ_mesh=griddata(X_new,Y _new,dZ_new,X_m,Y_m);238 coord_x=X_new(end,1):0.1:X_new(end,end); 239 [Y_m,X_m]=meshgrid(y_scan,coord_x); 240 %Y_new=Y'; 241 dZ_mesh=griddata(X_new,Y,dZ_new,X_m,Y_m); 231 242 232 243 if checkrun … … 234 245 hold on 235 246 plot(x,Z_s+700) 236 xlim([0 4096])237 ylim([0 3000])247 % xlim([0 4096]) 248 % ylim([0 3000]) 238 249 239 250 figure(2) … … 260 271 end 261 272 262 save(fullfile(DirOut,'18OS_f.mat'),'dZ','dZ_new','X','Y','Z_s','Z_sb','y')273 %save(fullfile(DirOut,'18OS_f.mat'),'dZ','dZ_new','X','Y','Z_s','Z_sb','y') 263 274 264 275 % save netcdf … … 276 287 struct2nc(fullfile(DirOut,'dZ.nc'),Data) 277 288 289 %% gives the physical position x from the image position X and the physical position y of the laser plane 278 290 function F=phys_scan(X,y) 291 % linear fct of X whose coefficient depend on y in a quadratic way 279 292 F=(9.4*10^(-7)*y.^2-3.09*10^(-4)*y+0.07).*X +(-0.001023*y.^2+0.469*y+186.9); 280 293 294 %% gives the physical position z from the image position Z and the physical position y of the laser plane 281 295 function Fz=phys_scanz(Z,y) 296 % scale factor applied to Z depending on the physical position y of the laser plane 282 297 Fz=(-1.4587*10^(-5)*y.^2 + 0.001072*y+0.0833).*Z; %+(-2.1*10^(-6)*x.^2+5.1*10^(-4)*x+0.0735).*Z; 283 298 284 299 285 -
trunk/src/uvmat.m
r1181 r1182 13 13 14 14 %======================================================================= 15 % Copyright 2008-2024, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France15 % Copyright 2008-2024, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, ileSeriesrance 16 16 % http://www.legi.grenoble-inp.fr 17 17 % Joel.Sommeria - Joel.Sommeria (A) univ-grenoble-alpes.fr … … 2878 2878 else 2879 2879 index_string=get(handles.FileIndex,'String'); 2880 if isfield(UvData,'XmlData')&& isfield(UvData.XmlData{1},'FileSeries') 2880 if isfield(UvData,'XmlData')&& isfield(UvData.XmlData{1},'FileSeries')% The frame indexing is determined through the xml file, section FileSeries 2881 2881 i1=str2double(get(handles.i1,'String')); 2882 2882 j1=str2double(get(handles.j1,'String')); 2883 2883 NbField_j_cell=get(handles.MaxIndex_j,'String'); 2884 2884 NbField_j=str2double(NbField_j_cell{1}); 2885 [RootFile,index_string,FrameIndex]=index2filename(UvData.XmlData{1}.FileSeries,i1,j1,NbField_j); 2885 [RootFile,index_string,FrameIndex]=index2filename(UvData.XmlData{1}.FileSeries,i1,j1,NbField_j);% convert frame index i1 j1 to index in the files 2886 2886 set(handles.RootFile,'String',RootFile) 2887 2887 else
Note: See TracChangeset
for help on using the changeset viewer.
