	PROGRAM  SVARJN
C	FUNCTION :
C
C
C		TO CREATE STATIC FROM N IMAGES STORED IN SV 1- N
C	PROCESSED IMAGES ARE STORED IN A MULTIPLE STATIC
C	FILE WITH PATIENT NAME.X??
	LOGICAL*1 LADMIN(512),ADMIN(512)
	LOGICAL*1 TITLE(6),STITLE(12)
	INTEGER*2 SADMIN(256),P(75),ISAVE
	INTEGER*2 MAT(64,64)
	REAL*4 B(3,42)
	REAL*8 STUDY,NEWSTY
	EQUIVALENCE(LADMIN,SADMIN,STUDY)
	DATA TITLE/'S','V','A','R','J','N'/
	DATA STITLE/'C','O','M','B',' ',' ','S','T','A','T','I','C'/
	CALL GAMSTP(LADMIN,TITLE)
	WRITE(7,5)
5	FORMAT('$ENTER N0. OF SAVE AREAS TO BE JOINED  ')
	READ(5,6)NSAV
6	FORMAT(I6)
	ITBLK=17*NSAV+1
C
C open new patient file for static images
C
	NFRAME = NSAV
	CALL CSTAT(1,1,ISTUDY,NEW,MDOFF,NFRAME,STITLE,NEWSTY)
	DO 100 I = 1,NSAV
	INUM=I
	CALL SAVOP(INUM,ISAVE,LADMIN,IERR)
C convert to Fortran format
	CALL CRTFIL(STUDY,IBLKS,NEXSTD,1)
	ITP = 0
	CALL READW(256,ADMIN,ITP,NEXSTD)
	CALL FGADM1(ADMIN,P,B)
C change admin parms for new file
	P(1)=NSAV
	P(14)=4
	P(20)=NSAV
	P(3)=ITBLK
	P(5)=0
	P(9)=NSAV
	P(13)=1
	P(21)=I
	IF(I.EQ.1)GO TO 20
	P(2)=-17*(I-1)
	P(4)=-17*(I-1)-1
	P(6)=1
	P(7)=-17
	IF(I.EQ.2)P(7)=-18
	P(8)=17
	GO TO 40
20	P(2)=1
	P(4)=0
	P(6)=2
	P(7)=0
	P(8)=18
40	CONTINUE
	CALL FGADM2(ADMIN,P,B)
C
C	WRITE FRAME 
C
	IF(I.EQ.1)CALL HDCHG(ADMIN,STITLE)
	ITP = 17*(I-1)+1
	IF(I.EQ.1)ITP=0
	CALL WRITW(256,ADMIN,ITP,NEW)
	ITP = 1
	CALL READW(4096,MAT,ITP,ISAVE)
	ITP = 2+17*(I-1)
	CALL WRITW(4096,MAT,ITP,NEW)
	CALL CLOSEC(ISAVE)
	CALL IFREEC(ISAVE)
	CALL CLOSEC(NEXSTD)
	CALL IFREEC(NEXSTD)
100	CONTINUE
	DO 110 I = 1,256
110	ADMIN(I) = 0
	ITP = 1
	CALL WRITW(256,ADMIN,ITP,NEW)
	CALL CLOSEC(ISTUDY)
	CALL IFREEC(ISTUDY)
	CALL CLOSEC(NEW)
	CALL IFREEC(NEW)
	CALL GAMCA(ADMIN,-1)
	END
