Work started.
authorilb@NIH.GOV <ilb@NIH.GOV@ba61647d-9d00-f842-95cd-605cb4296b96>
Thu, 14 Dec 2017 23:17:44 +0000 (23:17 +0000)
committerilb@NIH.GOV <ilb@NIH.GOV@ba61647d-9d00-f842-95cd-605cb4296b96>
Thu, 14 Dec 2017 23:17:44 +0000 (23:17 +0000)
git-svn-id: https://citdcbmipav.cit.nih.gov/repos-pub/mipav/trunk@15311 ba61647d-9d00-f842-95cd-605cb4296b96

mipav/src/gov/nih/mipav/model/algorithms/SymmsIntegralMapping.java [new file with mode: 0644]

diff --git a/mipav/src/gov/nih/mipav/model/algorithms/SymmsIntegralMapping.java b/mipav/src/gov/nih/mipav/model/algorithms/SymmsIntegralMapping.java
new file mode 100644 (file)
index 0000000..3bc2893
--- /dev/null
@@ -0,0 +1,505 @@
+package gov.nih.mipav.model.algorithms;\r
+\r
+import java.io.File;\r
+import java.io.IOException;\r
+import java.io.RandomAccessFile;\r
+\r
+import gov.nih.mipav.model.structures.ModelImage;\r
+import gov.nih.mipav.view.MipavUtil;\r
+\r
+public class SymmsIntegralMapping extends AlgorithmBase  {\r
+       String fileDir;\r
+       \r
+       // EPS returns the distance from 1.0 to the next larger double-precision number, that is, eps = 2^-52.\r
+    private double EPS;\r
+       public SymmsIntegralMapping() {\r
+               \r
+       }\r
+       \r
+       public SymmsIntegralMapping(ModelImage destImg, ModelImage srcImg) {\r
+           super(destImg, srcImg);     \r
+       }\r
+       \r
+       public void runAlgorithm() {\r
+           fileDir = srcImage.getFileInfo(0).getFileDirectory();\r
+           \r
+        // eps returns the distance from 1.0 to the next larger double-precision number, that is, eps = 2^-52.\r
+       // epsilon = D1MACH(4)\r
+        // Machine epsilon is the smallest positive epsilon such that\r
+        // (1.0 + epsilon) != 1.0.\r
+        // epsilon = 2**(1 - doubleDigits) = 2**(1 - 53) = 2**(-52)\r
+        // epsilon = 2.2204460e-16\r
+        // epsilon is called the largest relative spacing\r
+        EPS = 1.0;\r
+        double neweps = 1.0;\r
+\r
+\r
+        while (true) {\r
+\r
+            if (1.0 == (1.0 + neweps)) {\r
+                break;\r
+            } else {\r
+                EPS = neweps;\r
+                neweps = neweps / 2.0;\r
+            }\r
+        } // while(true)\r
+       }\r
+       \r
+       public void PARGEN() {\r
+       //.......................................................................\r
+       //     AN INTERACTIVE PREPROCESSOR TO HELP THE  C O N F P A C K  USER \r
+       //     GENERATE THE FORTRAN CODE DEFINING THE BOUNDARY PARAMETRISATION \r
+       //     AND ITS DERIVATIVE.\r
+       //\r
+       //     THE FOLLOWING CONVENTIONS ARE ASSUMED:\r
+       //\r
+       //  ** IF A QUESTION REQUIRES A YES OR NO ANSWER, THE DETECTION OF 'Y' OR\r
+       //     'y' IN THE FIRST 6 INPUT CHARACTERS IS TAKEN AS YES, ANYTHING ELSE\r
+       //     AS NO.\r
+       //\r
+       //  ** WHEN ASKED FOR COORDINATES, THIS ALWAYS MEANS CARTESIAN COORDIN-\r
+       //     ATES AND THESE SHOULD BE SUPPLIED AS TWO REAL NUMBERS, AS EITHER \r
+       //\r
+       //                      X,Y     OR      X Y\r
+       //\r
+       //     WITHOUT PARENTHESES. \r
+       //\r
+       //  ** FOUR TYPES OF ARCS ARE CURRENTLY TREATED, WITH NUMERICAL CODES TO \r
+       //     DENOTE THE TYPE AS FOLLOWS:\r
+       //       1:= LINE SEGMENT.\r
+       //       2:= CIRCULAR ARC SEGMENT.\r
+       //           CONVENTIONS:\r
+       //           1 - THE ANGLE SUBTENDED AT THE CENTRE IS POSITIVE FOR\r
+       //               ANTICLOCKWISE TRAVERSAL OF THE ARC AND NEGATIVE FOR\r
+       //               CLOCKWISE TRAVERSAL.\r
+       //       3:= THE USER IS ASKED TO SUPPLY THE FORTRAN 77 ARITHMETIC \r
+       //           EXPRESSIONS WHICH DEFINE THE CARTESIAN PARAMETRIC FUNCTION  \r
+       //           AND THE DERIVATIVE OF THIS FUNCTION.\r
+       //           CONVENTIONS:\r
+       //           1 - THE PARAMETER MUST BE DENOTED BY T.\r
+       //           2 - THE REAL CONSTANT PI=3.14159.. AND THE COMPLEX CONSTANT\r
+       //               UI=(0.0,1.0) MAY BE USED IN THE ARITHMETIC EXPRESSIONS.\r
+       //       4:= THE USER IS ASKED TO SUPPLY THE FORTRAN 77 ARITHMETIC \r
+       //           EXPRESSIONS WHICH DEFINE THE POLAR COORDINATE AS A FUNCTION\r
+       //           OF POLAR ANGLE AND THE DERIVATIVE OF THIS FUNCTION.\r
+       //           CONVENTIONS:\r
+       //           1 - THE POLAR ANGLE MUST BE DENOTED BY T.\r
+       //           2 - THE REAL CONSTANT PI=3.14159.. MAY BE USED IN THE ARITH-\r
+       //               METIC EXPRESSIONS. \r
+       //           3 - PARGEN ASSIGNS THE EXPRESSION FOR THE RADIUS TO THE \r
+       //               COMPLEX VARIABLE ZRAD;  IF REQUIRED THE USER MAY THERE- \r
+       //               FORE USE THE VARIABLE ZRAD IN THE EXPRESSION FOR THE \r
+       //               DERIVATIVE OF THE RADIUS WRT POLAR ANGLE\r
+       //      IN ADDITION, FOR TYPES 3 AND 4, THE FOLLOWING CONVENTIONS HOLD:\r
+       //           1 - ONLY USE UP TO 66 CHARACTERS PER LINE.\r
+       //           2 - IF THE EXPRESSION OCCUPIES MORE THAN ONE LINE THEN THERE\r
+       //               IS NO NEED TO SUPPLY ANY CONTINUATION CHARACTER.\r
+       //           3 - ONLY USE THOSE FORTRAN 77 INTRINSIC MATHS FUNCTIONS  \r
+       //               WHICH ACCEPT COMPLEX ARGUMENTS AND ARE ANALYTIC; I.E.,\r
+       //               IN STANDARD FORTRAN,\r
+       //                    SQRT, EXP, LOG, SIN, COS\r
+       //           4 - THE WHOLE EXPRESSION SHOULD BE TERMINATED WITH A\r
+       //               REPEATED DIVISION SIGN, I.E. //.\r
+       //\r
+       // ** THE CODE ISN'T VERY ROBUST IN THAT THERE IS LITTLE PROVISION FOR\r
+       //    INTERACTIVE CORRECTION OF ERRORS.  HOWEVER, ALL THE USER'S INPUT\r
+       //     IS AUTOMATICALLY OUTPUT TO A FILE NAMED pgenin.  IF THE USER\r
+       //     REALISES THAT AN ITEM HAS BEEN INPUT INCORRECTLY, THE BEST POLICY\r
+       //     IS TO CARRY ON TO THE END OF THE INPUT PHASE AND THEN TERMINATE \r
+       //     THE EXECUTION;  THE FILE pgenin CAN BE EDITED, RENAMED AND \r
+       //     SUBMITTED AS STANDARD INPUT FOR A SECOND RUN OF PARGEN.   \r
+       //     (THE SUGGESTION TO RENAME IS TO AVOID ANY POSSIBLE DIFFICULTY \r
+       //    ARISING FROM READING THE FILE AS STANDARD INPUT WHILST ALSO \r
+       //     WRITING OUTPUT TO THE SAME FILE.) \r
+       //     IF THE USER REALISES ONLY AT A LATER STAGE (E.G. IN PLOTTING THE \r
+       //     BOUNDARY) THAT AN ITEM HAS BEEN INPUT INCORRECTLY THEN pgenin \r
+       //     MAY STILL BE AVAILABLE FOR RE-USE AS ABOVE.\r
+       //  \r
+       //     SUBROUTINES OR FUNCTIONS NEEDED\r
+       //              - THE CONFPACK LIBRARY.\r
+       //              - THE REAL FUNCTION R1MACH.\r
+       //\r
+       //.......................................................................\r
+       //     AUTHOR: DAVID HOUGH, COVENTRY POLYTECHNIC, UK\r
+       //     LAST UPDATE: 15 FEB 1991\r
+       //.......................................................................\r
+       //\r
+       //     LOCAL VARIABLES\r
+       //\r
+             int GMCO,IA,I,IER,J,L,NARCS,ORDRG,ORDSG,SW,\r
+                 TXCO,TYPE;\r
+             double ALPHA,PI,R1MACH,X,Y;\r
+             //COMPLEX CENSY,RTUNI,U2\r
+             double CENSY[] = new double[2];\r
+             double RTUNI[] = new double[2];\r
+             double U2[] = new double[2];\r
+             boolean CHRIN,REFLN,SYMTY,CHCK;\r
+            // CHARACTER TXT*72,TABC*6,FORTFL*72,CH*2,SIG(10)*2,WID(10)*2,REDD*6,\r
+            //+FMT1*8,FMT2*9\r
+             String TXT;\r
+             String FORTFL;\r
+             String CH;\r
+             String SIG[] = new String[]{"7","8","9","10","11","12","13","14","15","16"};\r
+             String WID[] = new String[]{"15","16","17","18","19","20","21","22","23","24"};\r
+             String REDD;\r
+             String FMT1;\r
+             String FMT2;\r
+       \r
+             //PARAMETER (MNARC=100,TABC='     +',CHNL=20,CHIN=21)\r
+             final int MNARC = 100;\r
+             final String TABC = "     +";\r
+             final int CHNL = 20;\r
+             final int CHIN = 21;\r
+             int ARCTY[] = new int[MNARC];\r
+             int PGM[] = new int[MNARC];\r
+             int PTX[] = new int[2*MNARC];\r
+             int NTX[] = new int[2*MNARC];\r
+             double RGM[] = new double[3*MNARC];\r
+             //COMPLEX STAPT(MNARC)\r
+             double STAPT[][] = new double[MNARC][2];\r
+             boolean NUMDER[] = new boolean[MNARC];\r
+             //CHARACTER DEFN(MNARC*2)*72\r
+             String DEFN[] = new String[2*MNARC];\r
+             File file;\r
+             RandomAccessFile raFile = null;\r
+       \r
+             //EXTERNAL CHRIN,HEADER,R1MACH,SYINF1,WRFUN1,WRFUN2,WRHEAD,WRSYM1,\r
+             //+WRSYM2,WRSYM3,WRTAIL\r
+       \r
+             WRHEAD(6,0, null);\r
+       \r
+             PI= Math.PI;\r
+             file = new File(fileDir + "pgenin");\r
+             try {\r
+                 raFile = new RandomAccessFile(file, "rw");\r
+             }\r
+             catch (IOException e) {\r
+                 MipavUtil.displayError("IOException " + e + " on raFile = new RandomAccessFile(file, rw)");\r
+                 System.exit(-1);\r
+             }\r
+             // Necessary so that if this is an overwritten file there isn't any\r
+             // junk at the end\r
+             try {\r
+                 raFile.setLength(0);\r
+             }\r
+             catch (IOException e) {\r
+                 MipavUtil.displayError("IOException " + e + " on raFile.setLength(0)");\r
+                 System.exit(-1);  \r
+             }\r
+             //OPEN(CHIN,FILE='pgenin')\r
+       \r
+             //**** DETERMINE NUMBER OF SIGNIFICANT FIGURES REQUIRED TO MATCH MACHINE \r
+          //**** PRECISION AND SET UP POINTER SW TO SIG AND WID\r
+       \r
+             SW=(int)(-Math.log10(EPS))+2;\r
+             /*IF (SW.LE.7) THEN\r
+               SW=1\r
+             ELSE IF (SW.GE.16) THEN\r
+               SW=10\r
+             ELSE\r
+               SW=SW-6\r
+             ENDIF\r
+       C\r
+       C**** SET UP THE EDIT DESCRIPTOR AND FORMAT SPECIFICATION FOR FLOATING \r
+       C**** POINT OUTPUT\r
+       C\r
+             REDD='E'//WID(SW)//'.'//SIG(SW) \r
+             FMT1='('//REDD//')'\r
+             FMT2='(2'//REDD//')'   \r
+       C\r
+             WRITE(*,*) 'FILENAME TO RECEIVE OUTPUT FORTRAN CODE?'\r
+             READ(*,'(A)') FORTFL\r
+             WRITE(CHIN,'(A)') FORTFL\r
+       C\r
+             WRITE(*,*) 'DOES THE DOMAIN HAVE ANY SYMMETRY?'\r
+             SYMTY=CHRIN('Y','y')\r
+             IF (SYMTY) THEN\r
+               WRITE(CHIN,*) 'Y','      ..SYMMETRY'\r
+             ELSE\r
+               WRITE(CHIN,*) 'N','      ..SYMMETRY'\r
+             ENDIF\r
+             IF (SYMTY) THEN\r
+               WRITE(*,*) 'ARE THERE ANY REFLECTIONAL SYMMETRIES?'\r
+               REFLN=CHRIN('Y','y')\r
+               IF (REFLN) THEN\r
+                 WRITE(CHIN,*) 'Y','      ..REFLECTIONAL SYMMETRY'\r
+               ELSE\r
+                 WRITE(CHIN,*) 'N','      ..REFLECTIONAL SYMMETRY'\r
+               ENDIF\r
+               WRITE(*,*) 'WHAT ARE THE COORDINATES OF THE CENTRE OF SYMMETRY?'\r
+               READ(*,*) X,Y\r
+               WRITE(CHIN,FMT2) X,Y\r
+               CENSY=CMPLX(X,Y)\r
+               WRITE(*,*) 'HOW MANY ARCS ARE THERE ON THE FUNDAMENTAL BOUNDARY\r
+            +SECTION?'\r
+               READ(*,*) NARCS\r
+               WRITE(CHIN,*) NARCS,'      ..NUMBER OF ARCS ON FBS'\r
+             ELSE\r
+               WRITE(*,*) 'HOW MANY ARCS ARE THERE ON THE BOUNDARY?'\r
+               READ(*,*) NARCS\r
+               WRITE(CHIN,*) NARCS,'      ..NUMBER OF ARCS ON BOUNDARY'\r
+             ENDIF\r
+       C\r
+             IF (NARCS.GT.MNARC-1) THEN\r
+               IER=58\r
+               GOTO 999 \r
+             ENDIF \r
+       C\r
+             GMCO=0\r
+             TXCO=0\r
+       C\r
+             DO 100 IA=1,NARCS\r
+               NUMDER(IA)=.FALSE.\r
+       5       CONTINUE\r
+               WRITE(*,'(//A,I2,A)') 'TYPE OF ARC ',IA,'?'\r
+               READ(*,*) TYPE\r
+               WRITE(CHIN,*) TYPE,'      ..TYPE FOR ARC',IA\r
+               IF (TYPE.EQ.1) THEN\r
+                 ARCTY(IA)=TYPE\r
+                 WRITE(*,*) 'COORDINATES OF INITIAL POINT ON LINE?'\r
+                 READ(*,*) X,Y\r
+                 WRITE(CHIN,FMT2) X,Y\r
+                 STAPT(IA)=CMPLX(X,Y)\r
+               ELSE IF (TYPE.EQ.2) THEN\r
+                 ARCTY(IA)=TYPE\r
+                 WRITE(*,*) 'COORDINATES OF INITIAL POINT ON CIRCLE?'\r
+                 READ(*,*) X,Y\r
+                 WRITE(CHIN,FMT2) X,Y\r
+                 STAPT(IA)=CMPLX(X,Y)\r
+                 WRITE(*,*) 'COORDINATES OF CENTRE OF CIRCLE?'\r
+                 READ(*,*) X,Y\r
+                 WRITE(CHIN,FMT2) X,Y\r
+                 WRITE(*,*)'SIGNED ANGLE SUBTENDED AT CENTRE (IN UNITS OF PI)?'\r
+                 READ(*,*) ALPHA\r
+                 WRITE(CHIN,FMT1) ALPHA\r
+                 GMCO=GMCO+1\r
+                 PGM(IA)=GMCO\r
+                 RGM(GMCO)=X\r
+                 GMCO=GMCO+1\r
+                 RGM(GMCO)=Y\r
+                 GMCO=GMCO+1\r
+                 RGM(GMCO)=ALPHA*PI\r
+               ELSE IF (TYPE.EQ.3 .OR. TYPE.EQ.4) THEN\r
+                 ARCTY(IA)=TYPE\r
+                 WRITE(*,*) 'COORDINATES OF INITIAL POINT ON CURVE?'\r
+                 READ(*,*) X,Y\r
+                 WRITE(CHIN,FMT2) X,Y\r
+                 STAPT(IA)=CMPLX(X,Y)\r
+                 IF (TYPE.EQ.3) THEN\r
+                   WRITE(*,*) 'INITIAL AND FINAL PARAMETER VALUES?'\r
+                 ELSE\r
+                   WRITE(*,*)'INITIAL AND FINAL POLAR ANGLES (IN UNITS OF PI)?'\r
+                 ENDIF\r
+                 READ(*,*) X,Y\r
+                 WRITE(CHIN,FMT2) X,Y\r
+                 GMCO=GMCO+1\r
+                 PGM(IA)=GMCO\r
+                 IF (TYPE.EQ.4) THEN\r
+                   RGM(GMCO)=X*PI\r
+                   GMCO=GMCO+1\r
+                   RGM(GMCO)=Y*PI\r
+                 ELSE\r
+                   RGM(GMCO)=X\r
+                   GMCO=GMCO+1\r
+                   RGM(GMCO)=Y\r
+                 ENDIF\r
+                 DO 50 J=1,2\r
+                   IF (J.EQ.1 .AND. TYPE.EQ.3) THEN\r
+                     WRITE(*,*) 'FORTRAN EXPRESSION FOR PARFUN?'\r
+                   ELSE IF (J.EQ.2 .AND. TYPE.EQ.3) THEN          \r
+                     WRITE(*,*) 'FORTRAN EXPRESSION FOR DPARFN?'\r
+                   ELSE IF (J.EQ.1 .AND. TYPE.EQ.4) THEN\r
+                     WRITE(*,*) 'FORTRAN EXPRESSION FOR RADIUS?'\r
+                   ELSE\r
+                     WRITE(*,*) 'FORTRAN EXPRESSION FOR RADIUS DERIVATIVE?'\r
+                   ENDIF\r
+       C\r
+                   TXCO=TXCO+1\r
+                   PTX(IA+(J-1)*MNARC)=TXCO\r
+                   I=1\r
+       C\r
+       10          CONTINUE\r
+                   READ(*,'(A72)') TXT\r
+                   WRITE(CHIN,'(A72)') TXT\r
+                   L=INDEX(TXT,'//')\r
+                   IF (L.EQ.0) THEN\r
+                     IF (TXT(67:72) .NE. '      ') THEN\r
+                       WRITE(*,*) 'THIS LINE IS MORE THAN 66CH LONG.'\r
+                       WRITE(*,*) 'PLEASE SPLIT AND ENTER AS SEPERATE LINES.'\r
+                       GOTO 10\r
+                     ENDIF\r
+                     DEFN(TXCO)=TABC//TXT\r
+                     I=I+1\r
+                     TXCO=TXCO+1\r
+                     GOTO 10\r
+                   ELSE\r
+                     IF (L.GT.67) THEN\r
+                       WRITE(*,*) 'THIS LINE IS MORE THAN 66CH LONG.'\r
+                       WRITE(*,*) 'PLEASE SPLIT AND ENTER AS SEPERATE LINES.'\r
+                       GOTO 10\r
+                     ENDIF\r
+                     NTX(IA+(J-1)*MNARC)=I\r
+                     IF (L.EQ.1) THEN\r
+                       DEFN(TXCO)=TABC\r
+                       NUMDER(IA)=.TRUE.\r
+                     ELSE \r
+                       DEFN(TXCO)=TABC//TXT(1:L-1)\r
+                     ENDIF\r
+                   ENDIF\r
+                   IF (J.EQ.1 .AND. TYPE.EQ.4) THEN\r
+                     WRITE(*,*) '(... = ZRAD)'\r
+                   ENDIF\r
+       50        CONTINUE\r
+               ELSE\r
+                 WRITE(*,*) 'TYPE MUST BE EITHER 1,2,3 OR 4'\r
+                 GOTO 5\r
+               ENDIF\r
+       100   CONTINUE  \r
+       C\r
+             IF (SYMTY) THEN\r
+               WRITE(*,*) 'COORDINATES OF FINAL POINT ON THIS ARC?'\r
+               READ(*,*) X,Y\r
+               WRITE(CHIN,FMT2) X,Y\r
+               STAPT(NARCS+1)=CMPLX(X,Y)\r
+             ELSE\r
+               STAPT(NARCS+1)=STAPT(1)\r
+             ENDIF\r
+       C\r
+       C**** CHECK WITH THE USER THAT THE INPUT DATA IS OK\r
+       C\r
+             IER=0\r
+             WRITE(*,*)\r
+             WRITE(*,*) 'END OF INPUT PHASE; CONTINUE WITH PROCESSING?'\r
+             CHCK=CHRIN('Y','y')\r
+             IF (.NOT.CHCK) THEN\r
+               WRITE(CHIN,*) 'N','      ..CONTINUE PROCESSING'\r
+               GOTO 999\r
+             ELSE\r
+               WRITE(CHIN,*) 'Y','      ..CONTINUE PROCESSING'\r
+             ENDIF\r
+             CLOSE(CHIN) \r
+       C\r
+       C**** WRITE THE SOURCE CODE FOR PARFUN\r
+       C\r
+             OPEN(CHNL,FILE=FORTFL)\r
+             CALL HEADER('PARFUN',REDD,CHNL)\r
+             IF (SYMTY) THEN\r
+               CALL SYINF1(ORDRG,ORDSG,RTUNI,U2,REFLN,CENSY,STAPT(1),\r
+            +              STAPT(NARCS+1),IER)\r
+               IF (IER.GT.0) GOTO 999\r
+               WRITE(*,'(/A,I3)') 'N O T E : THE ORDER OF THE SYMMETRY GROUP IS\r
+            +',ORDSG\r
+               IF (REFLN) THEN\r
+                  WRITE(*,*) '          ISYGP = ',-ORDSG\r
+               ELSE\r
+                  WRITE(*,*) '          ISYGP = ',ORDSG\r
+               ENDIF\r
+               CALL WRSYM1(NARCS,ORDRG,ORDSG,RTUNI,U2,CENSY,REFLN,.TRUE.,REDD,\r
+            +              CHNL)\r
+               IF (REFLN) THEN\r
+                 CH='TS'\r
+               ELSE\r
+                 CH='TT'\r
+               ENDIF\r
+               CALL WRFUN1(NARCS,STAPT,ARCTY,PGM,RGM,PTX,NTX,DEFN,CHNL,\r
+            +             'IB',CH,'ZETA  ',REDD)\r
+               CALL WRSYM2(NARCS,ORDRG,CENSY,REFLN,CHNL)\r
+             ELSE\r
+               CALL WRFUN1(NARCS,STAPT,ARCTY,PGM,RGM,PTX,NTX,DEFN,CHNL,\r
+            +             'IA','TT','PARFUN',REDD)\r
+             ENDIF\r
+       C\r
+             WRITE(CHNL,'(A1)') 'C'\r
+             WRITE(CHNL,'(A9)') '      END'\r
+       C\r
+       C**** WRITE THE SOURCE CODE FOR DPARFN\r
+       C\r
+             WRITE(CHNL,'(A40)') 'C...........................................'\r
+             CALL HEADER('DPARFN',REDD,CHNL)\r
+             IF (SYMTY) THEN\r
+               CALL WRSYM1(NARCS,ORDRG,ORDSG,RTUNI,U2,CENSY,REFLN,.FALSE.,REDD,\r
+            +              CHNL)\r
+               IF (REFLN) THEN\r
+                 CH='TS'\r
+               ELSE\r
+                 CH='TT'\r
+               ENDIF\r
+               CALL WRFUN2(NARCS,MNARC,STAPT,ARCTY,PGM,RGM,PTX,NTX,DEFN,\r
+            +              CHNL,'IB',CH,'ZETA  ',NUMDER,REDD)\r
+               CALL WRSYM3(NARCS,ORDRG,REFLN,CHNL)\r
+             ELSE\r
+               CALL WRFUN2(NARCS,MNARC,STAPT,ARCTY,PGM,RGM,PTX,NTX,DEFN,\r
+            +              CHNL,'IA','TT','DPARFN',NUMDER,REDD)\r
+             ENDIF\r
+       C\r
+             WRITE(CHNL,'(A1)') 'C'\r
+             WRITE(CHNL,'(A9)') '      END'\r
+             CLOSE(CHNL)\r
+       C\r
+       999   CONTINUE\r
+             CALL WRTAIL(6,0,IER)\r
+       C*/\r
+       } // public void PARGEN\r
+       \r
+      //COMPLEX FUNCTION PARFUN(I,T)\r
+      //INTEGER I\r
+      //COMPLEX T\r
+      double[] PARFUN(int I, double T[]) {\r
+\r
+          // DUMMY FUNCTION TO AID LINK-LOADING OF PARGEN\r
+\r
+          double result[] =new double[]{1.0,0.0};\r
+          return result;\r
+      } // double[] PARFUN     \r
+       \r
+         //COMPLEX FUNCTION DPARFN(I,T)\r
+         //INTEGER I\r
+         //COMPLEX T\r
+      double[] DPARFN(int I, double T[]) {\r
+       \r
+             // DUMMY FUNCTION TO AID LINK-LOADING OF PARGEN\r
+       \r
+         double result[] =new double[]{1.0,0.0};\r
+          return result;\r
+      } // double[] DPARFN\r
+\r
+      private void WRHEAD(int I,int CHNL, RandomAccessFile raFile) {\r
+   \r
+\r
+      //**** WRITE A HEADING FOR THE MAIN CONFPACK MODULES JAPHYC (I=1), \r
+      //**** GQPHYC (I=2), JACANP (I=3), GQCANP (I=4), CNDPLT (I=5), THE\r
+      //**** PARAMETRIC FUNCTION GENERATOR PARGEN (I=6),THE PARAMETRIC FUNCTION\r
+      //**** TESTER TSTPLT (I=7) AND THE LEVEL CURVE ROUTINE LEVCUR (I=8).  IF \r
+      //**** CHNL=0 THEN WRITE ON THE STANDARD OUTPUT CHANNEL, OTHERWISE WRITE \r
+      //**** ON THE CHANNEL SPECIFIED BY CHNL.\r
+      //\r
+      //    LOCAL VARIABLES\r
+      //\r
+         String DOTS = ".................................................";\r
+         String CPHEAD = ": C O N F P A C K    M O D U L E    ";\r
+         String MOD[] = new String[]{"J A P H Y C :",\r
+                                     "G Q P H Y C :",\r
+                                     "J A C A N P :",\r
+                                     "G Q C A N P :",\r
+                                     "C N D P L T :",\r
+                                     "P A R G E N :",\r
+                                     "T S T P L T :",\r
+                                     "L E V C U R :"};\r
+         String TXT = CPHEAD + MOD[I-1];\r
+            \r
+          if (CHNL == 0 || CHNL == 6) {\r
+                 System.out.println("\n\n      "+DOTS+"\n      "+TXT+"\n      "+DOTS+"\n");\r
+          }\r
+          else {\r
+                 try {\r
+                     raFile.writeBytes("\n\n      "+DOTS+"\n      "+TXT+"\n      "+DOTS+"\n");\r
+                 }\r
+                 catch (IOException e) {\r
+                         MipavUtil.displayError("IOException " + e + " on raFile.writeBytes in WRHEAD");\r
+                         System.exit(-1);\r
+                 }\r
+          }\r
+          return;\r
+      } // private void WRHEAD\r
+\r
+}
\ No newline at end of file