Sie sind auf Seite 1von 25

******************************************************************************* * SOURCE CODE and DOCUMENTATION COPYRIGHT (C) 1987 KEVIN G.

RHOADS AND THE * * HIGH VOLTAGE RESEARCH LAB., L.E.E.S, Massachusetts Institute of Technology * ******************************************************************************* ******************************************************************************* * * * This file is part of the GRAPHICS.LIB library, the other library components * * are in files: MULTI.FOR, PLOT.FOR, XGRAPH.FOR & GRPRIM.FOR. This library * * uses routines from the UTILS.LIB and ASMUTILS.LIB libraries and should be * * listed before them at link time. In particular, routines used from outside * * this library are primarily concentrated in SUTIL.FOR. * *-----------------------------------------------------------------------------* $SEGMENT MOREPLOT *compiler is directed to place object code in segment MOREPLOT * *-----------------------------------------------------------------------------* $CHAREQU *compiler is directed NOT to barf on CHARACTER and numeric data types mixed in* *same COMMON BLOCK or EQUIVALENCE * *-----------------------------------------------------------------------------* * * * LIST OF ENTRY POINTS * * * * These routines were used for plotting from OMA images, and have since been * * superceded. * * SUBROUTINE PLTPAR(A256,LX,LY) * * ENTRY PARPLT(A256,LX,LY) * * ENTRY PARPL(A256,LX,LY) * *-----------------------------------------------------------------------------* * These routines either generate or display (or both) scaling messages for the* * plotting routines. * * PLOTMS - message is displayed HIGH, RIGHT justified, without reversal * * message is generated internally from scaling data * * SUBROUTINE PLOTMS * * PLTMLR - message is displayed LOW, RIGHT justified, REVERSED * * message is generated internally from scaling data * * ENTRY PLTMLR * * PLTMLL - message is displayed LOW, LEFT justified, REVERSED * * message is generated internally from scaling data * * ENTRY PLTMLL * * PLTMHL - message is displayed HIGH, LEFT justified, REVERSED * * message is generated internally from scaling data * * ENTRY PLTMHL * * PLTMHL - message is displayed HIGH, RIGHT justified, REVERSED * * message is generated internally from scaling data * * ENTRY PLTMHR * * PL0TMS - message is displayed HIGH, RIGHT justified, without reversal * * message is supplied by caller in SCMESS * * ENTRY PL0TMS * * MKPLMS makes a plot message and stores it in a common string variable. The * * variable is SCMESS (character*78) which is in common block SCALEM. * * ENTRY MKPLMS * * * * In the next set of entry points the line on which the plot message is to be * * displayed is specified by the argument NQNQ. * * PLMSR - message is displayed right justified, no reversal * * message is supplied by caller in SCMESS * * ENTRY PLMS(NQNQ) alias PLMSR * * ENTRY PLMSR(NQNQ) alias PLMS * * PLMSL - message is displayed left justified, no reversal * * message is supplied by caller in SCMESS *

* ENTRY PLMSL(NQNQ) * * PLMSXR - message is displayed right justified, no reversal, XORed onto plot * * message is supplied by caller in SCMESS * * ENTRY PLMSX(NQNQ) alias PLMSXR * * ENTRY PLMSXR(NQNQ) alias PLMSX * * PLMSXR - message is displayed left justified, no reversal, XORed onto plot * * message is supplied by caller in SCMESS * * ENTRY PLMSXL(NQNQ) * * PLXTMS - message is displayed HIGH, RIGHT justified, without reversal and * * XORed onto plot; message is supplied by caller in SCMESS * * ENTRY PLXTMS * *-----------------------------------------------------------------------------* * BAR2 plots an integer*2 array (IT), and was used to plot X slices through * * an OMA frame. It has since been superceded. This generates bar plots. * * INTEGER*2 IT(LEN) is the form taken for the input array. * * SUBROUTINE BAR2(IT,LEN,IST) * * ENTRY BARQ(IT,LEN,IST) * **----------------------------------------------------------------------------* **PLOTI2 plots an integer*2 array (IT), and was used to plot X slices through * **an OMA frame. It has since been superceded. * ** SUBROUTINE PLOTI2(IT,LEN) * **----------------------------------------------------------------------------* * PARMKL xors a "line", vertical or horizontal, with $FFFF in the on-screen * * image. The width of the line is adjusted to reflect magnification in display * The effect of this is to reverse the line. This is used to display and erase * cursor lines and marks on the image reconstruction. * * SUBROUTINE PARMKL * *-----------------------------------------------------------------------------* * These routines initialize for the plotting routines with a variety of options * PLTINT is the original, it initializes full screen and forces windowing * * variables off. * * SUBROUTINE PLTINT alias PLINIT * * ENTRY PLINIT alias PLTINT * * PLTINW forces windowing on and sets the window per input values. * * ENTRY PLTINW(LL,BB,RR,TT) * * PLINIW forces windowing on but uses preset window bounds. * * ENTRY PLINIW * * The next group was for multi-screen plotting and has not been kept up to date * ENTRY TOPINT * * ENTRY MIDINT * * ENTRY BOTINT alias BOTINT * * ENTRY BTMINT alias BTMINT * * ENTRY TOPTST * * ENTRY MIDTST * * ENTRY BOTTST alias BTMTST * * ENTRY BTMTST alias BOTTST * * PLINTS is like PLINIT, but initializes only if not already done. * * ENTRY PLINTS * * PLINWS is like PLTINW, but initializes only if not already done. * * ENTRY PLINWS(LL,BB,RR,TT) * * PLINOB is like PLINIT, but initializes without a border (frame). * * ENTRY PLINOB * *-----------------------------------------------------------------------------* * PLTTRM does various (non-critical) cleanup for after plotting. * * SUBROUTINE PLTTRM * **----------------------------------------------------------------------------* **These last five routines are the the ones implementing the iso-intensity * **tracing functions. PLISO, PLIS0 and FLISO are variant forms of the tracing * **routines, LEGIT and NABOR are subroutines used by them. * ** SUBROUTINE PLISO(ARRAY,X,Y) *

*-----------------------------------------------------------------------------* * SUBROUTINE LEGIT(X,Y,OK,ARRAY,X100,Y100) * **----------------------------------------------------------------------------* ** SUBROUTINE NABOR(K3,L3,K100,L100,XDIR,YDIR,ARRAY,X,Y) * **----------------------------------------------------------------------------* ** SUBROUTINE PLIS0(ARRAY,X,Y) * *-----------------------------------------------------------------------------* * SUBROUTINE FLISO(ARRAY,X,Y) * ******************************************************************************* *---------------------------------------------------------------------SUBROUTINE PLTPAR(A256,LX,LY) *---------ENTRY PARPLT(A256,LX,LY) CHARACTER*1 TC,TCALGN(2) REAL R256(256,2,5),R258(258,2,5),R493(493,2,5),R500(500,2,5) INTEGER*4 CMAGF,XART,YART,XOP,YOP,XLOC,YLOC,ARRADR INTEGER*4 PICPAG,GRPHPG,GEWAIT,XLIM,YLIM,HILO,MAG INTEGER*4 LX,LY,X,Y,BIG,SMALL,KADDR,IA128,IA256,IA512 INTEGER*2 ASC,SCAN,KBF1,KBF2,ERR,IASC,ISCAN,IKBF1,IKBF2,IERR INTEGER*2 A256(LX,LY) LOGICAL DOX,DOY,MANUAL,REPEAT,FLAG LOGICAL*2 RSH,LSH,CTRL,ALT,SCRL,NUML,CAPS,INS,ABORT,ESCAPE,INTRPT EQUIVALENCE (ASC,IASC),(SCAN,ISCAN),(KBF1,IKBF1),(KBF2,IKBF2),(ERR,IERR) EQUIVALENCE (R256(1,1,1),R258(1,1,1),R493(1,1,1),R500(1,1,1)) EQUIVALENCE (TCALGN(1),IASC),(TCALGN(2),TC) COMMON /OMAPR2/IIXLEN,IIYLEN,IXLEN,IYLEN,IA256,IA512,/PARPLZ/R500 COMMON /BLKLIM/XLIM,YLIM,/BLKCNV/MAG,HILO,CONTRS,BRIGHT,BASLOG COMMON /GEWRTN/REPEAT,NMAG,CNTRS,BRGHT,BASVAL COMMON /KEYGET/IASC,ISCAN,IKBF1,IKBF2,IERR COMMON /SHFSTA/RSH,LSH,CTRL,ALT,SCRL,NUML,CAPS,INS COMMON /BLKPRM/CMAGF,XART,YART,XOP,YOP,XLOC,YLOC,ARRADR COMMON /NTRVN/ABORT,ESCAPE,INTRPT,/TWOPAR/PICPAG,GRPHPG SAVE /NTRVN/,/KEYGET/,/SHFSTA/,/BLKLIM/,/PARPLZ/,/OMAPR2/,/BLKCNV/,/BLKPRM / MANUAL = .TRUE. REPEAT = .FALSE. DOX = .TRUE. DOY = .FALSE. ARRADR = KADDR(A256(1,1)) 9999 CONTINUE Y = (1+LY)/2 YLOC = Y XLOC = 0 9998 CONTINUE CALL LEDSET(4) CALL USEPG0 IF (.NOT.MANUAL) THEN IF (XLOC.NE.0.AND.YLOC.EQ.0) CALL PARPLY(A256,LX,LY) IF (YLOC.NE.0.OR.XLOC.EQ.0) CALL PARPLX(A256,LX,LY) ELSE IF (.NOT.REPEAT) THEN CALL NORML2(A256(1,1),LX,LY) IF ((ASC.EQ.3).OR.(ASC.EQ.0.AND.SCAN.EQ.$2E)) GOTO 9898 IF ((LSH.OR.RSH).AND.SCAN.EQ.121) GOTO 9898 IF (SCRL.AND.RSH.AND.SCAN.EQ.$4F) GOTO 9898 ENDIF REPEAT = .FALSE. CALL SETPG0 CALL GRCLS GRPHPG = 0

PICPAG = 1 IF (XLOC.NE.0.AND.YLOC.EQ.0) CALL PARPLY(A256,LX,LY) IF (YLOC.NE.0.OR.XLOC.EQ.0) CALL PARPLX(A256,LX,LY) CALL USEPG1 II = IBLKDS(A256,LX,LY) CALL SETPG0 9898 CONTINUE II = GEWAIT(A256,LX,LY) IF (REPEAT) GOTO 9998 CALL SETPG0 CALL GRCLS ENDIF RETURN *---------ENTRY PARPL(A256,LX,LY) MANUAL = .FALSE. ARRADR = KADDR(A256(1,1)) GOTO 9999 END *---------------------------------------------------------------------SUBROUTINE PLOTMS CHARACTER*78 SCMESS REAL XMIN,XMAX,YMIN,YMAX,XOFF,XSCALE,YOFF,YSCALE REAL SCALES(2,2) REAL*4 RLEFT,RRIGHT,RTOP,RBOTM INTEGER*4 SLEFT,SRIGHT,STOP,SBOTM,GRPAGE,DSPAGE INTEGER*4 PLTRMN,PLTRMX,PLTDMN,PLTDMX LOGICAL*2 HIGH,RIGHT,REVERS,ORD,NOWR,XOR COMMON /TIKGRD/XMIN,XMAX,YMIN,YMAX,XOFF,XSCALE,YOFF,YSCALE COMMON /SCALEM/SCMESS,/AUTOSC/SCALES COMMON /THEWIN/SLEFT,SRIGHT,STOP,SBOTM,RLEFT,RRIGHT,RTOP,RBOTM COMMON /PLOTSZ/PLTRMN,PLTRMX,PLTDMN,PLTDMX HIGH = .TRUE. RIGHT = .TRUE. REVERS = .FALSE. 9999 CONTINUE ORD = .TRUE. NOWR = .FALSE. 9998 CONTINUE IF (HIGH) THEN LINE = 1 ELSE LINE = 23 ENDIF IF (.NOT.ORD) GOTO 8001 SCMESS = ' ' WRITE (SCMESS,8000,ERR=8001) XMIN,XMAX,YMIN,YMAX 8000 FORMAT('Xmin=',G13.6,' Xmax=',G13.6,'; Ymin=',G13.6,' Ymax=',G13.6) 8001 CONTINUE IF (NOWR) RETURN XOR = .FALSE. 8002 CONTINUE IPAGE = GRPAGE() IF (IPAGE.EQ.0) THEN IUNIT = 12 IF (LINE.GE.25) THEN IUNIT = 11 LINE = MOD(LINE,2) ENDIF ELSE

IUNIT = 13 IF (LINE.GE.24) LINE = 23 + MOD(LINE,2) ENDIF DO 1001 I = 76,1,-1 J = I IF (SCMESS(I:I).NE.' ') GOTO 1002 1001 CONTINUE RETURN 1002 CONTINUE IF (RIGHT) THEN J = J + 1 K = 78 - J L = 78 ELSE K = 1 L = J + 1 ENDIF IF (XOR) THEN CALL SAYATX(IUNIT,LINE,K,SCMESS(1:J)) ELSE CALL SAYAT(IUNIT,LINE,K,SCMESS(1:J)) ENDIF IF (REVERS) CALL RVRBLK(LINE,K,L) RETURN *---------ENTRY PLTMLR HIGH = .FALSE. RIGHT = .TRUE. REVERS = .TRUE. GOTO 9999 *---------ENTRY PLTMLL HIGH = .FALSE. RIGHT = .FALSE. REVERS = .TRUE. GOTO 9999 *---------ENTRY PLTMHL HIGH = .TRUE. RIGHT = .FALSE. REVERS = .TRUE. GOTO 9999 *---------ENTRY PLTMHR HIGH = .TRUE. RIGHT = .TRUE. REVERS = .TRUE. GOTO 9999 *---------ENTRY PL0TMS ORD = .FALSE. HIGH = .TRUE. RIGHT = .TRUE. REVERS = .FALSE. NOWR = .FALSE. GOTO 9998 *---------ENTRY MKPLMS ORD = .TRUE. NOWR = .TRUE.

GOTO 9998 *---------ENTRY PLMS(NQNQ) ENTRY PLMSR(NQNQ) LINE = NQNQ RIGHT = .TRUE. REVERS = .FALSE. NOWR = .FALSE. GOTO 8001 *---------ENTRY PLMSL(NQNQ) LINE = NQNQ RIGHT = .FALSE. REVERS = .FALSE. NOWR = .FALSE. GOTO 8001 *---------ENTRY PLMSX(NQNQ) ENTRY PLMSXR(NQNQ) LINE = NQNQ RIGHT = .TRUE. REVERS = .FALSE. NOWR = .FALSE. XOR = .TRUE. GOTO 8002 *---------ENTRY PLMSXL(NQNQ) LINE = NQNQ RIGHT = .FALSE. REVERS = .FALSE. NOWR = .FALSE. XOR = .TRUE. GOTO 8002 *---------ENTRY PLXTMS LINE = 1 RIGHT = .TRUE. REVERS = .FALSE. NOWR = .FALSE. XOR = .TRUE. GOTO 8002 END *---------------------------------------------------------------------SUBROUTINE BAR2(IT,LEN,IST) CHARACTER*74 MESS(2) CHARACTER*1 TC,TCALGN(2),AC,MESS1(74),MESS2(74) REAL*4 RLEFT,RRIGHT,RTOP,RBOTM,SCALES(2,2) REAL*4 XMIN,XMAX,YMIN,YMAX,XOFF,XSCALE,YOFF,YSCALE INTEGER*4 SM2IT,B2GIT,BIG,SMALL,ALLOC,BASE,LEFT,RIGHT,TOP,BOT INTEGER*4 BEGIN,END,LEN,IST,SLEFT,SRIGHT,STOP,SBOTM,FILLWD(7) INTEGER*4 GRPAGE,DSPAGE,IKKIKK,IJIJIJ,HEIGHT,L,B,R,T INTEGER*4 INDEX3,PLTRMN,PLTRMX,PLTDMN,PLTDMX,IGNORE,CUMUL(0:16383) INTEGER*2 ASC,SCAN,KBF1,KBF2,ERR,IASC,ISCAN,IKBF1,IKBF2,IERR INTEGER*2 IT(LEN),PROFIL(0:16383) LOGICAL*2 RSH,LSH,CTRL,ALT,SCRL,NUML,CAPS,INS,QUIET LOGICAL*2 ABORT,ESCAPE,INTRPT,HALF,USEWIN EQUIVALENCE (MESS(1),MESS1(1)),(MESS(2),MESS2(1)) EQUIVALENCE (ASC,IASC),(SCAN,ISCAN),(KBF1,IKBF1),(KBF2,IKBF2),(ERR,IERR) EQUIVALENCE (TCALGN(1),IASC),(TCALGN(2),TC) COMMON /TIKGRD/XMIN,XMAX,YMIN,YMAX,XOFF,XSCALE,YOFF,YSCALE

COMMON /THEWIN/SLEFT,SRIGHT,STOP,SBOTM,RLEFT,RRIGHT,RTOP,RBOTM COMMON /SHFSTA/RSH,LSH,CTRL,ALT,SCRL,NUML,CAPS,INS COMMON /KEYGET/IASC,ISCAN,IKBF1,IKBF2,IERR,/WIN/USEWIN,L,B,R,T COMMON /PLOTSZ/PLTRMN,PLTRMX,PLTDMN,PLTDMX,/PARCUM/IGNORE,PROFIL,CUMUL COMMON /NTRVN/ABORT,ESCAPE,INTRPT,/FILLS/FILLWD,/AUTOSC/SCALES SAVE /NTRVN/,/KEYGET/,/SHFSTA/,/TIKGRD/,/FILLS/,/AUTOSC/,/THEWIN/ SAVE /PLOTSZ/,/USEWIN/,/WIN/,/PARCUM/ EXTERNAL GRPAGE,DSPAGE SAVE QUIET = .FALSE. 9999 CONTINUE I = LEN SMALL = SM2IT(IT(1),I) I = LEN BIG = B2GIT(IT(1),I) IF (SMALL.GT.BIG) SMALL = 0 HALF = (BIG.GT.16380.OR.SMALL.LT.-16380) LEN4 = LEN*2 J = 74 WRITE (MESS(1),'(A,I6,A,I6)',ERR=8001) 'Baseline: ',SMALL,' Top: ',BIG WRITE (MESS(2),'(A,I6,A,I6)',ERR=8001) 'Left: ',IST,' Right: ',LEN+IST -1 DO 7999 I = 74,1,-1 J = I IF (MESS1(I).NE.' ') GOTO 7998 IF (MESS2(I).NE.' ') GOTO 7998 7999 CONTINUE 7998 CONTINUE MSTART = 74 - J 8001 CONTINUE PLTDMN = IST PLTDMX = LEN+IST-1 PLTRMN = SMALL PLTRMX = BIG IJIJIJ = DSPAGE() IKKIKK = GRPAGE() IF (HALF) THEN BIG = (BIG+1)/2 SMALL = (SMALL-1)/2 MARK = ALLOC(0) ISAVE = ALLOC(LEN4) CALL DIC0PY(IT,ISAVE,LEN4) I = LEN CALL ASRIT(IT,I) ENDIF IF (IGNORE.LE.0) IGNORE = 300 IR2 = (BIG - SMALL)/IGNORE IGN = SMALL + IR2 BASE = SMALL IF (LEN.LE.16371) THEN MN = LEN/100 IF (MN.LE.0) MN = 1 IOFF = 0 LEFT = -MN RIGHT = LEN+MN ELSEIF (LEN.GE.16372.AND.LEN.LE.32766) THEN IOFF = - (LEN/2 + 1) LEFT = IOFF-4 RIGHT = IOFF + LEN + 4 ENDIF

HEIGHT = BIG - SMALL MN = HEIGHT/100 IF (MN.LE.0) MN = 1 TOP = BIG + MN BOT = SMALL - MN BEGIN = IOFF END = LEN + IOFF KKIKKI = IKKIKK CALL USEPG(KKIKKI) CALL CRSROF CALL PXLSET CALL FILWRD($FFFF) KKIKKI = IKKIKK CALL DISPG(KKIKKI) CALL CRSROF IF (USEWIN) CALL SETWIN(L,B,R,T) CALL GRCLSW CALL SETMAP(LEFT,BOT,RIGHT,TOP) IF (USEWIN) CALL SETWIN(L,B,R,T) JIJIJI = IJIJIJ CALL DISPG(JIJIJI) IF (.NOT.USEWIN) THEN CALL GRCLS IF (IKKIKK.EQ.0) THEN CALL SAYAT(12,0,MSTART,MESS(1)) CALL SAYAT(12,1,MSTART,MESS(2)) ELSE CALL SAYAT(13,0,MSTART,MESS(1)) CALL SAYAT(13,1,MSTART,MESS(2)) ENDIF ENDIF CALL PXLSET CALL FILWRD($FFFF) * JIJIJI = IJIJIJ CALL DISPG(JIJIJI) DO 2 I = 1,LEN IF (IT(I).GT.IGN) THEN CALL SETCOP(I+IOFF,BASE) CALL VECTOR(I+IOFF,IT(I)) ENDIF CALL ISNTRP IF (ERR.EQ.0) THEN IF (ABORT) STOP ' User ABORT detected in BAR2' IF (INTRPT.OR.ESCAPE) GOTO 9000 CALL SHIFTS IF (SCRL.AND.SCAN.EQ.$3D) CALL DSPSWP IF (ASC.EQ.14.OR.ASC.EQ.27.OR.(ASC.EQ.0.AND.SCAN.EQ.$31)) GOTO 900 0 ENDIF 2 CONTINUE 9000 CONTINUE CALL SETCOP(BEGIN,BASE) CALL FILWRD($3E3E) CALL VECTOR(END,BASE) CALL SETCOP(BEGIN,BASE) CALL VECTOR(BEGIN,BIG) CALL VECTOR(END,BIG) CALL VECTOR(END,BASE) IF (QUIET) GOTO 3131

133

33

30 31

34 35

233 3131

CALL FILWRD($4924) CALL PXLXOR IF (LEN.GE.16300) THEN DO 133 I = 1,3 R = FLOAT(I)*0.25 D = R*FLOAT(LEN) +0.5 MX = IOFF + D CALL SETCOP(MX,BASE) CALL VECTOR(MX,BIG) CONTINUE ELSEIF (LEN.GT.30) THEN DO 33 I = 1,4 R = FLOAT(I)*0.2 D = R*FLOAT(LEN) +0.5 MX = IOFF + D CALL SETCOP(MX,BASE) CALL VECTOR(MX,BIG) CONTINUE ENDIF IF (HEIGHT.GT.30) THEN NN = 5 ELSEIF (HEIGHT.GT.8) THEN DO 30 N = 3,1,-1 NN = N + 1 JH = MOD(HEIGHT,NN) IF (JH.EQ.0) GOTO 31 CONTINUE GOTO 35 ENDIF CONTINUE T = 1.0/FLOAT(NN) N = NN - 1 DO 34 I = 1,N R = FLOAT(I)*T D = R*FLOAT(HEIGHT) +0.5 MY = BASE + D CALL SETCOP(BEGIN,MY) CALL VECTOR(END,MY) CONTINUE CONTINUE CALL FILWRD($4210) IF (LEN.GE.16300) THEN DO 233 I = 1,7,2 R = FLOAT(I)*0.125 D = R*FLOAT(LEN) +0.5 MX = IOFF + D CALL SETCOP(MX,BASE) CALL VECTOR(MX,BIG) CONTINUE ENDIF CONTINUE CALL FILWRD($FFFF) CALL PXLSET CALL RSTMAP CALL PLTTRM KKIKKI = IKKIKK CALL DISPG(KKIKKI) KKIKKI = IKKIKK CALL USEPG(KKIKKI) CALL RSTMAP

IF (HALF) THEN CALL IDC0PY(ISAVE,IT,LEN4) CALL RLSE(MARK) ENDIF RETURN *---------ENTRY BARQ(IT,LEN,IST) QUIET = .TRUE. GOTO 9999 END **---------------------------------------------------------------------* SUBROUTINE PLOTI2(IT,LEN) * INTEGER*2 LEN*4,IT(LEN) * INTEGER*4 SM2IT,B2GIT,BIG,SMALL,KADDR,ALLOC,AR,TBUF,AR2 * REAL XMIN,XMAX,YMIN,YMAX,XOFF,XSCALE,YOFF,YSCALE * COMMON /TIKGRD/XMIN,XMAX,YMIN,YMAX,XOFF,XSCALE,YOFF,YSCALE * INTEGER FILLWD(7) * COMMON /FILLS/FILLWD * REAL SCALES(2,2) * COMMON /AUTOSC/SCALES * INTEGER*4 SLEFT,SRIGHT,STOP,SBOTM * REAL*4 RLEFT,RRIGHT,RTOP,RBOTM * COMMON /THEWIN/SLEFT,SRIGHT,STOP,SBOTM,RLEFT,RRIGHT,RTOP,RBOTM * EXTERNAL AUTO,DOAPLT,CALL3,CALL5 * LOGICAL*2 ABORT,ESCAPE,INTRPT * COMMON /NTRVN/ ABORT,ESCAPE,INTRPT * SAVE /NTRVN/ * INTEGER*2 ASC,SCAN,KBF1,KBF2,ERR * INTEGER*2 IASC,ISCAN,IKBF1,IKBF2,IERR * EQUIVALENCE (ASC,IASC),(SCAN,ISCAN),(KBF1,IKBF1),(KBF2,IKBF2),(ERR,IERR) * COMMON /KEYGET/IASC,ISCAN,IKBF1,IKBF2,IERR * CHARACTER*1 TC,TCALGN(2) * EQUIVALENCE (TCALGN(1),IASC),(TCALGN(2),TC) * LOGICAL*2 RSH,LSH,CTRL,ALT,SCRL,NUML,CAPS,INS * COMMON /SHFSTA/RSH,LSH,CTRL,ALT,SCRL,NUML,CAPS,INS * SAVE /KEYGET/,/SHFSTA/ * MARK = ALLOC(0) * LEN8 = LEN*8 * TBUF = ALLOC(LEN8) * NOPNTS = LEN * NOPLTS = 1 ** * LEN4 = LEN*4 * DO 1 I = 1,LEN * X = FLOAT(I) * Y = FLOAT(IT(I)) * AR = TBUF + I*4 * AR2 = AR + LEN4 * CALL LPOKE(AR,X) * CALL LPOKE(AR2,Y) * CALL ISNTRP * IF (ABORT.OR.ESCAPE.OR.INTRPT) GOTO 9000 * IF (ERR.EQ.0) THEN * CALL SHIFTS * IF (SCRL.AND.SCAN.EQ.$3D) CALL DSPSWP * ENDIF * 1 CONTINUE ** * KPNTS = KADDR(NOPNTS) * KPLTS = KADDR(NOPLTS)

* AR = TBUF * CALL CALL3(AUTO,AR,KPNTS,KPLTS) * CALL PLTINT * CALL GENTIK * AR = TBUF * AR2 = TBUF + LEN4 * KPNTS = KADDR(NOPNTS) * KSCALE = KADDR(SCALES(1,1)) * KFFFF = KADDR(FILLWD(1)) * CALL CALL5(DOAPLT,AR,AR2,KPNTS,KSCALE,KFFFF) * 9000 CONTINUE * CALL PLTTRM * CALL RLSE(MARK) * RETURN * END *---------------------------------------------------------------------SUBROUTINE PARMKL CHARACTER*17 MESS INTEGER*4 XLIM,YLIM,HILO,MAG,PICPAG,GRPHPG,XMAG,XSAV,YSAV INTEGER*4 CMAGF,XART,YART,XOP,YOP,XLOC,YLOC,ARRADR,L,B,R,T LOGICAL*4 REPEAT,FLAG,DOIT LOGICAL*2 USEWIN,WINSAV,MULTI,FANCY,NQUIET COMMON /TWOPAR/PICPAG,GRPHPG,/BLKCNV/MAG,HILO,CONTRS,BRIGHT,BASLOG COMMON /GEWRTN/REPEAT,NMAG,CNTRS,BRGHT,BASVAL,/BLKLIM/XLIM,YLIM COMMON /BLKPRM/CMAGF,XART,YART,XOP,YOP,XLOC,YLOC,ARRADR COMMON /WIN/USEWIN,L,B,R,T,/PLTMLT/MULTI,FANCY,/TST170/NQUIET SAVE /BLKLIM/,/BLKCNV/,/GEWRTN/,/BLKPRM/,/TWOPAR/,/WIN/,/PLTMLT/ SAVE XSAV,YSAV,WINSAV EXTERNAL USEPG,PXLXOR,FILWRD,DOFILL,SAYAT SAVE DATA XSAV/-1/,YSAV/-1/ WINSAV = USEWIN USEWIN = .FALSE. CALL SETWIN(0,0,768,479) XMAG = MOD(MAG,8)*3 IF (XMAG.EQ.0) XMAG = 3 IF (CMAGF.EQ.0) CMAGF = 3 DOIT = YLIM .LT. 416 IF (DOIT) THEN IF (YLOC.NE.0) THEN WRITE (MESS,'(''CURSOR @ Y = '',I3.3)',ERR=1) YLOC ELSE WRITE (MESS,'(''CURSOR @ X = '',I3.3)',ERR=1) XLOC ENDIF ENDIF CALL USEPG(PICPAG) CALL PXLXOR CALL FILWRD($FFFF) IF (YLOC.GE.YART.AND.YLOC.LE.YOP) THEN DOIT = (YSAV.NE.YLOC) .OR. DOIT XSAV = -1 YSAV = YLOC I1 = (YLOC-YART)*CMAGF + 4 I2 = I1 + CMAGF - 1 CALL DOFILL(4,I1,XLIM-4,I2) IF (DOIT) WRITE (MESS,'(''CURSOR @ Y = '',I3.3)',ERR=1) YLOC ELSEIF (XLOC.GE.XART.AND.XLOC.LE.XOP) THEN DOIT = (XSAV.NE.XLOC) .OR. DOIT YSAV = -1 XSAV = XLOC

I1 = (XLOC-XART)*XMAG + 4 I2 = I1 + XMAG - 1 CALL DOFILL(I1,4,I2,YLIM-4) IF (DOIT) WRITE (MESS,'(''CURSOR @ X = '',I3.3)',ERR=1) XLOC ENDIF 1 CONTINUE IF (DOIT.AND.NQUIET) THEN CALL PXLSET CALL SAYAT(13,2,0,MESS) ELSE XSAV = -1 YSAV = -1 ENDIF USEWIN = WINSAV IF (WINSAV) CALL SETWIN(L,B,R,T) RETURN END *---------------------------------------------------------------------SUBROUTINE PLTINT *---------ENTRY PLINIT CHARACTER*12 PRFORM REAL*4 RLEFT,RRIGHT,RTOP,RBOTM INTEGER*4 FILLWD(7),UNITNO,SLEFT,SRIGHT,STOP,SBOTM,L,B,R,T INTEGER*4 LL,BB,RR,TT LOGICAL*4 PRSTAT,ALREDY,B0RDER LOGICAL*2 TOP,BOTTOM,MID,WINDOW,USEWIN,RST,XOR COMMON /STATUS/PRSTAT,UNITNO,ALREDY,/WIN/USEWIN,L,B,R,T,/PLMODE/RST,XOR COMMON /FILLS/FILLWD,/CSTAT/PRFORM,/MULTI/TOP,BOTTOM,MID COMMON /THEWIN/SLEFT,SRIGHT,STOP,SBOTM,RLEFT,RRIGHT,RTOP,RBOTM SAVE /STATUS/,/FILLS/,/MULTI/,/THEWIN/,/CSTAT/,/WIN/,/PLMODE/ EXTERNAL SETPRM,RSTMAP,GRINIT,GRCLS,CRSROF,FILWRD,BORDER SAVE WINDOW = .FALSE. GOTO 9909 *---------ENTRY PLTINW(LL,BB,RR,TT) L = LL B = BB R = RR T = TT *---------ENTRY PLINIW WINDOW = .TRUE. 9909 CONTINUE TOP = .FALSE. BOTTOM = .FALSE. MID = .FALSE. CALL SETPRM 9999 CONTINUE ALREDY = .FALSE. 9998 CONTINUE B0RDER = .TRUE. 9997 CONTINUE WINDOW = WINDOW .AND. .NOT.(TOP.OR.BOTTOM.OR.MID) USEWIN = WINDOW IF (ALREDY) RETURN IF (USEWIN) THEN CALL SETWIN(L,B,R,T) CALL SMPMOD(2)

ELSE CALL SETWIN(0,0,767,479) CALL SMPMOD(0) ENDIF PRFORM = 'UNFORMATTED' INQUIRE (FILE='#PR',OPENED=PRSTAT,FORM=PRFORM,NUMBER=UNITNO) IF (PRSTAT) THEN CLOSE(UNIT=UNITNO) ELSE UNITNO = 7 ENDIF IF (MID) THEN SBOTM = 0 STOP = 479 RBOTM = 0.0 RTOP = 479.0 ELSEIF (.NOT.(TOP.OR.MID.OR.BOTTOM)) THEN CALL SETPRM ENDIF CALL RSTMAP IF (WINDOW) THEN CALL GRINIW(L,B,R,T) ELSE CALL GRINIT ENDIF CALL CRSROF CALL PXLSET CALL FILWRD($FFFF) IF (RST) THEN CALL GRFLSW * ENTRY FFILL(X,Y,ENDX,ENDY,MODE,IFILL) CALL FFILL(0,0,767,479,1,$FFFFFFFF) CALL PXLRST ELSE CALL GRCLSW ENDIF CALL FILWRD($FFFF) IF (RST) CALL PXLRST IF (XOR) CALL PXLXOR IF (B0RDER) CALL BORDER FILLWD(1) = $FFFF FILLWD(2) = $AAAA FILLWD(3) = $CCCC FILLWD(4) = $F0F0 FILLWD(5) = $FC3F FILLWD(6) = $F99F FILLWD(7) = $A9C5 ALREDY = .TRUE. RETURN *---------ENTRY TOPINT TOP = .TRUE. MID = .FALSE. BOTTOM = .FALSE. GOTO 9999 *---------ENTRY MIDINT MID = .TRUE. TOP = .FALSE. BOTTOM = .FALSE.

GOTO 9999 *---------ENTRY BOTINT ENTRY BTMINT BOTTOM = .TRUE. MID = .FALSE. TOP = .FALSE. GOTO 9999 *---------ENTRY TOPTST ALREDY = (.NOT.(MID.OR.BOTTOM)).AND.ALREDY TOP = .TRUE. MID = .FALSE. BOTTOM = .FALSE. GOTO 9998 *---------ENTRY MIDTST ALREDY = (.NOT.(TOP.OR.BOTTOM)).AND.ALREDY MID = .TRUE. TOP = .FALSE. BOTTOM = .FALSE. GOTO 9998 *---------ENTRY BOTTST ENTRY BTMTST ALREDY = (.NOT.(TOP.OR.MID)).AND.ALREDY BOTTOM = .TRUE. MID = .FALSE. TOP = .FALSE. GOTO 9998 *---------ENTRY PLINTS ALREDY = ALREDY .AND. (.NOT.(TOP.OR.MID.OR.BOTTOM)) TOP = .FALSE. MID = .FALSE. BOTTOM = .FALSE. WINDOW = .FALSE. GOTO 9998 *---------ENTRY PLINWS(LL,BB,RR,TT) L = LL B = BB R = RR T = TT ALREDY = ALREDY .AND. (.NOT.(TOP.OR.MID.OR.BOTTOM)) WINDOW = .NOT.(TOP.OR.MID.OR.BOTTOM) USEWIN = WINDOW TOP = .FALSE. MID = .FALSE. BOTTOM = .FALSE. GOTO 9998 *---------ENTRY PLINOB ALREDY = .FALSE. WINDOW = .FALSE. TOP = .FALSE. MID = .FALSE. BOTTOM = .FALSE. B0RDER = .FALSE. GOTO 9997

END *---------------------------------------------------------------------SUBROUTINE PLTTRM CHARACTER*12 PRFORM REAL*4 RLEFT,RRIGHT,RTOP,RBOTM INTEGER*4 SLEFT,SRIGHT,STOP,SBOTM,UNITNO LOGICAL*4 PRSTAT,ALREDY LOGICAL*2 TOP,BOTTOM,MID COMMON /STATUS/PRSTAT,UNITNO,ALREDY,/CSTAT/PRFORM COMMON /MULTI/TOP,BOTTOM,MID COMMON /THEWIN/SLEFT,SRIGHT,STOP,SBOTM,RLEFT,RRIGHT,RTOP,RBOTM SAVE /STATUS/,/CSTAT/,/MULTI/,/THEWIN/ EXTERNAL CRSRON,PXLSET,FILWRD SAVE TOP = .FALSE. BOTTOM = .FALSE. MID = .FALSE. IF (PRSTAT) OPEN (UNIT=UNITNO,FILE='#PR',FORM=PRFORM,ERR=9999) CALL CRSRON 9999 ALREDY = .FALSE. CALL FILWRD($FFFF) CALL PXLSET RETURN END **---------------------------------------------------------------------SUBROUTINE PLISO(ARRAY,X,Y) CALL FLISO(ARRAY,X,Y) RETURN END * SUBROUTINE PLISO(ARRAY,X,Y) * CHARACTER*44 MESS,TC*1,TCALGN(2)*1 * REAL*4 RATE(0:8,0:8),RDELTA,IRATE * INTEGER*4 X,Y,NL,IXQL(0:8),IYQL(0:8),NP,IXP(0:8),IYP(0:8),K1,L1,IFOO * INTEGER*4 DELTA,DIV,XDIV,YDIV,DELTA1,DELTA2,MODE,IX,IY,KK1,LL1,IBAR * INTEGER*2 ARRAY(X,Y),BIG,SMALL,RANGE,BASE,TOL,HIGH,LOW,BIGA,SMALLA,I16384 * INTEGER*2 ASC,SCAN,KBF1,KBF2,ERR,IASC,ISCAN,IKBF1,IKBF2,IERR * LOGICAL*2 ABORT,ESCAPE,INTRPT,RSH,LSH,CTRL,ALT,SCRL,NUML,CAPS,INS * LOGICAL*2 ISIT,OK,OK2 * EQUIVALENCE (ASC,IASC),(SCAN,ISCAN),(KBF1,IKBF1),(KBF2,IKBF2),(ERR,IERR) * EQUIVALENCE (TCALGN(1),IASC),(TCALGN(2),TC) * COMMON /KEYGET/IASC,ISCAN,IKBF1,IKBF2,IERR,/NTRVN/ABORT,ESCAPE,INTRPT * COMMON /SHFSTA/RSH,LSH,CTRL,ALT,SCRL,NUML,CAPS,INS * COMMON /PARNML/BIGA,SMALLA,RANGE,/PARNM2/BIG,SMALL,MODE,I16384 * COMMON /ISOCM1/HIGH,LOW,OK2/ISOCM3/BASE,TOL * SAVE /KEYGET/,/SHFSTA/,/NTRVN/,/ISOCM1/,/ISOCM3/ * EXTERNAL GETPXL,LEGIT,NABOR,ISOMAP,PXLSET,WSAYAT * SAVE * IX = X * IY = Y * CALL ISOMAP(IX,IY) * LOW = BASE - TOL * HIGH = BASE + TOL * IF (LOW.LT.SMALL) LOW = SMALL * IF (HIGH.GT.BIG) HIGH = BIG * WRITE (MESS,'(''o'',A,I5,A,I3,A,I5,A,I5)',ERR=9111) 'Tracing ',BASE,' +/',TOL,' == ',LOW,' to ',HIGH * 9111 CONTINUE * CALL WSAYAT(12,0,5,MESS) * CALL PXLSET * MIDX = (1+X)/2

* MIDY = (1+Y)/2 * CALL LEDSET(4) ** NEW STUFF - FIND AN ISO-INTENSITY LINE & FOLLOW IT * DO 2100 LL1 = 0,(Y-1) * IFOO = LL1 - 2*(LL1/2) * IBAR = LL1/2 * IF (IFOO.EQ.0) THEN * L1 = MIDY - IBAR - 1 * ELSE * L1 = MIDY + IBAR * ENDIF * DO 2101 KK1 = 0,(X-1) * ERR = -1 * CALL ISNTRP * IF (ABORT.OR.ESCAPE.OR.INTRPT) GOTO 2099 * IF (ERR.EQ.0) THEN * CALL SHIFTS * IF (SCRL.AND.SCAN.EQ.$3D) CALL DSPSWP * ENDIF * IFOO = KK1 - 2*(KK1/2) * IBAR = KK1/2 * IF (IFOO.EQ.0) THEN * K1 = MIDX - IBAR - 1 * ELSE * K1 = MIDX + IBAR * ENDIF * CALL LEGIT(K1,L1,OK,ARRAY,X,Y) * IF (OK) CALL GETPXL(K1,L1,ISIT) * IF (.NOT.ISIT.AND.OK) THEN * CALL SETCOP(K1,L1) * CALL DOPIXL(K1,L1) *C FIND OPTIMUM DIRECTION * NL=-1 * DO 2200 IX=-1,1 * DO 2201 IY=-1,1 * IF (IX.EQ.0.AND.IY.EQ.0) GOTO 2202 * CALL LEGIT(K1+IX,L1+IY,OK,ARRAY,X,Y) * IF (OK) CALL GETPXL(K1+IX,L1+IY,ISIT) * IF (.NOT.ISIT.AND.OK) THEN * NL=NL+1 * IXQL(NL)=IX * IYQL(NL)=IY * ENDIF * 2202 CONTINUE * 2201 CONTINUE * 2200 CONTINUE *C TO THIS POINT WE HAVE AN ARRAY CONTAINING THE LEGIT DIRECTIONS TO A POINT *C NEXT MISSION:CHOOSE TWO BEST POINTS *C NL+1 IS NUMBER OF LEGIT POINTS *C K1,L1 IS THE CURRENT OPERATING POINT *C IF THERE ARE 3 OR MORE LEGIT NABORS, CHOOSE OPTIMUM PAIR * IF (NL+1.GE.3) THEN * DO 2212 NL1=0,NL * DO 2211 NL2=NL1+1,NL *C CHECK FOR NABORNESS (BAD!) & OPPOSITENESS (GOOD!) * XDIV=ABS(IXQL(NL1)-IXQL(NL2)) * YDIV=ABS(IYQL(NL1)-IYQL(NL2)) * DIV=XDIV+YDIV * DELTA1=ARRAY(K1+IXQL(NL1),L1+IYQL(NL1))-BASE * DELTA2=ARRAY(K1+IXQL(NL2),L1+IYQL(NL2))-BASE

* DELTA=ABS(DELTA1)+ABS(DELTA2) * RDELTA=DELTA * IF (DIV.GT.4.OR.DIV.LT.1) THEN * PRINT *,'DIVERGENCE ERROR',DIV * STOP * ELSEIF (DIV.EQ.4) THEN *C PAIR => RATING OF 100 * RATE(NL1,NL2)=100/RDELTA * ELSEIF (DIV.EQ.3) THEN *C "ALMOST" PAIR => RATING OF 75 * RATE(NL1,NL2)=75/RDELTA * ELSEIF (DIV.EQ.2) THEN *C PERPENDICULAR => RATING OF 50 * RATE(NL1,NL2)=50/RDELTA * ELSEIF (DIV.EQ.1) THEN *C NABORS => RATING OF 0 * RATE(NL1,NL2)=0 * ENDIF *C THE RATING OF A PAIR IS REFERENCED BY TWO INDICES REPRESENTING *C THE TWO POINTS IN THE PAIR. THE LOWER POINT INDEX IS GIVEN FIRST. *C THE DESIRABILITY OF A PAIR IS DIRECTLY PROPORTIONAL TO ITS DEGREE OF OPPOSITE NESS *C AND INVERSELY PROPORTIONAL TO THE DIVERGENCE OF ITS MEMBERS FROM THE BASE * 2211 CONTINUE * 2212 CONTINUE *C NOW WE HAVE A QUANITATIVE WAY TO COMPARE PAIRS * IRATE=-1. *C FIND HIGHEST RATING * DO 2215 NL1=0,NL * DO 2214 NL2 = NL1+1,NL * IF (RATE(NL1,NL2).GT.IRATE) THEN * IRATE=RATE(NL1,NL2) * IJ1=NL1 * IJ2=NL2 * ENDIF * 2214 CONTINUE * 2215 CONTINUE *C OPTIMAL PAIR HAS XDIR,YDIR OF INDICES IJ1,IJ2 AND RATING OF RATE *C IF RATE 0, THEN WE ARE STUCK WITH NABORS *C IF TWO OK POINTS NABOR DISCARD THE ONE FARTHER FROM THE BASE] * IF (.NOT. (IRATE.EQ.0)) THEN * CALL NABOR(K1,L1,K1,L1,IXQL(IJ1),IYQL(IJ1),ARRAY,X,Y) * CALL NABOR(K1,L1,K1,L1,IXQL(IJ2),IYQL(IJ2),ARRAY,X,Y) * ELSE * IF (ABS(ARRAY(K1+IXQL(IJ1),L1+IYQL(IJ1))-BASE).LT. * & (ABS(ARRAY(K1+IXQL(IJ2),L1+IYQL(IJ2))-BASE))) THEN * CALL NABOR(K1,L1,K1,L1,IXQL(IJ1),IYQL(IJ1),ARRAY,X,Y) * ELSE * CALL NABOR(K1,L1,K1,L1,IXQL(IJ2),IYQL(IJ2),ARRAY,X,Y) * ENDIF * ENDIF *C IF WE ARE HERE, THEN WE SHOULD HAVE EITHER 0, 1, OR 2 LEGIT POINTS TO TRY *C IF 0, ABANDON; IF 1 FOLLOW; IF TWO CHECK FOR NABORS, THEN FOLLOW *C BEFORE, WE CHECKED FOR 3 OR MORE LEGIT POINTS. IF THE BEST PAIR TURNED OUT *C TO BE NABORS, WE CHOSE THE OPTIMUM POINT BETWEEN THE TWO. BUT IT SEEMS *C THIS NEVER HAPPENED AND WOULD HAPPEN ONLY HERE AND NOW. * ELSEIF(NL+1.EQ.2) THEN * XDIV=ABS(IXQL(0)-IXQL(1)) * YDIV=ABS(IYQL(0)-IYQL(1)) * DIV = XDIV + YDIV

* IF (DIV.LT.1.OR.DIV.GT.4) THEN * PRINT *,'DIVERGENCE ERROR .',DIV * STOP * ENDIF * IF (DIV.EQ.1) THEN * IF((ABS(ARRAY(K1+IXQL(1),L1+IYQL(1))-BASE)).LT. * & (ABS(ARRAY(K1+IXQL(0),L1+IYQL(0))-BASE))) THEN * CALL NABOR(K1,L1,K1,L1,IXQL(1),IYQL(1),ARRAY,X,Y) * ELSE * CALL NABOR(K1,L1,K1,L1,IXQL(0),IYQL(0),ARRAY,X,Y) * ENDIF * ELSE * CALL NABOR(K1,L1,K1,L1,IXQL(0),IYQL(0),ARRAY,X,Y) * CALL NABOR(K1,L1,K1,L1,IXQL(1),IYQL(1),ARRAY,X,Y) * ENDIF * ELSEIF(NL+1.EQ.1) THEN * CALL NABOR(K1,L1,K1,L1,IXQL(0),IYQL(0),ARRAY,X,Y) * ENDIF * ENDIF * 2101 CONTINUE * 2100 CONTINUE * 2099 CONTINUE * CALL SETPG0 * CALL RSTMAP * CALL LEDSON * RETURN * END *--------------------------------------------------------------------SUBROUTINE LEGIT(X,Y,OK,ARRAY,X100,Y100) INTEGER*4 X,Y,X100,Y100,XTEST,YTEST INTEGER*2 HIGH,LOW,BASE,ARRAY(X100,Y100),CTR,QUERY,TOL LOGICAL*2 OK,OK2 COMMON /ISOCM1/HIGH,LOW,OK2/ISOCM3/BASE,TOL SAVE /ISOCM1/,/ISOCM3/ SAVE OK2 = .FALSE. IF (X.GE.X100.OR.Y.GE.Y100.OR.X.LE.1.OR.Y.LE.1) GOTO 5200 CTR = ARRAY(X,Y) IF (CTR.GE.LOW.AND.CTR.LE.HIGH) THEN OK=.TRUE. GOTO 5100 ENDIF DO 5000 IX=-1,1 DO 5001 IY=-1,1 IF (IX.EQ.0.AND.IY.EQ.0) GOTO 5002 XTEST = X + IX YTEST = Y + IY IF (XTEST.LT.0.OR.XTEST.GT.X100.OR.YTEST.LT.0.OR.YTEST.GT.Y100) GOTO 5002 C WE WANT TO KNOW IF THE BASE VALUE LIES BETWEEN ARRAY(X,Y) AND ARRAY(X+IX,Y+IY) QUERY=ARRAY(X+IX,Y+IY) IF ((HIGH.GE.CTR.AND.LOW.LE.QUERY).OR. & (LOW.LE.CTR.AND.HIGH.GE.QUERY)) THEN OK2 = (ABS(CTR-BASE).LE.ABS(QUERY-BASE)) ENDIF IF ((BASE.GE.CTR.AND.BASE.LE.QUERY).OR. & (BASE.LE.CTR.AND.BASE.GE.QUERY)) THEN IF (ABS(CTR-BASE).LE.ABS(QUERY-BASE)) THEN OK = .TRUE. GOTO 5100

ENDIF ENDIF 5002 CONTINUE 5001 CONTINUE 5000 CONTINUE 5200 CONTINUE OK = .FALSE. 5100 CONTINUE OK2 = OK2 .OR. OK RETURN END **-----------------------------------------------------------------------------* SUBROUTINE NABOR(K3,L3,K100,L100,XDIR,YDIR,ARRAY,X,Y) * INTEGER*4 K100,L100,K3,L3,X,Y,XDIR,YDIR,N,LDIV,NM,MINX(0:2),MINY(0:2) * INTEGER*4 IXQ(0:8),IYQ(0:8),XDIV(0:8),YDIV(0:8),DIV(0:8),BDNS(0:2) * INTEGER*2 ARRAY(X,Y),BASE,TOL,HIGH,LOW * LOGICAL*2 OK,ISIT,OK2,CTROK2 * COMMON /ISOCM1/HIGH,LOW,OK2,/ISOCM3/BASE,TOL * SAVE /ISOCM1/,/ISOCM3/ * EXTERNAL LEGIT,GETPXL * SAVE * 4010 CALL LEGIT(K3+XDIR,L3+YDIR,OK,ARRAY,X,Y) * CTROK2 = OK2 * IF (OK) THEN * CALL GETPXL(K3+XDIR,L3+YDIR,ISIT) * CALL VECTOR(K3+XDIR,L3+YDIR) * IF (.NOT.ISIT) THEN * K3=K3+XDIR * L3=L3+YDIR * GOTO 4010 * ENDIF * CALL SETCOP(K3,L3) * ENDIF ** IF CURRENT DIRECTION NOT SUCCESSFUL, CHANGE DIRECTIONS ** PERMISSABLE DIRECTIONS:NOT CURRENT DIRECTION OR ITS INVERSE, NOT 0,0 ** GET LEGITIMATE SQUARES ** IF WE ARE DONE TRACING A PARTICULAR PATH ** THIS SECTION SHOULD GET EVALUATED * N=-1 * DO 4030 IX=-1,1 * DO 4031 IY=-1,1 * IF ((IX.EQ.0.AND.IY.EQ.0).OR.(IX.EQ.-XDIR.AND.IY.EQ.-YDIR)) GOTO 40 32 * IF (IX.EQ.XDIR.AND.IY.EQ.YDIR) THEN * IF (.NOT.CTROK2) GOTO 4032 * CALL GETPXL(K3+IX,L3+IY,ISIT) * IF (ISIT) GOTO 4032 * N = N+1 * IXQ(N) = IX * IYQ(N) = IY * DIV(N) = 3 * GOTO 4032 * ENDIF * CALL LEGIT(K3+IX,L3+IY,OK,ARRAY,X,Y) * IF (OK2) CALL GETPXL(K3+IX,L3+IY,ISIT) * IF (.NOT.ISIT.AND.OK2) THEN * N = N+1 * IXQ(N) = IX * IYQ(N) = IY * XDIV(N) = ABS(XDIR - IXQ(N))

* YDIV(N) = ABS(YDIR - IYQ(N)) * DIV(N) = XDIV(N) + YDIV(N) * IF (.NOT.OK) DIV(N) = DIV(N) + 3 * ENDIF * 4032 CONTINUE * 4031 CONTINUE * 4030 CONTINUE *C IF N IS STILL -1, CALL IT QUITS * IF (N.EQ.-1) RETURN *C OTHERWISE, FIND THE MIN DIVERGENCE. DIV MAY RANGE FROM 1 TO 6 * LDIV = 7 * NM=-1 * DO 4050 NK=0,N * IF (DIV(NK).LT.1.OR.DIV(NK).GT.6) PRINT *,'DIVERGENCE ERROR',NK,DIV(NK ) * IF (DIV(NK).LT.LDIV) LDIV=DIV(NK) * 4050 CONTINUE *C LOWEST DIVERGENCE IS LDIV * DO 4060 NK=0,N * IF (DIV(NK).EQ.LDIV) THEN * NM=NM+1 * MINX(NM)=IXQ(NK) * MINY(NM)=IYQ(NK) * ENDIF * 4060 CONTINUE *C AT MOST THEIR CAN BE THREE MINIMUM DIVERGENCE DIRECTIONS, SO NM=0 , 1, 2 * IF (NM.EQ.0) THEN * XDIR = MINX(0) * YDIR = MINY(0) * GOTO 4010 * ELSEIF (NM.EQ.1) THEN * IF ((ABS(BASE-ARRAY(K3+MINX(0),L3+MINY(0)))).LT. * & (ABS(BASE-ARRAY(K3+MINX(1),L3+MINY(1))))) THEN * XDIR = MINX(0) * YDIR = MINY(0) * GOTO 4010 * ELSE * XDIR = MINX(1) * YDIR = MINY(1) * GOTO 4010 * ENDIF * ELSEIF (NM.EQ.2) THEN * DO 4070 INM = 0,2 * BDNS(INM) = ABS(BASE-ARRAY(K3+MINX(INM),L3+MINY(INM))) * 4070 CONTINUE * IBAD = MIN0(BDNS(0),BDNS(1),BDNS(2)) * DO 4080 INM = 0,2 * IF (IBAD.EQ.BDNS(I)) THEN * XDIR = MINX(INM) * YDIR = MINY(INM) * GOTO 4010 * ENDIF * 4080 CONTINUE * ELSE * PRINT *,'ERROR IN NM .',NM * STOP * ENDIF * END **---------------------------------------------------------------------SUBROUTINE PLIS0(ARRAY,X,Y)

CALL FLISO(ARRAY,X,Y) RETURN END * SUBROUTINE PLIS0(ARRAY,X,Y) * CHARACTER*44 MESS,TC*1,TCALGN(2)*1 * REAL*4 RATE(0:8,0:8),RDELTA,IRATE,RADIUS,RAD,PHI,IPHI,PI * INTEGER*4 X,Y,NL,IXQL(0:8),IYQL(0:8),NP,IXP(0:8),IYP(0:8),K1,L1,IFOO * INTEGER*4 DELTA,DIV,XDIV,YDIV,DELTA1,DELTA2,MODE,IX,IY,KK1,LL1,IBAR * INTEGER*4 IRAD,IRDIUS * INTEGER*2 ARRAY(X,Y),BIG,SMALL,RANGE,BASE,TOL,HIGH,LOW,BIGA,SMALLA,I16384 * INTEGER*2 ASC,SCAN,KBF1,KBF2,ERR,IASC,ISCAN,IKBF1,IKBF2,IERR * LOGICAL*2 ABORT,ESCAPE,INTRPT,RSH,LSH,CTRL,ALT,SCRL,NUML,CAPS,INS * LOGICAL*2 ISIT,OK,OK2 * EQUIVALENCE (ASC,IASC),(SCAN,ISCAN),(KBF1,IKBF1),(KBF2,IKBF2),(ERR,IERR) * EQUIVALENCE (TCALGN(1),IASC),(TCALGN(2),TC) * COMMON /KEYGET/IASC,ISCAN,IKBF1,IKBF2,IERR,/NTRVN/ABORT,ESCAPE,INTRPT * COMMON /SHFSTA/RSH,LSH,CTRL,ALT,SCRL,NUML,CAPS,INS * COMMON /PARNML/BIGA,SMALLA,RANGE,/PARNM2/BIG,SMALL,MODE,I16384 * COMMON /ISOCM1/HIGH,LOW,OK2/ISOCM3/BASE,TOL * SAVE /KEYGET/,/SHFSTA/,/NTRVN/,/ISOCM1/,/ISOCM3/ * EXTERNAL GETPXL,LEGIT,NABOR,ISOMAP,PXLSET,WSAYAT * SAVE * PI = 3.1415926535897932384D0 * IX = X * IY = Y * CALL ISOMAP(IX,IY) * LOW = BASE - TOL * HIGH = BASE + TOL * IF (LOW.LT.SMALL) LOW = SMALL * IF (HIGH.GT.BIG) HIGH = BIG * WRITE (MESS,'(1X,A,I5,A,I3,A,I5,A,I5)',ERR=9111) 'Tracing ',BASE,' +/- ', TOL,' == ',LOW,' to ',HIGH * 9111 CONTINUE * CALL WSAYAT(12,0,5,MESS) * CALL PXLSET * MIDX = (1+X)/2 * MIDY = (1+Y)/2 * RADIUS = X**2 + Y**2 * RADIUS = SQRT(RADIUS) * IRDIUS = RADIUS + 0.5 * CALL LEDSET(4) ** NEW STUFF - FIND AN ISO-INTENSITY LINE & FOLLOW IT * DO 2100 IRAD = 0,IRDIUS * RAD = IRAD + 0.1E-6 * IPHIMX = PI*RAD * DO 2101 IPHI = -IPHIMX,IPHIMX * PHI = IPHI/RAD * LL1 = RAD*SIN(PHI) * L1 = MIDY + LL1 * ERR = -1 * CALL ISNTRP * IF (ABORT.OR.ESCAPE.OR.INTRPT) GOTO 2099 * IF (ERR.EQ.0) THEN * CALL SHIFTS * IF (SCRL.AND.SCAN.EQ.$3D) CALL DSPSWP * ENDIF * IF (L1.LE.0.OR.L1.GE.Y) GOTO 2102 * KK1 = RAD*COS(PHI) * K1 = MIDX + KK1 * IF (K1.LE.0.OR.K1.GE.X) GOTO 2102

* CALL LEGIT(K1,L1,OK,ARRAY,X,Y) * IF (OK) CALL GETPXL(K1,L1,ISIT) * IF (.NOT.ISIT.AND.OK) THEN * CALL SETCOP(K1,L1) * CALL DOPIXL(K1,L1) *C FIND OPTIMUM DIRECTION * NL=-1 * DO 2200 IX=-1,1 * DO 2201 IY=-1,1 * IF (IX.EQ.0.AND.IY.EQ.0) GOTO 2202 * CALL LEGIT(K1+IX,L1+IY,OK,ARRAY,X,Y) * IF (OK) CALL GETPXL(K1+IX,L1+IY,ISIT) * IF (.NOT.ISIT.AND.OK) THEN * NL=NL+1 * IXQL(NL)=IX * IYQL(NL)=IY * ENDIF * 2202 CONTINUE * 2201 CONTINUE * 2200 CONTINUE *C TO THIS POINT WE HAVE AN ARRAY CONTAINING THE LEGIT DIRECTIONS TO A POINT *C NEXT MISSION:CHOOSE TWO BEST POINTS *C NL+1 IS NUMBER OF LEGIT POINTS *C K1,L1 IS THE CURRENT OPERATING POINT *C IF THERE ARE 3 OR MORE LEGIT NABORS, CHOOSE OPTIMUM PAIR * IF (NL+1.GE.3) THEN * DO 2212 NL1=0,NL * DO 2211 NL2=NL1+1,NL *C CHECK FOR NABORNESS (BAD!) & OPPOSITENESS (GOOD!) * XDIV=ABS(IXQL(NL1)-IXQL(NL2)) * YDIV=ABS(IYQL(NL1)-IYQL(NL2)) * DIV=XDIV+YDIV * DELTA1=ARRAY(K1+IXQL(NL1),L1+IYQL(NL1))-BASE * DELTA2=ARRAY(K1+IXQL(NL2),L1+IYQL(NL2))-BASE * DELTA=ABS(DELTA1)+ABS(DELTA2) * RDELTA=DELTA * IF (DIV.GT.4.OR.DIV.LT.1) THEN * PRINT *,'DIVERGENCE ERROR',DIV * STOP * ELSEIF (DIV.EQ.4) THEN *C PAIR => RATING OF 100 * RATE(NL1,NL2)=100/RDELTA * ELSEIF (DIV.EQ.3) THEN *C "ALMOST" PAIR => RATING OF 75 * RATE(NL1,NL2)=75/RDELTA * ELSEIF (DIV.EQ.2) THEN *C PERPENDICULAR => RATING OF 50 * RATE(NL1,NL2)=50/RDELTA * ELSEIF (DIV.EQ.1) THEN *C NABORS => RATING OF 0 * RATE(NL1,NL2)=0 * ENDIF *C THE RATING OF A PAIR IS REFERENCED BY TWO INDICES REPRESENTING *C THE TWO POINTS IN THE PAIR. THE LOWER POINT INDEX IS GIVEN FIRST. *C THE DESIRABILITY OF A PAIR IS DIRECTLY PROPORTIONAL TO ITS DEGREE OF OPPOSITE NESS *C AND INVERSELY PROPORTIONAL TO THE DIVERGENCE OF ITS MEMBERS FROM THE BASE * 2211 CONTINUE * 2212 CONTINUE *C NOW WE HAVE A QUANITATIVE WAY TO COMPARE PAIRS

* IRATE=-1. *C FIND HIGHEST RATING * DO 2215 NL1=0,NL * DO 2214 NL2 = NL1+1,NL * IF (RATE(NL1,NL2).GT.IRATE) THEN * IRATE=RATE(NL1,NL2) * IJ1=NL1 * IJ2=NL2 * ENDIF * 2214 CONTINUE * 2215 CONTINUE *C OPTIMAL PAIR HAS XDIR,YDIR OF INDICES IJ1,IJ2 AND RATING OF RATE *C IF RATE 0, THEN WE ARE STUCK WITH NABORS *C IF TWO OK POINTS NABOR DISCARD THE ONE FARTHER FROM THE BASE] * IF (.NOT. (IRATE.EQ.0)) THEN * CALL NABOR(K1,L1,K1,L1,IXQL(IJ1),IYQL(IJ1),ARRAY,X,Y) * CALL NABOR(K1,L1,K1,L1,IXQL(IJ2),IYQL(IJ2),ARRAY,X,Y) * ELSE * IF (ABS(ARRAY(K1+IXQL(IJ1),L1+IYQL(IJ1))-BASE).LT. * & (ABS(ARRAY(K1+IXQL(IJ2),L1+IYQL(IJ2))-BASE))) THEN * CALL NABOR(K1,L1,K1,L1,IXQL(IJ1),IYQL(IJ1),ARRAY,X,Y) * ELSE * CALL NABOR(K1,L1,K1,L1,IXQL(IJ2),IYQL(IJ2),ARRAY,X,Y) * ENDIF * ENDIF *C IF WE ARE HERE, THEN WE SHOULD HAVE EITHER 0, 1, OR 2 LEGIT POINTS TO TRY *C IF 0, ABANDON; IF 1 FOLLOW; IF TWO CHECK FOR NABORS, THEN FOLLOW *C BEFORE, WE CHECKED FOR 3 OR MORE LEGIT POINTS. IF THE BEST PAIR TURNED OUT *C TO BE NABORS, WE CHOSE THE OPTIMUM POINT BETWEEN THE TWO. BUT IT SEEMS *C THIS NEVER HAPPENED AND WOULD HAPPEN ONLY HERE AND NOW. * ELSEIF(NL+1.EQ.2) THEN * XDIV=ABS(IXQL(0)-IXQL(1)) * YDIV=ABS(IYQL(0)-IYQL(1)) * DIV = XDIV + YDIV * IF (DIV.LT.1.OR.DIV.GT.4) THEN * PRINT *,'DIVERGENCE ERROR .',DIV * STOP * ENDIF * IF (DIV.EQ.1) THEN * IF((ABS(ARRAY(K1+IXQL(1),L1+IYQL(1))-BASE)).LT. * & (ABS(ARRAY(K1+IXQL(0),L1+IYQL(0))-BASE))) THEN * CALL NABOR(K1,L1,K1,L1,IXQL(1),IYQL(1),ARRAY,X,Y) * ELSE * CALL NABOR(K1,L1,K1,L1,IXQL(0),IYQL(0),ARRAY,X,Y) * ENDIF * ELSE * CALL NABOR(K1,L1,K1,L1,IXQL(0),IYQL(0),ARRAY,X,Y) * CALL NABOR(K1,L1,K1,L1,IXQL(1),IYQL(1),ARRAY,X,Y) * ENDIF * ELSEIF(NL+1.EQ.1) THEN * CALL NABOR(K1,L1,K1,L1,IXQL(0),IYQL(0),ARRAY,X,Y) * ENDIF * ENDIF * 2102 CONTINUE * 2101 CONTINUE * 2100 CONTINUE * 2099 CONTINUE * CALL SETPG0 * CALL RSTMAP * CALL LEDSON

* RETURN * END *---------------------------------------------------------------------SUBROUTINE FLISO(ARRAY,X,Y) CHARACTER*44 MESS,TC*1,TCALGN(2)*1 REAL*4 RATE(0:8,0:8),RDELTA,IRATE INTEGER*4 X,Y,NL,IXQL(0:8),IYQL(0:8),NP,IXP(0:8),IYP(0:8),K1,L1,IFOO INTEGER*4 DELTA,DIV,XDIV,YDIV,DELTA1,DELTA2,MODE,IX,IY,KK1,LL1,IBAR INTEGER*2 ARRAY(X,Y),BIG,SMALL,RANGE,BASE,TOL,HIGH,LOW,BIGA,SMALLA,I16384 INTEGER*2 ASC,SCAN,KBF1,KBF2,ERR,IASC,ISCAN,IKBF1,IKBF2,IERR LOGICAL*2 ABORT,ESCAPE,INTRPT,RSH,LSH,CTRL,ALT,SCRL,NUML,CAPS,INS LOGICAL*2 ISIT,OK,OK2 EQUIVALENCE (ASC,IASC),(SCAN,ISCAN),(KBF1,IKBF1),(KBF2,IKBF2),(ERR,IERR) EQUIVALENCE (TCALGN(1),IASC),(TCALGN(2),TC) COMMON /KEYGET/IASC,ISCAN,IKBF1,IKBF2,IERR,/NTRVN/ABORT,ESCAPE,INTRPT COMMON /SHFSTA/RSH,LSH,CTRL,ALT,SCRL,NUML,CAPS,INS COMMON /PARNML/BIGA,SMALLA,RANGE,/PARNM2/BIG,SMALL,MODE,I16384 COMMON /ISOCM1/HIGH,LOW,OK2/ISOCM3/BASE,TOL SAVE /KEYGET/,/SHFSTA/,/NTRVN/,/ISOCM1/,/ISOCM3/ EXTERNAL LEGIT,ISOMAP,PXLSET,WSAYAT,DOPIXL,SHIFTS SAVE IX = X IY = Y CALL ISOMAP(IX,IY) LOW = BASE - TOL HIGH = BASE + TOL IF (LOW.LT.SMALL) LOW = SMALL IF (HIGH.GT.BIG) HIGH = BIG WRITE (MESS,'('' '',A,I5,A,I3,A,I5,A,I5)',ERR=9111) 'Marking ',BASE,' +/',TOL,' == ',LOW,' to ',HIGH 9111 CONTINUE CALL WSAYAT(12,0,5,MESS) CALL PXLSET MIDX = (1+X)/2 MIDY = (1+Y)/2 CALL LEDSET(4) * NEW STUFF - FIND AN ISO-INTENSITY LINE & FOLLOW IT DO 2100 KK1 = 0,(X-1) ERR = -1 CALL ISNTRP IF (ABORT.OR.ESCAPE.OR.INTRPT) GOTO 2099 IF (ERR.EQ.0) THEN CALL SHIFTS IF (SCRL.AND.SCAN.EQ.$3D) CALL DSPSWP ENDIF IFOO = KK1 - 2*(KK1/2) IBAR = KK1/2 IF (IFOO.EQ.0) THEN K1 = MIDX - IBAR - 1 ELSE K1 = MIDX + IBAR ENDIF DO 2101 LL1 = 0,(Y-1),2 IBAR = LL1/2 L1 = MIDY - IBAR - 1 CALL LEGIT(K1,L1,OK,ARRAY,X,Y) IF (OK) CALL DOPIXL(K1,L1) L1 = MIDY + IBAR CALL LEGIT(K1,L1,OK,ARRAY,X,Y) IF (OK) CALL DOPIXL(K1,L1)

2101 CONTINUE 2100 CONTINUE 2099 CONTINUE CALL SETPG0 CALL RSTMAP CALL LEDSON RETURN END