-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
-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.
--------
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.
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
-------------
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
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; }
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.
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
** 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
}
+/* 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
//
+++ /dev/null
-/*****************************************************************************
-** 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
-
-}
-