From 286d655a25df2668bd65ad365676c6ecc94415a1 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Sat, 22 Jul 2000 15:45:33 +0000 Subject: [PATCH] r158: *** empty log message *** --- ChangeLog | 5 +- configure.in | 2 +- include/backprojectors.h | 118 +++++++------- include/filter.h | 164 ++++++++----------- include/phantom.h | 142 ++++++++--------- include/scanner.h | 37 +++-- libctsim/backprojectors.cpp | 227 +++++++++++++++------------ libctsim/filter.cpp | 305 +++++++++++++++++++----------------- libctsim/phantom.cpp | 114 ++++++++------ libctsim/scanner.cpp | 69 ++++++-- src/ctsim.cpp | 6 +- src/dialogs.cpp | 143 +++++------------ src/dialogs.h | 82 +++++----- src/docs.h | 6 +- src/views.cpp | 12 +- tools/phm2if.cpp | 6 +- tools/phm2pj.cpp | 6 +- tools/pjrec.cpp | 10 +- 18 files changed, 723 insertions(+), 731 deletions(-) diff --git a/ChangeLog b/ChangeLog index bc6b5ff..ff04082 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,11 @@ -2.0.0-b6 - 7/19/00 +2.0.0-b6 - 7/22/00 ctsim program: improved initial size and scroll area for image and projection files ctsim program: added rasterization parameters, projections parameters, and reconstruction parameters dialogs + Moved char[] static definition from header files to c++ files + Completely reorganized option processing in classes to improve + expandability and to assist ctsim graphical user interface. 2.0.0-b5 - 7/17/00 ctsim program: Added dialog to set minimum/maximum display levels diff --git a/configure.in b/configure.in index c8bc7f4..0363f91 100644 --- a/configure.in +++ b/configure.in @@ -4,7 +4,7 @@ dnl Must reset CDPATH so that bash's cd does not print to stdout dnl CDPATH= AC_INIT(src/ctsim.cpp) -AM_INIT_AUTOMAKE(ctsim,2.0.0-b5) +AM_INIT_AUTOMAKE(ctsim,2.0.0-b6) AM_CONFIG_HEADER(config.h) dnl Checks for programs. diff --git a/include/backprojectors.h b/include/backprojectors.h index 598c244..ac609da 100644 --- a/include/backprojectors.h +++ b/include/backprojectors.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: backprojectors.h,v 1.11 2000/07/20 11:17:31 kevin Exp $ +** $Id: backprojectors.h,v 1.12 2000/07/22 15:45:33 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 @@ -35,79 +35,71 @@ class Backproject; +class ImageFile; +class Projections; class Backprojector { public: - typedef enum { - BPROJ_INVALID, - BPROJ_TRIG, - BPROJ_TABLE, - BPROJ_DIFF, - BPROJ_DIFF2, - BPROJ_IDIFF2, - BPROJ_IDIFF3 -} BackprojectID; - - typedef enum { - INTERP_INVALID, - INTERP_NEAREST, // Nearest neighbor + static const int BPROJ_INVALID; + static const int BPROJ_TRIG; + static const int BPROJ_TABLE; + static const int BPROJ_DIFF; + static const int BPROJ_DIFF2; + static const int BPROJ_IDIFF2; + static const int BPROJ_IDIFF3; + + static const int INTERP_INVALID; + static const int INTERP_NEAREST; + static const int INTERP_LINEAR; + static const int INTERP_FREQ_PREINTERPOLATION; #if HAVE_BSPLINE_INTERP - I_BSPLINE, - I_1BSPLINE, // 1st order B-Spline - I_2BSPLINE, - I_3BSPLINE, + static const int INTERP_BSPLINE; + static const int INTERP_1BSPLINE; + static const int INTERP_2BSPLINE; + static const int INTERP_3BSPLINE; #endif - INTERP_LINEAR, // Linear interpolation - INTERP_FREQ_PREINTERPOLATION, - } InterpolationID; - - static const char BPROJ_TRIG_STR[]; - static const char BPROJ_TABLE_STR[]; - static const char BPROJ_DIFF_STR[]; - static const char BPROJ_DIFF2_STR[]; - static const char BPROJ_IDIFF2_STR[]; - static const char BPROJ_IDIFF3_STR[]; - - static const char BPROJ_TRIG_TITLE_STR[]; - static const char BPROJ_TABLE_TITLE_STR[]; - static const char BPROJ_DIFF_TITLE_STR[]; - static const char BPROJ_DIFF2_TITLE_STR[]; - static const char BPROJ_IDIFF2_TITLE_STR[]; - static const char BPROJ_IDIFF3_TITLE_STR[]; - - static const char INTERP_NEAREST_STR[]; - static const char INTERP_LINEAR_STR[]; - static const char INTERP_BSPLINE_STR[]; - static const char INTERP_FREQ_PREINTERPOLATION_STR[]; - - static const char INTERP_NEAREST_TITLE_STR[]; - static const char INTERP_LINEAR_TITLE_STR[]; - static const char INTERP_BSPLINE_TITLE_STR[]; - static const char INTERP_FREQ_PREINTERPOLATION_TITLE_STR[]; Backprojector (const Projections& proj, ImageFile& im, const char* const backprojName, const char* const interpName, const int interpFactor); - ~Backprojector (void); + ~Backprojector (); void BackprojectView (const double* const viewData, const double viewAngle); - bool fail(void) const {return m_fail;} - const string& failMessage(void) const {return m_failMessage;} + bool fail() const {return m_fail;} + const string& failMessage() const {return m_failMessage;} + + static const int getBackprojectCount() {return s_iBackprojectCount;} + static const char** getBackprojectNameArray() {return s_aszBackprojectName;} + static const char** getBackprojectTitleArray() {return s_aszBackprojectTitle;} + static int convertBackprojectNameToID (const char* const bprojName); + static const char* convertBackprojectIDToName (const int bprojID); + static const char* convertBackprojectIDToTitle (const int bprojID); + + static const int getInterpCount() {return s_iInterpCount;} + static const char** getInterpNameArray() {return s_aszInterpName;} + static const char** getInterpTitleArray() {return s_aszInterpTitle;} + static int convertInterpNameToID (const char* const interpName); + static const char* convertInterpIDToName (const int interpID); + static const char* convertInterpIDToTitle (const int interpID); + private: string m_nameBackproject; string m_nameInterpolation; - BackprojectID m_idBackproject; - InterpolationID m_idInterpolation; + int m_idBackproject; + int m_idInterpolation; Backproject* m_pBackprojectImplem; bool m_fail; string m_failMessage; - static const InterpolationID convertInterpolationNameToID (const char* const interpName); - static const char* convertInterpolationIDToName (const InterpolationID interpID); - static const BackprojectID convertBackprojectNameToID (const char* const bprojName); - static const char* convertBackprojectIDToName (const BackprojectID bprojID); + static const char* s_aszBackprojectName[]; + static const char* s_aszBackprojectTitle[]; + static const int s_iBackprojectCount; + + static const char* s_aszInterpName[]; + static const char* s_aszInterpTitle[]; + static const int s_iInterpCount; bool initBackprojector (const Projections& proj, ImageFile& im, const char* const backprojName, const char* const interpName, const int interpFactor); }; @@ -116,20 +108,20 @@ class Backprojector class Backproject { public: - Backproject (const Projections& proj, ImageFile& im, Backprojector::InterpolationID interpType, const int interpFactor); + Backproject (const Projections& proj, ImageFile& im, int interpID, const int interpFactor); virtual ~Backproject (); virtual void BackprojectView (const double* const viewData, const double viewAngle) {}; protected: - void ScaleImageByRotIncrement (void); + void ScaleImageByRotIncrement (); void Backproject::errorIndexOutsideDetector (int ix, int iy, double theta, double r, double phi, double L, int ni); void Backproject::errorIndexOutsideDetector (int ix, int iy, double theta, double L, int ni); const Projections& proj; ImageFile& im; - Backprojector::InterpolationID interpType; + int interpType; ImageFileArray v; kint32 nx; kint32 ny; @@ -150,7 +142,7 @@ class Backproject class BackprojectTrig : public Backproject { public: - BackprojectTrig (const Projections& proj, ImageFile& im, Backprojector::InterpolationID interpType, const int interpFactor) + BackprojectTrig (const Projections& proj, ImageFile& im, int interpID, const int interpFactor) : Backproject::Backproject (proj, im, interpType, interpFactor) {} @@ -161,7 +153,7 @@ class BackprojectTrig : public Backproject class BackprojectTable : public Backproject { public: - BackprojectTable (const Projections& proj, ImageFile& im, Backprojector::InterpolationID interpType, const int interpFactor); + BackprojectTable (const Projections& proj, ImageFile& im, int interpID, const int interpFactor); ~BackprojectTable (); void BackprojectView (const double* const t, double view_angle); @@ -177,7 +169,7 @@ class BackprojectTable : public Backproject class BackprojectDiff : public Backproject { public: - BackprojectDiff (const Projections& proj, ImageFile& im, Backprojector::InterpolationID interpType, const int interpFactor); + BackprojectDiff (const Projections& proj, ImageFile& im, int interpID, const int interpFactor); ~BackprojectDiff (); void BackprojectView (const double* const t, double view_angle); @@ -191,7 +183,7 @@ class BackprojectDiff : public Backproject class BackprojectDiff2 : public BackprojectDiff { public: - BackprojectDiff2 (const Projections& proj, ImageFile& im, Backprojector::InterpolationID interpType, const int interpFactor) + BackprojectDiff2 (const Projections& proj, ImageFile& im, int interpID, const int interpFactor) : BackprojectDiff::BackprojectDiff (proj, im, interpType, interpFactor) {} @@ -201,7 +193,7 @@ class BackprojectDiff2 : public BackprojectDiff class BackprojectIntDiff2 : public BackprojectDiff { public: - BackprojectIntDiff2 (const Projections& proj, ImageFile& im, Backprojector::InterpolationID interpType, const int interpFactor) + BackprojectIntDiff2 (const Projections& proj, ImageFile& im, int interpID, const int interpFactor) : BackprojectDiff::BackprojectDiff (proj, im, interpType, interpFactor) {} @@ -212,7 +204,7 @@ class BackprojectIntDiff2 : public BackprojectDiff class BackprojectIntDiff3 : public BackprojectDiff { public: - BackprojectIntDiff3 (const Projections& proj, ImageFile& im, Backprojector::InterpolationID interpType, const int interpFactor) + BackprojectIntDiff3 (const Projections& proj, ImageFile& im, int interpType, const int interpFactor) : BackprojectDiff::BackprojectDiff (proj, im, interpType, interpFactor) {} diff --git a/include/filter.h b/include/filter.h index 5527b3e..6795569 100644 --- a/include/filter.h +++ b/include/filter.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: filter.h,v 1.15 2000/07/20 11:17:31 kevin Exp $ +** $Id: filter.h,v 1.16 2000/07/22 15:45:33 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 @@ -43,91 +43,36 @@ class SignalFilter { public: - typedef enum { - FILTER_INVALID, - FILTER_BANDLIMIT, - FILTER_SINC, - FILTER_G_HAMMING, - FILTER_COSINE, - FILTER_TRIANGLE, - FILTER_ABS_BANDLIMIT, // filter times |x| - FILTER_ABS_SINC, - FILTER_ABS_G_HAMMING, - FILTER_ABS_COSINE, - FILTER_SHEPP - } FilterID; - - typedef enum { - FILTER_METHOD_INVALID, - FILTER_METHOD_CONVOLUTION, - FILTER_METHOD_FOURIER, - FILTER_METHOD_FOURIER_TABLE, - FILTER_METHOD_FFT, + static const int FILTER_INVALID; + static const int FILTER_BANDLIMIT; + static const int FILTER_SINC; + static const int FILTER_G_HAMMING; + static const int FILTER_COSINE; + static const int FILTER_TRIANGLE; + static const int FILTER_ABS_BANDLIMIT; // filter times |x| + static const int FILTER_ABS_SINC; + static const int FILTER_ABS_G_HAMMING; + static const int FILTER_ABS_COSINE; + static const int FILTER_SHEPP; + + static const int FILTER_METHOD_INVALID; + static const int FILTER_METHOD_CONVOLUTION; + static const int FILTER_METHOD_FOURIER; + static const int FILTER_METHOD_FOURIER_TABLE; + static const int FILTER_METHOD_FFT; #if HAVE_FFTW - FILTER_METHOD_FFTW, - FILTER_METHOD_RFFTW, + static const int FILTER_METHOD_FFTW; + static const int FILTER_METHOD_RFFTW; #endif - } FilterMethodID; - typedef enum { - DOMAIN_INVALID, - DOMAIN_FREQUENCY, - DOMAIN_SPATIAL - } DomainID; + static const int DOMAIN_INVALID; + static const int DOMAIN_FREQUENCY; + static const int DOMAIN_SPATIAL; - // Filters - static const char FILTER_ABS_BANDLIMIT_STR[]; - static const char FILTER_ABS_SINC_STR[]; - static const char FILTER_ABS_COS_STR[]; - static const char FILTER_ABS_HAMMING_STR[]; - static const char FILTER_SHEPP_STR[]; - static const char FILTER_BANDLIMIT_STR[]; - static const char FILTER_SINC_STR[]; - static const char FILTER_COS_STR[]; - static const char FILTER_HAMMING_STR[]; - static const char FILTER_TRIANGLE_STR[]; - - static const char FILTER_ABS_BANDLIMIT_TITLE_STR[]; - static const char FILTER_ABS_SINC_TITLE_STR[]; - static const char FILTER_ABS_COS_TITLE_STR[]; - static const char FILTER_ABS_HAMMING_TITLE_STR[]; - static const char FILTER_SHEPP_TITLE_STR[]; - static const char FILTER_BANDLIMIT_TITLE_STR[]; - static const char FILTER_SINC_TITLE_STR[]; - static const char FILTER_COS_TITLE_STR[]; - static const char FILTER_HAMMING_TITLE_STR[]; - static const char FILTER_TRIANGLE_TITLE_STR[]; - - // Filter Methods - static const char FILTER_METHOD_CONVOLUTION_STR[]; - static const char FILTER_METHOD_FOURIER_STR[]; - static const char FILTER_METHOD_FOURIER_TABLE_STR[]; - static const char FILTER_METHOD_FFT_STR[]; -#if HAVE_FFTW - static const char FILTER_METHOD_FFTW_STR[]; - static const char FILTER_METHOD_RFFTW_STR[]; -#endif - - static const char FILTER_METHOD_CONVOLUTION_TITLE_STR[]; - static const char FILTER_METHOD_FOURIER_TITLE_STR[]; - static const char FILTER_METHOD_FOURIER_TABLE_TITLE_STR[]; - static const char FILTER_METHOD_FFT_TITLE_STR[]; -#if HAVE_FFTW - static const char FILTER_METHOD_FFTW_TITLESTR[]; - static const char FILTER_METHOD_RFFTW_TITLE_STR[]; -#endif - - // Domains - static const char DOMAIN_FREQUENCY_STR[]; - static const char DOMAIN_SPATIAL_STR[]; - - static const char DOMAIN_FREQUENCY_TITLE_STR[]; - static const char DOMAIN_SPATIAL_TITLE_STR[]; - SignalFilter (const char* filterName, const char* filterMethodName,double bw, double signalIncrement, int n, double param, const char* domainName, const int zeropad = 0, const int preinterpolationFactor = 1); - SignalFilter (const FilterID filt_type, FilterMethodID filterMethodID, double bw, double signalIncrement, int n, double param, const DomainID domain, const int zeropad = 0, const int preinterpolationFactor = 1); + SignalFilter (const int filt_type, int filterMethodID, double bw, double signalIncrement, int n, double param, const int domain, const int zeropad = 0, const int preinterpolationFactor = 1); SignalFilter (const char* filterName, const char* domainName, double bw, double param); @@ -161,24 +106,47 @@ class SignalFilter { const string& nameFilter(void) const { return m_nameFilter;} const string& nameDomain(void) const { return m_nameDomain;} - const FilterID idFilter(void) const { return m_idFilter;} - const DomainID idDomain(void) const { return m_idDomain;} + const int idFilter(void) const { return m_idFilter;} + const int idDomain(void) const { return m_idDomain;} const double getFilterMin(void) const {return m_filterMin;} const double getFilterMax(void) const {return m_filterMax;} const double getFilterIncrement(void) const {return m_filterInc;} double response (double x); - static double spatialResponse (FilterID fType, double bw, double x, double param); + static double spatialResponse (int fType, double bw, double x, double param); - static double frequencyResponse (FilterID fType, double bw, double u, double param); + static double frequencyResponse (int fType, double bw, double u, double param); - static double spatialResponseAnalytic (FilterID fType, double bw, double x, double param); + static double spatialResponseAnalytic (int fType, double bw, double x, double param); - static double spatialResponseCalc (FilterID fType, double bw, double x, double param, int nIntegral); + static double spatialResponseCalc (int fType, double bw, double x, double param, int nIntegral); static void setNumIntegral(int nIntegral) {N_INTEGRAL = nIntegral;} + static const int getFilterCount() {return s_iFilterCount;} + static const char** getFilterNameArray() {return s_aszFilterName;} + static const char** getFilterTitleArray() {return s_aszFilterTitle;} + static int convertFilterNameToID (const char* const filterName); + static const char* convertFilterIDToName (const int idFilter); + static const char* convertFilterIDToTitle (const int idFilter); + + static const int getFilterMethodCount() {return s_iFilterMethodCount;} + static const char** getFilterMethodNameArray() {return s_aszFilterMethodName;} + static const char** getFilterMethodTitleArray() {return s_aszFilterMethodTitle;} + static int convertFilterMethodNameToID (const char* const filterMethodName); + static const char* convertFilterMethodIDToName (const int idFilterMethod); + static const char* convertFilterMethodIDToTitle (const int idFilterMethod); + + static const int getDomainCount() {return s_iDomainCount;} + static const char** getDomainNameArray() {return s_aszDomainName;} + static const char** getDomainTitleArray() {return s_aszDomainTitle;} + static int convertDomainNameToID (const char* const domainName); + static const char* convertDomainIDToName (const int idDomain); + static const char* convertDomainIDToTitle (const int idDomain); + + + private: double m_bw; int m_nFilterPoints; @@ -203,26 +171,30 @@ class SignalFilter { string m_nameFilter; string m_nameFilterMethod; string m_nameDomain; - FilterID m_idFilter; - FilterMethodID m_idFilterMethod; - DomainID m_idDomain; + int m_idFilter; + int m_idFilterMethod; + int m_idDomain; double m_filterParam; int m_traceLevel; int m_zeropad; int m_nOutputPoints; int m_preinterpolationFactor; + static const char* s_aszFilterName[]; + static const char* s_aszFilterTitle[]; + static const int s_iFilterCount; + static const char* s_aszFilterMethodName[]; + static const char* s_aszFilterMethodTitle[]; + static const int s_iFilterMethodCount; + static const char* s_aszDomainName[]; + static const char* s_aszDomainTitle[]; + static const int s_iDomainCount; + static int N_INTEGRAL; - static const bool haveAnalyticSpatial (const FilterID filterID); - static const FilterID convertFilterNameToID (const char* filterName); - static const char* convertFilterIDToName (const FilterID filterID); - static const FilterMethodID convertFilterMethodNameToID (const char* filterMethodName); - static const char* convertFilterMethodIDToName (const FilterMethodID filterMethodID); - static const DomainID convertDomainNameToID (const char* domainName); - static const char* convertDomainIDToName (const DomainID domainID); + static const bool haveAnalyticSpatial (const int filterID); - void init (const FilterID filt_type, const FilterMethodID filterMethod, double bw, double signalIncrement, int n, double param, const DomainID domain, const int zeropad, const int preInterpScale); + void init (const int filt_type, const int filterMethod, double bw, double signalIncrement, int n, double param, const int domain, const int zeropad, const int preInterpScale); double spatialResponseCalc (double x, double param) const; diff --git a/include/phantom.h b/include/phantom.h index a82381f..416b833 100644 --- a/include/phantom.h +++ b/include/phantom.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: phantom.h,v 1.9 2000/07/20 11:17:31 kevin Exp $ +** $Id: phantom.h,v 1.10 2000/07/22 15:45:33 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 @@ -29,6 +29,10 @@ #define PHANTOM_H #include +#include "ctsupport.h" +#include "backprojectors.h" +class ImageFile; + using namespace std; typedef enum { @@ -54,7 +58,7 @@ class PhantomElement public: PhantomElement (const char* const type, const double cx, const double cy, const double u, const double v, const double rot, const double atten); - ~PhantomElement (void); + ~PhantomElement (); bool isPointInside (double x, double y, const CoordType coord_type) const; @@ -62,21 +66,21 @@ class PhantomElement bool clipLineWorldCoords (double& x1, double& y1, double& x2, double& y2) const; - const int nOutlinePoints(void) const {return m_nPoints;} - double* rectLimits(void) {return m_rectLimits;} + const int nOutlinePoints() const {return m_nPoints;} + double* rectLimits() {return m_rectLimits;} double* xOutline() {return m_xOutline;} double* yOutline() {return m_yOutline;} - const double atten(void) const {return m_atten;} - const double diameter(void) const {return m_diameter;} - const double xmin(void) const {return m_xmin;} - const double xmax(void) const {return m_xmax;} - const double ymin(void) const {return m_ymin;} - const double ymax(void) const {return m_ymax;} - const double rot(void) const {return m_rot;} - const double cx(void) const {return m_cx;} - const double cy(void) const {return m_cy;} - const double u(void) const {return m_u;} - const double v(void) const {return m_v;} + const double atten() const {return m_atten;} + const double diameter() const {return m_diameter;} + const double xmin() const {return m_xmin;} + const double xmax() const {return m_xmax;} + const double ymin() const {return m_ymin;} + const double ymax() const {return m_ymax;} + const double rot() const {return m_rot;} + const double cx() const {return m_cx;} + const double cy() const {return m_cy;} + const double u() const {return m_u;} + const double v() const {return m_v;} private: PhmElemType m_type; // pelem type (box, ellipse, etc) @@ -99,9 +103,9 @@ class PhantomElement static PhmElemType PhantomElement::convertNameToType (const char* const typeName); - void makeTransformMatrices (void); + void makeTransformMatrices (); - void makeVectorOutline (void); + void makeVectorOutline (); void calcArcPoints (double x[], double y[], const int pts, const double xcent, const double ycent, const double r, const double start, const double stop); @@ -120,46 +124,35 @@ typedef enum { P_FILTER // defined only by this type } PhantomComposition; -// Phantom class + +////////////////////////////////////////////////////// +// Phantom Class Declaration +////////////////////////////////////////////////////// class Phantom { public: - typedef enum { - PHM_INVALID, - PHM_HERMAN, /* Herman head phantom */ - PHM_BHERMAN, /* Bordered Herman head phantom */ - PHM_ROWLAND, /* Rowland head phantom */ - PHM_BROWLAND, /* Bordered Rowland head phantom */ - PHM_UNITPULSE /* Unit pulse phantom */ - } PhantomID; - - static const char PHM_HERMAN_STR[]; - static const char PHM_BHERMAN_STR[]; - static const char PHM_ROWLAND_STR[]; - static const char PHM_BROWLAND_STR[]; - static const char PHM_UNITPULSE_STR[]; - - static const char PHM_HERMAN_TITLE_STR[]; - static const char PHM_BHERMAN_TITLE_STR[]; - static const char PHM_ROWLAND_TITLE_STR[]; - static const char PHM_BROWLAND_TITLE_STR[]; - static const char PHM_UNITPULSE_TITLE_STR[]; - - Phantom (void); + static const int PHM_INVALID; + static const int PHM_HERMAN; + static const int PHM_BHERMAN; + static const int PHM_ROWLAND; + static const int PHM_BROWLAND; + static const int PHM_UNITPULSE; + + Phantom (); Phantom (const char* const phmName); - ~Phantom (void); + ~Phantom (); void setComposition (PhantomComposition composition) { m_composition = composition; } - const PhantomComposition getComposition (void) const + const PhantomComposition getComposition () const { return m_composition; } bool createFromPhantom (const char* const phmName); - bool createFromPhantom (const PhantomID phmid); + bool createFromPhantom (const int phmid); bool createFromFile (const char* const fname); @@ -171,33 +164,40 @@ class Phantom void convertToImagefile (ImageFile& im, const int in_nsample, const int trace) const; - bool fail(void) const {return m_fail;} - const string& failMessage(void) const {return m_failMessage;} - const string& name(void) const {return m_name;} - const PhantomID id(void) const {return m_id;} + bool fail() const {return m_fail;} + const string& failMessage() const {return m_failMessage;} + const string& name() const {return m_name;} + const int id() const {return m_id;} #if HAVE_SGP - void show (void) const; - void draw (void) const; + void show () const; + void draw () const; #endif - void addStdHerman (void); - void addStdHermanBordered (void); - void addStdRowland (void); - void addStdRowlandBordered (void); - - void print (void) const; - - const double maxAxisLength (void) const {return (((m_xmax - m_xmin) > (m_ymax - m_ymin)) ? (m_xmax - m_xmin) : (m_ymax - m_ymin));} - - const double diameter(void) const {return m_diameter;} - const double xmin(void) const {return m_xmin;} - const double xmax(void) const {return m_xmax;} - const double ymin(void) const {return m_ymin;} - const double ymax(void) const {return m_ymax;} - slist& listPElem(void) {return m_listPElem;} - const slist& listPElem(void) const {return m_listPElem;} - const int nPElem(void) const {return m_nPElem;} + void addStdHerman (); + void addStdHermanBordered (); + void addStdRowland (); + void addStdRowlandBordered (); + + void print () const; + + const double maxAxisLength () const {return (((m_xmax - m_xmin) > (m_ymax - m_ymin)) ? (m_xmax - m_xmin) : (m_ymax - m_ymin));} + + const double diameter() const {return m_diameter;} + const double xmin() const {return m_xmin;} + const double xmax() const {return m_xmax;} + const double ymin() const {return m_ymin;} + const double ymax() const {return m_ymax;} + slist& listPElem() {return m_listPElem;} + const slist& listPElem() const {return m_listPElem;} + const int nPElem() const {return m_nPElem;} + + static const int getPhantomCount() {return s_iPhantomCount;} + static const char** getPhantomNameArray() {return s_aszPhantomName;} + static const char** getPhantomTitleArray() {return s_aszPhantomTitle;} + static int convertNameToPhantomID (const char* const phmName); + static const char* convertPhantomIDToName (const int phmID); + static const char* convertPhantomIDToTitle (const int phmID); private: PhantomComposition m_composition; @@ -206,15 +206,15 @@ class Phantom double m_diameter; // diameter of object mutable slist m_listPElem; // pelem lists string m_name; - PhantomID m_id; + int m_id; bool m_fail; string m_failMessage; - // Standard phantomsa - static PhantomID convertNameToPhantomID (const char* const phmName); - static const char* convertPhantomIDToName (const PhantomID phmID); + static const char* s_aszPhantomName[]; + static const char* s_aszPhantomTitle[]; + static const int s_iPhantomCount; - void init(void); + void init(); Phantom (const Phantom& rhs); // copy constructor Phantom& operator= (const Phantom&); // assignment operator diff --git a/include/scanner.h b/include/scanner.h index 000aba1..c446280 100644 --- a/include/scanner.h +++ b/include/scanner.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: scanner.h,v 1.7 2000/07/20 11:17:31 kevin Exp $ +** $Id: scanner.h,v 1.8 2000/07/22 15:45:33 kevin Exp $ ** ** ** This program is free software; you can redistribute it and/or modify @@ -61,24 +61,16 @@ class DetectorArray DetectorArray (const DetectorArray& rhs); // copy constructor }; + class Scanner { public: - typedef enum { - GEOMETRY_INVALID, - GEOMETRY_PARALLEL, - GEOMETRY_EQUILINEAR, - GEOMETRY_EQUIANGULAR, - } GeometryID; - - static const char GEOMETRY_PARALLEL_STR[]; - static const char GEOMETRY_EQUILINEAR_STR[]; - static const char GEOMETRY_EQUIANGULAR_STR[]; - - static const char GEOMETRY_PARALLEL_TITLE_STR[]; - static const char GEOMETRY_EQUILINEAR_TITLE_STR[]; - static const char GEOMETRY_EQUIANGULAR_TITLE_STR[]; + static const int Scanner::GEOMETRY_INVALID; + static const int Scanner::GEOMETRY_PARALLEL; + static const int Scanner::GEOMETRY_EQUILINEAR; + static const int Scanner::GEOMETRY_EQUIANGULAR; + Scanner (const Phantom& phm, const char* const geometryName, int nDet, int nView, int nSample, const double rot_anglen); ~Scanner(); @@ -95,11 +87,17 @@ class Scanner const double detInc(void) const {return m_detInc;} const double radius(void) const {return m_radius;} - + static const int getGeometryCount() {return s_iGeometryCount;} + static const char** getGeometryNameArray() {return s_aszGeometryName;} + static const char** getGeometryTitleArray() {return s_aszGeometryTitle;} + static int convertGeometryNameToID (const char* const geometryName); + static const char* convertGeometryIDToName (const int idGeometry); + static const char* convertGeometryIDToTitle (const int idGeometry); + private: bool m_fail; string m_failMessage; - GeometryID m_idGeometry; + int m_idGeometry; unsigned int m_nDet; /* Number of detectors in array */ unsigned int m_nView; /* Number of rotated views */ unsigned int m_nSample; /* Number of rays per detector */ @@ -116,10 +114,11 @@ class Scanner double angle; /* Starting angle */ } m_initPos; + static const char* s_aszGeometryName[]; + static const char* s_aszGeometryTitle[]; + static const int s_iGeometryCount; static const int N_EXTRA_DETECTORS=4; /* Number of extra detectors widths when calculating detlen */ - static GeometryID convertGeometryNameToID (const char* const geometryName); - void projectSingleView (const Phantom& phm, DetectorArray& darray, const double xd1, const double yd1, const double xd2, const double yd2, const double xs1, const double ys1, const double xs2, const double ys2); double projectSingleLine (const Phantom& phm, const double x1, const double y1, const double x2, const double y2); diff --git a/libctsim/backprojectors.cpp b/libctsim/backprojectors.cpp index ae31cf8..4983256 100644 --- a/libctsim/backprojectors.cpp +++ b/libctsim/backprojectors.cpp @@ -8,7 +8,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: backprojectors.cpp,v 1.9 2000/07/20 11:17:31 kevin Exp $ +** $Id: backprojectors.cpp,v 1.10 2000/07/22 15:45:33 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 @@ -26,29 +26,75 @@ #include "ct.h" -const char Backprojector::BPROJ_TRIG_STR[]= "trig"; -const char Backprojector::BPROJ_TABLE_STR[]= "table"; -const char Backprojector::BPROJ_DIFF_STR[]= "diff"; -const char Backprojector::BPROJ_DIFF2_STR[]= "diff2"; -const char Backprojector::BPROJ_IDIFF2_STR[]= "idiff2"; -const char Backprojector::BPROJ_IDIFF3_STR[]= "idiff3"; - -const char Backprojector::BPROJ_TRIG_TITLE_STR[]= "Direc Trigometric"; -const char Backprojector::BPROJ_TABLE_TITLE_STR[]= "Trig Table"; -const char Backprojector::BPROJ_DIFF_TITLE_STR[]= "Diff"; -const char Backprojector::BPROJ_DIFF2_TITLE_STR[]= "Diff2"; -const char Backprojector::BPROJ_IDIFF2_TITLE_STR[]= "Integer Diff2"; -const char Backprojector::BPROJ_IDIFF3_TITLE_STR[]= "Integer Diff3"; - -const char Backprojector::INTERP_NEAREST_STR[]= "nearest"; -const char Backprojector::INTERP_LINEAR_STR[]= "linear"; -const char Backprojector::INTERP_BSPLINE_STR[]= "bspline"; -const char Backprojector::INTERP_FREQ_PREINTERPOLATION_STR[]= "freq_preinterpolation"; - -const char Backprojector::INTERP_NEAREST_TITLE_STR[]= "Nearest"; -const char Backprojector::INTERP_LINEAR_TITLE_STR[]= "Linear"; -const char Backprojector::INTERP_BSPLINE_TITLE_STR[]= "B-Spline"; -const char Backprojector::INTERP_FREQ_PREINTERPOLATION_TITLE_STR[]= "Frequency Preinterpolation"; +const int Backprojector::BPROJ_INVALID = -1; +const int Backprojector::BPROJ_TRIG = 0; +const int Backprojector::BPROJ_TABLE = 1; +const int Backprojector::BPROJ_DIFF = 2; +const int Backprojector::BPROJ_DIFF2 = 3; +const int Backprojector::BPROJ_IDIFF2 = 4; +const int Backprojector::BPROJ_IDIFF3 = 5; + +const char* Backprojector::s_aszBackprojectName[] = +{ + {"trig"}, + {"table"}, + {"diff"}, + {"diff2"}, + {"idiff2"}, + {"idiff3"}, +}; + +const char* Backprojector::s_aszBackprojectTitle[] = +{ + {"Direct Trigometric"}, + {"Trigometric Table"}, + {"Difference Iteration"}, + {"Difference Iteration Optimized"}, + {"Integer Difference Iteration Optimized"}, + {"Integer Difference Iteration Highly-Optimized"}, +}; + +const int Backprojector::s_iBackprojectCount = sizeof(s_aszBackprojectName) / sizeof(const char*); + +const int Backprojector::INTERP_INVALID = -1; +const int Backprojector::INTERP_NEAREST = 0; +const int Backprojector::INTERP_LINEAR = 1; +const int Backprojector::INTERP_FREQ_PREINTERPOLATION = 2; +#if HAVE_BSPLINE_INTERP +const int Backprojector::INTERP_BSPLINE = 3; +const int Backprojector::INTERP_1BSPLINE = 4; +const int Backprojector::INTERP_2BSPLINE = 5; +const int Backprojector::INTERP_3BSPLINE = 6; +#endif + +const char* Backprojector::s_aszInterpName[] = +{ + {"nearest"}, + {"linear"}, + {"freq_preinterpolationj"}, +#if HAVE_BSPLINE_INTERP + {"bspline"}, + {"1bspline"}, + {"2bspline"}, + {"3bspline"}, +#endif +}; + +const char* Backprojector::s_aszInterpTitle[] = +{ + {"Nearest"}, + {"Linear"}, + {"Frequency Preinterpolationj"}, +#if HAVE_BSPLINE_INTERP + {"B-Spline"}, + {"B-Spline 1st Order"}, + {"B-Spline 2nd Order"}, + {"B-Spline 3rd Order"}, +#endif +}; + +const int Backprojector::s_iInterpCount = sizeof(s_aszInterpName) / sizeof(const char*); + Backprojector::Backprojector (const Projections& proj, ImageFile& im, const char* const backprojName, const char* const interpName, const int interpFactor) @@ -66,7 +112,7 @@ Backprojector::BackprojectView (const double* const viewData, const double viewA m_pBackprojectImplem->BackprojectView (viewData, viewAngle); } -Backprojector::~Backprojector (void) +Backprojector::~Backprojector () { delete m_pBackprojectImplem; } @@ -90,7 +136,7 @@ Backprojector::initBackprojector (const Projections& proj, ImageFile& im, const m_failMessage = "Invalid backprojection name "; m_failMessage += backprojName; } - m_idInterpolation = convertInterpolationNameToID (interpName); + m_idInterpolation = convertInterpNameToID (interpName); if (m_idInterpolation == INTERP_INVALID) { m_fail = true; m_failMessage = "Invalid interpolation name "; @@ -124,107 +170,88 @@ Backprojector::initBackprojector (const Projections& proj, ImageFile& im, const } -const Backprojector::BackprojectID +int Backprojector::convertBackprojectNameToID (const char* const backprojName) { - BackprojectID backprojID = BPROJ_INVALID; - - if (strcasecmp (backprojName, BPROJ_TRIG_STR) == 0) - backprojID = BPROJ_TRIG; - else if (strcasecmp (backprojName, BPROJ_TABLE_STR) == 0) - backprojID = BPROJ_TABLE; - else if (strcasecmp (backprojName, BPROJ_DIFF_STR) == 0) - backprojID = BPROJ_DIFF; - else if (strcasecmp (backprojName, BPROJ_DIFF2_STR) == 0) - backprojID = BPROJ_DIFF2; - else if (strcasecmp (backprojName, BPROJ_IDIFF2_STR) == 0) - backprojID = BPROJ_IDIFF2; - else if (strcasecmp (backprojName, BPROJ_IDIFF3_STR) == 0) - backprojID = BPROJ_IDIFF3; + int backprojID = BPROJ_INVALID; + + for (int i = 0; i < s_iBackprojectCount; i++) + if (strcasecmp (backprojName, s_aszBackprojectName[i]) == 0) { + backprojID = i; + break; + } return (backprojID); } const char* -Backprojector::convertBackprojectIDToName (const BackprojectID bprojID) +Backprojector::convertBackprojectIDToName (int bprojID) { - const char *bprojName = ""; - - if (bprojID == BPROJ_TRIG) - bprojName = BPROJ_TRIG_STR; - else if (bprojID == BPROJ_TABLE) - bprojName = BPROJ_TABLE_STR; - else if (bprojID == BPROJ_DIFF) - bprojName = BPROJ_DIFF_STR; - else if (bprojID == BPROJ_DIFF2) - bprojName = BPROJ_DIFF2_STR; - else if (bprojID == BPROJ_IDIFF2) - bprojName = BPROJ_IDIFF2_STR; - else if (bprojID == BPROJ_IDIFF3) - bprojName = BPROJ_IDIFF3_STR; + static const char *bprojName = ""; + + if (bprojID >= 0 && bprojID < s_iBackprojectCount) + return (s_aszBackprojectName[bprojID]); return (bprojName); } +const char* +Backprojector::convertBackprojectIDToTitle (const int bprojID) +{ + static const char *bprojTitle = ""; + + if (bprojID >= 0 && bprojID < s_iBackprojectCount) + return (s_aszBackprojectTitle[bprojID]); + + return (bprojTitle); +} -const Backprojector::InterpolationID -Backprojector::convertInterpolationNameToID (const char* const interpName) +int +Backprojector::convertInterpNameToID (const char* const interpName) { - InterpolationID interpID = INTERP_INVALID; - - if (strcasecmp (interpName, INTERP_NEAREST_STR) == 0) - interpID = INTERP_NEAREST; - else if (strcasecmp (interpName, INTERP_LINEAR_STR) == 0) - interpID = INTERP_LINEAR; - else if (strcasecmp (interpName, INTERP_FREQ_PREINTERPOLATION_STR) == 0) - interpID = INTERP_FREQ_PREINTERPOLATION; -#if HAVE_BSPLINE_INTERP - else if (strcasecmp (interpName, INTERP_BSPLINE_STR) == 0) - interpID = INTERP_BSPLINE; -#endif + int interpID = INTERP_INVALID; + + for (int i = 0; i < s_iInterpCount; i++) + if (strcasecmp (interpName, s_aszInterpName[i]) == 0) { + interpID = i; + break; + } return (interpID); } +const char* +Backprojector::convertInterpIDToName (const int interpID) +{ + static const char *interpName = ""; -/* NAME - * name_of_interp Return name of interpolation method - * - * SYNOPSIS - * name = name_of_interp (interp_type) - * char *name Name of interpolation method - * int interp_type Method of interpolation - * - * NOTES - * Returns NULL if interp_type is invalid - */ + if (interpID >= 0 && interpID < s_iInterpCount) + return (s_aszInterpName[interpID]); + + return (interpName); +} const char* -Backprojector::convertInterpolationIDToName (const InterpolationID interpID) +Backprojector::convertInterpIDToTitle (const int interpID) { - if (interpID == INTERP_NEAREST) - return (INTERP_NEAREST_STR); - else if (interpID == INTERP_LINEAR) - return (INTERP_LINEAR_STR); - else if (interpID == INTERP_FREQ_PREINTERPOLATION) - return (INTERP_FREQ_PREINTERPOLATION_STR); -#if HAVE_BSPLINE_INTERP - else if (interpID == INTERP_BSPLINE) - return (INTERP_BSPLINE_STR); -#endif - else - return (""); + static const char *interpTitle = ""; + + if (interpID >= 0 && interpID < s_iInterpCount) + return (s_aszInterpTitle[interpID]); + + return (interpTitle); } + // CLASS IDENTICATION // Backproject // // PURPOSE // Pure virtual base class for all backprojectors. -Backproject::Backproject (const Projections& proj, ImageFile& im, const Backprojector::InterpolationID interpType, const int interpFactor) +Backproject::Backproject (const Projections& proj, ImageFile& im, const int interpType, const int interpFactor) : proj(proj), im(im), interpType(interpType), m_interpFactor(interpFactor) { detInc = proj.detInc(); @@ -246,11 +273,11 @@ Backproject::Backproject (const Projections& proj, ImageFile& im, const Backproj yInc = (yMax - yMin) / ny; } -Backproject::~Backproject (void) +Backproject::~Backproject () {} void -Backproject::ScaleImageByRotIncrement (void) +Backproject::ScaleImageByRotIncrement () { for (int ix = 0; ix < nx; ix++) for (int iy = 0; iy < ny; iy++) @@ -320,7 +347,7 @@ BackprojectTrig::BackprojectView (const double* const filteredProj, const double // PURPOSE // Precalculates trigometric function value for each point in image for backprojection. -BackprojectTable::BackprojectTable (const Projections& proj, ImageFile& im, Backprojector::InterpolationID interpType, const int interpFactor) +BackprojectTable::BackprojectTable (const Projections& proj, ImageFile& im, int interpType, const int interpFactor) : Backproject::Backproject (proj, im, interpType, interpFactor) { arrayR.initSetSize (nx, ny); @@ -337,7 +364,7 @@ BackprojectTable::BackprojectTable (const Projections& proj, ImageFile& im, Back } } -BackprojectTable::~BackprojectTable (void) +BackprojectTable::~BackprojectTable () { ScaleImageByRotIncrement(); } @@ -382,7 +409,7 @@ BackprojectTable::BackprojectView (const double* const filteredProj, const doubl // Backprojects by precalculating the change in L position for each x & y step in the image. // Iterates in x & y direction by adding difference in L position -BackprojectDiff::BackprojectDiff (const Projections& proj, ImageFile& im, Backprojector::InterpolationID interpType, const int interpFactor) +BackprojectDiff::BackprojectDiff (const Projections& proj, ImageFile& im, int interpType, const int interpFactor) : Backproject::Backproject (proj, im, interpType, interpFactor) { // calculate center of first pixel v[0][0] diff --git a/libctsim/filter.cpp b/libctsim/filter.cpp index a0638b2..1eda236 100644 --- a/libctsim/filter.cpp +++ b/libctsim/filter.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: filter.cpp,v 1.19 2000/07/20 11:17:31 kevin Exp $ +** $Id: filter.cpp,v 1.20 2000/07/22 15:45:33 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 @@ -27,57 +27,98 @@ #include "ct.h" - int SignalFilter::N_INTEGRAL=500; //static member -// Filters -const char SignalFilter::FILTER_ABS_BANDLIMIT_STR[] = "abs_bandlimit"; -const char SignalFilter::FILTER_ABS_SINC_STR[] = "abs_sinc"; -const char SignalFilter::FILTER_ABS_COS_STR[] = "abs_cos"; -const char SignalFilter::FILTER_ABS_HAMMING_STR[] = "abs_hamming"; -const char SignalFilter::FILTER_SHEPP_STR[] = "shepp"; -const char SignalFilter::FILTER_BANDLIMIT_STR[] = "bandlimit"; -const char SignalFilter::FILTER_SINC_STR[] = "sinc"; -const char SignalFilter::FILTER_COS_STR[] = "cos"; -const char SignalFilter::FILTER_HAMMING_STR[] = "hamming"; -const char SignalFilter::FILTER_TRIANGLE_STR[] = "triangle"; - -const char SignalFilter::FILTER_ABS_BANDLIMIT_TITLE_STR[] = "Abs(w) * Bandlimit"; -const char SignalFilter::FILTER_ABS_SINC_TITLE_STR[] = "Abs(w) * Sinc"; -const char SignalFilter::FILTER_ABS_COS_TITLE_STR[] = "Abs(w) * Cos"; -const char SignalFilter::FILTER_ABS_HAMMING_TITLE_STR[] = "Abs(w) * Hamming"; -const char SignalFilter::FILTER_SHEPP_TITLE_STR[] = "Shepp"; -const char SignalFilter::FILTER_BANDLIMIT_TITLE_STR[] = "Bandlimit"; -const char SignalFilter::FILTER_SINC_TITLE_STR[] = "Sinc"; -const char SignalFilter::FILTER_COS_TITLE_STR[] = "Cos"; -const char SignalFilter::FILTER_HAMMING_TITLE_STR[] = "Hamming"; -const char SignalFilter::FILTER_TRIANGLE_TITLE_STR[] = "Triangle"; - -// Filter Methods -const char SignalFilter::FILTER_METHOD_CONVOLUTION_STR[] = "convolution"; -const char SignalFilter::FILTER_METHOD_FOURIER_STR[] = "fourier"; -const char SignalFilter::FILTER_METHOD_FOURIER_TABLE_STR[] = "fourier_table"; -const char SignalFilter::FILTER_METHOD_FFT_STR[] = "fft"; +const int SignalFilter::FILTER_INVALID = -1 ; +const int SignalFilter::FILTER_BANDLIMIT = 0; +const int SignalFilter::FILTER_SINC = 1; +const int SignalFilter::FILTER_G_HAMMING = 2; +const int SignalFilter::FILTER_COSINE = 3; +const int SignalFilter::FILTER_TRIANGLE = 4; +const int SignalFilter::FILTER_ABS_BANDLIMIT = 5; // filter times |x = | +const int SignalFilter::FILTER_ABS_SINC = 6; +const int SignalFilter::FILTER_ABS_G_HAMMING = 7; +const int SignalFilter::FILTER_ABS_COSINE = 8; +const int SignalFilter::FILTER_SHEPP = 9; + +const char* SignalFilter::s_aszFilterName[] = { + {"bandlimit"}, + {"sinc"}, + {"hamming"}, + {"cosine"}, + {"triangle"}, + {"abs_bandlimit"}, + {"abs_sinc"}, + {"abs_hamming"}, + {"abs_cosine"}, + {"shepp"}, +}; + +const char* SignalFilter::s_aszFilterTitle[] = { + {"Bandlimit"}, + {"Sinc"}, + {"Hamming"}, + {"Cosine"}, + {"Triangle"}, + {"Abs(w) * Bandlimit"}, + {"Abs(w) * Sinc"}, + {"Abs(w) * Hamming"}, + {"Abs(w) * Cosine"}, + {"Shepp"}, +}; + +const int SignalFilter::s_iFilterCount = sizeof(s_aszFilterName) / sizeof(const char*); + +const int SignalFilter::FILTER_METHOD_INVALID = -1; +const int SignalFilter::FILTER_METHOD_CONVOLUTION = 0; +const int SignalFilter::FILTER_METHOD_FOURIER = 1; +const int SignalFilter::FILTER_METHOD_FOURIER_TABLE = 2; +const int SignalFilter::FILTER_METHOD_FFT = 3; +#if HAVE_FFTW +const int SignalFilter::FILTER_METHOD_FFTW = 4; +const int SignalFilter::FILTER_METHOD_RFFTW =5 ; +#endif + +const char* SignalFilter::s_aszFilterMethodName[] = { + {"convolution"}, + {"fourier"}, + {"fouier_table"}, + {"fft"}, #if HAVE_FFTW -const char SignalFilter::FILTER_METHOD_FFTW_STR[] = "fftw"; -const char SignalFilter::FILTER_METHOD_RFFTW_STR[] = "rfftw"; + {"fftw"}, + {"rfftw"}, #endif +}; -const char SignalFilter::FILTER_METHOD_CONVOLUTION_TITLE_STR[] = "Convolution"; -const char SignalFilter::FILTER_METHOD_FOURIER_TITLE_STR[] = "Direct Fourier"; -const char SignalFilter::FILTER_METHOD_FOURIER_TABLE_TITLE_STR[] = "Fourier Trig Table"; -const char SignalFilter::FILTER_METHOD_FFT_TITLE_STR[] = "FFT"; +const char* SignalFilter::s_aszFilterMethodTitle[] = { + {"Convolution"}, + {"Direct Fourier"}, + {"Fouier Trigometric Table Lookout"}, + {"FFT"}, #if HAVE_FFTW -const char SignalFilter::FILTER_METHOD_FFTW_TITLESTR[] = "FFTW"; -const char SignalFilter::FILTER_METHOD_RFFTW_TITLE_STR[] = "Real FFTW"; + {"FFTW"}, + {"Real/Half-Complex FFTW"}, #endif +}; -// Domains -const char SignalFilter::DOMAIN_FREQUENCY_STR[] = "frequency"; -const char SignalFilter::DOMAIN_SPATIAL_STR[] = "spatial"; +const int SignalFilter::s_iFilterMethodCount = sizeof(s_aszFilterMethodName) / sizeof(const char*); -const char SignalFilter::DOMAIN_FREQUENCY_TITLE_STR[] = "Frequency"; -const char SignalFilter::DOMAIN_SPATIAL_TITLE_STR[] = "Spatial"; + +const int SignalFilter::DOMAIN_INVALID = -1; +const int SignalFilter::DOMAIN_FREQUENCY = 0; +const int SignalFilter::DOMAIN_SPATIAL = 1; + +const char* SignalFilter::s_aszDomainName[] = { + {"frequency"}, + {"spatial"}, +}; + +const char* SignalFilter::s_aszDomainTitle[] = { + {"Frequency"}, + {"Spatial"}, +}; + +const int SignalFilter::s_iDomainCount = sizeof(s_aszDomainName) / sizeof(const char*); /* NAME @@ -123,7 +164,7 @@ SignalFilter::SignalFilter (const char* filterName, const char* filterMethodName init (m_idFilter, m_idFilterMethod, bw, signalIncrement, nSignalPoints, param, m_idDomain, zeropad, preinterpolationFactor); } -SignalFilter::SignalFilter (const FilterID filterID, const FilterMethodID filterMethodID, double bw, double signalIncrement, int nSignalPoints, double param, const DomainID domainID, int zeropad = 0, int preinterpolationFactor = 1) +SignalFilter::SignalFilter (const int filterID, const int filterMethodID, double bw, double signalIncrement, int nSignalPoints, double param, const int domainID, int zeropad = 0, int preinterpolationFactor = 1) { init (filterID, filterMethodID, bw, signalIncrement, nSignalPoints, param, domainID, zeropad, preinterpolationFactor); } @@ -154,7 +195,7 @@ SignalFilter::SignalFilter (const char* filterName, const char* domainName, doub } void -SignalFilter::init (const FilterID filterID, const FilterMethodID filterMethodID, double bw, double signalIncrement, int nSignalPoints, double filterParam, const DomainID domainID, int zeropad, int preinterpolationFactor) +SignalFilter::init (const int filterID, const int filterMethodID, double bw, double signalIncrement, int nSignalPoints, double filterParam, const int domainID, int zeropad, int preinterpolationFactor) { m_bw = bw; m_idFilter = filterID; @@ -316,136 +357,114 @@ SignalFilter::~SignalFilter (void) } -const SignalFilter::FilterID +int SignalFilter::convertFilterNameToID (const char *filterName) { - FilterID filterID = FILTER_INVALID; - - if (strcasecmp (filterName, FILTER_BANDLIMIT_STR) == 0) - filterID = FILTER_BANDLIMIT; - else if (strcasecmp (filterName, FILTER_HAMMING_STR) == 0) - filterID = FILTER_G_HAMMING; - else if (strcasecmp (filterName, FILTER_SINC_STR) == 0) - filterID = FILTER_SINC; - else if (strcasecmp (filterName, FILTER_COS_STR) == 0) - filterID = FILTER_COSINE; - else if (strcasecmp (filterName, FILTER_TRIANGLE_STR) == 0) - filterID = FILTER_TRIANGLE; - else if (strcasecmp (filterName, FILTER_ABS_BANDLIMIT_STR) == 0) - filterID = FILTER_ABS_BANDLIMIT; - else if (strcasecmp (filterName, FILTER_ABS_HAMMING_STR) == 0) - filterID = FILTER_ABS_G_HAMMING; - else if (strcasecmp (filterName, FILTER_ABS_SINC_STR) == 0) - filterID = FILTER_ABS_SINC; - else if (strcasecmp (filterName, FILTER_ABS_COS_STR) == 0) - filterID = FILTER_ABS_COSINE; - else if (strcasecmp (filterName, FILTER_SHEPP_STR) == 0) - filterID = FILTER_SHEPP; + int filterID = FILTER_INVALID; + + for (int i = 0; i < s_iFilterCount; i++) + if (strcasecmp (filterName, s_aszFilterName[i]) == 0) { + filterID = i; + break; + } return (filterID); } const char * -SignalFilter::convertFilterIDToName (const FilterID filterID) +SignalFilter::convertFilterIDToName (const int filterID) { - const char *name = ""; - - if (filterID == FILTER_SHEPP) - name = FILTER_SHEPP_STR; - else if (filterID == FILTER_ABS_COSINE) - name = FILTER_ABS_COS_STR; - else if (filterID == FILTER_ABS_SINC) - name = FILTER_ABS_SINC_STR; - else if (filterID == FILTER_ABS_G_HAMMING) - name = FILTER_ABS_HAMMING_STR; - else if (filterID == FILTER_ABS_BANDLIMIT) - name = FILTER_ABS_BANDLIMIT_STR; - else if (filterID == FILTER_COSINE) - name = FILTER_COS_STR; - else if (filterID == FILTER_SINC) - name = FILTER_SINC_STR; - else if (filterID == FILTER_G_HAMMING) - name = FILTER_HAMMING_STR; - else if (filterID == FILTER_BANDLIMIT) - name = FILTER_BANDLIMIT_STR; - else if (filterID == FILTER_TRIANGLE) - name = FILTER_TRIANGLE_STR; - + static const char *name = ""; + + if (filterID >= 0 && filterID < s_iFilterCount) + return (s_aszFilterName [filterID]); + return (name); } + +const char * +SignalFilter::convertFilterIDToTitle (const int filterID) +{ + static const char *title = ""; + + if (filterID >= 0 && filterID < s_iFilterCount) + return (s_aszFilterTitle [filterID]); + + return (title); +} -const SignalFilter::FilterMethodID +int SignalFilter::convertFilterMethodNameToID (const char* const filterMethodName) { - FilterMethodID fmID = FILTER_METHOD_INVALID; - - if (strcasecmp (filterMethodName, FILTER_METHOD_CONVOLUTION_STR) == 0) - fmID = FILTER_METHOD_CONVOLUTION; - else if (strcasecmp (filterMethodName, FILTER_METHOD_FOURIER_STR) == 0) - fmID = FILTER_METHOD_FOURIER; - else if (strcasecmp (filterMethodName, FILTER_METHOD_FOURIER_TABLE_STR) == 0) - fmID = FILTER_METHOD_FOURIER_TABLE; - else if (strcasecmp (filterMethodName, FILTER_METHOD_FFT_STR) == 0) - fmID = FILTER_METHOD_FFT; -#if HAVE_FFTW - else if (strcasecmp (filterMethodName, FILTER_METHOD_FFTW_STR) == 0) - fmID = FILTER_METHOD_FFTW; - else if (strcasecmp (filterMethodName, FILTER_METHOD_RFFTW_STR) == 0) - fmID = FILTER_METHOD_RFFTW; -#endif + int fmID = FILTER_METHOD_INVALID; + + for (int i = 0; i < s_iFilterMethodCount; i++) + if (strcasecmp (filterMethodName, s_aszFilterMethodName[i]) == 0) { + fmID = i; + break; + } return (fmID); } const char * -SignalFilter::convertFilterMethodIDToName (const FilterMethodID fmID) +SignalFilter::convertFilterMethodIDToName (const int fmID) { - const char *name = ""; - - if (fmID == FILTER_METHOD_CONVOLUTION) - return (FILTER_METHOD_CONVOLUTION_STR); - else if (fmID == FILTER_METHOD_FOURIER) - return (FILTER_METHOD_FOURIER_STR); - else if (fmID == FILTER_METHOD_FOURIER_TABLE) - return (FILTER_METHOD_FOURIER_TABLE_STR); - else if (fmID == FILTER_METHOD_FFT) - return (FILTER_METHOD_FFT_STR); -#if HAVE_FFTW - else if (fmID == FILTER_METHOD_FFTW) - return (FILTER_METHOD_FFTW_STR); - else if (fmID == FILTER_METHOD_RFFTW) - return (FILTER_METHOD_RFFTW_STR); -#endif + static const char *name = ""; + + if (fmID >= 0 && fmID < s_iFilterMethodCount) + return (s_aszFilterName [fmID]); return (name); } -const SignalFilter::DomainID +const char * +SignalFilter::convertFilterMethodIDToTitle (const int fmID) +{ + static const char *title = ""; + + if (fmID >= 0 && fmID < s_iFilterMethodCount) + return (s_aszFilterTitle [fmID]); + + return (title); +} + +int SignalFilter::convertDomainNameToID (const char* const domainName) { - DomainID dID = DOMAIN_INVALID; + int dID = DOMAIN_INVALID; - if (strcasecmp (domainName, DOMAIN_SPATIAL_STR) == 0) - dID = DOMAIN_SPATIAL; - else if (strcasecmp (domainName, DOMAIN_FREQUENCY_STR) == 0) - dID = DOMAIN_FREQUENCY; + for (int i = 0; i < s_iDomainCount; i++) + if (strcasecmp (domainName, s_aszDomainName[i]) == 0) { + dID = i; + break; + } return (dID); } const char * -SignalFilter::convertDomainIDToName (const DomainID domain) +SignalFilter::convertDomainIDToName (const int domainID) { - const char *name = ""; + static const char *name = ""; - if (domain == DOMAIN_SPATIAL) - return (DOMAIN_SPATIAL_STR); - else if (domain == DOMAIN_FREQUENCY) - return (DOMAIN_FREQUENCY_STR); + if (domainID >= 0 && domainID < s_iDomainCount) + return (s_aszDomainName [domainID]); return (name); } +const char * +SignalFilter::convertDomainIDToTitle (const int domainID) +{ + static const char *title = ""; + + if (domainID >= 0 && domainID < s_iDomainCount) + return (s_aszDomainTitle [domainID]); + + return (title); +} + void SignalFilter::filterSignal (const float input[], double output[]) const { @@ -530,7 +549,7 @@ SignalFilter::response (double x) double -SignalFilter::spatialResponse (FilterID filterID, double bw, double x, double param) +SignalFilter::spatialResponse (int filterID, double bw, double x, double param) { if (haveAnalyticSpatial(filterID)) return spatialResponseAnalytic (filterID, bw, x, param); @@ -560,7 +579,7 @@ SignalFilter::spatialResponseCalc (double x, double param) const } double -SignalFilter::spatialResponseCalc (FilterID filterID, double bw, double x, double param, int n) +SignalFilter::spatialResponseCalc (int filterID, double bw, double x, double param, int n) { double zmin, zmax; @@ -604,7 +623,7 @@ SignalFilter::frequencyResponse (double u, double param) const double -SignalFilter::frequencyResponse (FilterID filterID, double bw, double u, double param) +SignalFilter::frequencyResponse (int filterID, double bw, double u, double param) { double q; double au = fabs (u); @@ -689,7 +708,7 @@ SignalFilter::spatialResponseAnalytic (double x, double param) const } const bool -SignalFilter::haveAnalyticSpatial (FilterID filterID) +SignalFilter::haveAnalyticSpatial (int filterID) { bool haveAnalytic = false; @@ -713,7 +732,7 @@ SignalFilter::haveAnalyticSpatial (FilterID filterID) } double -SignalFilter::spatialResponseAnalytic (FilterID filterID, double bw, double x, double param) +SignalFilter::spatialResponseAnalytic (int filterID, double bw, double x, double param) { double q, temp; double u = TWOPI * x; diff --git a/libctsim/phantom.cpp b/libctsim/phantom.cpp index 8d4ea38..2063683 100644 --- a/libctsim/phantom.cpp +++ b/libctsim/phantom.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: phantom.cpp,v 1.9 2000/07/20 11:17:31 kevin Exp $ +** $Id: phantom.cpp,v 1.10 2000/07/22 15:45:33 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 @@ -28,25 +28,39 @@ #include "ct.h" -const char Phantom::PHM_HERMAN_STR[]= "herman"; -const char Phantom::PHM_BHERMAN_STR[]= "bherman"; -const char Phantom::PHM_ROWLAND_STR[]= "rowland"; -const char Phantom::PHM_BROWLAND_STR[]= "browland"; -const char Phantom::PHM_UNITPULSE_STR[]= "unitpulse"; +const int Phantom::PHM_INVALID = -1; +const int Phantom::PHM_HERMAN = 0; +const int Phantom::PHM_BHERMAN = 1; +const int Phantom::PHM_ROWLAND = 2; +const int Phantom::PHM_BROWLAND = 3; +const int Phantom::PHM_UNITPULSE = 4; -const char Phantom::PHM_HERMAN_TITLE_STR[]= "Herman Head"; -const char Phantom::PHM_BHERMAN_TITLE_STR[]= "Herman Head Bordered"; -const char Phantom::PHM_ROWLAND_TITLE_STR[]= "Rowland Head"; -const char Phantom::PHM_BROWLAND_TITLE_STR[]= "Rowland Head Bordered"; -const char Phantom::PHM_UNITPULSE_TITLE_STR[]= "Unit Pulse"; +const char* Phantom::s_aszPhantomName[] = +{ + {"herman"}, + {"bherman"}, + {"rowland"}, + {"browland"}, + {"unitpulse"}, +}; + +const char* Phantom::s_aszPhantomTitle[] = +{ + {"Herman Head"}, + {"Herman Head Bordered"}, + {"Rowland Head"}, + {"Rowland Head Bordered"}, + {"Unit Pulse"}, +}; +const int Phantom::s_iPhantomCount = sizeof(s_aszPhantomName) / sizeof(const char*); // CLASS IDENTIFICATION -// Phanton +// Phantom // -Phantom::Phantom (void) +Phantom::Phantom () { init (); } @@ -59,7 +73,7 @@ Phantom::Phantom (const char* const phmName) } void -Phantom::init (void) +Phantom::init () { m_nPElem = 0; m_xmin = 1E30; @@ -72,7 +86,7 @@ Phantom::init (void) m_id = PHM_INVALID; } -Phantom::~Phantom (void) +Phantom::~Phantom () { for (PElemIterator i = m_listPElem.begin(); i != m_listPElem.end(); i++) { delete *i; @@ -81,39 +95,37 @@ Phantom::~Phantom (void) const char* -Phantom::convertPhantomIDToName (const PhantomID phmID) +Phantom::convertPhantomIDToName (int phmID) { - const char *name = ""; + static const char *name = ""; - if (phmID == PHM_HERMAN) - name = PHM_HERMAN_STR; - else if (phmID == PHM_BHERMAN) - name = PHM_BHERMAN_STR; - else if (phmID == PHM_ROWLAND) - name = PHM_ROWLAND_STR; - else if (phmID == PHM_BROWLAND) - name = PHM_BROWLAND_STR; - else if (phmID == PHM_UNITPULSE) - name = PHM_UNITPULSE_STR; + if (phmID >= 0 && phmID < s_iPhantomCount) + return (s_aszPhantomName[phmID]); return (name); } + +const char* +Phantom::convertPhantomIDToTitle (int phmID) +{ + static const char *title = ""; + + if (phmID >= 0 && phmID < s_iPhantomCount) + return (s_aszPhantomName[phmID]); + + return (title); +} -Phantom::PhantomID +int Phantom::convertNameToPhantomID (const char* const phmName) { - PhantomID id = PHM_INVALID; + int id = PHM_INVALID; - if (strcasecmp (phmName, PHM_HERMAN_STR) == 0) - id = PHM_HERMAN; - else if (strcasecmp (phmName, PHM_BHERMAN_STR) == 0) - id = PHM_BHERMAN; - else if (strcasecmp (phmName, PHM_ROWLAND_STR) == 0) - id = PHM_ROWLAND; - else if (strcasecmp (phmName, PHM_BROWLAND_STR) == 0) - id = PHM_BROWLAND; - else if (strcasecmp (phmName, PHM_UNITPULSE_STR) == 0) - id = PHM_UNITPULSE; + for (int i = 0; i < s_iPhantomCount; i++) + if (strcasecmp (phmName, s_aszPhantomName[i]) == 0) { + id = i; + break; + } return (id); } @@ -122,7 +134,7 @@ Phantom::convertNameToPhantomID (const char* const phmName) bool Phantom::createFromPhantom (const char* const phmName) { - PhantomID phmid = convertNameToPhantomID (phmName); + int phmid = convertNameToPhantomID (phmName); if (phmid == PHM_INVALID) { m_fail = true; m_failMessage = "Invalid phantom name "; @@ -136,7 +148,7 @@ Phantom::createFromPhantom (const char* const phmName) } bool -Phantom::createFromPhantom (const PhantomID phmid) +Phantom::createFromPhantom (const int phmid) { switch (phmid) { @@ -262,7 +274,7 @@ Phantom::addPElem (const char *type, const double cx, const double cy, const dou */ void -Phantom::print (void) const +Phantom::print () const { printf("PRINTING Phantom\n\n"); printf("number of pelems in Phantom = %d\n", m_nPElem); @@ -292,7 +304,7 @@ Phantom::print (void) const #ifdef HAVE_SGP void -Phantom::show (void) const +Phantom::show () const { double wsize = m_xmax - m_xmin; double xmin = m_xmin; @@ -330,7 +342,7 @@ Phantom::show (void) const #ifdef HAVE_SGP void -Phantom::draw (void) const +Phantom::draw () const { for (PElemIterator i = m_listPElem.begin(); i != m_listPElem.end(); i++) sgp2_polyline_abs ((*i)->xOutline(), (*i)->yOutline(), (*i)->nOutlinePoints()); @@ -348,7 +360,7 @@ Phantom::draw (void) const */ void -Phantom::addStdRowland (void) +Phantom::addStdRowland () { addPElem ("ellipse", 0.0000, 0.0000, 0.6900, 0.9200, 0.0, 1.00); addPElem ("ellipse", 0.0000, -0.0184, 0.6624, 0.8740, 0.0, -0.98); @@ -364,7 +376,7 @@ Phantom::addStdRowland (void) } void -Phantom::addStdRowlandBordered (void) +Phantom::addStdRowlandBordered () { addStdRowland (); addPElem ("ellipse", 0.000, 0.0000, 0.7500, 1.000, 0.0, 0.00); @@ -379,7 +391,7 @@ Phantom::addStdRowlandBordered (void) */ void -Phantom::addStdHerman (void) +Phantom::addStdHerman () { addPElem ("ellipse", 0.000, 1.50, 0.375, 0.3000, 90.00, -0.003); addPElem ("ellipse", 0.675, -0.75, 0.225, 0.1500, 140.00, 0.010); @@ -399,7 +411,7 @@ Phantom::addStdHerman (void) } void -Phantom::addStdHermanBordered (void) +Phantom::addStdHermanBordered () { addStdHerman(); addPElem ("ellipse", 0.000, 0.000, 8.650, 8.650, 0.00, 0.000); @@ -529,7 +541,7 @@ PhantomElement::PhantomElement (const char *type, const double cx, const double } -PhantomElement::~PhantomElement (void) +PhantomElement::~PhantomElement () { delete m_xOutline; delete m_yOutline; @@ -557,7 +569,7 @@ PhantomElement::convertNameToType (const char* const typeName) } void -PhantomElement::makeTransformMatrices (void) +PhantomElement::makeTransformMatrices () { GRFMTX_2D temp; @@ -597,7 +609,7 @@ PhantomElement::makeTransformMatrices (void) */ void -PhantomElement::makeVectorOutline (void) +PhantomElement::makeVectorOutline () { double radius, theta, start, stop; double xfact, yfact; diff --git a/libctsim/scanner.cpp b/libctsim/scanner.cpp index 4f46d05..ae665f2 100644 --- a/libctsim/scanner.cpp +++ b/libctsim/scanner.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: scanner.cpp,v 1.4 2000/07/20 11:17:31 kevin Exp $ +** $Id: scanner.cpp,v 1.5 2000/07/22 15:45:33 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 @@ -27,13 +27,28 @@ #include "ct.h" -const char Scanner::GEOMETRY_PARALLEL_STR[] = "parallel"; -const char Scanner::GEOMETRY_EQUILINEAR_STR[] = "equilinear"; -const char Scanner::GEOMETRY_EQUIANGULAR_STR[] = "equiangular"; -const char Scanner::GEOMETRY_PARALLEL_TITLE_STR[] = "Parallel"; -const char Scanner::GEOMETRY_EQUILINEAR_TITLE_STR[] = "Equilinear"; -const char Scanner::GEOMETRY_EQUIANGULAR_TITLE_STR[] = "Equiangular"; +const int Scanner::GEOMETRY_INVALID = -1; +const int Scanner::GEOMETRY_PARALLEL = 0; +const int Scanner::GEOMETRY_EQUILINEAR = 1; +const int Scanner::GEOMETRY_EQUIANGULAR = 2; + +const char* Scanner::s_aszGeometryName[] = +{ + {"parallel"}, + {"equilinear"}, + {"equiangular"}, +}; + +const char* Scanner::s_aszGeometryTitle[] = +{ + {"Parallel"}, + {"Equilinear"}, + {"Equiangular"}, +}; + +const int Scanner::s_iGeometryCount = sizeof(s_aszGeometryName) / sizeof(const char*); + // NAME // DetectorArray Construct a DetectorArray @@ -116,22 +131,42 @@ Scanner::~Scanner (void) } -Scanner::GeometryID -Scanner::convertGeometryNameToID (const char* const geometryName) +const char* +Scanner::convertGeometryIDToName (const int geomID) +{ + const char *name = ""; + + if (geomID >= 0 && geomID < s_iGeometryCount) + return (s_aszGeometryName[geomID]); + + return (name); +} + +const char* +Scanner::convertGeometryIDToTitle (const int geomID) { - GeometryID geometryID = GEOMETRY_INVALID; + const char *title = ""; - if (strcasecmp (geometryName, GEOMETRY_PARALLEL_STR) == 0) - geometryID = GEOMETRY_PARALLEL; - else if (strcasecmp (geometryName, GEOMETRY_EQUILINEAR_STR) == 0) - geometryID = GEOMETRY_EQUILINEAR; - else if (strcasecmp (geometryName, GEOMETRY_EQUIANGULAR_STR) == 0) - geometryID = GEOMETRY_EQUIANGULAR; + if (geomID >= 0 && geomID < s_iGeometryCount) + return (s_aszGeometryName[geomID]); - return (geometryID); + return (title); } + +int +Scanner::convertGeometryNameToID (const char* const geomName) +{ + int id = GEOMETRY_INVALID; + for (int i = 0; i < s_iGeometryCount; i++) + if (strcasecmp (geomName, s_aszGeometryName[i]) == 0) { + id = i; + break; + } + return (id); +} + /* NAME * raysum_collect Calculate ray sums for a Phantom diff --git a/src/ctsim.cpp b/src/ctsim.cpp index 71b0539..533f324 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.7 2000/07/20 11:17:31 kevin Exp $ +** $Id: ctsim.cpp,v 1.8 2000/07/22 15:45:33 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 @@ -196,10 +196,10 @@ MainFrame::OnAbout(wxCommandEvent& WXUNUSED(event) ) void MainFrame::OnCreatePhantom(wxCommandEvent& WXUNUSED(event)) { - DialogGetPhantom dialogPhantom (this, Phantom::PHM_HERMAN_STR); + DialogGetPhantom dialogPhantom (this, Phantom::PHM_HERMAN); int dialogReturn = dialogPhantom.ShowModal(); if (dialogReturn == wxID_OK) { - wxString selection = dialogPhantom.getPhantom(); + wxString selection (dialogPhantom.getPhantom()); *theApp->getLog() << "Selected phantom " << selection.c_str() << "\n"; wxString filename = selection + ".phm"; theApp->getDocManager()->CreateDocument(filename, wxDOC_SILENT); diff --git a/src/dialogs.cpp b/src/dialogs.cpp index 27b454f..e608fd1 100644 --- a/src/dialogs.cpp +++ b/src/dialogs.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: dialogs.cpp,v 1.4 2000/07/20 11:17:31 kevin Exp $ +** $Id: dialogs.cpp,v 1.5 2000/07/22 15:45:33 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 @@ -55,38 +55,36 @@ #include "backprojectors.h" +StringValueAndTitleListBox::StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* aszTitle[], const char* aszValue[]) + : wxListBox () +{ + wxString asTitle[nChoices]; + for (int i = 0; i < nChoices; i++) + asTitle[i] = aszTitle[i]; -const wxString DialogGetPhantom::s_asPhantom[] = -{ - wxString(Phantom::PHM_HERMAN_STR), - wxString(Phantom::PHM_BHERMAN_STR), - wxString(Phantom::PHM_ROWLAND_STR), - wxString(Phantom::PHM_BROWLAND_STR), - wxString(Phantom::PHM_UNITPULSE_STR), -}; -const wxString DialogGetPhantom::s_asPhantomTitle[] = -{ - wxString(Phantom::PHM_HERMAN_TITLE_STR), - wxString(Phantom::PHM_BHERMAN_TITLE_STR), - wxString(Phantom::PHM_ROWLAND_TITLE_STR), - wxString(Phantom::PHM_BROWLAND_TITLE_STR), - wxString(Phantom::PHM_UNITPULSE_TITLE_STR), + Create (pParent, -1, wxDefaultPosition, wxDefaultSize, nChoices, asTitle, wxLB_SINGLE | wxLB_NEEDED_SB); + + m_ppszValues = aszValue; }; -const unsigned int DialogGetPhantom::s_iNumPhantom = sizeof(s_asPhantom) / sizeof(wxString); + +const char* +StringValueAndTitleListBox::getSelectionStringValue (void) const +{ + return m_ppszValues[GetSelection()]; +} -DialogGetPhantom::DialogGetPhantom (wxFrame* pParent, const char* szDefaultPhantom = NULL) + +DialogGetPhantom::DialogGetPhantom (wxFrame* pParent, int iDefaultPhantom = Phantom::PHM_HERMAN) : wxDialog (pParent, -1, "Select Phantom", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) { - m_sDefaultPhantom = szDefaultPhantom; - wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL); pTopSizer->Add (new wxStaticText (this, -1, "Select Phantom"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5); pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5); - m_pListBoxPhantom = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, s_iNumPhantom, s_asPhantomTitle, wxLB_SINGLE | wxLB_NEEDED_SB); + m_pListBoxPhantom = new StringValueAndTitleListBox (this, Phantom::getPhantomCount(), Phantom::getPhantomTitleArray(), Phantom::getPhantomNameArray()); pTopSizer->Add (m_pListBoxPhantom, 0, wxALL | wxALIGN_CENTER | wxEXPAND); pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5); @@ -105,14 +103,10 @@ DialogGetPhantom::DialogGetPhantom (wxFrame* pParent, const char* szDefaultPhant pTopSizer->SetSizeHints (this); } -const wxString& +const char* DialogGetPhantom::getPhantom(void) { - int selection = m_pListBoxPhantom->GetSelection(); - if (selection >= 0) - return (s_asPhantom[selection]); - - return (m_sDefaultPhantom); + return m_pListBoxPhantom->getSelectionStringValue(); } @@ -283,22 +277,8 @@ DialogGetRasterParameters::getNSamples (void) // DialogGetProjectionParameters ///////////////////////////////////////////////////////////////////// -const wxString DialogGetProjectionParameters::s_asGeometry[] = -{ - wxString(Scanner::GEOMETRY_PARALLEL_STR), - wxString(Scanner::GEOMETRY_EQUILINEAR_STR), - wxString(Scanner::GEOMETRY_EQUIANGULAR_STR), -}; -const wxString DialogGetProjectionParameters::s_asGeometryTitle[] = -{ - wxString(Scanner::GEOMETRY_PARALLEL_TITLE_STR), - wxString(Scanner::GEOMETRY_EQUILINEAR_TITLE_STR), - wxString(Scanner::GEOMETRY_EQUIANGULAR_TITLE_STR), -}; -const unsigned int DialogGetProjectionParameters::s_iNumGeometry = sizeof(s_asGeometry) / sizeof(wxString); - -DialogGetProjectionParameters::DialogGetProjectionParameters (wxFrame* pParent, int iDefaultNDet = 0, int iDefaultNView = 0, int iDefaultNSamples = 1, double dDefaultRotAngle = 1., const char* szDefaultGeometry = NULL) +DialogGetProjectionParameters::DialogGetProjectionParameters (wxFrame* pParent, int iDefaultNDet = 0, int iDefaultNView = 0, int iDefaultNSamples = 1, double dDefaultRotAngle = 1., int iDefaultGeometry = Scanner::GEOMETRY_PARALLEL) : wxDialog (pParent, -1, "Set Projection Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) { wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL); @@ -307,7 +287,7 @@ DialogGetProjectionParameters::DialogGetProjectionParameters (wxFrame* pParent, pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5); - m_pListBoxGeometry = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, s_iNumGeometry, s_asGeometryTitle, wxLB_SINGLE | wxLB_NEEDED_SB); + m_pListBoxGeometry = new StringValueAndTitleListBox (this, Scanner::getGeometryCount(), Scanner::getGeometryTitleArray(), Scanner::getGeometryNameArray()); pTopSizer->Add (m_pListBoxGeometry, 0, wxALL | wxALIGN_CENTER | wxEXPAND); ostringstream os; @@ -333,7 +313,6 @@ DialogGetProjectionParameters::DialogGetProjectionParameters (wxFrame* pParent, pGridSizer->Add (new wxStaticText (this, -1, "Rotation Angle (PI units)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); pGridSizer->Add (m_pTextCtrlRotAngle, 0, wxALIGN_CENTER_VERTICAL); pTopSizer->Add (pGridSizer, 1, wxALL, 10); - m_sDefaultGeometry = szDefaultGeometry; pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5); @@ -401,14 +380,10 @@ DialogGetProjectionParameters::getRotAngle (void) return (m_dDefaultRotAngle); } -const wxString& +const char* DialogGetProjectionParameters::getGeometry (void) { - int selection = m_pListBoxGeometry->GetSelection(); - if (selection >= 0) - return (s_asGeometry[selection]); - - return m_sDefaultGeometry; + return m_pListBoxGeometry->getSelectionStringValue(); } @@ -419,33 +394,8 @@ DialogGetProjectionParameters::getGeometry (void) // DialogGetReconstructionParameters ///////////////////////////////////////////////////////////////////// -const wxString DialogGetReconstructionParameters::s_asFilter[] = -{ - wxString(SignalFilter::FILTER_ABS_BANDLIMIT_STR), - wxString(SignalFilter::FILTER_SHEPP_STR), -}; -const wxString DialogGetReconstructionParameters::s_asFilterTitle[] = -{ - wxString(SignalFilter::FILTER_ABS_BANDLIMIT_TITLE_STR), - wxString(SignalFilter::FILTER_SHEPP_TITLE_STR), -}; -const unsigned int DialogGetReconstructionParameters::s_iNumFilter = sizeof(s_asFilter) / sizeof(wxString); - - -const wxString DialogGetReconstructionParameters::s_asInterp[] = -{ - wxString(Backprojector::INTERP_NEAREST_STR), - wxString(Backprojector::INTERP_LINEAR_STR), -}; -const wxString DialogGetReconstructionParameters::s_asInterpTitle[] = -{ - wxString(Backprojector::INTERP_NEAREST_TITLE_STR), - wxString(Backprojector::INTERP_LINEAR_TITLE_STR), - }; -const unsigned int DialogGetReconstructionParameters::s_iNumInterp = sizeof(s_asInterp) / sizeof(wxString); - -DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxFrame* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, const char* szDefaultFilterName = NULL, double dDefaultFilterParam = 1., const char* szDefaultFilterMethodName = NULL, int iDefaultZeropad = 3, const char* szDefaultInterpName = NULL, int iDefaultInterpParam = 1, const char* szDefaultBackprojName = NULL) +DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxFrame* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, int iDefaultFilterID = SignalFilter::FILTER_ABS_BANDLIMIT, double dDefaultFilterParam = 1., int iDefaultFilterMethodID = SignalFilter::FILTER_METHOD_CONVOLUTION, int iDefaultZeropad = 3, int iDefaultInterpID = Backprojector::INTERP_LINEAR, int iDefaultInterpParam = 1, int iDefaultBackprojID = Backprojector::BPROJ_IDIFF3) : wxDialog (pParent, -1, "Set Reconstruction Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION) { wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL); @@ -454,10 +404,16 @@ DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxFrame* p pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5); - m_pListBoxFilter = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, s_iNumFilter, s_asFilterTitle, wxLB_SINGLE | wxLB_NEEDED_SB); + m_pListBoxFilter = new StringValueAndTitleListBox (this, SignalFilter::getFilterCount(), SignalFilter::getFilterTitleArray(), SignalFilter::getFilterNameArray()); pTopSizer->Add (m_pListBoxFilter, 0, wxALL | wxALIGN_CENTER | wxEXPAND); - m_pListBoxInterp = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, s_iNumInterp, s_asInterpTitle, wxLB_SINGLE | wxLB_NEEDED_SB); + m_pListBoxFilterMethod = new StringValueAndTitleListBox (this, SignalFilter::getFilterMethodCount(), SignalFilter::getFilterMethodTitleArray(), SignalFilter::getFilterMethodNameArray()); + pTopSizer->Add (m_pListBoxFilterMethod, 0, wxALL | wxALIGN_CENTER | wxEXPAND); + + m_pListBoxBackproject = new StringValueAndTitleListBox (this, Backprojector::getBackprojectCount(), Backprojector::getBackprojectTitleArray(), Backprojector::getBackprojectNameArray()); + pTopSizer->Add (m_pListBoxBackproject, 0, wxALL | wxALIGN_CENTER | wxEXPAND); + + m_pListBoxInterp = new StringValueAndTitleListBox (this, Backprojector::getInterpCount(), Backprojector::getInterpTitleArray(), Backprojector::getInterpNameArray()); pTopSizer->Add (m_pListBoxInterp, 0, wxALL | wxALIGN_CENTER | wxEXPAND); ostringstream os; @@ -489,11 +445,6 @@ DialogGetReconstructionParameters::DialogGetReconstructionParameters (wxFrame* p pGridSizer->Add (m_pTextCtrlInterpParam, 0, wxALIGN_CENTER_VERTICAL); pTopSizer->Add (pGridSizer, 1, wxALL, 10); - m_sDefaultFilterName = szDefaultFilterName; - m_sDefaultFilterMethodName = szDefaultFilterMethodName; - m_sDefaultInterpName = szDefaultInterpName; - m_sDefaultBackprojName = szDefaultBackprojName; - pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5); wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL); @@ -571,34 +522,26 @@ DialogGetReconstructionParameters::getFilterParam (void) return (m_dDefaultFilterParam); } -const wxString& +const char* DialogGetReconstructionParameters::getFilterName (void) { - int selection = m_pListBoxFilter->GetSelection(); - if (selection >= 0) - return (s_asFilter[selection]); - - return m_sDefaultFilterName; + return m_pListBoxFilter->getSelectionStringValue(); } -const wxString& +const char* DialogGetReconstructionParameters::getFilterMethodName (void) { - return m_sDefaultFilterMethodName; + return m_pListBoxFilterMethod->getSelectionStringValue(); } -const wxString& +const char* DialogGetReconstructionParameters::getInterpName (void) { - int selection = m_pListBoxInterp->GetSelection(); - if (selection >= 0) - return (s_asInterp[selection]); - - return m_sDefaultInterpName; + return m_pListBoxInterp->getSelectionStringValue(); } -const wxString& -DialogGetReconstructionParameters::getBackprojName (void) +const char* +DialogGetReconstructionParameters::getBackprojectName (void) { - return m_sDefaultBackprojName; + return m_pListBoxBackproject->getSelectionStringValue(); } diff --git a/src/dialogs.h b/src/dialogs.h index 1592947..cb81417 100644 --- a/src/dialogs.h +++ b/src/dialogs.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: dialogs.h,v 1.5 2000/07/20 11:17:31 kevin Exp $ +** $Id: dialogs.h,v 1.6 2000/07/22 15:45:33 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 @@ -31,23 +31,37 @@ #include "wx/wx.h" #include +#include "scanner.h" +#include "phantom.h" +#include "filter.h" + +// CLASS StringValueAndTitleListBox +// +// A superclass of wxListBox that can handle string values and titles +// and by displaying the title in the list box and returning the string value + +class StringValueAndTitleListBox : public wxListBox +{ + public: + StringValueAndTitleListBox (wxDialog* pParent, int nChoices, const char* aszTitle[], const char* aszValue[]); + + const char* getSelectionStringValue (void) const; + + private: + const char** m_ppszValues; +}; class DialogGetPhantom : public wxDialog { public: - DialogGetPhantom (wxFrame* pParent, const char* szDefaultPhantom); + DialogGetPhantom (wxFrame* pParent, int iDefaultPhantom = Phantom::PHM_HERMAN); virtual ~DialogGetPhantom (void) {} - const wxString& getPhantom (void); + const char* getPhantom (void); private: - wxListBox* m_pListBoxPhantom; - wxString m_sDefaultPhantom; - - static const wxString s_asPhantom[]; - static const wxString s_asPhantomTitle[]; - static const unsigned int s_iNumPhantom; + StringValueAndTitleListBox* m_pListBoxPhantom; }; @@ -94,49 +108,45 @@ class DialogGetRasterParameters : public wxDialog class DialogGetProjectionParameters : public wxDialog { public: - DialogGetProjectionParameters (wxFrame* pParent, int iDefaultNDet = 0, int iDefaultNView = 0, int iDefaultNSamples = 1, double dDefaultRotAngle = 1., const char* szDefaultGeometry = NULL); + DialogGetProjectionParameters (wxFrame* pParent, int iDefaultNDet = 0, int iDefaultNView = 0, int iDefaultNSamples = 1, double dDefaultRotAngle = 1., int iDefaultGeometry = Scanner::GEOMETRY_PARALLEL); ~DialogGetProjectionParameters (void); unsigned int getNDet (void); unsigned int getNView (void); unsigned int getNSamples (void); double getRotAngle (void); - const wxString& getGeometry(void); + const char* getGeometry(void); private: wxTextCtrl* m_pTextCtrlNDet; wxTextCtrl* m_pTextCtrlNView; wxTextCtrl* m_pTextCtrlNSamples; wxTextCtrl* m_pTextCtrlRotAngle; - wxListBox* m_pListBoxGeometry; + + StringValueAndTitleListBox* m_pListBoxGeometry; int m_iDefaultNDet; int m_iDefaultNView; int m_iDefaultNSamples; double m_dDefaultRotAngle; - wxString m_sDefaultGeometry; - - static const wxString s_asGeometry[]; - static const wxString s_asGeometryTitle[]; - static const unsigned int s_iNumGeometry; }; class DialogGetReconstructionParameters : public wxDialog { public: - DialogGetReconstructionParameters (wxFrame* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, const char* szDefaultFilterName = NULL, double dDefaultFilterParam = 1., const char* szDefaultFilterMethodName = NULL, int iDefaultZeropad = 3, const char* szDefaultInterpName = NULL, int iDefaultInterpParam = 1, const char* szDefaultBackprojName = NULL); + DialogGetReconstructionParameters (wxFrame* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, int iDefaultFilterID = SignalFilter::FILTER_ABS_BANDLIMIT, double dDefaultFilterParam = 1., int iDefaultFilterMethodID = SignalFilter::FILTER_METHOD_CONVOLUTION, int iDefaultZeropad = 3, int iDefaultInterpID = Backprojector::INTERP_LINEAR, int iDefaultInterpParam = 1, int iDefaultBackprojID = Backprojector::BPROJ_IDIFF3); virtual ~DialogGetReconstructionParameters (void); unsigned int getXSize(void); unsigned int getYSize(void); - const wxString& getFilterName(void); + const char* getFilterName(void); double getFilterParam(void); - const wxString& getFilterMethodName(void); + const char* getFilterMethodName(void); unsigned int getZeropad(void); - const wxString& getInterpName(void); + const char* getInterpName(void); unsigned int getInterpParam(void); - const wxString& getBackprojName(void); + const char* getBackprojectName(void); private: wxTextCtrl* m_pTextCtrlXSize; @@ -145,36 +155,16 @@ class DialogGetReconstructionParameters : public wxDialog wxTextCtrl* m_pTextCtrlFilterParam; wxTextCtrl* m_pTextCtrlInterpParam; - wxListBox* m_pListBoxFilter; - wxListBox* m_pListBoxFilterMethod; - wxListBox* m_pListBoxInterp; - wxListBox* m_pListBoxBackproj; + StringValueAndTitleListBox* m_pListBoxFilter; + StringValueAndTitleListBox* m_pListBoxFilterMethod; + StringValueAndTitleListBox* m_pListBoxInterp; + StringValueAndTitleListBox* m_pListBoxBackproject; int m_iDefaultXSize; int m_iDefaultYSize; double m_dDefaultFilterParam; int m_iDefaultZeropad; int m_iDefaultInterpParam; - wxString m_sDefaultFilterName; - wxString m_sDefaultFilterMethodName; - wxString m_sDefaultInterpName; - wxString m_sDefaultBackprojName; - - static const wxString s_asFilter[]; - static const wxString s_asFilterTitle[]; - static const unsigned int s_iNumFilter; - - static const wxString s_asFilterMethod[]; - static const wxString s_asFilterMethodTitle[]; - static const unsigned int s_iNumFilterMethod; - - static const wxString s_asInterp[]; - static const wxString s_asInterpTitle[]; - static const unsigned int s_iNumInterp; - - static const wxString s_asBackproj[]; - static const wxString s_asBackprojTitle[]; - static const unsigned int s_iNumBackproj; }; #endif diff --git a/src/docs.h b/src/docs.h index b56ebe5..d9997c8 100644 --- a/src/docs.h +++ b/src/docs.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: docs.h,v 1.3 2000/07/19 04:33:27 kevin Exp $ +** $Id: docs.h,v 1.4 2000/07/22 15:45:33 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 @@ -91,7 +91,7 @@ class PhantomDocument: public wxDocument private: Phantom m_phantom; - Phantom::PhantomID m_idPhantom; + int m_idPhantom; wxString m_namePhantom; public: @@ -102,7 +102,7 @@ public: ~PhantomDocument (void) {} - const Phantom::PhantomID getPhantomID (void) const + const int getPhantomID (void) const { return m_idPhantom; } const wxString& getPhantomName (void) const diff --git a/src/views.cpp b/src/views.cpp index affcb6f..536db90 100644 --- a/src/views.cpp +++ b/src/views.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: views.cpp,v 1.7 2000/07/20 11:17:31 kevin Exp $ +** $Id: views.cpp,v 1.8 2000/07/22 15:45:33 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 @@ -375,10 +375,10 @@ PhantomView::~PhantomView(void) void PhantomView::OnProperties (wxCommandEvent& event) { - const Phantom::PhantomID idPhantom = GetDocument()->getPhantomID(); + const int idPhantom = GetDocument()->getPhantomID(); const string& namePhantom = GetDocument()->getPhantomName(); ostringstream os; - os << "Phantom " << namePhantom << " (" << static_cast(idPhantom) << ")\n"; + os << "Phantom " << namePhantom << " (" << idPhantom << ")\n"; *theApp->getLog() << os.str().c_str(); #if DEBUG const Phantom& rPhantom = GetDocument()->getPhantom(); @@ -390,7 +390,7 @@ PhantomView::OnProperties (wxCommandEvent& event) void PhantomView::OnProjections (wxCommandEvent& event) { - DialogGetProjectionParameters dialogProjection (m_frame, 367, 320, 1, 1., Scanner::GEOMETRY_PARALLEL_STR); + DialogGetProjectionParameters dialogProjection (m_frame, 367, 320, 1, 1., Scanner::GEOMETRY_PARALLEL); int retVal = dialogProjection.ShowModal(); if (retVal == wxID_OK) { int nDet = dialogProjection.getNDet(); @@ -607,7 +607,7 @@ ProjectionFileView::OnProperties (wxCommandEvent& event) void ProjectionFileView::OnReconstruct (wxCommandEvent& event) { - DialogGetReconstructionParameters dialogReconstruction (m_frame, 256, 256, SignalFilter::FILTER_ABS_BANDLIMIT_STR, 1., SignalFilter::FILTER_METHOD_CONVOLUTION_STR, 3, Backprojector::INTERP_LINEAR_STR, 1, Backprojector::BPROJ_IDIFF3_STR); + DialogGetReconstructionParameters dialogReconstruction (m_frame, 256, 256, SignalFilter::FILTER_ABS_BANDLIMIT, 1., SignalFilter::FILTER_METHOD_CONVOLUTION, 3, Backprojector::INTERP_LINEAR, 1, Backprojector::BPROJ_IDIFF3); int retVal = dialogReconstruction.ShowModal(); if (retVal == wxID_OK) { int xSize = dialogReconstruction.getXSize(); @@ -618,7 +618,7 @@ ProjectionFileView::OnReconstruct (wxCommandEvent& event) int optZeropad = dialogReconstruction.getZeropad(); wxString optInterpName = dialogReconstruction.getInterpName(); int optInterpParam = dialogReconstruction.getInterpParam(); - wxString optBackprojectName = dialogReconstruction.getBackprojName(); + wxString optBackprojectName = dialogReconstruction.getBackprojectName(); if (xSize > 0 && ySize > 0) { ImageFileDocument* pReconDoc = dynamic_cast(theApp->getDocManager()->CreateDocument("untitled.if", wxDOC_SILENT)); ImageFile& imageFile = pReconDoc->getImageFile(); diff --git a/tools/phm2if.cpp b/tools/phm2if.cpp index ce522b9..1e6992e 100644 --- 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 ** -** $Id: phm2if.cpp,v 1.2 2000/07/20 11:17:31 kevin Exp $ +** $Id: phm2if.cpp,v 1.3 2000/07/22 15:45:33 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 @@ -108,9 +108,9 @@ phm2if_main (int argc, char* argv[]) 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 optDomainName = SignalFilter::DOMAIN_SPATIAL_STR; + string optDomainName (SignalFilter::convertDomainIDToName (SignalFilter::DOMAIN_SPATIAL)); char *opt_outfile = NULL; int opt_debug = 0; string opt_desc; diff --git a/tools/phm2pj.cpp b/tools/phm2pj.cpp index c465210..b494aa2 100644 --- a/tools/phm2pj.cpp +++ b/tools/phm2pj.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: phm2pj.cpp,v 1.2 2000/07/20 11:17:31 kevin Exp $ +** $Id: phm2pj.cpp,v 1.3 2000/07/22 15:45:33 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,7 +88,7 @@ int phm2pj_main (int argc, char* argv[]) { Phantom phm; - string optGeometryName = Scanner::GEOMETRY_PARALLEL_STR; + string optGeometryName = Scanner::convertGeometryIDToName(Scanner::GEOMETRY_PARALLEL); char *opt_outfile = NULL; string opt_desc; string optPhmFileName; @@ -96,7 +96,7 @@ phm2pj_main (int argc, char* argv[]) int opt_nview; int opt_nray = 1; int opt_trace = 0; - string optPhmName = Phantom::PHM_HERMAN_STR; + string optPhmName (Phantom::convertPhantomIDToName(Phantom::PHM_HERMAN)); int opt_verbose = 0; int opt_debug = 0; double opt_rotangle = 1; diff --git a/tools/pjrec.cpp b/tools/pjrec.cpp index 74d1a3e..03ee9e8 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.4 2000/07/20 11:38:00 kevin Exp $ +** $Id: pjrec.cpp,v 1.5 2000/07/22 15:45:33 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 @@ -131,10 +131,10 @@ pjrec_main (int argc, char * argv[]) int optZeroPad = 0; int optTrace = TRACE_NONE; double optFilterParam = -1; - string optFilterName = SignalFilter::FILTER_ABS_BANDLIMIT_STR; - string optFilterMethodName = SignalFilter::FILTER_METHOD_CONVOLUTION_STR; - string optInterpName = Backprojector::INTERP_LINEAR_STR; - string optBackprojName = Backprojector::BPROJ_IDIFF3_STR; + string optFilterName (SignalFilter::convertFilterIDToName (SignalFilter::FILTER_ABS_BANDLIMIT)); + string optFilterMethodName (SignalFilter::convertFilterMethodIDToName (SignalFilter::FILTER_METHOD_CONVOLUTION)); + string optInterpName (Backprojector::convertInterpIDToName (Backprojector::INTERP_LINEAR)); + string optBackprojName (Backprojector::convertBackprojectIDToName (Backprojector::BPROJ_IDIFF3)); int optPreinterpolationFactor = 1; int nx, ny; #ifdef HAVE_MPI -- 2.34.1