Changeset 79 for trunk/src/transform_field/phys.m
 Timestamp:
 Apr 5, 2010, 3:11:51 AM (14 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/transform_field/phys.m
r40 r79 168 168 yima=[0.5 0.5 siz(1)0.5 siz(1)0.5]; 169 169 [xcorner_new,ycorner_new]=phys_XYZ(Calib,xima,yima,ZIndex);%corresponding physical coordinates 170 dx(icell)=(max(xcorner_new)min(xcorner_new))/(siz(2)1); 171 dy(icell)=(max(ycorner_new)min(ycorner_new))/(siz(1)1); 170 172 xcorner=[xcorner xcorner_new]; 171 173 ycorner=[ycorner ycorner_new]; … … 176 178 Rangy(1)=max(ycorner); 177 179 test_multi=(max(npx)~=min(npx))  (max(npy)~=min(npy)); 178 np x=max(npx);179 np y=max(npy);180 x=linspace(Rangx(1),Rangx(2),np x);181 y=linspace(Rangy(1),Rangy(2),np y);180 npX=1+round((Rangx(2)Rangx(1))/min(dx));% nbre of pixels in the new image (use the finest resolution min(dx) in the set of images) 181 npY=1+round((Rangy(1)Rangy(2))/min(dy)); 182 x=linspace(Rangx(1),Rangx(2),npX); 183 y=linspace(Rangy(1),Rangy(2),npY); 182 184 [X,Y]=meshgrid(x,y);%grid in physical coordiantes 183 185 vec_B=[]; … … 192 194 zphys=SliceCoord(3); %to generalize for nonparallel planes 193 195 end 194 [XIMA,YIMA]=px_XYZ(CalibIn{icell},X,Y,zphys);% corresponding image indices for each point in the real space grid195 XIMA=reshape(round(XIMA),1,np x*npy);%indices reorganized in 'line'196 YIMA=reshape(round(YIMA),1,np x*npy);197 flagin=XIMA>=1 & XIMA<=npx & YIMA >=1 & YIMA<=npy;%flagin=1 inside the original image196 [XIMA,YIMA]=px_XYZ(CalibIn{icell},X,Y,zphys);% image coordinates for each point in the real space grid 197 XIMA=reshape(round(XIMA),1,npX*npY);%indices reorganized in 'line' 198 YIMA=reshape(round(YIMA),1,npX*npY); 199 flagin=XIMA>=1 & XIMA<=npx(icell) & YIMA >=1 & YIMA<=npy(icell);%flagin=1 inside the original image 198 200 testuint8=isa(A{icell},'uint8'); 199 201 testuint16=isa(A{icell},'uint16'); 200 202 if numel(siz)==2 %(B/W images) 201 vec_A=reshape(A{icell},1,npx *npy);%put the original image in line203 vec_A=reshape(A{icell},1,npx(icell)*npy(icell));%put the original image in line 202 204 ind_in=find(flagin); 203 205 ind_out=find(~flagin); 204 ICOMB=((XIMA1)*npy +(npy+1YIMA));206 ICOMB=((XIMA1)*npy(icell)+(npy(icell)+1YIMA)); 205 207 ICOMB=ICOMB(flagin);%index corresponding to XIMA and YIMA in the aligned original image vec_A 206 208 vec_B(ind_in)=vec_A(ICOMB); 207 209 vec_B(ind_out)=zeros(size(ind_out)); 208 A_out{icell}=reshape(vec_B,np y,npx);%new image in real coordinates210 A_out{icell}=reshape(vec_B,npY,npX);%new image in real coordinates 209 211 elseif numel(siz)==3 210 212 for icolor=1:siz(3)
Note: See TracChangeset
for help on using the changeset viewer.