From befd71a7157339b52a0c40359518d5276b25d127 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Sun, 11 Feb 2001 21:57:08 +0000 Subject: [PATCH] r521: no message --- doc/ctsim-appendix.tex | 92 ++++++------ doc/ctsim-gui.tex | 133 ++++++++++++++++-- doc/ctsim-textui.tex | 49 +++++-- doc/ctsim-web.tex | 15 +- doc/ctsim.tex | 4 +- doc/texhelp.sty | 4 +- include/{cubicinterp.h => interpolator.h} | 22 ++- .../{cubicinterp.cpp => interpolator.cpp} | 67 +++++++-- msvc/ctsim/ctsim.dsp | 18 ++- msvc/ctsim/ctsim.plg | 34 +---- msvc/libctsim/libctsim.dsp | 16 +-- src/ctsim.cpp | 51 +++++-- src/ctsim.h | 12 +- src/dialogs.cpp | 62 +++++++- src/dialogs.h | 17 ++- src/views.cpp | 107 +++++++++----- tools/pjrec.cpp | 6 +- 17 files changed, 505 insertions(+), 204 deletions(-) rename include/{cubicinterp.h => interpolator.h} (72%) rename libctsupport/{cubicinterp.cpp => interpolator.cpp} (51%) diff --git a/doc/ctsim-appendix.tex b/doc/ctsim-appendix.tex index c25c257..38358eb 100644 --- a/doc/ctsim-appendix.tex +++ b/doc/ctsim-appendix.tex @@ -5,7 +5,9 @@ \section{Simple Graphics Package}\index{Simple Graphics Package}% \subsection{Overview}% -Simple Graphics Package was creates in 1983 by Kevin Rosenberg and is modelled after the graphics library in Foley and van Dam\cite{FOLEY82}. +Simple Graphics Package was created in 1980 by Kevin Rosenberg and +is modelled after the graphics library in Foley and van +Dam\cite{FOLEY82}. \begin{verbatim} +------------------------+ @@ -33,55 +35,61 @@ Simple Graphics Package was creates in 1983 by Kevin Rosenberg and is modelled a \subsection{Functions}% -\subsubsection{World Coordinate Level}% - initgrf2 () Initialize 2 dimensional graphics\\ - termgrf2 () Terminate 2 dimensional graphics\\ - Window (xmin, ymin, xmax, ymax) Set window for world coordinates\\ - Viewport (xmin, ymin, xmax, ymax) Viewport for window in NDC\\ - MoveAbs (x, y) Move graphics cursor\\ - MoveRel (dx, dy)\\ - PointAbs (x, y) Plot point at current position\\ - PointRel (dx, dy)\\ - LineAbs2 (x, y) Draw line from current point to point\\ - LineRel2 (dx, dy)\\ - MarkerAbs2 (x, y) Draw marker at current position\\ - MarkerRel2 (dx, dy)\\ - PolylineAbs (x[], y[], n) Draw a set of lines\\ - PolylineRel (dx[]. dy[]. n)\\ - wc\_to\_ndc (xwc, ywc, xndc, yndc) Convert from world coord to NDC\\ - ndc\_to\_wc (xndc, yndc, xwc, ywc) Convert from NDC to world coord\\ - DrawText (str) Draw text string at current positon\\ +\subsubsection{World Coordinate Level} +\begin{twocollist} +\twocolitem{initgrf2}{Initialize 2 dimensional graphics} +\twocolitem{termgrf2}{Terminate 2 dimensional graphics} +\twocolitem{setColor(color)}{Set current drawing color} +\twocolitem{setLinestyle (style)}{Set current line style} +\twocolitem{setLinewidth (width)}{Set current line width} +\twocolitem{setTextColor (foreground, background)}{If back=-1, +then transparent} \twocolitem{setMarker (type, color)}{Set marker +attibutes} +\end{twocollist} - INTERNAL:\\ - calc\_map () Calculate wc to ndc factors\\ - clip(rectangle[4], x1, y1, x2, y2) Clip a line againt rectangle\\ +\subsubsection{State Commands} +\begin{twocollist} +\twocolitem{Window(xmin, ymin, xmax, ymax)}{Set window for world +coordinates} \twocolitem{MoveAbs(x, y)}{Move graphics cursor} +\twocolitem{MoveRel(dx, dy)}{} \twocolitem{PointAbs (x, y)}{Plot +point at current position} \twocolitem{PointRel (dx, dy)}{} +\twocolitem{LineAbs2 (x, y)}{Draw line from current point to +point} \twocolitem{LineRel2 (dx, dy)}{} \twocolitem{MarkerAbs2 (x, +y)}{Draw marker at current position} \twocolitem{MarkerRel2 (dx, +dy)}{} \twocolitem{PolylineAbs (x[], y[], n)}{Draw a set of lines} +\twocolitem{PolylineRel (dx[], dy[], n)}{} +\twocolitem{wc\_to\_ndc(xwc, ywc, xndc, yndc)}{Convert from world +coord to NDC} \twocolitem{ndc\_to\_wc(xndc, yndc, xwc, +ywc)}{Convert from NDC to world coord} \twocolitem{DrawText +(str)}{Draw text string at current positon} +\end{twocollist} \subsubsection{Normalized Coordinate level}% - stylus (x, y, beam) Draw a line from current position\\ - setColor (color) Set current drawing color\\ - setLinestyle (style) Set current line style\\ - setLinewidth (width) Set current line width\\ - setTextColor (foreground, background) If back=-1, then transparent \\ +\begin{twocollist} +\twocolitem{Viewport (xmin, ymin, xmax, ymax)}{Viewport for window +in NDC} \twocolitem{stylus (x, y, beam)}{Draw a line from current +position} \twocolitem{markerNDC(xndc, yndc)}{Draw marker at NDC +position} +\end{twocollist} - setMarker (type, color) Set marker attibutes\\ - markerNDC (xndc, yndc) Draw marker at NDC position\\ -\subsection{Coordinate Mapping}% +\subsection{Coordinate Mapping} \subsubsection{Mapping from world coordinates to physical device coordinates}% -Window (World Coordinates): xwmin, xwmax, ywmin, ywmax \\ -Viewport (Normalized Device Coordinates): xvmin, xvmax, yvmin, yvmax\\ -Physical (Physicial Device Coordinates): xpmax, ypmax\\ +Window (World Coordinates): $X_{wmin}, X_{wmax}, Y_{wmin}, Y_{wmax}$ \\ +Viewport (Normalized Device Coordinates): $X_{vmin}, X_{vmax}, Y_{vmin}, Y_{vmax}$\\ +Physical (Physicial Device Coordinates): $X_{pmax}, Y_{pmax}$\\ To convert from WC to NDC:\\ \begin{equation} - X_{ndc} = X_vmin + (X_wc - X_wmin) / (X_wmax - X_wmin) + X_{ndc} = X_{vmin} + (X_{vmax} - X_{vmin}) (X_{wc} - X_{wmin}) / (X_{wmax} - X_{wmin}) \end{equation} \begin{equation} - Y_{ndc} = Y_vmin + (Y_wc - Y_wmin) / (Y_wmax - Y_wmin) + Y_{ndc} = Y_{vmin} + (Y_{vmax} - Y_{vmin}) (Y_{wc} - Y_{wmin}) / (Y_{wmax} - Y_{wmin}) \end{equation} + To convert from NDC to PDC: \begin{equation} X_{pdc} = X_{ndc} X_{pmax} @@ -89,17 +97,3 @@ To convert from NDC to PDC: \begin{equation} Y_{pdc} = X_{ndc} Y_{pmax} \end{equation} - -So, for each device set up the following composite transformation:\\ -\begin{equation} - x_{pdc} = x_{pmax} (x_{vmin} + (x_{wc} - x_{wmin}) / (x_{wmax} - x_{wmin})) -\end{equation} -\begin{equation} - y_{pdc} = y_{pmax} (y_{vmin} + (y_{wc} - y_{wmin}) / (y_{wmax} - y_{wmin})) -\end{equation} -\begin{equation} - X_{pdc} = X_{pmax} X_{vmin} + ((X_{wc} \- X_{wmin}) X_{pmax})/(X_{wmax} \- X_{wmin})) -\end{equation} -\begin{equation} - X_{pdc} = X_{add} + (X_wc - X_{sub}) X_{fract} -\end{equation} diff --git a/doc/ctsim-gui.tex b/doc/ctsim-gui.tex index 8d675de..7e0f6d4 100644 --- a/doc/ctsim-gui.tex +++ b/doc/ctsim-gui.tex @@ -13,17 +13,18 @@ command-line interface \helprefn{\ctsimtext}{ctsimtext} as well as great image processing and visualization features. \ctsim\ can open projection files, image files, phantom files, and -plotfiles. +plot files. -\usage \texttt{ctsim [files to open...] +\usage \texttt{ctsim [files to open...]} You can invoke \ctsim\ by itself on the command line, or include -any number of files that you want \ctsim\ to automatically open. +on the command-line any number of files that you want \ctsim\ to +automatically open. \section{File Types Support} Phantom and plot files are stored as ASCII text. In contrast, -image and projection files are stored in binary format. \ctsim\ +image and projection files are stored in binary format. \ctsim incorporates logic so that binary files are cross-platform compatible between both little and big endian architectures. @@ -41,9 +42,19 @@ processed by Fourier transforms. As you might expect, complex-valued images are twice the size of real-valued images since both a real and imaginary component need to be store. +Images files can also store any number of text labels. \ctsim\ uses +these labels for storing history information regarding +the creation and modifications of images. + +When complex-valued images are viewed on the screen, only the real +component is displayed. + \subsection{Projection} -Projection files are created from Phantom files during the projection process. -Numerous options are available for creation of the these files. +Projection files are created from Phantom files during the +projection process. Numerous options are available for the +creation of the these files. The files are stored in a binary +format with cross-platform compatibility on little and big endian +architectures. \subsection{Plot} Plot files are created by \ctsim\ during analysis of image files. @@ -52,6 +63,14 @@ files for easy cross-platform support. \section{Phantom Menus} +\subsection{Properties} +Displays the properties of a phantom which includes: + +\begin{itemize}\itemsep=0pt +\item Overall dimensions of a phantom +\item A list of all component phantom elements +\end{itemize} + \subsection{Rasterize Dialog} This creates an image file from a phantom. Technically, it converts the phantom from a vector (infinite resolution) object @@ -59,7 +78,7 @@ into a 2-dimension array of floating-point pixels. The parameters to set are: \begin{twocollist} -%\twocolitemruled{\textbf{Parameter}}{\textbf{Options}} +\twocolitemruled{\textbf{Parameter}}{\textbf{Options}} \twocolitem{\texttt{X size}}{Number of columns in image file} \twocolitem{\texttt{Y size}}{Number of rows in image file} \twocolitem{\texttt{Samples per pixel}}{Numbers of samples taken @@ -69,7 +88,50 @@ pixel in the image file 9 samples (3 x 3) are averaged.} \end{twocollist} \subsection{Projection Dialog} -This creates a projection file from a phantom. +This creates a projection file from a phantom. The options +available when collecting projections are: + +\begin{twocollist} +\twocolitem{\textbf{Geometry}}{ + \begin{itemize}\itemsep=0pt + \item Parallel + \item Equiangular + \item Equilinear + \end{itemize}} +\twocolitem{\textbf{Number of detectors}}{Sets the number of +detectors in the detector array.} + +\twocolitem{\textbf{Number of views}}{Sets the number of views +collected} + +\twocolitem{\textbf{Samples per detector}}{Sets the number of +samples collected for each detector} + +\twocolitem{\textbf{View Ratio}}{Sets the field of view as a ratio +of the diameter of the phantom. For normal scanning, a value of +1.0 is fine.} + +\twocolitem{\textbf{Scan Ratio}}{Sets the length of scanning as a +ratio of the view diameter. For normal scanning, a value of 1.0 is +fine.} + +\twocolitem{\textbf{Focal length ratio}}{Sets the distance of the +radiation source and detectors from the center of the object as a +ratio of the radius of the object. + +For parallel geometries, a value of 1.0 is fine. For other +geometries, this should be at least 2.0 to avoid artifacts.} +\end{twocollist} + +\subsection{Advanced Options} +\begin{twocollist} +\twocolitem{\textbf{Rotation Angle}}{Sets the rotation amount as a +multiple of pi. For parallel geometries use a rotation angle of 1 +and for equilinear and equiangular geometries use a rotation angle +of 2. Using any other rotation angle will lead to artifacts.} +\end{twocollist} + + \section{Image Menus} \subsection{File - Properties} @@ -80,21 +142,62 @@ Properties of image files include \item Image file labels \end{itemize} -\subsection{View} +\subsection{File - Export} +This command allows for exporting image files to a standard +graphics file format. This is helpful when you want to take an +image and import it into another application. The current +\helprefn{intensity scale}{intensityscale} is used when exporting +the file. The support file formats are: + +\begin{description}\itemsep=0pt +\item[PNG]Portable Network Graphics format. This uses 8-bits or +256 shades of gray. + +\item[PNG-16]This is a 16-bit version of PNG which allows for +65536 shades of gray. +\item[PGM]Portable Graymap format. This is a common format used on +UNIX systems. +\item[PGM]ASCII version of PGM. +\end{description} + + +\subsection{View}\label{intensityscale} These options are for change the intensity scale for viewing the image. They do not change the image data. +\subsubsection{Set} +\subsubsection{Auto} +\subsubsection{Full} +This resets the intensity scale to the full scale of the image. \subsection{Image} These commands create a new image based upon the current image, and for some commands, also a comparison image. +\subsubsection{Add, Subtract, Multiply, Divide} + +\subsubsection{Image Size} + +\subsubsection{3-D Conversion} +Generates a 3-dimensional view of the current phantom. + \subsection{Filter} -These commands filter image. +These commands filter and modify the image. -\subsection{Anaylze} +\subsubsection{Arithmetic} + +\subsubsection{Frequency Based} + +\subsection{Analyze} These commands are used for analyzing an image. +\subsubsection{Plotting} + +\subsubsection{Image Comparison} + \section{Projection Menus} + +\subsection{File - Properties} + \subsection{Process - Convert Polar Dialog}\label{convertpolardialog} The parameters are \texttt{xsize}, \texttt{ysize}, and \texttt{interpolation}. The \texttt{xsize} and \texttt{ysize} parameters set the size of the @@ -103,10 +206,10 @@ interpolation method. Currently, the \texttt{bilinear} option provides the highest quality interpolation. \subsection{Process - Convert FFT Polar Dialog} -The parameters for this option are the same as -\helprefn{convertpolardialog}{Convert Polar Dialog}. For this -command, though, the projections are Fourier transformed prior to -conversion to polar image. +The parameters for this option are the same as \helprefn{Convert +Polar Dialog}{convertpolardialog}. For this command, though, the +projections are Fourier transformed prior to conversion to polar +image. \subsection{Reconstruct - Filtered Backprojection Dialog} This dialog sets the parameters for reconstructing an image from projections diff --git a/doc/ctsim-textui.tex b/doc/ctsim-textui.tex index 5a7976f..6a4a675 100644 --- a/doc/ctsim-textui.tex +++ b/doc/ctsim-textui.tex @@ -4,14 +4,28 @@ \ctsimtext\ is a master shell for all of the command-line utilities. -\usage -\ctsimtext\ can be executed without any parameters. In that case, \ctsimtext\ -offers a command-line to enter the function-names and their parameters. The output of the command is displayed. Further commands may be given to \ctsimtext. The shell is exited by the \texttt{quit} command. - -\ctsimtext\ can also be called to execute a single command. This is especially useful for batch files containing multiple \ctsimtext\ commands. This is invoked by calling \par -\texttt{ctsimtext function-name parameters...}. +\usage \ctsimtext\ can be invoked via three different +methods. +\begin{itemize}\itemsep=0pt +\item \ctsimtext\ can executed without any parameters. In that case, +\ctsimtext\ offers a command-line to enter the function-names and +their parameters. The output of the command is displayed. Further +commands may be given to \ctsimtext. The shell is exited by the +\texttt{quit} command. + +\item \ctsimtext\ can also be called to +execute a single command. This is especially useful for batch +files containing multiple \ctsimtext\ commands. This is invoked by +calling\\ \texttt{ctsimtext function-name parameters...}. + +\item Using operating systems that support soft or hard linking of +files (such as UNIX and Linux), the executable file \ctsimtext\ can +be linked to the function names. This is automatically done by +the installation file for Linux. Thus, to use \ctsimtext\ with the +function name \texttt{pjrec}, the below command can be executed:\\ +\texttt{pjrec parameters...} -The available functions are: +\end{itemize} \section{if1}\label{if1}\index{ctsimtext,if1}% Perfoms math functions on a single image. @@ -112,13 +126,21 @@ phm2pj projection-file-name number-of-detectors number-of-views [options...] \item -\,-rotangle Sets the rotation amount as a multiple of pi. For parallel geometries use -a rotation angle of 1 and for equilinear and equiangular geometries use a rotation angle of 2. +a rotation angle of 1 and for equilinear and equiangular +geometries use a rotation angle of 2. The default is to use to +appropriate rotation angle based on the geometry. + + \item -\,-view-ratio + Sets the field of view as a ratio of the diameter of the phantom. + For normal scanning, a value of 1.0 is fine. - \item -\,-field-of-view - Sets the field of view as a ratio of the diameter of the phantom. For parallel geometries, using a value of 1.0 is fine. For other geometies, this should be at least 1.3 to avoid artifacts. + \item -\,-scan-ratio + Sets the length of scanning as a ratio of the view diameter. + For normal scanning, a value of 1.0 is fine. \item -\,-focal-length - Sets the distance of the radiation source and detectors from the center of the object as a ratio of the radius of the object. For parallel geometries, a value of 1.0 is fine. For other geometries, this should be at least 2.0 to avoid artifacts. + Sets the distance of the radiation source and detectors from the center of the object as a ratio of the radius of the object. + For parallel geometries, a value of 1.0 is fine. For other geometries, this should be at least 2.0 to avoid artifacts. \end{itemize} The Herman phantom is taken with permission from Gabor Hermans 1980 book\cite{HERMAN80}. The Shepp-Logan phantom was published in 1974\cite{SHEPP74}. @@ -131,6 +153,7 @@ to average per pixel. \usage \begin{itemize}\itemsep=0pt \item -\,-nsamples + \item -\,-view-ratio \end{itemize} \section{pj2if}\label{pj2if}\index{ctsimtext,pj2if}% @@ -156,7 +179,6 @@ Displays information about a projection file. \section{pjrec}\label{pjrec}\index{ctsimtext,pjrec}% Reconstructs the interior of an object from a projection file. -\usage \begin{twocollist} \twocolitemruled{\textbf{Parameter}}{\textbf{Options}} \twocolitem{\textbf{-\,-filter}}{Selects which filter to apply to @@ -220,6 +242,5 @@ to select. With any of the frequency methods, \item direct \item inverse-fourier \end{itemize} - -\end{twocollist} } +\end{twocollist} diff --git a/doc/ctsim-web.tex b/doc/ctsim-web.tex index 42c2d6a..758716d 100644 --- a/doc/ctsim-web.tex +++ b/doc/ctsim-web.tex @@ -3,11 +3,12 @@ \setfooter{\thepage}{}{}{}{}{\thepage}% \section{Overview}\index{Web Interface,Overview}% -The CGI program \texttt{ctsim.cgi} takes projections of a standard -phantom object, performs reconstruction, and then compares the -rasterized phantom object with the reconstruction. The comparison is -performed both visually by an image subtraction as well as by standard -statistics as described by Herman\cite{HERMAN80}. +\ctsim\ can also be executed via a web browser. The CGI program +\texttt{ctsim.cgi} takes projections of a standard phantom object, +performs reconstruction, and then compares the rasterized phantom +object with the reconstruction. The comparison is performed both +visually by an image subtraction as well as by standard statistics +as described by Herman\cite{HERMAN80}. \section{Requirements}\index{Web Interface,Requirements}% \begin{itemize}\itemsep=0pt @@ -17,4 +18,8 @@ statistics as described by Herman\cite{HERMAN80}. \item A client web browser than can display PNG files. Most current web browsers support PNG. + + \item A knowledgable system administrator. It is beyond the + scope of this manual to explain the installation of the CGI + interfact. \end{itemize} diff --git a/doc/ctsim.tex b/doc/ctsim.tex index 73deaf4..f3e0256 100644 --- a/doc/ctsim.tex +++ b/doc/ctsim.tex @@ -4,7 +4,7 @@ \usepackage{fancyhea} %\usepackage{mysober} \usepackage{mytitle} -%\usepackage{verbatim} +\usepackage{verbatim} \usepackage{makeidx} %\usepackage{times} \usepackage{hyperref} @@ -113,4 +113,4 @@ I hope that you enjoy \ctsim! \setfooter{\thepage}{}{}{}{}{\thepage} % \printindex % -\end{document}% +\end{document} diff --git a/doc/texhelp.sty b/doc/texhelp.sty index df04b58..54769c3 100644 --- a/doc/texhelp.sty +++ b/doc/texhelp.sty @@ -110,7 +110,9 @@ \newcommand{\helpref}[2]{{\it #1} (section \ref{#2}) } % Type text with URL in verbatim mode -\newcommand{\urlref}[2]{#1 (\verb$#2$)} +%\newcommand{\urlref}[2]{#1 (\verb$#2$)} +\newcommand{\urlref}[2]{#1 ($#2$)} +%\newcommand{\urlref}[2]{#1 \begin{verbatim}(#2)\end{verbatim}} % Don't typeset section number in LaTeX \newcommand{\helprefn}[2]{{\it #1}} diff --git a/include/cubicinterp.h b/include/interpolator.h similarity index 72% rename from include/cubicinterp.h rename to include/interpolator.h index 9e677cd..def913e 100644 --- a/include/cubicinterp.h +++ b/include/interpolator.h @@ -2,7 +2,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: cubicinterp.h,v 1.1 2001/02/09 01:54:20 kevin Exp $ +** $Id: interpolator.h,v 1.1 2001/02/11 21:57:08 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 @@ -18,7 +18,8 @@ ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ******************************************************************************/ -class CubicInterpolator { + +class CubicSplineInterpolator { private: double *m_pdY2; // second differential of y data @@ -26,9 +27,22 @@ private: const int m_n; public: - CubicInterpolator (const double* const y, int n); + CubicSplineInterpolator (const double* const y, int n); + + ~CubicSplineInterpolator (); + + double interpolate (double x); +}; + +class CubicPolyInterpolator { +private: + const double* const m_pdY; + const int m_n; + +public: + CubicPolyInterpolator (const double* const y, int n); - ~CubicInterpolator (); + ~CubicPolyInterpolator (); double interpolate (double x); }; diff --git a/libctsupport/cubicinterp.cpp b/libctsupport/interpolator.cpp similarity index 51% rename from libctsupport/cubicinterp.cpp rename to libctsupport/interpolator.cpp index 8d0c62c..e8abdfa 100644 --- a/libctsupport/cubicinterp.cpp +++ b/libctsupport/interpolator.cpp @@ -2,7 +2,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: cubicinterp.cpp,v 1.4 2001/02/09 21:27:51 kevin Exp $ +** $Id: interpolator.cpp,v 1.1 2001/02/11 21:57:08 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 @@ -20,15 +20,66 @@ #include "ctsupport.h" -#include "cubicinterp.h" +#include "interpolator.h" -CubicInterpolator::CubicInterpolator (const double* const y, const int n) +CubicPolyInterpolator::CubicPolyInterpolator (const double* const y, const int n) + : m_pdY(y), m_n(n) +{ + if (m_n < 2) + sys_error (ERR_SEVERE, "Too few points (%d) in CubicPolyInterpolator", m_n); +} + +CubicPolyInterpolator::~CubicPolyInterpolator () +{ +} + + +double +CubicPolyInterpolator::interpolate (double x) +{ + int lo = static_cast(floor(x)) - 1; + int hi = lo + 3; + + if (lo < -1) { + sys_error (ERR_WARNING, "x=%f, out of range [CubicPolyInterpolator]", x); + return (0); + } else if (lo == -1) // linear interpolate at between x = 0 & 1 + return m_pdY[0] + x * (m_pdY[1] - m_pdY[0]); + + if (hi > m_n) { + sys_error (ERR_WARNING, "x=%f, out of range [CubicPolyInterpolator]", x); + return (0); + } else if (hi == m_n) {// linear interpolate between x = (n-2) and (n-1) + double frac = x - (lo + 1); + return m_pdY[m_n - 2] + frac * (m_pdY[m_n - 1] - m_pdY[m_n - 2]); + } + + // Lagrange formula for N=4 (cubic) + + double xd_0 = x - lo; + double xd_1 = x - (lo + 1); + double xd_2 = x - (lo + 2); + double xd_3 = x - (lo + 3); + + static double oneSixth = (1. / 6.); + + double y = xd_1 * xd_2 * xd_3 * -oneSixth * m_pdY[lo]; + y += xd_0 * xd_2 * xd_3 * 0.5 * m_pdY[lo+1]; + y += xd_0 * xd_1 * xd_3 * -0.5 * m_pdY[lo+2]; + y += xd_0 * xd_1 * xd_2 * oneSixth * m_pdY[lo+3]; + + return (y); +} + + + +CubicSplineInterpolator::CubicSplineInterpolator (const double* const y, const int n) : m_pdY(y), m_n(n) { // Precalculate 2nd derivative of y and put in m_pdY2 - // Calculated by solving set of simultaneous cubic spline equations - // Only n-2 cubic spline equations, but able to make two more + // Calculated by solving set of simultaneous CubicSpline spline equations + // Only n-2 CubicSpline spline equations, but able to make two more // equations by setting second derivative to 0 at ends m_pdY2 = new double [n]; @@ -51,21 +102,21 @@ CubicInterpolator::CubicInterpolator (const double* const y, const int n) delete temp; } -CubicInterpolator::~CubicInterpolator () +CubicSplineInterpolator::~CubicSplineInterpolator () { delete m_pdY2; } double -CubicInterpolator::interpolate (double x) +CubicSplineInterpolator::interpolate (double x) { const static double oneSixth = (1. / 6.); int lo = static_cast(floor(x)); int hi = lo + 1; if (lo < 0 || hi >= m_n) { - sys_error (ERR_SEVERE, "X range out of bounds [CubicInterpolator::interpolate]"); + sys_error (ERR_SEVERE, "X range out of bounds [CubicSplineInterpolator::interpolate]"); return (0); } diff --git a/msvc/ctsim/ctsim.dsp b/msvc/ctsim/ctsim.dsp index f53ce27..0b57a6b 100644 --- a/msvc/ctsim/ctsim.dsp +++ b/msvc/ctsim/ctsim.dsp @@ -53,7 +53,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib wsock32.lib comctl32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib tiff.lib jpeg.lib png.lib zlib.lib xpm.lib opengl32.lib glu32.lib /nologo /subsystem:windows /machine:I386 /libpath:"\wx2.2.5\lib" +# ADD LINK32 wsock32.lib tiff.lib jpeg.lib png.lib zlib.lib xpm.lib comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib htmlhelp.lib /nologo /subsystem:windows /machine:I386 /libpath:"\wx2.2.5\lib" !ELSEIF "$(CFG)" == "ctsim - Win32 Debug" @@ -79,7 +79,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 comctl32.lib winmm.lib rpcrt4.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../libctsim/Debug/libctsim.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libcmtd.lib ..\..\..\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib ..\..\..\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib wxd.lib xpmd.lib tiffd.lib zlibd.lib pngd.lib opengl32.lib glu32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"\wx2.2.5\lib" +# ADD LINK32 winmm.lib rpcrt4.lib ws2_32.lib ../libctsim/Debug/libctsim.lib libcmtd.lib ..\..\..\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib ..\..\..\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib wxd.lib xpmd.lib tiffd.lib zlibd.lib pngd.lib comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib htmlhelp.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"\wx2.2.5\lib" # SUBTRACT LINK32 /nodefaultlib !ENDIF @@ -97,7 +97,7 @@ SOURCE=..\..\src\ctsim.cpp !IF "$(CFG)" == "ctsim - Win32 Release" -# ADD CPP /I "..\..\..\fftw-2.1.3\fftw" /D CTSIMVERSION=\"3.0.0alpha5\" +# ADD CPP /D CTSIMVERSION=\"3.0.0alpha5\" # SUBTRACT CPP /D CTSIMVERSION=\"3.0.0beta1\" !ELSEIF "$(CFG)" == "ctsim - Win32 Debug" @@ -114,7 +114,7 @@ SOURCE=..\..\src\dialogs.cpp !IF "$(CFG)" == "ctsim - Win32 Release" -# ADD CPP /I "..\..\..\fftw-2.1.3\fftw" /D CTSIMVERSION=\"3.0.0alpha5\" +# ADD CPP /D CTSIMVERSION=\"3.0.0alpha5\" # SUBTRACT CPP /D CTSIMVERSION=\"3.0.0beta1\" !ELSEIF "$(CFG)" == "ctsim - Win32 Debug" @@ -131,7 +131,7 @@ SOURCE=..\..\src\dlgprojections.cpp !IF "$(CFG)" == "ctsim - Win32 Release" -# ADD CPP /I "..\..\..\fftw-2.1.3\fftw" /D CTSIMVERSION=\"3.0.0alpha5\" +# ADD CPP /D CTSIMVERSION=\"3.0.0alpha5\" # SUBTRACT CPP /D CTSIMVERSION=\"3.0.0beta1\" !ELSEIF "$(CFG)" == "ctsim - Win32 Debug" @@ -148,7 +148,7 @@ SOURCE=..\..\src\dlgreconstruct.cpp !IF "$(CFG)" == "ctsim - Win32 Release" -# ADD CPP /I "..\..\..\fftw-2.1.3\fftw" /D CTSIMVERSION=\"3.0.0alpha5\" +# ADD CPP /D CTSIMVERSION=\"3.0.0alpha5\" # SUBTRACT CPP /D CTSIMVERSION=\"3.0.0beta1\" !ELSEIF "$(CFG)" == "ctsim - Win32 Debug" @@ -165,7 +165,7 @@ SOURCE=..\..\src\docs.cpp !IF "$(CFG)" == "ctsim - Win32 Release" -# ADD CPP /I "..\..\..\fftw-2.1.3\fftw" /D CTSIMVERSION=\"3.0.0alpha5\" +# ADD CPP /D CTSIMVERSION=\"3.0.0alpha5\" # SUBTRACT CPP /D CTSIMVERSION=\"3.0.0beta1\" !ELSEIF "$(CFG)" == "ctsim - Win32 Debug" @@ -182,8 +182,6 @@ SOURCE=..\..\src\graph3dview.cpp !IF "$(CFG)" == "ctsim - Win32 Release" -# ADD CPP /I "..\..\..\fftw-2.1.3\fftw" - !ELSEIF "$(CFG)" == "ctsim - Win32 Debug" !ENDIF @@ -195,7 +193,7 @@ SOURCE=..\..\src\views.cpp !IF "$(CFG)" == "ctsim - Win32 Release" -# ADD CPP /I "..\..\..\fftw-2.1.3\fftw" /D CTSIMVERSION=\"3.0.0alpha5\" +# ADD CPP /D CTSIMVERSION=\"3.0.0alpha5\" # SUBTRACT CPP /D CTSIMVERSION=\"3.0.0beta1\" !ELSEIF "$(CFG)" == "ctsim - Win32 Debug" diff --git a/msvc/ctsim/ctsim.plg b/msvc/ctsim/ctsim.plg index d9390b5..3413765 100644 --- a/msvc/ctsim/ctsim.plg +++ b/msvc/ctsim/ctsim.plg @@ -3,41 +3,9 @@
 

Build Log

---------------------Configuration: ctsim - Win32 Debug-------------------- +--------------------Configuration: ctsim - Win32 Release--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP299.tmp" with contents -[ -/nologo /G6 /MTd /W3 /Gm /Gi /GR /GX /Zi /Od /Gy /I "\wx2.2.5\include" /I "..\..\..\fftw-2.1.3\fftw" /I "\wx2.2.5\src\png" /I "\wx2.2.5\src\zlib" /I "..\..\include" /I "..\..\getopt" /I "..\..\..\fftw-2.1.3\rfftw" /D VERSION=\"3.0.0beta1\" /D "_DEBUG" /D "__WXMSW__" /D "HAVE_SGP" /D "HAVE_PNG" /D "HAVE_WXWINDOWS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_FFTW" /D "HAVE_RFFTW" /D "HAVE_GETOPT_H" /D "MSVC" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D CTSIMVERSION=\"3.0.0alpha5\" /FR"Debug/" /Fp"Debug/ctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c -"C:\ctsim\src\dialogs.cpp" -] -Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP299.tmp" -Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP29A.tmp" with contents -[ -winmm.lib rpcrt4.lib ws2_32.lib ../libctsim/Debug/libctsim.lib libcmtd.lib ..\..\..\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib ..\..\..\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib wxd.lib xpmd.lib tiffd.lib zlibd.lib pngd.lib comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib htmlhelp.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/ctsim.pdb" /debug /machine:I386 /out:"Debug/ctsim.exe" /pdbtype:sept /libpath:"\wx2.2.5\lib" -.\Debug\ctsim.obj -.\Debug\dialogs.obj -.\Debug\dlgprojections.obj -.\Debug\dlgreconstruct.obj -.\Debug\docs.obj -.\Debug\graph3dview.obj -.\Debug\views.obj -.\Debug\ctsim.res -\ctsim\msvc\libctsim\Debug\libctsim.lib -"\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib" -"\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib" -\wx2.2.5\lib\jpegd.lib -\wx2.2.5\lib\pngd.lib -\wx2.2.5\lib\wxd.lib -\wx2.2.5\lib\xpmd.lib -\wx2.2.5\lib\zlibd.lib -\wx2.2.5\lib\tiffd.lib -] -Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP29A.tmp" -

Output Window

-Compiling... -dialogs.cpp -Linking... diff --git a/msvc/libctsim/libctsim.dsp b/msvc/libctsim/libctsim.dsp index c44e324..d981c55 100644 --- a/msvc/libctsim/libctsim.dsp +++ b/msvc/libctsim/libctsim.dsp @@ -118,10 +118,6 @@ SOURCE=..\..\libctsupport\consoleio.cpp # End Source File # Begin Source File -SOURCE=..\..\libctsupport\cubicinterp.cpp -# End Source File -# Begin Source File - SOURCE=..\..\libctgraphics\dlgezplot.cpp # End Source File # Begin Source File @@ -170,6 +166,10 @@ SOURCE=..\..\libctsim\imagefile.cpp # End Source File # Begin Source File +SOURCE=..\..\libctsupport\interpolator.cpp +# End Source File +# Begin Source File + SOURCE=..\..\libctsupport\mathfuncs.cpp # End Source File # Begin Source File @@ -254,10 +254,6 @@ SOURCE=..\..\include\ctsupport.h # End Source File # Begin Source File -SOURCE=..\..\include\cubicinterp.h -# End Source File -# Begin Source File - SOURCE=..\..\include\dlgezplot.h # End Source File # Begin Source File @@ -290,6 +286,10 @@ SOURCE=..\..\include\imagefile.h # End Source File # Begin Source File +SOURCE=..\..\include\interpolator.h +# End Source File +# Begin Source File + SOURCE=..\..\include\mpiworld.h # End Source File # Begin Source File diff --git a/src/ctsim.cpp b/src/ctsim.cpp index b08db82..8cd618e 100644 --- a/src/ctsim.cpp +++ b/src/ctsim.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ctsim.cpp,v 1.74 2001/02/11 04:56:38 kevin Exp $ +** $Id: ctsim.cpp,v 1.75 2001/02/11 21:57:08 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 @@ -71,7 +71,7 @@ #endif #endif -static const char* rcsindent = "$Id: ctsim.cpp,v 1.74 2001/02/11 04:56:38 kevin Exp $"; +static const char* rcsindent = "$Id: ctsim.cpp,v 1.75 2001/02/11 21:57:08 kevin Exp $"; struct option CTSimApp::ctsimOptions[] = { @@ -83,7 +83,8 @@ struct option CTSimApp::ctsimOptions[] = IMPLEMENT_APP(CTSimApp) CTSimApp::CTSimApp() -: m_docManager(NULL), m_pFrame(NULL), m_pLog(0), m_pLogDoc(0), m_bAdvancedOptions(false) +: m_docManager(NULL), m_pFrame(NULL), m_pLog(0), m_pLogDoc(0), m_pConfig(0), + m_bAdvancedOptions(false), m_bSetModifyNewDocs(true) { theApp = this; } @@ -103,8 +104,7 @@ CTSimApp::OnInit() setpriority (PRIO_PROCESS, 0, 15); // set to low scheduling priority #endif - m_pConfig = new wxConfig("ctsim", _T(""), ".ctsim", "", wxCONFIG_USE_LOCAL_FILE); - wxConfigBase::Set(m_pConfig); + openConfig(); g_bRunningWXWindows = true; // process options @@ -183,13 +183,13 @@ CTSimApp::OnInit() #endif wxLog::SetActiveTarget (new wxLogTextCtrl(m_pLog)); -#ifdef CTSIM_WINHELP - if (! m_pFrame->getWinHelpController().Initialize("ctsim")) - *m_pLog << "Cannot initialize the Windows Help system" << "\n"; -#endif wxString helpDir; if (! m_pConfig->Read("HelpDir", &helpDir)) helpDir = ::wxGetCwd(); +#ifdef CTSIM_WINHELP + if (! m_pFrame->getWinHelpController().Initialize(helpDir + "/ctsim")) + *m_pLog << "Cannot initialize the Windows Help system" << "\n"; +#else if (! m_pFrame->getHtmlHelpController().Initialize(helpDir + "/ctsim") && ! m_pFrame->getHtmlHelpController().Initialize("/usr/local/man/ctsim")) *m_pLog << "Cannot initialize the HTML Help system" << "\n"; @@ -198,6 +198,7 @@ CTSimApp::OnInit() m_pFrame->getHtmlHelpController().SetTempDir(_T("/tmp")); m_pFrame->getHtmlHelpController().UseConfig (m_pConfig); } +#endif for (int i = optind + 1; i <= argc; i++) { wxString filename = argv [i - 1]; @@ -231,7 +232,7 @@ CTSimApp::usage(const char* program) int CTSimApp::OnExit() { - delete m_pConfig; + closeConfig(); #ifdef HAVE_DMALLOC dmalloc_shutdown(); @@ -239,6 +240,29 @@ CTSimApp::OnExit() return 0; } +void +CTSimApp::openConfig() +{ +#ifdef MSVC + m_pConfig = new wxConfig("ctsim", "Kevin Rosenberg", "", "", wxCONFIG_USE_LOCAL_FILE); +#else + m_pConfig = new wxConfig("ctsim", "Kevin Rosenberg", ".ctsim", "", wxCONFIG_USE_LOCAL_FILE); +#endif + + wxConfigBase::Set(m_pConfig); + m_pConfig->Read ("AdvancedOptions", &m_bAdvancedOptions); + m_pConfig->Read ("SetModifyNewDocs", &m_bSetModifyNewDocs); +} + +void +CTSimApp::closeConfig() +{ + m_pConfig->Write ("AdvancedOptions", m_bAdvancedOptions); + m_pConfig->Write ("SetModifyNewDocs", m_bSetModifyNewDocs); + delete m_pConfig; +} + + wxString CTSimApp::getUntitledFilename() { @@ -766,7 +790,12 @@ BitmapDialog::~BitmapDialog() void MainFrame::OnPreferences (wxCommandEvent& WXUNUSED(event) ) { - theApp->setAdvancedOptions (! theApp->getAdvancedOptions()); + DialogPreferences dlg (this, "CTSim Preferences", theApp->getAdvancedOptions(), + theApp->getAskDeleteNewDocs()); + if (dlg.ShowModal() == wxID_OK) { + theApp->setAdvancedOptions (dlg.getAdvancedOptions()); + theApp->setAskDeleteNewDocs (dlg.getAskDeleteNewDocs()); + } } diff --git a/src/ctsim.h b/src/ctsim.h index c878803..92b13f9 100644 --- a/src/ctsim.h +++ b/src/ctsim.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: ctsim.h,v 1.43 2001/02/11 04:56:38 kevin Exp $ +** $Id: ctsim.h,v 1.44 2001/02/11 21:57:08 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 @@ -73,7 +73,7 @@ class Graph3dFileDocument; #include "dlgezplot.h" -#if defined(__WXMSW__) +#if defined(__WXMSW__) || defined (MSVC) #define CTSIM_WINHELP 1 #endif @@ -181,6 +181,8 @@ private: static struct option ctsimOptions[]; bool m_bAdvancedOptions; + bool m_bSetModifyNewDocs; + wxDocManager* m_docManager; MainFrame* m_pFrame; wxConfig* m_pConfig; @@ -197,7 +199,9 @@ private: TextFileDocument* m_pLogDoc; void usage (const char* program); - + void openConfig(); + void closeConfig(); + public: CTSimApp(); bool OnInit(); @@ -223,6 +227,8 @@ public: void setIconForFrame (wxFrame* pFrame); wxConfig* getConfig() { return m_pConfig; } + bool getAskDeleteNewDocs() const { return m_bSetModifyNewDocs; } + void setAskDeleteNewDocs(bool bAsk) { m_bSetModifyNewDocs = bAsk; } wxDocTemplate* getDocTemplImage() { return m_pDocTemplImage; } wxDocTemplate* getDocTemplProjection() { return m_pDocTemplProjection; } diff --git a/src/dialogs.cpp b/src/dialogs.cpp index 0afae26..8a3bf0a 100644 --- a/src/dialogs.cpp +++ b/src/dialogs.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: dialogs.cpp,v 1.29 2001/02/11 04:56:38 kevin Exp $ +** $Id: dialogs.cpp,v 1.30 2001/02/11 21:57:08 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 @@ -198,6 +198,66 @@ DialogGetComparisonImage::getMakeDifferenceImage() } +///////////////////////////////////////////////////////////////////// +// CLASS DiaglogPreferences Implementation +///////////////////////////////////////////////////////////////////// + +DialogPreferences::DialogPreferences (wxWindow* pParent, const char* const pszTitle, + bool bAdvancedOptions, bool bAskDeleteNewDocs) +: wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) +{ + wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL); + + pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5); + + pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5); + + m_pCBAdvancedOptions = new wxCheckBox (this, -1, "", wxDefaultPosition, wxSize(100, 25), 0); + m_pCBAdvancedOptions->SetValue (bAdvancedOptions); + + m_pCBAskDeleteNewDocs = new wxCheckBox (this, -1, "", wxDefaultPosition, wxSize(100, 25), 0); + m_pCBAskDeleteNewDocs->SetValue (bAskDeleteNewDocs); + + wxFlexGridSizer *pGridSizer = new wxFlexGridSizer (2); + pGridSizer->Add (m_pCBAdvancedOptions, 0, wxALIGN_CENTER_VERTICAL); + pGridSizer->Add (new wxStaticText (this, -1, "Show Advanced Options"), 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); + pGridSizer->Add (m_pCBAskDeleteNewDocs, 0, wxALIGN_CENTER_VERTICAL); + pGridSizer->Add (new wxStaticText (this, -1, "Ask Save New Documents Before Closing"), 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL); + pTopSizer->Add (pGridSizer, 1, wxALL, 10); + + pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5); + + wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL); + wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay"); + wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel"); + pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10); + pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10); + + pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER); + + SetAutoLayout (true); + SetSizer (pTopSizer); + pTopSizer->Fit (this); + pTopSizer->SetSizeHints (this); +} + +DialogPreferences::~DialogPreferences () +{ +} + +bool +DialogPreferences::getAdvancedOptions () +{ + return static_cast(m_pCBAdvancedOptions->GetValue()); +} + +bool +DialogPreferences::getAskDeleteNewDocs () +{ + return static_cast(m_pCBAskDeleteNewDocs->GetValue()); +} + + ///////////////////////////////////////////////////////////////////// // CLASS DiaglogGetMinMax Implementation ///////////////////////////////////////////////////////////////////// diff --git a/src/dialogs.h b/src/dialogs.h index 8311bb2..92ba70c 100644 --- a/src/dialogs.h +++ b/src/dialogs.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: dialogs.h,v 1.24 2001/02/11 04:56:38 kevin Exp $ +** $Id: dialogs.h,v 1.25 2001/02/11 21:57:08 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 @@ -88,6 +88,21 @@ class DialogGetComparisonImage : public wxDialog }; +class DialogPreferences : public wxDialog +{ + public: + DialogPreferences (wxWindow* pParent, const char* const pszTitle, bool bAdvanced, bool bAskNewDocs); + virtual ~DialogPreferences (); + + bool getAdvancedOptions (); + bool getAskDeleteNewDocs (); + + private: + wxCheckBox* m_pCBAdvancedOptions; + wxCheckBox* m_pCBAskDeleteNewDocs; +}; + + class ImageFile; class DialogGetMinMax : public wxDialog { diff --git a/src/views.cpp b/src/views.cpp index ce66ec1..2743605 100644 --- a/src/views.cpp +++ b/src/views.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: views.cpp,v 1.102 2001/02/11 04:56:38 kevin Exp $ +** $Id: views.cpp,v 1.103 2001/02/11 21:57:08 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 @@ -398,7 +398,8 @@ ImageFileView::OnCompare (wxCommandEvent& event) << " and " << pCompareDoc->GetFirstView()->GetFrame()->GetTitle().c_str() << ": " << os.str().c_str(); pDifferenceImage->labelAdd (os.str().c_str()); - pDifferenceDoc->Modify (true); + if (theApp->getAskDeleteNewDocs()) + pDifferenceDoc->Modify (true); pDifferenceDoc->UpdateAllViews (this); pDifferenceDoc->getView()->OnUpdate (this, NULL); pDifferenceDoc->getView()->getFrame()->Show(true); @@ -414,7 +415,8 @@ ImageFileView::OnInvertValues (wxCommandEvent& event) ImageFile& rIF = GetDocument()->getImageFile(); rIF.invertPixelValues (rIF); rIF.labelAdd ("Invert Pixel Values"); - GetDocument()->Modify (true); + if (theApp->getAskDeleteNewDocs()) + GetDocument()->Modify (true); GetDocument()->UpdateAllViews (this); } @@ -424,7 +426,8 @@ ImageFileView::OnSquare (wxCommandEvent& event) ImageFile& rIF = GetDocument()->getImageFile(); rIF.square (rIF); rIF.labelAdd ("Square Pixel Values"); - GetDocument()->Modify (true); + if (theApp->getAskDeleteNewDocs()) + GetDocument()->Modify (true); GetDocument()->UpdateAllViews (this); } @@ -434,7 +437,8 @@ ImageFileView::OnSquareRoot (wxCommandEvent& event) ImageFile& rIF = GetDocument()->getImageFile(); rIF.sqrt (rIF); rIF.labelAdd ("Square-root Pixel Values"); - GetDocument()->Modify (true); + if (theApp->getAskDeleteNewDocs()) + GetDocument()->Modify (true); GetDocument()->UpdateAllViews (this); } @@ -444,7 +448,8 @@ ImageFileView::OnLog (wxCommandEvent& event) ImageFile& rIF = GetDocument()->getImageFile(); rIF.log (rIF); rIF.labelAdd ("Logrithm base-e Pixel Values"); - GetDocument()->Modify (true); + if (theApp->getAskDeleteNewDocs()) + GetDocument()->Modify (true); GetDocument()->UpdateAllViews (this); } @@ -454,7 +459,8 @@ ImageFileView::OnExp (wxCommandEvent& event) ImageFile& rIF = GetDocument()->getImageFile(); rIF.exp (rIF); rIF.labelAdd ("Exponent base-e Pixel Values"); - GetDocument()->Modify (true); + if (theApp->getAskDeleteNewDocs()) + GetDocument()->Modify (true); GetDocument()->UpdateAllViews (this); } @@ -490,7 +496,8 @@ ImageFileView::OnAdd (wxCommandEvent& event) newImage.labelsCopy (rRHSIF, s.c_str()); newImage.labelAdd (os.str().c_str()); *theApp->getLog() << os.str().c_str() << "\n"; - pNewDoc->Modify (true); + if (theApp->getAskDeleteNewDocs()) + pNewDoc->Modify (true); pNewDoc->UpdateAllViews (this); pNewDoc->getView()->OnUpdate (this, NULL); pNewDoc->getView()->getFrame()->Show(true); @@ -530,7 +537,8 @@ ImageFileView::OnSubtract (wxCommandEvent& event) newImage.labelsCopy (rRHSIF, s.c_str()); newImage.labelAdd (os.str().c_str()); *theApp->getLog() << os.str().c_str() << "\n"; - pNewDoc->Modify (true); + if (theApp->getAskDeleteNewDocs()) + pNewDoc->Modify (true); pNewDoc->UpdateAllViews (this); pNewDoc->getView()->OnUpdate (this, NULL); pNewDoc->getView()->getFrame()->Show(true); @@ -570,7 +578,8 @@ ImageFileView::OnMultiply (wxCommandEvent& event) newImage.labelsCopy (rRHSIF, s.c_str()); newImage.labelAdd (os.str().c_str()); *theApp->getLog() << os.str().c_str() << "\n"; - pNewDoc->Modify (true); + if (theApp->getAskDeleteNewDocs()) + pNewDoc->Modify (true); pNewDoc->UpdateAllViews (this); pNewDoc->getView()->OnUpdate (this, NULL); pNewDoc->getView()->getFrame()->Show(true); @@ -610,7 +619,8 @@ ImageFileView::OnDivide (wxCommandEvent& event) newImage.labelsCopy (rRHSIF, s.c_str()); newImage.labelAdd (os.str().c_str()); *theApp->getLog() << os.str().c_str() << "\n"; - pNewDoc->Modify (true); + if (theApp->getAskDeleteNewDocs()) + pNewDoc->Modify (true); pNewDoc->UpdateAllViews (this); pNewDoc->getView()->OnUpdate (this, NULL); pNewDoc->getView()->getFrame()->Show(true); @@ -628,7 +638,8 @@ ImageFileView::OnFFT (wxCommandEvent& event) rIF.labelAdd ("FFT Image"); m_bMinSpecified = false; m_bMaxSpecified = false; - GetDocument()->Modify (true); + if (theApp->getAskDeleteNewDocs()) + GetDocument()->Modify (true); GetDocument()->UpdateAllViews (this); } @@ -640,7 +651,8 @@ ImageFileView::OnIFFT (wxCommandEvent& event) rIF.labelAdd ("IFFT Image"); m_bMinSpecified = false; m_bMaxSpecified = false; - GetDocument()->Modify (true); + if (theApp->getAskDeleteNewDocs()) + GetDocument()->Modify (true); GetDocument()->UpdateAllViews (this); } @@ -652,7 +664,8 @@ ImageFileView::OnFFTRows (wxCommandEvent& event) rIF.labelAdd ("FFT Rows"); m_bMinSpecified = false; m_bMaxSpecified = false; - GetDocument()->Modify (true); + if (theApp->getAskDeleteNewDocs()) + GetDocument()->Modify (true); GetDocument()->UpdateAllViews (this); } @@ -664,7 +677,8 @@ ImageFileView::OnIFFTRows (wxCommandEvent& event) rIF.labelAdd ("IFFT Rows"); m_bMinSpecified = false; m_bMaxSpecified = false; - GetDocument()->Modify (true); + if (theApp->getAskDeleteNewDocs()) + GetDocument()->Modify (true); GetDocument()->UpdateAllViews (this); } @@ -676,7 +690,8 @@ ImageFileView::OnFFTCols (wxCommandEvent& event) rIF.labelAdd ("FFT Columns"); m_bMinSpecified = false; m_bMaxSpecified = false; - GetDocument()->Modify (true); + if (theApp->getAskDeleteNewDocs()) + GetDocument()->Modify (true); GetDocument()->UpdateAllViews (this); } @@ -688,7 +703,8 @@ ImageFileView::OnIFFTCols (wxCommandEvent& event) rIF.labelAdd ("IFFT Columns"); m_bMinSpecified = false; m_bMaxSpecified = false; - GetDocument()->Modify (true); + if (theApp->getAskDeleteNewDocs()) + GetDocument()->Modify (true); GetDocument()->UpdateAllViews (this); } #endif @@ -702,7 +718,8 @@ ImageFileView::OnFourier (wxCommandEvent& event) rIF.labelAdd ("Fourier Image"); m_bMinSpecified = false; m_bMaxSpecified = false; - GetDocument()->Modify (true); + if (theApp->getAskDeleteNewDocs()) + GetDocument()->Modify (true); GetDocument()->UpdateAllViews (this); } @@ -715,7 +732,8 @@ ImageFileView::OnInverseFourier (wxCommandEvent& event) rIF.labelAdd ("Inverse Fourier Image"); m_bMinSpecified = false; m_bMaxSpecified = false; - GetDocument()->Modify (true); + if (theApp->getAskDeleteNewDocs()) + GetDocument()->Modify (true); GetDocument()->UpdateAllViews (this); } @@ -727,7 +745,8 @@ ImageFileView::OnShuffleNaturalToFourierOrder (wxCommandEvent& event) rIF.labelAdd ("Shuffle Natural To Fourier Order"); m_bMinSpecified = false; m_bMaxSpecified = false; - GetDocument()->Modify (true); + if (theApp->getAskDeleteNewDocs()) + GetDocument()->Modify (true); GetDocument()->UpdateAllViews (this); } @@ -739,7 +758,8 @@ ImageFileView::OnShuffleFourierToNaturalOrder (wxCommandEvent& event) rIF.labelAdd ("Shuffle Fourier To Natural Order"); m_bMinSpecified = false; m_bMaxSpecified = false; - GetDocument()->Modify (true); + if (theApp->getAskDeleteNewDocs()) + GetDocument()->Modify (true); GetDocument()->UpdateAllViews (this); } @@ -752,7 +772,8 @@ ImageFileView::OnMagnitude (wxCommandEvent& event) rIF.labelAdd ("Magnitude of complex-image"); m_bMinSpecified = false; m_bMaxSpecified = false; - GetDocument()->Modify (true); + if (theApp->getAskDeleteNewDocs()) + GetDocument()->Modify (true); GetDocument()->UpdateAllViews (this); } } @@ -766,7 +787,8 @@ ImageFileView::OnPhase (wxCommandEvent& event) rIF.labelAdd ("Phase of complex-image"); m_bMinSpecified = false; m_bMaxSpecified = false; - GetDocument()->Modify (true); + if (theApp->getAskDeleteNewDocs()) + GetDocument()->Modify (true); GetDocument()->UpdateAllViews (this); } } @@ -1110,7 +1132,8 @@ ImageFileView::OnScaleSize (wxCommandEvent& event) rScaledIF.labelAdd (os.str().c_str()); rIF.scaleImage (rScaledIF); *theApp->getLog() << os.str().c_str() << "\n"; - pScaledDoc->Modify (true); + if (theApp->getAskDeleteNewDocs()) + pScaledDoc->Modify (true); pScaledDoc->UpdateAllViews (this); pScaledDoc->getView()->OnUpdate (this, NULL); pScaledDoc->getView()->getFrame()->Show(true); @@ -1213,7 +1236,8 @@ ImageFileView::OnPlotRow (wxCommandEvent& event) delete pYImag; delete pYMag; } - pPlotDoc->Modify (true); + if (theApp->getAskDeleteNewDocs()) + pPlotDoc->Modify (true); pPlotDoc->UpdateAllViews (); pPlotDoc->getView()->OnUpdate (this, NULL); pPlotDoc->getView()->getFrame()->Show(true); @@ -1298,7 +1322,8 @@ ImageFileView::OnPlotCol (wxCommandEvent& event) delete pYImag; delete pYMag; } - pPlotDoc->Modify (true); + if (theApp->getAskDeleteNewDocs()) + pPlotDoc->Modify (true); pPlotDoc->UpdateAllViews (); pPlotDoc->getView()->OnUpdate (this, NULL); pPlotDoc->getView()->getFrame()->Show(true); @@ -1392,7 +1417,8 @@ ImageFileView::OnPlotFFTRow (wxCommandEvent& event) delete pYMag; delete [] pcIn; - pPlotDoc->Modify (true); + if (theApp->getAskDeleteNewDocs()) + pPlotDoc->Modify (true); pPlotDoc->UpdateAllViews (); pPlotDoc->getView()->OnUpdate (this, NULL); pPlotDoc->getView()->getFrame()->Show(true); @@ -1492,7 +1518,8 @@ ImageFileView::OnPlotFFTCol (wxCommandEvent& event) delete pdTemp; delete [] pcIn; - pPlotDoc->Modify (true); + if (theApp->getAskDeleteNewDocs()) + pPlotDoc->Modify (true); pPlotDoc->UpdateAllViews (); pPlotDoc->getView()->OnUpdate (this, NULL); pPlotDoc->getView()->getFrame()->Show(true); @@ -1582,7 +1609,8 @@ ImageFileView::OnCompareCol (wxCommandEvent& event) delete pX; delete pY1; delete pY2; - pPlotDoc->Modify (true); + if (theApp->getAskDeleteNewDocs()) + pPlotDoc->Modify (true); pPlotDoc->UpdateAllViews (); pPlotDoc->getView()->OnUpdate (this, NULL); pPlotDoc->getView()->getFrame()->Show(true); @@ -1673,7 +1701,8 @@ ImageFileView::OnCompareRow (wxCommandEvent& event) delete pX; delete pY1; delete pY2; - pPlotDoc->Modify (true); + if (theApp->getAskDeleteNewDocs()) + pPlotDoc->Modify (true); pPlotDoc->UpdateAllViews (); pPlotDoc->getView()->OnUpdate (this, NULL); pPlotDoc->getView()->getFrame()->Show(true); @@ -1739,7 +1768,8 @@ ImageFileView::OnPlotHistogram (wxCommandEvent& event) rPlotFile.addDescription (os.str().c_str()); delete pX; delete pY; - pPlotDoc->Modify (true); + if (theApp->getAskDeleteNewDocs()) + pPlotDoc->Modify (true); pPlotDoc->UpdateAllViews (); pPlotDoc->getView()->OnUpdate (this, NULL); pPlotDoc->getView()->getFrame()->Show(true); @@ -1937,7 +1967,8 @@ PhantomFileView::OnProjections (wxCommandEvent& event) GetDocumentManager()->ActivateView (projView, true, false); } ::wxYield(); - pProjectionDoc-> Modify(true); + if (theApp->getAskDeleteNewDocs()) + pProjectionDoc-> Modify(true); pProjectionDoc->UpdateAllViews (this); } } @@ -1984,7 +2015,8 @@ PhantomFileView::OnRasterize (wxCommandEvent& event) } pRasterDoc->setImageFile (pImageFile); - pRasterDoc->Modify (true); + if (theApp->getAskDeleteNewDocs()) + pRasterDoc->Modify (true); pRasterDoc->UpdateAllViews (this); pRasterDoc->getView()->getFrame()->Show(true); std::ostringstream os; @@ -2277,7 +2309,8 @@ ProjectionFileView::OnConvertPolar (wxCommandEvent& event) << strInterpolation.c_str(); *theApp->getLog() << os.str().c_str() << "\n"; rIF.labelAdd (os.str().c_str()); - pPolarDoc->Modify (true); + if (theApp->getAskDeleteNewDocs()) + pPolarDoc->Modify (true); pPolarDoc->UpdateAllViews (); pPolarDoc->getView()->OnUpdate (this, NULL); pPolarDoc->getView()->getFrame()->Show(true); @@ -2311,7 +2344,8 @@ ProjectionFileView::OnConvertFFTPolar (wxCommandEvent& event) << strInterpolation.c_str() << ", zeropad=" << m_iDefaultPolarZeropad; *theApp->getLog() << os.str().c_str() << "\n"; rIF.labelAdd (os.str().c_str()); - pPolarDoc->Modify (true); + if (theApp->getAskDeleteNewDocs()) + pPolarDoc->Modify (true); pPolarDoc->UpdateAllViews (); pPolarDoc->getView()->OnUpdate (this, NULL); pPolarDoc->getView()->getFrame()->Show(true); @@ -2394,7 +2428,8 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event) return; } pReconDoc->setImageFile (pImageFile); - pReconDoc->Modify (true); + if (theApp->getAskDeleteNewDocs()) + pReconDoc->Modify (true); pReconDoc->UpdateAllViews (this); if (ImageFileView* rasterView = pReconDoc->getView()) { rasterView->OnUpdate (rasterView, NULL); diff --git a/tools/pjrec.cpp b/tools/pjrec.cpp index 24ee087..3240ddd 100644 --- a/tools/pjrec.cpp +++ b/tools/pjrec.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: pjrec.cpp,v 1.22 2001/02/09 14:34:16 kevin Exp $ +** $Id: pjrec.cpp,v 1.23 2001/02/11 21:57:08 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 @@ -48,7 +48,7 @@ static struct option my_options[] = {0, 0, 0, 0} }; -static const char* g_szIdStr = "$Id: pjrec.cpp,v 1.22 2001/02/09 14:34:16 kevin Exp $"; +static const char* g_szIdStr = "$Id: pjrec.cpp,v 1.23 2001/02/11 21:57:08 kevin Exp $"; void pjrec_usage (const char *program) @@ -139,7 +139,7 @@ pjrec_main (int argc, char * const argv[]) std::string sOptFilterMethodName (ProcessSignal::convertFilterMethodIDToName (ProcessSignal::FILTER_METHOD_CONVOLUTION)); std::string sOptFilterGenerationName (ProcessSignal::convertFilterGenerationIDToName (ProcessSignal::FILTER_GENERATION_DIRECT)); std::string sOptInterpName (Backprojector::convertInterpIDToName (Backprojector::INTERP_LINEAR)); - std::string sOptBackprojectName (Backprojector::convertBackprojectIDToName (Backprojector::BPROJ_IDIFF3)); + std::string sOptBackprojectName (Backprojector::convertBackprojectIDToName (Backprojector::BPROJ_IDIFF)); int iOptPreinterpolationFactor = 1; int nx, ny; char *endptr; -- 2.34.1