% TRALONG1 1 called by DEPINTL sets up TRAnsverse vectors rep. electdes & gaps, % by requsting edge pnts & spec. pnts, sums LONGitdinl dirn then transvrs drctn thn % INTERPOLATES -> av. intensities over 1/2 el wdth & gap D. Bakewell Tu/4/5/1999 % most recent update 21:35 Sa/21/7/2001 imagmous1; fredo = 1; % Flag begin processing that can be REDOne if unsatisfactory while fredo == 1; [r,c]=size(rotimag); suml = sum(rotimag,2)/pmxlng; % SUMs rotated intens matix 'rotimag' over j in MATRIX coord. sys. % i.e along ea row or Longitud x dirctn in PIXEL cord sys relatng to electrode strips % GENerate VECtor (pmxtrv rows x 1 column) from chosen points for plot sumj % generate interpolation vectors % Integer VECtor Transverse direction on elctrd plne (1 row x pmxtrv colmns) switch fauto case 1 ipolqrt=50 % for PhD thesis publication %ipolqrt=input('no. resolutn points for HALF electrode = HALF gap (eg 30) = '); case 2 ipolqrt=invar(7); end % end switch fauto ipolhlf=round(2*ipolqrt); ipolper=round(2*ipolhlf); ipoltot = round(mp*ipolper); for n=1:1:edgpnts-1; for p=1:1:ipolhlf; pn=round(ipolhlf*n + p - ipolhlf); ypolvec(pn)=y(n) + (y(n+1)-y(n))*p/ipolhlf; end % p end % n pnmax=round(ipolhlf*(edgpnts-1)); pnvec=1:1:pnmax; t = 1:1:pmxtrv; % Integer VECtor Transverse direction on elctrd plne (1 row x pmxtrv colmns) ipolsuml = interp1(t,suml,ypolvec,'linear'); % interpolate suml smlmaxr=round(max(suml)); smlminr=round(min(suml)); smldifr=smlmaxr-smlminr; pvec = smlminr:smldifr/200:smlmaxr; fvecgen = 1; % Flag for VECtor GENeration switch fauto case 1 dummy = menu(' ','Press to continue'); case 2 pause(2) end % end switch fauto % display sum longitudinal k = []; figure ; plot(suml',t');axis ij; % switch fauto case 1 dummy = menu(' ','Press to continue'); case 2 pause(2) end % end switch fauto figure; plot(ipolsuml',pnvec');axis ij; switch fauto case 1 dummy = menu(' ','Press to continue'); case 2 pause(1) end % end switch fauto % plot(smlminr',y(n)','g+') hold off close; close; % sum suml -> sumt for two Transverse regions A & B Ai=0; Bi=0; p=0; q=0; sumAt=0; sumBt=0; for p = 1:1:ipolhlf; sumA=0; sumB=0; for k=1:1:mp; Ai = p-1 + ipolqrt + round((k-1)*ipolper); ipvecA = ipolsuml(Ai); sumA=ipvecA + sumA; Bi = Ai + ipolhlf; ipvecB = ipolsuml(Bi); sumB=ipvecB + sumB; end sumAt(p)=sumA/double(mp); sumBt(p)=sumB/double(mp); end p = 1:1:ipolhlf; q = ipolhlf:-1:1; figure; plot(sumAt,p',sumBt,q');axis ij; switch fauto case 1 dummy = menu('Press to','Add 2 profiles & plot'); case 2 pause(3) end % end switch fauto hold off sumBTt(p)=sumBt(q); sumCy=(sumAt + sumBTt)/double(2); figure plot(sumCy,p');axis ij; % sum of Collected solute (along Longitudinal) as a % function of Transverse direction (also called Y to avoid confusion with time) pause(2) figure plot(p,sumCy) pause(2) switch fauto case 1 fcont = menu('Press to','Re-process data/plot','Store results','End only'); case 2 fcont = 2; end hold off close close close % switch fcont case 1 imshow(rotimag) hold on truesize %[xi,yi] = ginput(1); plot(x,y,'c+','EraseMode','none') hold on fpoint2 = 2; while fpoint2 == 2; pntval = menu('POINT to be repositioned','None','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20'); switch pntval case 1 fpoint = 1 otherwise pntvlc=round(pntval-1); yi=y(pntvlc) ynew=input('New value of point = ') y(pntvlc)=ynew xnew=x(pntvlc) plot(xnew,ynew,'r+','EraseMode','none') hold on fpoint2 = menu('last point: satsfid wth selections?','Yes','No'); end % switch pntval end % end fpoint2 while vwgset = 2 hold off % case 2 switch fauto case 1 offset=7 of=1:1:offset ed=1:1:edgpnts edoff=offset+1:1:edgpnts+offset ouvar=zeros(1,edgpnts); ouvar(1)=ffile ouvar(2)=fcolor ouvar(3)=frotate ouvar(4)=rotang ouvar(5)=ftralo ouvar(6)=mp ouvar(7)=ipolqrt ouvar(edoff)=y(ed) ofnam = [ifcode '.dat'] dlmwrite(ofnam,ouvar, ';') % output data (ASCII) wth ifname of tif image set ofnamc= [ifname 'Cy.dat'] dlmwrite(ofnamc,sumCy, ';') case 2 ofnamc= [ifcode 'Cyt.dat']; % creates matric with no. rows = no. images, 1st column rep. time (secs), % other other columns representing profiles (at each point). sumCyt(cnt,1)=time; sumCyt(cnt,p+1)=sumCy(1,p); dlmwrite(ofnamc,sumCyt, ';'); end % end switch auto % case 3 end switch fauto case 1 fredo=menu('start again?','Yes','No') case 2 fredo=2; end % end switch auto end % end main program loop: fredo while close close close