r113: *** empty log message ***
authorKevin M. Rosenberg <kevin@rosenberg.net>
Mon, 19 Jun 2000 19:54:23 +0000 (19:54 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Mon, 19 Jun 2000 19:54:23 +0000 (19:54 +0000)
ChangeLog
NEWS
README
configure
configure.in
libctsim/Makefile.am
libctsim/phantom.cpp
libctsim/phm2image.cpp [deleted file]

index 1bb4c6b8723069a7ffdd787523d7954bf1afd362..fe5bd6b76eefd12bdec9b71afcad60292298fa17 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,7 @@
-1.9.2 - 6/17/2000
+1.9.3 - 6/19/2000
+   Reorganized source file
+       
+1.9.2 - 6/18/2000
    Reorganized include files
    Fixed const pointers in strfuncs
        
diff --git a/NEWS b/NEWS
index d10d07d9d3a7227f2cb4d4576493635e2462206d..3361499b774ec4c8fbc7ec82f779237a972e31a1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,2 @@
-Now, CTSim uses C++ and has cross-platform compatible data files.
-
-In the next release, interactive graphics will be added.
+6/17/2000
+       CTSim converted to C++ and has cross-platform compatible data files.
diff --git a/README b/README
index 5e16d8e993f55e0574562854aae281975df11f0e..2028fad4630beaca2f793f051886aa0fc03956d1 100644 (file)
--- a/README
+++ b/README
@@ -38,7 +38,7 @@ OVERVIEW
 --------
 
 CTSim simulates the collection of x-rays by a CT scanner. These x-rays
-of objects are called projections or raysums.
+of objects are called projections.
 
 Phantom objects are defined. Several built-in phantoms are included,
 as well as an extension to load files of phantom definitions.
@@ -51,20 +51,20 @@ based on a image file format used by the Jet Propulsion Laboratory
 THE PROGRAMS
 ------------
 
-phm2sdf - generates an SDF image of a phantom object
+phm2if - generates an image file of a phantom object
 
-phm2rs - Simulates the collection of CT data, or raysums, of a phantom
+phm2pj - Simulates the collection of CT data, or projections, of a phantom
 object
 
 ctrec - Performs an CT reconstruction, also known as image
-reconstruction from projections. Reads a raysum file and writes a SDF
+reconstruction from projections. Reads a projection file and writes a SDF
 file.
 
-rs2sdf - Converts raysum data to a raw sinugram image
+pj2if - Converts projection data to a raw sinugram image
 
-sdf2img - Converts an SDF file to a variety of 8-bit image formats
+if2img - Converts an image file to a variety of 8-bit and 16-bit image formats
 
-sdfinfo - Show statistics and history labels of SDF files
+ifinfo - Show statistics and history labels of SDF files
 
 TYPICAL USAGE
 -------------
@@ -75,9 +75,9 @@ Create a phantom image and viewable image file
   phm2sdf ...
   sdf2img ...
 
-Simulate CT data collection and create a viewable image of raw raysums
-  phm2rs ...
-  rs2sdf ...
+Simulate CT data collection and create a viewable image of raw projections
+  phm2pj ...
+  pj2sdf ...
   sdf2img ...
 
 Perform CT reconstruction and create viewable image file
index b525481f8594ea2a49116007531f9e96c5111902..5b11285747620503ecbb5f02af517aec0b1939e0 100755 (executable)
--- a/configure
+++ b/configure
@@ -711,7 +711,7 @@ fi
 
 PACKAGE=ctsim
 
-VERSION=1.9.2
+VERSION=1.9.3
 
 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
   { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
index 2e4a23d4a1b45188acc1f5faed08105cbd64af4d..b63f09ad59d2db3fa8ec39209cda7eb053edb208 100644 (file)
@@ -4,7 +4,7 @@ dnl Must reset CDPATH so that bash's cd does not print to stdout
 dnl CDPATH=
 
 AC_INIT(src/ctrec.cpp)
-AM_INIT_AUTOMAKE(ctsim,1.9.2)
+AM_INIT_AUTOMAKE(ctsim,1.9.3)
 AM_CONFIG_HEADER(config.h)
 
 dnl Checks for programs.
index 0c1b79b1e626fb2be62158c4c180fe90f55b1b65..3cc76ac8924dbfd6e422eaf122cb16c7639f3fa2 100644 (file)
@@ -1,5 +1,5 @@
 noinst_LIBRARIES = libctsim.a 
-libctsim_a_SOURCES = filter.cpp  scanner.cpp projections.cpp phantom.cpp options.cpp convolve.cpp reconstr.cpp phm2image.cpp imagefile.cpp reconstr.cpp phm2image.cpp backprojectors.cpp projections.cpp
+libctsim_a_SOURCES = filter.cpp  scanner.cpp projections.cpp phantom.cpp options.cpp convolve.cpp reconstr.cpp imagefile.cpp reconstr.cpp backprojectors.cpp
 
 INCLUDES=@my_includes@
 EXTRA_DIST=Makefile.nt
index 1508bea745912e3ffc07661c057f52c2096db4b1..e28074f5917f5555c0c017f9a62a4e6ef3c02d82 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: phantom.cpp,v 1.1 2000/06/19 02:59:34 kevin Exp $
+**  $Id: phantom.cpp,v 1.2 2000/06/19 19:54:23 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
@@ -315,6 +315,84 @@ Phantom::std_herman (void)
 }
 
 
+/* NAME
+ *    convertToImagefile               Make image array from Phantom
+ *
+ * SYNOPSIS
+ *    pic_to_imagefile (pic, im, nsample)
+ *    Phantom& pic             Phantom definitions
+ *    ImageFile  *im           Computed pixel array
+ *    int nsample              Number of samples along each axis for each pixel
+ *                             (total samples per pixel = nsample * nsample)
+ */
+
+void 
+Phantom::convertToImagefile (ImageFile& im, const int colStart, const int colCount, const int in_nsample, const int trace) const
+{
+  int nx = im.nx();
+  int ny = im.ny();
+  if (nx < 2 || ny < 2)
+      return;
+
+  if (nsample < 1)  
+        nsample = 1;
+
+  int nsample = in_nsample;
+  double dx = m_xmax - m_xmin;
+  double dy = m_ymax - m_ymin;
+  double xcent = m_xmin + dx / 2;
+  double ycent = m_ymin + dy / 2;
+  double phmlen = (dx > dy ? dx : dy);
+
+  double phmradius = phmlen / 2;
+
+  double xmin = xcent - phmradius;
+  double xmax = xcent + phmradius;
+  double ymin = ycent - phmradius;
+  double ymax = ycent + phmradius;
+
+  // Each pixel holds the average of the intensity of the cell with (ix,iy) at the center of the pixel
+  // Set major increments so that the last cell v[nx-1][ny-1] will start at xmax - xinc, ymax - yinc).
+  // Set minor increments so that sample points are centered in cell
+
+  double xinc = (xmax - xmin) / nx;
+  double yinc = (ymax - ymin) / ny;
+
+  double kxinc = xinc / nsample;               /* interval between samples */
+  double kyinc = yinc / nsample;
+  double kxofs = kxinc / 2;            /* offset of 1st point */
+  double kyofs = kyinc / 2;
+
+  im.setAxisExtent (xmin, xmax, ymin, ymax);
+  im.setAxisIncrement (xinc, yinc);
+
+  ImageFileArray v = im.getArray();
+
+  double x_start = xmin + (colStart * xinc);
+  for (PElemConstIterator pelem = m_listPElem.begin; pelem != m_listPElem.end; pelem++) {
+    double x, y, xi, yi;
+    int ix, iy, kx, ky;
+    for (ix = 0, x = x_start; ix < colCount; ix++, x += xinc) {
+      for (iy = 0, y = ymin; iy < ny; iy++, y += yinc) {
+       for (kx = 0, xi = x + kxofs; kx < nsample; kx++, xi += kxinc) {
+         for (ky = 0, yi = y + kyofs; ky < nsample; ky++, yi += kyinc)
+           if ((*pelem)->isPointInside (xi, yi, PHM_COORD) == TRUE)
+             v[ix][iy] += (*pelem)->atten();
+       } // for kx
+      } /* for iy */
+    }  /* for ix */
+  }  /* for pelem */
+  
+
+  if (nsample > 1) {
+    double factor = 1.0 / (nsample * nsample);
+
+    for (int ix = 0; ix < colCount; ix++)
+      for (int iy = 0; iy < ny; iy++)
+       v[ix][iy] *= factor;
+  }
+}
+
 ////////////////////////////////////////////////////////////////////////////////////////////////////////
 // CLASS IDENTIFICATION
 //
diff --git a/libctsim/phm2image.cpp b/libctsim/phm2image.cpp
deleted file mode 100644 (file)
index 3e65e58..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*****************************************************************************
-** FILE IDENTIFICATION
-**
-**   Name:        phm2image.cpp
-**   Purpose:      Convert phantom objects to rasterized images
-**   Programmer:   Kevin Rosenberg
-**   Date Started: 1984
-**
-**  This part of the CTSim program
-**  Copyright (C) 1983-2000 Kevin Rosenberg
-**
-**  $Id: phm2image.cpp,v 1.1 2000/06/19 02:59:34 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"
-
-
-/* NAME
- *    pic_to_imagefile         Make image array from Phantom
- *
- * SYNOPSIS
- *    pic_to_imagefile (pic, im, nsample)
- *    Phantom& pic             Phantom definitions
- *    ImageFile  *im           Computed pixel array
- *    int nsample              Number of samples along each axis for each pixel
- *                             (total samples per pixel = nsample * nsample)
- */
-
-void 
-phm_to_imagefile (const Phantom& phm, ImageFile& im, const int col_start, const int col_count, const int in_nsample, const int trace)
-{
-  int nsample = in_nsample;
-  double dx = phm.xmax() - phm.xmin();
-  double dy = phm.ymax() - phm.ymin();
-  double xcent = phm.xmin() + dx / 2;
-  double ycent = phm.ymin() + dy / 2;
-  double phmlen = (dx > dy ? dx : dy);
-
-  double phmradius = phmlen / 2;
-
-  double xmin = xcent - phmradius;
-  double xmax = xcent + phmradius;
-  double ymin = ycent - phmradius;
-  double ymax = ycent + phmradius;
-
-  im.setAxisExtent (xmin, xmax, ymin, ymax);
-  int nx = im.nx();
-  int ny = im.ny();
-
-/* Each pixel holds the average of the intensity of the cell with (ix,iy)
- * at the center of the pixel
- *
- * Set major increments so that the last cell v[nx-1][ny-1] will start at
- * (xmax - xinc, ymax - yinc).
- *
- * Set minor increments so that sample points are centered in cell
- */
-
-  if (nx < 2 || ny < 2)
-      return;
-
-  double xinc = (xmax - xmin) / nx;
-  double yinc = (ymax - ymin) / ny;
-  im.setAxisIncrement (xinc, yinc);
-
-  if (nsample < 1)  
-        nsample = 1;
-
-  double kxinc = xinc / nsample;               /* interval between samples */
-  double kyinc = yinc / nsample;
-  double kxofs = kxinc / 2;            /* offset of 1st point */
-  double kyofs = kyinc / 2;
-
-#ifdef HAVE_SGP
-  SGP_ID gid = NULL;
-  if (trace > TRACE_TEXT) {
-    gid = sgp2_init (0, 0, "Phantom to Image");
-    sgp2_window (xmin, ymin, xmax, ymax);
-    sgp2_frame_vpt();
-  }
-#endif
-
-  ImageFileArray v = im.getArray();
-
-  double x_start = xmin + (col_start * xinc);
-  for (PElemConstIterator i = phm.listPElem().begin(); i != phm.listPElem().end(); i++) {
-#ifdef HAVE_SGP
-    if (trace > TRACE_TEXT)
-      sgp2_polyline_abs ((*i)->xOutline(), (*i)->yOutline(), (*i)->nOutlinePoints());
-#endif
-    double x, y, xi, yi;
-    int ix, iy, kx, ky;
-    for (ix = 0, x = x_start; ix < col_count; ix++, x += xinc) {
-      for (iy = 0, y = ymin; iy < ny; iy++, y += yinc) {
-       for (kx = 0, xi = x + kxofs; kx < nsample; kx++, xi += kxinc) {
-         for (ky = 0, yi = y + kyofs; ky < nsample; ky++, yi += kyinc)
-           if ((*i)->isPointInside (xi, yi, PHM_COORD) == TRUE)
-             v[ix][iy] += (*i)->atten();
-       } // for kx
-      } /* for iy */
-    }  /* for ix */
-  }  /* for pelem */
-  
-
-  if (nsample > 0) {
-    double factor = 1.0 / (nsample * nsample);
-
-    for (int ix = 0; ix < col_count; ix++)
-      for (int iy = 0; iy < ny; iy++)
-       v[ix][iy] *= factor;
-  }
-
-#if HAVE_SGP
-  if (trace > TRACE_TEXT)
-      sgp2_close(gid);
-#endif
-
-}
-