projects
/
ctsim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r600: *** empty log message ***
[ctsim.git]
/
tools
/
phm2if.cpp
diff --git
a/tools/phm2if.cpp
b/tools/phm2if.cpp
index f7f9551d62505bc5f7447df0b8f69cc5492a5d7d..c6755eca9f6915276c9d0589b0f67926d1465e83 100644
(file)
--- a/
tools/phm2if.cpp
+++ b/
tools/phm2if.cpp
@@
-9,7
+9,7
@@
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: phm2if.cpp,v 1.
19 2001/01/02 13:57:5
2 kevin Exp $
+** $Id: phm2if.cpp,v 1.
23 2001/02/08 21:49:3
2 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
**
** 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
@@
-29,7
+29,7
@@
#include "timer.h"
#include "timer.h"
-enum { O_PHANTOM, O_DESC, O_NSAMPLE, O_FILTER, O_TRACE, O_VERBOSE, O_HELP,
+enum { O_PHANTOM, O_DESC, O_NSAMPLE, O_FILTER, O_
VIEW_RATIO, O_
TRACE, O_VERBOSE, O_HELP,
O_PHMFILE, O_FILTER_DOMAIN, O_FILTER_BW, O_FILTER_PARAM, O_DEBUG, O_VERSION };
static struct option my_options[] =
O_PHMFILE, O_FILTER_DOMAIN, O_FILTER_BW, O_FILTER_PARAM, O_DEBUG, O_VERSION };
static struct option my_options[] =
@@
-43,6
+43,7
@@
static struct option my_options[] =
{"filter-bw", 1, 0, O_FILTER_BW},
{"filter-param", 1, 0, O_FILTER_PARAM},
{"trace", 1, 0, O_TRACE},
{"filter-bw", 1, 0, O_FILTER_BW},
{"filter-param", 1, 0, O_FILTER_PARAM},
{"trace", 1, 0, O_TRACE},
+ {"view-ratio", 1, 0, O_VIEW_RATIO},
{"verbose", 0, 0, O_VERBOSE},
{"debug", 0, 0, O_DEBUG},
{"help", 0, 0, O_HELP},
{"verbose", 0, 0, O_VERBOSE},
{"debug", 0, 0, O_DEBUG},
{"help", 0, 0, O_HELP},
@@
-50,7
+51,7
@@
static struct option my_options[] =
{0, 0, 0, 0}
};
{0, 0, 0, 0}
};
-static const char* g_szIdStr = "$Id: phm2if.cpp,v 1.
19 2001/01/02 13:57:5
2 kevin Exp $";
+static const char* g_szIdStr = "$Id: phm2if.cpp,v 1.
23 2001/02/08 21:49:3
2 kevin Exp $";
void
phm2if_usage (const char *program)
void
phm2if_usage (const char *program)
@@
-61,6
+62,7
@@
phm2if_usage (const char *program)
std::cout << " outfile Name of output file for image\n";
std::cout << " nx Number of pixels X-axis\n";
std::cout << " ny Number of pixels Y-axis\n";
std::cout << " outfile Name of output file for image\n";
std::cout << " nx Number of pixels X-axis\n";
std::cout << " ny Number of pixels Y-axis\n";
+ std::cout << " --view-ratio View diameter to phantom diameter ratio (default = 1)\n";
std::cout << " --phantom Phantom to use for projection\n";
std::cout << " herman Herman head phantom\n";
std::cout << " herman-b Herman head phantom (Bordered)\n";
std::cout << " --phantom Phantom to use for projection\n";
std::cout << " herman Herman head phantom\n";
std::cout << " herman-b Herman head phantom (Bordered)\n";
@@
-104,7
+106,7
@@
void mpi_gather_image (MPIWorld& mpiWorld, ImageFile* pImGlobal, ImageFile* pImL
#endif
int
#endif
int
-phm2if_main (int argc, char* argv[])
+phm2if_main (int argc, char*
const
argv[])
{
ImageFile* pImGlobal = NULL;
Phantom phm;
{
ImageFile* pImGlobal = NULL;
Phantom phm;
@@
-117,6
+119,7
@@
phm2if_main (int argc, char* argv[])
int opt_nx = 0;
int opt_ny = 0;
int opt_nsample = 1;
int opt_nx = 0;
int opt_ny = 0;
int opt_nsample = 1;
+ double optViewRatio = 1.;
double optFilterParam = 1.;
double optFilterBW = 1.;
int optTrace = Trace::TRACE_NONE;
double optFilterParam = 1.;
double optFilterBW = 1.;
int optTrace = Trace::TRACE_NONE;
@@
-173,6
+176,15
@@
phm2if_main (int argc, char* argv[])
return (1);
}
break;
return (1);
}
break;
+ case O_VIEW_RATIO:
+ optViewRatio = strtod(optarg, &endptr);
+ endstr = optarg + strlen(optarg);
+ if (endptr != endstr) {
+ sys_error(ERR_SEVERE,"Error setting --view-ratio to %s\n", optarg);
+ phm2if_usage(argv[0]);
+ return (1);
+ }
+ break;
case O_FILTER_PARAM:
optFilterParam = strtod(optarg, &endptr);
endstr = optarg + strlen(optarg);
case O_FILTER_PARAM:
optFilterParam = strtod(optarg, &endptr);
endstr = optarg + strlen(optarg);
@@
-234,7
+246,7
@@
phm2if_main (int argc, char* argv[])
}
std::ostringstream oss;
}
std::ostringstream oss;
- oss << "phm2if: nx=" << opt_nx << ", ny=" << opt_ny << ", nsample=" << opt_nsample << ", ";
+ oss << "phm2if: nx=" << opt_nx << ", ny=" << opt_ny << ",
viewRatio=" << optViewRatio << ",
nsample=" << opt_nsample << ", ";
if (optPhmFilename != "")
oss << "phantomFile=" << optPhmFilename;
else if (optPhmName != "")
if (optPhmFilename != "")
oss << "phantomFile=" << optPhmFilename;
else if (optPhmName != "")
@@
-279,6
+291,7
@@
phm2if_main (int argc, char* argv[])
mpiWorld.getComm().Bcast (&opt_nx, 1, MPI::INT, 0);
mpiWorld.getComm().Bcast (&opt_ny, 1, MPI::INT, 0);
mpiWorld.getComm().Bcast (&opt_nsample, 1, MPI::INT, 0);
mpiWorld.getComm().Bcast (&opt_nx, 1, MPI::INT, 0);
mpiWorld.getComm().Bcast (&opt_ny, 1, MPI::INT, 0);
mpiWorld.getComm().Bcast (&opt_nsample, 1, MPI::INT, 0);
+ mpiWorld.getComm().Bcast (&optViewRatio, 1, MPI::DOUBLE, 0);
mpiWorld.getComm().Bcast (&optFilterParam, 1, MPI::DOUBLE, 0);
mpiWorld.getComm().Bcast (&optFilterBW, 1, MPI::DOUBLE, 0);
mpiWorld.getComm().Bcast (&optFilterParam, 1, MPI::DOUBLE, 0);
mpiWorld.getComm().Bcast (&optFilterBW, 1, MPI::DOUBLE, 0);
@@
-316,7
+329,7
@@
phm2if_main (int argc, char* argv[])
}
} else {
TimerCollectiveMPI timerRasterize (mpiWorld.getComm());
}
} else {
TimerCollectiveMPI timerRasterize (mpiWorld.getComm());
- phm.convertToImagefile (*pImLocal, opt_nsample, optTrace, mpiWorld.getMyStartWorkUnit(), mpiWorld.getMyLocalWorkUnits(), false);
+ phm.convertToImagefile (*pImLocal, opt
ViewRatio, opt
_nsample, optTrace, mpiWorld.getMyStartWorkUnit(), mpiWorld.getMyLocalWorkUnits(), false);
if (optVerbose)
timerRasterize.timerEndAndReport ("Time to rasterize phantom");
if (optVerbose)
timerRasterize.timerEndAndReport ("Time to rasterize phantom");
@@
-332,11
+345,7
@@
phm2if_main (int argc, char* argv[])
} else if (optFilterName != "") {
pImGlobal->filterResponse (optDomainName.c_str(), optFilterBW, optFilterName.c_str(), optFilterParam);
} else {
} else if (optFilterName != "") {
pImGlobal->filterResponse (optDomainName.c_str(), optFilterBW, optFilterName.c_str(), optFilterParam);
} else {
-#if HAVE_SGP
- if (optTrace >= Trace::TRACE_PHANTOM)
- phm.show();
-#endif
- phm.convertToImagefile (*pImGlobal, opt_nsample, optTrace);
+ phm.convertToImagefile (*pImGlobal, optViewRatio, opt_nsample, optTrace);
}
#endif
}
#endif
@@
-349,19
+358,6
@@
phm2if_main (int argc, char* argv[])
pImGlobal->fileWrite (optOutFilename.c_str());
if (optVerbose)
std::cout << "Time to rasterize phantom: " << calctime << " seconds\n";
pImGlobal->fileWrite (optOutFilename.c_str());
if (optVerbose)
std::cout << "Time to rasterize phantom: " << calctime << " seconds\n";
-
- if (optTrace >= Trace::TRACE_PHANTOM) {
- double dmin, dmax;
- int nscale;
-
- std::cout << "Enter display size scale (nominal = 1): ";
- std::cin >> nscale;
- std::cout << "Enter minimum and maximum densities (min, max): ";
- std::cin >> dmin;
-
- std::cin >> dmax;
- pImGlobal->displayScaling (nscale, dmin, dmax);
- }
}
delete pImGlobal;
}
delete pImGlobal;