r96: *** empty log message ***
[ctsim.git] / src / phm2if.cpp
index 208de9acd7dd6cb5710984b5602da27530f38f92..3e82eefaadebc2802b5a430352af2f4ef191e13a 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: phm2if.cpp,v 1.8 2000/06/13 16:20:31 kevin Exp $
+**  $Id: phm2if.cpp,v 1.9 2000/06/15 19:07:10 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
@@ -104,7 +104,7 @@ int
 phm2if_main (int argc, char* argv[])
 {
   ImageFile* imGlobal = NULL;
-  PHANTOM *phm = NULL;
+  Phantom phm;
   int opt_nx = 0, opt_ny = 0;
   int opt_nsample = 1;
   int opt_phmnum = -1;
@@ -148,7 +148,7 @@ phm2if_main (int argc, char* argv[])
        break;
       case O_PHMFILE:
        strncpy(opt_phmfilename, optarg, sizeof(opt_phmfilename));
-       phm = phm_create_from_file(opt_phmfilename);
+       phm.createFromFile(opt_phmfilename);
 #ifdef HAVE_MPI
        if (mpiWorld.getRank() == 0) 
          cerr << "Can't use phantom from file in MPI mode" << endl;
@@ -225,7 +225,7 @@ phm2if_main (int argc, char* argv[])
       }
     }
     
-    if (phm == NULL && opt_phmnum == -1 && opt_filter == -1) {
+    if (phm.nPElem() == 0 && opt_phmnum == -1 && opt_filter == -1) {
       cerr << "No phantom defined" << endl;
       phm2if_usage(argv[0]);
       return (1);
@@ -308,7 +308,7 @@ phm2if_main (int argc, char* argv[])
 #endif
 
   if (opt_phmnum >= 0)
-      phm = phm_create (opt_phmnum);
+      phm.create (opt_phmnum);
 
 #ifdef HAVE_MPI
   else {
@@ -323,7 +323,7 @@ phm2if_main (int argc, char* argv[])
   if (mpiWorld.getRank() == 0)
     v = imGlobal->getArray ();
 
-  if (phm->type == P_UNIT_PULSE) {
+  if (phm.getComposition() == P_UNIT_PULSE) {
     if (mpiWorld.getRank() == 0) {
       v[opt_nx/2][opt_ny/2] = 1.;
     }
@@ -344,14 +344,14 @@ phm2if_main (int argc, char* argv[])
   }
 #else
   v = imGlobal->getArray ();
-  if (phm->type == P_UNIT_PULSE) {
+  if (phm.getComposition() == P_UNIT_PULSE) {
     v[opt_nx/2][opt_ny/2] = 1.;
   } else if (opt_filter != -1) {
     image_filter_response (*imGlobal, opt_filter_domain, opt_filter_bw, opt_filter, opt_filter_param, opt_trace);
   } else {
 #if HAVE_SGP
       if (opt_trace >= TRACE_PHM)
-       phm_show(phm);
+       phm.show();
 #endif
       phm_to_imagefile (phm, *imGlobal, 0, opt_nx, opt_nsample, opt_trace);
   }
@@ -380,8 +380,6 @@ phm2if_main (int argc, char* argv[])
     }
   }
 
-  phm_free (phm);
-
   return (0);
 }