projects
/
ctsim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r160: *** empty log message ***
[ctsim.git]
/
tools
/
phm2if.cpp
diff --git
a/tools/phm2if.cpp
b/tools/phm2if.cpp
index ce522b98ac13c00ffb2f880693f2fe7e4488a247..b027975bdc156f76bfc9b85115cee2bae164e795 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.
2 2000/07/20 11:17:31
kevin Exp $
+** $Id: phm2if.cpp,v 1.
4 2000/07/23 01:49:03
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
@@
-98,19
+98,19
@@
phm2if_usage (const char *program)
}
#ifdef HAVE_MPI
}
#ifdef HAVE_MPI
-void mpi_gather_image (MPIWorld& mpiWorld, ImageFile*
imGlobal, ImageFile* i
mLocal, const int opt_debug);
+void mpi_gather_image (MPIWorld& mpiWorld, ImageFile*
pImGlobal, ImageFile* pI
mLocal, const int opt_debug);
#endif
int
phm2if_main (int argc, char* argv[])
{
#endif
int
phm2if_main (int argc, char* argv[])
{
- ImageFile*
i
mGlobal = NULL;
+ ImageFile*
pI
mGlobal = NULL;
Phantom phm;
int opt_nx = 0, opt_ny = 0;
int opt_nsample = 1;
Phantom phm;
int opt_nx = 0, opt_ny = 0;
int opt_nsample = 1;
- string optPhmName
= Phantom::PHM_HERMAN_STR
;
+ string optPhmName
(Phantom::convertPhantomIDToName(Phantom::PHM_HERMAN))
;
string optFilterName;
string optFilterName;
- string optDomainName
= SignalFilter::DOMAIN_SPATIAL_STR
;
+ string optDomainName
(SignalFilter::convertDomainIDToName (SignalFilter::DOMAIN_SPATIAL))
;
char *opt_outfile = NULL;
int opt_debug = 0;
string opt_desc;
char *opt_outfile = NULL;
int opt_debug = 0;
string opt_desc;
@@
-121,7
+121,7
@@
phm2if_main (int argc, char* argv[])
int opt_trace = TRACE_NONE;
bool opt_verbose = false;
#ifdef HAVE_MPI
int opt_trace = TRACE_NONE;
bool opt_verbose = false;
#ifdef HAVE_MPI
- ImageFile*
i
mLocal = NULL;
+ ImageFile*
pI
mLocal = NULL;
MPIWorld mpiWorld (argc, argv);
#endif
MPIWorld mpiWorld (argc, argv);
#endif
@@
-296,17
+296,17
@@
phm2if_main (int argc, char* argv[])
phm.createFromPhantom (optPhmName.c_str());
if (mpiWorld.getRank() == 0) {
phm.createFromPhantom (optPhmName.c_str());
if (mpiWorld.getRank() == 0) {
-
i
mGlobal = new ImageFile (opt_nx, opt_ny);
+
pI
mGlobal = new ImageFile (opt_nx, opt_ny);
}
}
-
i
mLocal = new ImageFile (opt_nx, opt_ny);
+
pI
mLocal = new ImageFile (opt_nx, opt_ny);
#else
#else
-
i
mGlobal = new ImageFile (opt_nx, opt_ny);
+
pI
mGlobal = new ImageFile (opt_nx, opt_ny);
#endif
ImageFileArray v;
#ifdef HAVE_MPI
if (mpiWorld.getRank() == 0)
#endif
ImageFileArray v;
#ifdef HAVE_MPI
if (mpiWorld.getRank() == 0)
- v =
i
mGlobal->getArray ();
+ v =
pI
mGlobal->getArray ();
if (phm.getComposition() == P_UNIT_PULSE) {
if (mpiWorld.getRank() == 0) {
if (phm.getComposition() == P_UNIT_PULSE) {
if (mpiWorld.getRank() == 0) {
@@
-314,31
+314,31
@@
phm2if_main (int argc, char* argv[])
}
} else if (optFilterName != "") {
if (mpiWorld.getRank() == 0) {
}
} else if (optFilterName != "") {
if (mpiWorld.getRank() == 0) {
-
i
mGlobal->filterResponse (optDomainName.c_str(), opt_filter_bw, optFilterName.c_str(), opt_filter_param);
+
pI
mGlobal->filterResponse (optDomainName.c_str(), opt_filter_bw, optFilterName.c_str(), opt_filter_param);
}
} else {
TimerCollectiveMPI timerRasterize (mpiWorld.getComm());
}
} else {
TimerCollectiveMPI timerRasterize (mpiWorld.getComm());
- phm.convertToImagefile (*
i
mLocal, opt_nsample, opt_trace, mpiWorld.getMyStartWorkUnit(), mpiWorld.getMyLocalWorkUnits());
+ phm.convertToImagefile (*
pI
mLocal, opt_nsample, opt_trace, mpiWorld.getMyStartWorkUnit(), mpiWorld.getMyLocalWorkUnits());
if (opt_verbose)
timerRasterize.timerEndAndReport ("Time to rasterize phantom");
TimerCollectiveMPI timerGather (mpiWorld.getComm());
if (opt_verbose)
timerRasterize.timerEndAndReport ("Time to rasterize phantom");
TimerCollectiveMPI timerGather (mpiWorld.getComm());
- mpi_gather_image (mpiWorld,
imGlobal, i
mLocal, opt_debug);
+ mpi_gather_image (mpiWorld,
pImGlobal, pI
mLocal, opt_debug);
if (opt_verbose)
timerGather.timerEndAndReport ("Time to gather image");
}
#else
if (opt_verbose)
timerGather.timerEndAndReport ("Time to gather image");
}
#else
- v =
i
mGlobal->getArray ();
+ v =
pI
mGlobal->getArray ();
if (phm.getComposition() == P_UNIT_PULSE) {
v[opt_nx/2][opt_ny/2] = 1.;
} else if (optFilterName != "") {
if (phm.getComposition() == P_UNIT_PULSE) {
v[opt_nx/2][opt_ny/2] = 1.;
} else if (optFilterName != "") {
-
i
mGlobal->filterResponse (optDomainName.c_str(), opt_filter_bw, optFilterName.c_str(), opt_filter_param);
+
pI
mGlobal->filterResponse (optDomainName.c_str(), opt_filter_bw, optFilterName.c_str(), opt_filter_param);
} else {
#if HAVE_SGP
if (opt_trace >= TRACE_PHM)
phm.show();
#endif
} else {
#if HAVE_SGP
if (opt_trace >= TRACE_PHM)
phm.show();
#endif
- phm.convertToImagefile (*
i
mGlobal, opt_nsample, opt_trace);
+ phm.convertToImagefile (*
pI
mGlobal, opt_nsample, opt_trace);
}
#endif
}
#endif
@@
-347,8
+347,8
@@
phm2if_main (int argc, char* argv[])
#endif
{
double calctime = timerProgram.timerEnd ();
#endif
{
double calctime = timerProgram.timerEnd ();
-
i
mGlobal->labelAdd (Array2dFileLabel::L_HISTORY, opt_desc.c_str(), calctime);
-
i
mGlobal->fileWrite (opt_outfile);
+
pI
mGlobal->labelAdd (Array2dFileLabel::L_HISTORY, opt_desc.c_str(), calctime);
+
pI
mGlobal->fileWrite (opt_outfile);
if (opt_verbose)
cout << "Time to rasterized phantom: " << calctime << " seconds" << endl;
if (opt_verbose)
cout << "Time to rasterized phantom: " << calctime << " seconds" << endl;
@@
-360,33
+360,38
@@
phm2if_main (int argc, char* argv[])
scanf ("%d", &nscale);
printf ("Enter minimum and maximum densities (min, max): ");
scanf ("%lf %lf", &dmin, &dmax);
scanf ("%d", &nscale);
printf ("Enter minimum and maximum densities (min, max): ");
scanf ("%lf %lf", &dmin, &dmax);
-
i
mGlobal->displayScaling (nscale, dmin, dmax);
+
pI
mGlobal->displayScaling (nscale, dmin, dmax);
}
}
}
}
+ delete pImGlobal;
+#ifdef HAVE_MPI
+ delete pImLocal;
+#endif
+
return (0);
}
#ifdef HAVE_MPI
return (0);
}
#ifdef HAVE_MPI
-void mpi_gather_image (MPIWorld& mpiWorld, ImageFile*
imGlobal, ImageFile* i
mLocal, const int opt_debug)
+void mpi_gather_image (MPIWorld& mpiWorld, ImageFile*
pImGlobal, ImageFile* pI
mLocal, const int opt_debug)
{
{
- ImageFileArray vLocal =
i
mLocal->getArray();
+ ImageFileArray vLocal =
pI
mLocal->getArray();
ImageFileArray vGlobal = NULL;
ImageFileArray vGlobal = NULL;
- int nyLocal =
i
mLocal->ny();
+ int nyLocal =
pI
mLocal->ny();
if (mpiWorld.getRank() == 0)
if (mpiWorld.getRank() == 0)
- vGlobal =
i
mGlobal->getArray();
+ vGlobal =
pI
mGlobal->getArray();
for (int iw = 0; iw < mpiWorld.getMyLocalWorkUnits(); iw++)
for (int iw = 0; iw < mpiWorld.getMyLocalWorkUnits(); iw++)
- mpiWorld.getComm().Send(vLocal[iw], nyLocal,
i
mLocal->getMPIDataType(), 0, 0);
+ mpiWorld.getComm().Send(vLocal[iw], nyLocal,
pI
mLocal->getMPIDataType(), 0, 0);
if (mpiWorld.getRank() == 0) {
for (int iProc = 0; iProc < mpiWorld.getNumProcessors(); iProc++) {
for (int iw = mpiWorld.getStartWorkUnit(iProc); iw <= mpiWorld.getEndWorkUnit(iProc); iw++) {
MPI::Status status;
if (mpiWorld.getRank() == 0) {
for (int iProc = 0; iProc < mpiWorld.getNumProcessors(); iProc++) {
for (int iw = mpiWorld.getStartWorkUnit(iProc); iw <= mpiWorld.getEndWorkUnit(iProc); iw++) {
MPI::Status status;
- mpiWorld.getComm().Recv(vGlobal[iw], nyLocal,
i
mLocal->getMPIDataType(), iProc, 0, status);
+ mpiWorld.getComm().Recv(vGlobal[iw], nyLocal,
pI
mLocal->getMPIDataType(), iProc, 0, status);
}
}
}
}
}
}