global img intmat intmat1 choice flag

init

out50=avsread('/nfs/ir6/w/fyz/2dd/huber/lc/out9q.fld');
pps=avsread2('/nfs/ir6/w/fyz/2dd/huber/lc/prompt3e5.50.fld');
img2=avsread('huber/phtm.fld')';
c1=zeros(200,2,50,15);c2=zeros(200,2,50,15);
c3=zeros(100,2,50,15);c4=zeros(500,2,50,15);
l1=zeros(50,15); l2=zeros(50,15); l3=zeros(50,15); l4=zeros(50,15); 
lsets=zeros(128,128,4,50);

for ii=1:1,
	ii
	!rm -f pp.fld
	avswrite('pp.fld',pps(:,:,ii));
	fuserf=1; flag1=1; flag2=1; flag3=1; flag4=1;
	choice=1; img=out50(:,:,ii)'*1e5; disp(choice); go; fuserf=0;
	!rm -f out.fld
	!reconstruct 11 20
	choice=2; img=avsread('out.fld')'*1e5; disp(choice); flag4=0; go;
        !rm -f out.fld
        !reconstruct 11 20
        choice=3; img=avsread('out.fld')'*1e5; disp(choice); flag3=0; go;
        !rm -f out.fld
        !reconstruct 11 20
        choice=4; img=avsread('out.fld')'*1e5; disp(choice); flag3=1; go;
        !rm -f out.fld
        !reconstruct 11 20
        choice=5; img=avsread('out.fld')'*1e5; disp(choice); flag3=0; go;
        !rm -f out.fld
        !reconstruct 11 20
        choice=6; img=avsread('out.fld')'*1e5; disp(choice); flag4=1; go;
        !rm -f out.fld
        !reconstruct 11 25
        choice=7; img=avsread('out.fld')'*1e5; disp(choice); go;
        !rm -f out.fld
        !reconstruct 11 25
        choice=8; img=avsread('out.fld')'*1e5; disp(choice); go;
        !rm -f out.fld
        !reconstruct 11 25
        choice=9; img=avsread('out.fld')'*1e5; flag1=0; flag2=0; go;
	lsets(:,:,1,ii)=lset1;
        lsets(:,:,2,ii)=lset2;
        lsets(:,:,3,ii)=lset3;
        lsets(:,:,4,ii)=lset4;
	%choice=10; flag4=0; flag3=1; myout1(:,:,ii)=img'; go;
        %!rm -f out.fld
        %!reconstruct 11 20
        %choice=11; img=avsread('out.fld')'*1e5; go;
        %!rm -f out.fld
        %!reconstruct 11 20
        %choice=12; img=avsread('out.fld')'*1e5; go;
        %!rm -f out.fld
        %!reconstruct 11 20
        %choice=13; img=avsread('out.fld')'*1e5; go;
	if mod(ii,5)==0, %| ii==1,
		save c1 c1 c2 c3 c4 l1 l2 l3 l4
		save lsets lsets
	end
end
