-man_MANS=pjrec.1 phm2pj.1 phm2if.1 if2img.1 ifinfo.1 if-1.1 if-2.1 pjinfo.1 ifinfo.1 pj2if.1
+man_MANS=pjrec.1 phm2pj.1 phm2if.1 if2img.1 ifinfo.1 if1.1 if2.1 pjinfo.1 ifinfo.1 pj2if.1
EXTRA_DIST = $(man_MANS)
-bin_PROGRAMS = pjrec phm2pj pj2if @lamprograms@ ifinfo phm2if if-1 if-2 ifexport pjinfo
+bin_PROGRAMS = pjrec phm2pj pj2if @lamprograms@ ifinfo phm2if if1 if2 ifexport pjinfo
bin_SCRIPTS = sample-ctsim.sh
EXTRA_PROGRAMS = pjrec-lam phm2pj-lam phm2if-lam
INCLUDES=@my_includes@
pjinfo_SOURCES = pjinfo.cpp
pjinfo_LDADD=@ctlibs@
pjinfo_DEPENDENCIES=$(SOURCE_DEPEND)
-if_1_SOURCES=if-1.cpp
-if_1_LDADD=@ctlibs@
-if_1_DEPENDENCIES=$(SOURCE_DEPEND)
-if_2_SOURCES=if-2.cpp
-if_2_LDADD=@ctlibs@
-if_2_DEPENDENCIES=$(SOURCE_DEPEND)
+if1_SOURCES=if1.cpp
+if1_LDADD=@ctlibs@
+if1_DEPENDENCIES=$(SOURCE_DEPEND)
+if2_SOURCES=if2.cpp
+if2_LDADD=@ctlibs@
+if2_DEPENDENCIES=$(SOURCE_DEPEND)
ifinfo_SOURCES = ifinfo.cpp
ifinfo_LDADD=@ctlibs@
ifinfo_DEPENDENCIES=$(SOURCE_DEPEND)
+++ /dev/null
-/*****************************************************************************
-** FILE IDENTIFICATION
-**
-** Name: if-1.cpp
-** Purpose: Manipulate a single image file
-** Programmer: Kevin Rosenberg
-** Date Started: Aug 1984
-**
-** This is part of the CTSim program
-** Copyright (C) 1983-2000 Kevin Rosenberg
-**
-** $Id: if-1.cpp,v 1.5 2000/12/17 23:30:48 kevin Exp $
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License (version 2) as
-** published by the Free Software Foundation.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-******************************************************************************/
-
-/* FILE
- * if-1.c Filter a single IF file
- */
-
-#include "ct.h"
-
-enum {O_LOG, O_EXP, O_SQRT, O_SQR, O_INVERT, O_VERBOSE, O_HELP, O_VERSION};
-
-static struct option my_options[] =
-{
- {"invert", 0, 0, O_INVERT},
- {"verbose", 0, 0, O_VERBOSE},
- {"log", 0, 0, O_LOG},
- {"exp", 0, 0, O_EXP},
- {"sqr", 0, 0, O_SQR},
- {"sqrt", 0, 0, O_SQRT},
- {"help", 0, 0, O_HELP},
- {"version", 0, 0, O_VERSION},
- {0, 0, 0, 0}
-};
-
-static const char* g_szIdStr = "$Id: if-1.cpp,v 1.5 2000/12/17 23:30:48 kevin Exp $";
-
-void
-if1_usage (const char *program)
-{
- std::cout << "usage: " << fileBasename(program) << " infile outfile [OPTIONS]" << std::endl;
- std::cout << "Generate a IF file from a IF file" << std::endl;
- std::cout << std::endl;
- std::cout << " --invert Invert image" << std::endl;
- std::cout << " --log Natural logrithm of image" << std::endl;
- std::cout << " --exp Natural exponential of image" << std::endl;
- std::cout << " --sqr Square of image" << std::endl;
- std::cout << " --sqrt Square root of image" << std::endl;
- std::cout << " --verbose Verbose modem" << std::endl;
- std::cout << " --version Print version" << std::endl;
- std::cout << " --help Print this help message" << std::endl;
-}
-
-int
-if1_main (int argc, char *const argv[])
-{
- ImageFile *im_in;
- ImageFile *im_out;
- char *in_file;
- char *out_file;
- int opt_verbose = 0;
- int opt_invert = 0;
- int opt_log = 0;
- int opt_exp = 0;
- int opt_sqr = 0;
- int opt_sqrt = 0;
-
- while (1)
- {
- int c = getopt_long (argc, argv, "", my_options, NULL);
-
- if (c == -1)
- break;
-
- switch (c)
- {
- case O_INVERT:
- opt_invert = 1;
- break;
- case O_LOG:
- opt_log = 1;
- break;
- case O_SQR:
- opt_sqr = 1;
- break;
- case O_SQRT:
- opt_sqrt = 1;
- break;
- case O_EXP:
- opt_exp = 1;
- break;
- case O_VERBOSE:
- opt_verbose = 1;
- break;
- case O_VERSION:
-#ifdef VERSION
- std::cout << "Version " << VERSION << std::endl << g_szIdStr << std::endl;
-#else
- std::cout << "Unknown version number" << std::endl;
-#endif
- return (0);
- case O_HELP:
- case '?':
- if1_usage(argv[0]);
- return (0);
- default:
- if1_usage(argv[0]);
- return (1);
- }
- }
-
- if (optind + 2 != argc)
- {
- if1_usage(argv[0]);
- return (1);
- }
-
- in_file = argv[optind];
- out_file = argv[optind + 1];
-
-
- std::string histString;
-
- if (opt_invert || opt_log || opt_exp || opt_sqr || opt_sqrt) {
- int ix, iy;
-
- im_in = new ImageFile ();
- im_in->fileRead (in_file);
- int nx = im_in->nx();
- int ny = im_in->ny();
- im_out = new ImageFile (nx, ny);
-
- ImageFileArray vIn = im_in->getArray();
- ImageFileArray vOut = im_out->getArray();
-
- if (opt_invert) {
- for (ix = 0; ix < nx; ix++)
- for (iy = 0; iy < ny; iy++)
- vOut[ix][iy] = - vIn[ix][iy];
- histString = "Invert transformation";
- }
- if (opt_log) {
- for (ix = 0; ix < nx; ix++)
- for (iy = 0; iy < ny; iy++)
- vOut[ix][iy] = log (vIn[ix][iy]);
- histString = "Log transformation";
- }
- if (opt_exp) {
- for (ix = 0; ix < nx; ix++)
- for (iy = 0; iy < ny; iy++)
- vOut[ix][iy] = exp (vIn[ix][iy]);
- histString = "Exp transformation";
- }
- if (opt_sqr) {
- for (ix = 0; ix < nx; ix++)
- for (iy = 0; iy < ny; iy++)
- vOut[ix][iy] = vIn[ix][iy] * vIn[ix][iy];
- histString = "Sqr transformation";
- }
- if (opt_sqrt) {
- for (ix = 0; ix < nx; ix++)
- for (iy = 0; iy < ny; iy++)
- vOut[ix][iy] = sqrt (vIn[ix][iy]);
- histString = "Sqrt transformation";
- }
-
- im_out->labelsCopy (*im_in);
- im_out->labelAdd (Array2dFileLabel::L_HISTORY, histString.c_str());
- im_out->fileWrite (out_file);
- }
-
- return (0);
-}
-
-#ifndef NO_MAIN
-int
-main (int argc, char *const argv[])
-{
- int retval = 1;
-
- try {
- retval = if1_main(argc, argv);
- } catch (exception e) {
- std::cerr << "Exception: " << e.what() << std::endl;
- } catch (...) {
- std::cerr << "Unknown exception" << std::endl;
- }
-
- return (retval);
-}
-#endif
-
+++ /dev/null
-/*****************************************************************************
-** FILE IDENTIFICATION
-**
-** Name: if-2.cpp
-** Purpose: Manipulate two image files
-** Programmer: Kevin Rosenberg
-** Date Started: May 2000
-**
-** This is part of the CTSim program
-** Copyright (C) 1983-2000 Kevin Rosenberg
-**
-** $Id: if-2.cpp,v 1.7 2000/12/17 23:30:48 kevin Exp $
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License (version 2) as
-** published by the Free Software Foundation.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-******************************************************************************/
-
-
-#include "ct.h"
-#include "timer.h"
-
-enum {O_ADD, O_SUB, O_MUL, O_COMP, O_ROW_PLOT, O_COLUMN_PLOT, O_VERBOSE, O_HELP, O_VERSION};
-
-static struct option my_options[] =
-{
- {"add", 0, 0, O_ADD},
- {"sub", 0, 0, O_SUB},
- {"mul", 0, 0, O_MUL},
- {"comp", 0, 0, O_COMP},
- {"column-plot", 1, 0, O_COLUMN_PLOT},
- {"row-plot", 1, 0, O_ROW_PLOT},
- {"verbose", 0, 0, O_VERBOSE},
- {"help", 0, 0, O_HELP},
- {"version", 0, 0, O_VERSION},
- {0, 0, 0, 0}
-};
-
-static const char* g_szIdStr = "$Id: if-2.cpp,v 1.7 2000/12/17 23:30:48 kevin Exp $";
-
-void
-if2_usage (const char *program)
-{
- std::cout << "usage: " << fileBasename(program) << " infile1 infile2 outfile [OPTIONS]\n";
- std::cout << "Perform functions on two input image files\n";
- std::cout << std::endl;
- std::cout << " infile1 Name of first input IF file\n";
- std::cout << " infile2 Name of second input IF file\n";
- std::cout << " outfile Name of output IF file\n";
- std::cout << " --add Add images\n";
- std::cout << " --sub Subtract image 2 from image 1\n";
- std::cout << " --mul Multiply images\n";
- std::cout << " --comp Compare images\n";
- std::cout << " --column-plot n Plot column\n";
- std::cout << " --row-plot n Plot row\n";
- std::cout << " --verbose Verbose modem\n";
- std::cout << " --version Print version\n";
- std::cout << " --help Print this help message\n";
-}
-
-int
-if2_main (int argc, char *const argv[])
-{
- ImageFile* pim_in1;
- ImageFile* pim_in2;
- ImageFile* pim_out = NULL;
- std::string in_file1;
- std::string in_file2;
- std::string out_file;
- int opt_verbose = 0;
- int opt_add = 0;
- int opt_sub = 0;
- int opt_mul = 0;
- int opt_comp = 0;
- bool opt_outputFile = false;
- int opt_rowPlot = -1;
- int opt_columnPlot = -1;
- Timer timerProgram;
-
- while (1) {
- char* endptr;
- int c = getopt_long (argc, argv, "", my_options, NULL);
-
- if (c == -1)
- break;
-
- switch (c) {
- case O_ADD:
- opt_add = 1;
- opt_outputFile = true;
- break;
- case O_SUB :
- opt_sub = 1;
- opt_outputFile = true;
- break;
- case O_MUL:
- opt_mul = 1;
- opt_outputFile = true;
- break;
- case O_ROW_PLOT:
- opt_rowPlot = strtol(optarg, &endptr, 10);
- if (endptr != optarg + strlen(optarg)) {
- if2_usage(argv[0]);
- }
- break;
- case O_COLUMN_PLOT:
- opt_columnPlot = strtol(optarg, &endptr, 10);
- if (endptr != optarg + strlen(optarg)) {
- if2_usage(argv[0]);
- }
- break;
- case O_COMP:
- opt_comp = 1;
- break;
- case O_VERBOSE:
- opt_verbose = 1;
- break;
- case O_VERSION:
-#ifdef VERSION
- std::cout << "Version " << VERSION << std::endl << g_szIdStr << std::endl;
-#else
- std::cout << "Unknown version number\n";
-#endif
- return (0);
- case O_HELP:
- case '?':
- if2_usage(argv[0]);
- return (0);
- default:
- if2_usage(argv[0]);
- return (1);
- }
- }
-
- if (opt_outputFile && (optind + 3 != argc)) {
- if2_usage(argv[0]);
- return (1);
- }
- else if (! opt_outputFile && optind + 2 != argc) {
- if2_usage(argv[0]);
- return (1);
- }
-
- in_file1 = argv[optind];
- in_file2 = argv[optind + 1];
- if (opt_outputFile)
- out_file = argv[optind + 2];
-
- pim_in1 = new ImageFile ();
- pim_in2 = new ImageFile ();
- ImageFile& im_in1 = *pim_in1;
- ImageFile& im_in2 = *pim_in2;
-
- if (! im_in1.fileRead(in_file1) || ! im_in2.fileRead(in_file2)) {
- sys_error (ERR_WARNING, "Error reading an image");
- return (1);
- }
-
- if (im_in1.nx() != im_in2.nx() || im_in1.ny() != im_in2.ny()) {
- sys_error (ERR_SEVERE, "Error: Size of image 1 (%d,%d) and image 2 (%d,%d) do not match",
- im_in1.nx(), im_in1.ny(), im_in2.nx(), im_in2.ny());
- return(1);
- }
- if (im_in1.nx() < 0 || im_in1.ny() < 0) {
- sys_error (ERR_SEVERE, "Error: Size of image < 0");
- return(1);
- }
-
- ImageFileArray v1 = im_in1.getArray();
- ImageFileArray v2 = im_in2.getArray();
- ImageFileArray vout = NULL;
-
- if (opt_outputFile) {
- pim_out = new ImageFile (im_in1.nx(), im_in1.ny());
- vout = pim_out->getArray();
- }
-
- std::string strOperation;
- int nx = im_in1.nx();
- int ny = im_in1.ny();
- int nx2 = im_in2.nx();
- int ny2 = im_in2.ny();
-
- if (opt_add) {
- strOperation = "Add Images";
- for (int ix = 0; ix < nx; ix++) {
- ImageFileColumn in1 = v1[ix];
- ImageFileColumn in2 = v2[ix];
- ImageFileColumn out = vout[ix];
- for (int iy = 0; iy < ny; iy++)
- *out++ = *in1++ + *in2++;
- }
- } else if (opt_sub) {
- strOperation = "Subtract Images";
- for (int ix = 0; ix < nx; ix++) {
- ImageFileColumn in1 = v1[ix];
- ImageFileColumn in2 = v2[ix];
- ImageFileColumn out = vout[ix];
- for (int iy = 0; iy < ny; iy++)
- *out++ = *in1++ - *in2++;
- }
- } else if (opt_mul) {
- strOperation = "Multiply Images";
- for (int ix = 0; ix < nx; ix++) {
- ImageFileColumn in1 = v1[ix];
- ImageFileColumn in2 = v2[ix];
- ImageFileColumn out = vout[ix];
- for (int iy = 0; iy < ny; iy++)
- *out++ = *in1++ * *in2++;
- }
- }
- if (opt_comp) {
- double d, r, e;
- im_in1.comparativeStatistics (im_in2, d, r, e);
- std::cout << "d=" << d << ", r=" << r << ", e=" << e << std::endl;
- }
- if (opt_columnPlot > 0) {
- if (opt_columnPlot >= nx || opt_columnPlot >= nx2) {
- sys_error (ERR_SEVERE, "column-plot > nx");
- return (1);
- }
- double plot_xaxis [nx];
- for (int i = 0; i < nx; i++)
- plot_xaxis[i] = i;
-#if HAVE_SGP
- SGPDriver driver ("Column Plot");
- SGP sgp (driver);
- EZPlot ezplot (sgp);
- ezplot.ezset ("clear.");
- ezplot.ezset ("xticks major 5.");
- ezplot.ezset ("xlabel Column");
- ezplot.ezset ("title Column Plot");
- ezplot.ezset ("ylabel Pixel");
- ezplot.ezset ("box.");
- ezplot.ezset ("grid.");
- ezplot.addCurve (plot_xaxis, v1[opt_columnPlot], im_in1.ny());
- ezplot.addCurve (plot_xaxis, v2[opt_columnPlot], im_in2.ny());
- ezplot.plot();
- std::cout << "Press enter to continue" << flush;
- cio_kb_getc();
-#endif
- }
-
- if (opt_rowPlot > 0) {
- if (opt_rowPlot >= ny || opt_rowPlot >= ny2) {
- sys_error (ERR_SEVERE, "row_plot > ny");
- return (1);
- }
- double plot_xaxis [ny];
- double v1Row[nx], v2Row[nx2];
-
- for (int i = 0; i < ny; i++)
- plot_xaxis[i] = i;
- for (int i = 0; i < nx; i++)
- v1Row[i] = v1[i][opt_rowPlot];
- for (int i = 0; i < nx2; i++)
- v2Row[i] = v2[i][opt_rowPlot];
-
-#if HAVE_SGP
- SGPDriver driver ("Row Plot");
- SGP sgp (driver);
- EZPlot ezplot (sgp);
- ezplot.ezset ("clear.");
- ezplot.ezset ("xticks major 5.");
- ezplot.ezset ("title Row Plot");
- ezplot.ezset ("xlabel Row");
- ezplot.ezset ("ylabel Pixel");
- ezplot.ezset ("box.");
- ezplot.ezset ("grid.");
- ezplot.addCurve (plot_xaxis, v1Row, im_in1.nx());
- ezplot.addCurve (plot_xaxis, v2Row, im_in2.nx());
- ezplot.plot();
- std::cout << "Press enter to continue" << flush;
- cio_kb_getc();
-#endif
- }
-
- if (opt_outputFile) {
- pim_out->labelsCopy (im_in1, "if-2 file 1: ");
- pim_out->labelsCopy (im_in2, "if-2 file 2: ");
- pim_out->labelAdd (Array2dFileLabel::L_HISTORY, strOperation.c_str(), timerProgram.timerEnd());
- pim_out->fileWrite(out_file);
- }
-
- return (0);
-}
-
-#ifndef NO_MAIN
-int
-main (int argc, char *const argv[])
-{
- int retval = 1;
-
- try {
- retval = if2_main(argc, argv);
- } catch (exception e) {
- std::cerr << "Exception: " << e.what() << std::endl;
- } catch (...) {
- std::cerr << "Unknown exception\n";
- }
-
- return (retval);
-}
-#endif
-
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: phm2pj.cpp,v 1.18 2000/12/17 23:30:48 kevin Exp $
+** $Id: phm2pj.cpp,v 1.19 2000/12/18 00:09:59 kevin Exp $
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License (version 2) as
{0, 0, 0, 0}
};
-static const char* g_szIdStr = "$Id: phm2pj.cpp,v 1.18 2000/12/17 23:30:48 kevin Exp $";
+static const char* g_szIdStr = "$Id: phm2pj.cpp,v 1.19 2000/12/18 00:09:59 kevin Exp $";
void
opt_rotangle = strtod(optarg, &endptr);
endstr = optarg + strlen(optarg);
if (endptr != endstr) {
- std::cerr << "Error setting --rotangle to " << optarg << endl;
+ std::cerr << "Error setting --rotangle to " << optarg << std::endl;
phm2pj_usage(argv[0]);
return (1);
}
dOptFocalLength = strtod(optarg, &endptr);
endstr = optarg + strlen(optarg);
if (endptr != endstr) {
- std::cerr << "Error setting --focal-length to " << optarg << endl;
+ std::cerr << "Error setting --focal-length to " << optarg << std::endl;
phm2pj_usage(argv[0]);
return (1);
}
dOptFieldOfView = strtod(optarg, &endptr);
endstr = optarg + strlen(optarg);
if (endptr != endstr) {
- std::cerr << "Error setting --field-of-view to " << optarg << endl;
+ std::cerr << "Error setting --field-of-view to " << optarg << std::endl;
phm2pj_usage(argv[0]);
return (1);
}
opt_nray = strtol(optarg, &endptr, 10);
endstr = optarg + strlen(optarg);
if (endptr != endstr) {
- std::cerr << "Error setting --nray to %s" << optarg << endl;
+ std::cerr << "Error setting --nray to %s" << optarg << std::endl;
phm2pj_usage(argv[0]);
return (1);
}
break;
case O_VERSION:
#ifdef VERSION
- std::cout << "Version: " << VERSION << endl << g_szIdStr << endl;
+ std::cout << "Version: " << VERSION << std::endl << g_szIdStr << std::endl;
#else
std::cout << "Unknown version number\n";
#endif
}
if (optPhmName == "" && optPhmFileName == "") {
- std::cerr << "No phantom defined\n" << endl;
+ std::cerr << "No phantom defined\n" << std::endl;
phm2pj_usage(argv[0]);
return (1);
}
opt_ndet = strtol(argv[optind+1], &endptr, 10);
endstr = argv[optind+1] + strlen(argv[optind+1]);
if (endptr != endstr) {
- std::cerr << "Error setting --ndet to " << argv[optind+1] << endl;
+ std::cerr << "Error setting --ndet to " << argv[optind+1] << std::endl;
phm2pj_usage(argv[0]);
return (1);
}
opt_nview = strtol(argv[optind+2], &endptr, 10);
endstr = argv[optind+2] + strlen(argv[optind+2]);
if (endptr != endstr) {
- std::cerr << "Error setting --nview to " << argv[optind+2] << endl;
+ std::cerr << "Error setting --nview to " << argv[optind+2] << std::endl;
phm2pj_usage(argv[0]);
return (1);
}
if (optPhmName != "") {
phm.createFromPhantom (optPhmName.c_str());
if (phm.fail()) {
- std::cout << phm.failMessage() << endl << endl;
+ std::cout << phm.failMessage() << std::endl << std::endl;
phm2pj_usage(argv[0]);
return (1);
}
opt_rotangle *= PI;
Scanner scanner (phm, optGeometryName.c_str(), opt_ndet, opt_nview, opt_nray, opt_rotangle, dOptFocalLength, dOptFieldOfView);
if (scanner.fail()) {
- std::cout << "Scanner Creation Error: " << scanner.failMessage() << endl;
+ std::cout << "Scanner Creation Error: " << scanner.failMessage() << std::endl;
return (1);
}
#ifdef HAVE_MPI
pjGlobal.write (opt_outfile);
if (opt_verbose) {
phm.print();
- std::cout << endl;
- ostringstream os;
+ std::cout << std::endl;
+ std::ostringstream os;
pjGlobal.printScanInfo (os);
- std::cout << os.str() << endl;
- std::cout << " Remark: " << pjGlobal.remark() << endl;
+ std::cout << os.str() << std::endl;
+ std::cout << " Remark: " << pjGlobal.remark() << std::endl;
std::cout << "Run time: " << pjGlobal.calcTime() << " seconds\n";
}
}
// dmalloc_shutdown();
#endif
} catch (exception e) {
- std::cerr << "Exception: " << e.what() << endl;
+ std::cerr << "Exception: " << e.what() << std::endl;
} catch (...) {
std::cerr << "Unknown exception\n";
}