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/pnch.cpp $
5 $LastChangedRevision: 80 $
6 $Date: 2014-07-01 21:01:54 -0400 (Tue, 01 Jul 2014) $
8 ***********************************************************
10 POST-PROCESSING ROUTINE TO OUTPUT RECONSTRUCTIONS IN THE SNARK
30 // was in post but it is really local
35 // was in geo but it is realy local
39 //commented out since it is never used. Lajos, Dec 16, 2004
40 static const INTEGER hphan = CHAR2INT('p', 'h', 'a', 'n');
42 // modified calls to getwrd() to use the 4-parameter version. Lajos, Dec 13, 2004
43 static const INTEGER pnch_codes[1] =
44 { CHAR2INT('p', 'h', 'a', 'n') };
49 unsigned INTEGER count, iter;
52 static bool called = FALSE;
54 // if first time call open new punch file
57 if (PunchFile.Open(false) != 0)
59 fprintf(output, "\n **** unable to open file: punch");
60 fprintf(output, "\n **** PUNCH execution aborted\n");
67 if (PunchFile.Open(true) != 0)
69 fprintf(output, "\n **** unable to open file: punch");
70 fprintf(output, "\n **** PUNCH execution aborted\n");
75 if (RecFile.Open("recfil") != 0)
77 fprintf(output, "\n **** unable to open file: punch");
78 fprintf(output, "\n **** PUNCH execution aborted\n");
83 if (RecFile.GetNelem(&nelem) != 0)
88 if (RecFile.GetProjName(prjnam) != 0)
95 phan = (InFile.getwrd(FALSE, &eol, pnch_codes, 1) == hphan);
99 recon = new REAL[area];
103 if (RecFile.ReadPhan(phnnam, recon) != 0)
105 fprintf(output, "\n **** phantom not present\n");
109 PunchFile.WritePhantomHeader(phnnam);
111 PunchFile.WriteData(recon, nelem);
117 while (RecFile.ReadRec(recnam, algn, &count, &iter, recon) == 0)
122 if (flags[iter - 1] != 0)
126 "\n reconstruction of %4s using %s iter %5i, %s",
127 recnam, algn, count, prjnam);
129 PunchFile.WriteRecHeader(recnam, algn, count, prjnam);
131 PunchFile.WriteData(recon, nelem);
135 delete[] recon; // bug 92 - Lajos - 03/02/2005