2 ***********************************************************
3 $SNARK_Header: S N A R K 1 4 - A PICTURE RECONSTRUCTION PROGRAM $
4 $HeadURL: svn://dig.cs.gc.cuny.edu/snark/trunk/src/snark/rdpict.cpp $
5 $LastChangedRevision: 91 $
6 $Date: 2014-07-02 17:34:27 -0400 (Wed, 02 Jul 2014) $
8 ***********************************************************
10 READ A TEST PICTURE FROM FILE 'FILE11' AND CONVERT TO SNARK
11 INTERNAL REPRESENTATION
35 static BOOLEAN rdpict_called = false;
40 static const INTEGER pict_codes[2] =
41 { CHAR2INT('r', 'e', 'c', 'o'), CHAR2INT('t', 'e', 's', 't') };
43 // TEST FOR MULTIPLE CALLS AND ISSUE WARNING
50 // DETERMINE WHETHER PICTURE TEST OR RECON.
52 tword = InFile.getwrd(FALSE, &eol, pict_codes, 2);
56 fprintf(output, "\n **** TEST or RECONSTRUCTION must be specified");
57 fprintf(output, "\n **** program aborted\n");
61 if (tword == pict_codes[0])
63 // FOR PICT RECON GET NELEM, PIXSIZ, WRITE ON RECFIL QUIT
64 GeoPar.nelem = InFile.getint(FALSE, &eol);
65 // The following line added for SNARK89 Version 1.01 7/13/90
66 if ((GeoPar.nelem <= 0) || (GeoPar.nelem / 2 * 2 == GeoPar.nelem))
68 GeoPar.area = GeoPar.nelem * GeoPar.nelem;
69 GeoPar.midpix = (GeoPar.nelem + 1) / 2;
70 GeoPar.pixsiz = InFile.getnum(FALSE, &eol);
71 // The following line added for SNARK89 Version 1.01 7/13/90
72 if (GeoPar.pixsiz < Consts.zero)
75 // OPEN RECONSTRUCTION FILE FOR PICTURE RECONSTRUCTION CASE
77 if (RecFile.Open("recfil", GeoPar.nelem, GeoPar.pixsiz) != 0)
79 fprintf(output, "\n **** unable to open recfil");
80 fprintf(output, "\n **** program aborted\n");
86 // READ PICTURE HEADER INFORMATION
88 if (File11.Open(FALSE) != 0)
90 fprintf(output, "\n **** unable to open file11 for reading");
91 fprintf(output, "\n **** program aborted\n");
96 File11.CreaInPicture();
101 // WRITE HEADER ON RECFIL
102 // OPEN RECONSTRUCTION FILE FOR PICTURE TEST CASE
104 if (RecFile.Open("recfil", GeoPar.nelem, GeoPar.pixsiz) != 0)
106 fprintf(output, "\n **** unable to open recfil");
107 fprintf(output, "\n **** program aborted\n");
111 // ALLOCATE SPACE FOR THE PICTURE
112 Creacm.test = new REAL[GeoPar.area];
114 // READ IN THE TEST PICTURE INTO THE WORK AREA
116 File11.ReadPicture(Creacm.test, GeoPar.nelem);
118 // WRITE TEST PICTURE ON RECFIL
119 RecFile.WritePhan(Creacm.name, Creacm.test);
121 fprintf(output, "\n test picture read");
122 fprintf(output, "\n %s", Creacm.name);