From: Kevin M. Rosenberg Date: Wed, 7 Jun 2000 07:43:39 +0000 (+0000) Subject: r84: *** empty log message *** X-Git-Tag: debian-4.5.3-3~933 X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=commitdiff_plain;h=3873067b47875ba7b09d511cb5cdfeaa35e8c27d r84: *** empty log message *** --- diff --git a/configure.in b/configure.in index 81e1de9..8a17be7 100644 --- a/configure.in +++ b/configure.in @@ -77,11 +77,12 @@ AC_CHECK_LIB(m, main) AC_CHECK_LIB(curses, main, [curses=true], [curses=false]) AC_CHECK_LIB(ncurses, main, [ncurses=true], [ncurses=false]) AC_CHECK_LIB(g2, main, [g2=true], [g2=false]) +AC_CHECK_LIB(wx_gtk, main, [wxwin=true; wx_gtk=true], [wxwin=false]) +AC_CHECK_LIB(wx_msw, main, [wxwin=true; wx_msw=true], [wxwin=false]) + if test "$zlib" = "true" ; then AC_CHECK_LIB(png, main, [png=true ; AC_DEFINE(HAVE_PNG)], [png=false]) fi -AC_CHECK_LIB(wx_gtk, main, [wxwin=true; wx_gtk=true], [wxwin=false]) -AC_CHECK_LIB(wx_msw, main, [wxwin=true; wx_msw=true], [wxwin=false]) dnl Checks for header files. AC_HEADER_STDC @@ -309,7 +310,7 @@ AC_SUBST(ctlibs) if test -n "$lamdir" ; then ctlamlibs="-lir_lam $ctlibs_base" - lamprograms="ctrec-lam phm2sdf-lam phm2rs-lam" + lamprograms="ctrec-lam phm2if-lam phm2rs-lam" AC_SUBST(lamprograms) AC_SUBST(ctlamlibs) fi diff --git a/include/ct.h b/include/ct.h index ef9e17b..9aa3639 100644 --- a/include/ct.h +++ b/include/ct.h @@ -2,8 +2,11 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ct.h,v 1.9 2000/06/07 03:49:54 kevin Exp $ +** $Id: ct.h,v 1.10 2000/06/07 07:43:39 kevin Exp $ ** $Log: ct.h,v $ +** Revision 1.10 2000/06/07 07:43:39 kevin +** *** empty log message *** +** ** Revision 1.9 2000/06/07 03:49:54 kevin ** *** empty log message *** ** @@ -60,16 +63,28 @@ #endif #ifdef HAVE_CONFIG_H -#include + #include #endif #ifdef HAVE_PNG -#include "png.h" + #include "png.h" #endif #ifdef HAVE_G2_H -#include "g2.h" -#ifdef HAVE_X11 -#include "g2_X11.h" -#endif + #ifdef __cplusplus + extern "C" { + #include "g2.h" + } + #else + #include "g2.h" + #endif + #ifdef HAVE_X11 + #ifdef __cplusplus + extern "C" { + #include "g2_X11.h" + } + #else + #include "g2_X11.h" + #endif + #endif #endif #ifdef HAVE_STDIO_H #include @@ -132,7 +147,6 @@ #include "kstddef.h" #include "kmath.h" -#include "sdf.h" #include "keyboard.h" #include "cio.h" diff --git a/include/imagefile.h b/include/imagefile.h index a6988d8..4660a92 100644 --- a/include/imagefile.h +++ b/include/imagefile.h @@ -35,7 +35,7 @@ public: ~Array2dFileLabel(); - const string& getLabelString (void) const + string getLabelString (void) const { return label_str; } kfloat64 getCalcTime (void) const @@ -44,6 +44,12 @@ public: kfloat64 getLabelType (void) const { return label_type; } + string& setLabelString (const char* const str) + { label_str = str; return (label_str); } + + string& setLabelString (const string& str) + { label_str = str; return (label_str); } + void getDateString (string& str) const; }; @@ -109,6 +115,8 @@ public: void labelAdd (int type, const char* const label_str, double calc_time=0.); + void labelsCopy (Array2dFile& file, const char* const idStr = NULL); + void fileClose (void); void setPixelType (int type) @@ -124,7 +132,7 @@ public: void setAxisExtent (double mMinX, double mMaxX, double mMinY, double mMaxY); - void getPixelValueRange (T& pvmin, T& pvmax); + void getPixelValueRange (T& pvmin, T& pvmax) const; void doPixelOffsetScale (double offset, double scale); @@ -133,6 +141,8 @@ public: bool arrayDataWrite (void); + void arrayDataClear (void); + bool fileRead (void); bool fileCreate (void); @@ -292,18 +302,18 @@ Array2dFile::setAxisExtent (double minX, double maxX, double minY, double max template void -Array2dFile::getPixelValueRange (T& pvmin, T& pvmax) +Array2dFile::getPixelValueRange (T& pvmin, T& pvmax) const { - if (array != NULL) { - T** da = array.GetArray(); + if (array != NULL) { + T** da = array->getArray(); pvmax = pvmin = da[0][0]; - for (int ix = 0; ix < mNX; ix++) - for (int iy = 0; iy < mNY; iy++) - if (pvmax < da[ix][iy]) - pvmax = da[ix][iy]; - else if (pvmin > da[ix][iy]) + for (int ix = 0; ix < mNX; ix++) + for (int iy = 0; iy < mNY; iy++) + if (pvmax < da[ix][iy]) + pvmax = da[ix][iy]; + else if (pvmin > da[ix][iy]) pvmin = da[ix][iy]; - } + } } template @@ -562,8 +572,33 @@ Array2dFile::labelAdd (const Array2dFileLabel& label) fsync(file_id); } +template +void +Array2dFile::labelsCopy (Array2dFile& copyFile, const char* const idStr) +{ + string id = idStr; + for (int i = 0; i < copyFile.getNumLabels(); i++) { + Array2dFileLabel l; + copyFile.labelRead (l, i); + string lstr = l.getLabelString(); + lstr = idStr + lstr; + l.setLabelString (lstr); + labelAdd (l); + } +} + +template +void +Array2dFile::arrayDataClear (void) +{ + if (array != NULL) { + T** v = array->getArray(); + for (unsigned int ix = 0; ix < mNX; ix++) + for (unsigned int iy = 0; iy < mNY; iy++) + v[ix][iy] = 0; + } +} -#endif #ifdef MPI_CT #include @@ -589,6 +624,15 @@ public: adf.setPixelType (Array2dFile::FLOAT32); } + kfloat32** getArray(void) const + { return adf.getArray(); } + + kuint32 nx(void) const + { return adf.nx(); } + + kuint32 ny(void) const + { return adf.ny(); } + #ifdef MPI_CT MPI_Datatype getMPIDataType (void) const { return MPI_FLOAT; } @@ -619,6 +663,15 @@ public: { adf.setPixelType (Array2dFile::FLOAT64); } + + kfloat64** getArray(void) const + { return adf.getArray(); } + + kuint32 nx(void) const + { return adf.nx(); } + + kuint32 ny(void) const + { return adf.ny(); } }; typedef F64Image ImageFile; @@ -626,5 +679,7 @@ typedef kfloat64 ImageFileValue; typedef kfloat64* ImageFileColumn; typedef kfloat64** ImageFileArray; +#endif + diff --git a/include/ir.h b/include/ir.h index a257bae..7da06ff 100644 --- a/include/ir.h +++ b/include/ir.h @@ -2,8 +2,11 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ir.h,v 1.21 2000/06/07 03:49:54 kevin Exp $ +** $Id: ir.h,v 1.22 2000/06/07 07:43:39 kevin Exp $ ** $Log: ir.h,v $ +** Revision 1.22 2000/06/07 07:43:39 kevin +** *** empty log message *** +** ** Revision 1.21 2000/06/07 03:49:54 kevin ** *** empty log message *** ** @@ -105,19 +108,6 @@ typedef struct histo_st HISTOGRAM; static const int POINTS_PER_CIRCLE=90; #define MAXREMARK 99 -typedef FMTX_2D IMAGE_ARRAY; /* use 2d floating point matrix */ -typedef float IMAGE_ELEM_VAL; /* use floats for image storing */ - -struct image_st { - IMAGE_ARRAY v; /* values of voxels in matrix form */ - SDF_2D *dfp_2d; /* Pointer to disk image file */ - int nx, ny; /* size of voxel matrix */ - double xmin, xmax, ymin, ymax; /* extent of voxel matrix in phm coord */ - char remark[MAXREMARK+1]; /* description of voxel data */ - float calctime; /* time to calculate voxels in seconds */ -}; -typedef struct image_st IMAGE; - typedef enum { RECTANGLE, TRIANGLE, @@ -380,40 +370,6 @@ void mpi_ct_calc_work_units(const unsigned int global_work_units); #endif -/* From reconstr.c */ -IMAGE *image_reconst (IMAGE *im, RAYSUM *rs, const FilterType filt_type, double filt_param, InterpolationType interp_type, int interp_param, const BackprojType backproj_type, int const ir_trace); - -/* From bproj.c */ -void backproj_init (const RAYSUM *rs, IMAGE *im, const BackprojType bproj_method); -int backproj_calc (const RAYSUM *rs, IMAGE *im, const double *t, const double view_angle, - const int interp_type, const int bproj_method); -void backproj_term (const RAYSUM *rs, IMAGE *im, const int bproj_method); - -void backproj_init_trig (const RAYSUM *rs, IMAGE *im); -int backproj_calc_trig (const RAYSUM *rs, IMAGE *im, const double *t, - const double view_angle, const int interp_type); -void backproj_term_trig (const RAYSUM *rs, IMAGE *im); -void backproj_init_table (const RAYSUM *rs, IMAGE *im); -int backproj_calc_table (const RAYSUM *rs, IMAGE *im, const double *t, - const double view_angle, const int interp_type); -void backproj_term_table (const RAYSUM *rs, IMAGE *im); -void backproj_init_d (const RAYSUM *rs, IMAGE *im); -int backproj_calc_d (const RAYSUM *rs, IMAGE *im, const double *t, - const double view_angle, const int interp_type); -void backproj_term_d (const RAYSUM *rs, IMAGE *im); -void backproj_init_d2 (const RAYSUM *rs, IMAGE *im); -int backproj_calc_d2 (const RAYSUM *rs, IMAGE *im, const double *t, - const double view_angle, const int interp_type); -void backproj_term_d2 (const RAYSUM *rs, IMAGE *im); -void backproj_init_id (const RAYSUM *rs, IMAGE *im); -int backproj_calc_id (const RAYSUM *rs, IMAGE *im, const double *t, - const double view_angle, const int interp_type); -void backproj_term_id (const RAYSUM *rs, IMAGE *im); -void backproj_init_id2 (const RAYSUM *rs, IMAGE *im); -int backproj_calc_id2 (const RAYSUM *rs, IMAGE *im, const double *t, - const double view_angle, const int interp_type); -void backproj_term_id2 (const RAYSUM *rs, IMAGE *im); - /* bspline.c */ int bspline(int samples, int zoom_factor, int spline_order, double input[], double output[]); @@ -435,15 +391,6 @@ double filter_frequency_response(int filt_type, double u, double bw, double para double sinc(double x, double mult); double integral_abscos(double u, double w); -/* image.c */ -IMAGE *image_create(const char *fname, const int nx, const int ny); -int image_clear(IMAGE *im); -int image_save(IMAGE *im); -IMAGE *image_load(const char *fname); -void image_filter_response(IMAGE *im, const DomainType domain, double bw, const FilterType filt_type, double filt_param, const int opt_trace); -int image_display (const IMAGE *im); -int image_display_scale (const IMAGE *im, const int scale, const double pmin, const double pmax); - /* options.c */ int opt_set_trace(const char *optarg); const char *name_of_phantom(const int phmid); @@ -478,10 +425,6 @@ void phm_show(const PHANTOM *phm); void phm_draw(const PHANTOM *phm); #endif -/* phm2image.c */ -void phm_to_image(const PHANTOM *phm, IMAGE *im, const int col_start, const int col_count, const int nsample, const int trace); -int pelm_is_point_inside(PELM *obj, const double x, const double y, const CoordType coord_type); - /* phmstd.c */ void phm_std_herman (PHANTOM *phm); void phm_std_rowland (PHANTOM *phm); @@ -520,7 +463,48 @@ int raysum_print(const RAYSUM *rs); #ifdef __cplusplus } +/* From phm2image.cpp */ void phm_to_imagefile (const PHANTOM *phm, ImageFile& im, const int col_start, const int col_count, const int nsample, const int trace); +int pelm_is_point_inside(PELM *obj, const double x, const double y, const CoordType coord_type); + +/* image.cpp */ +void image_filter_response(ImageFile& im, const DomainType domain, double bw, const FilterType filt_type, double filt_param, const int opt_trace); +int image_display (const ImageFile& im); +int image_display_scale (const ImageFile& im, const int scale, const double pmin, const double pmax); + +/* From reconstr.cpp */ +ImageFile& proj_reconst (ImageFile& im, RAYSUM *rs, const FilterType filt_type, double filt_param, InterpolationType interp_type, int interp_param, const BackprojType backproj_type, int const ir_trace); + +/* From bproj.cpp */ +void backproj_init (const RAYSUM *rs, ImageFile& im, const BackprojType bproj_method); +int backproj_calc (const RAYSUM *rs, ImageFile& im, const double *t, const double view_angle, const int interp_type, const int bproj_method); +void backproj_term (const RAYSUM *rs, ImageFile& im, const int bproj_method); + +void backproj_init_trig (const RAYSUM *rs, ImageFile& im); +int backproj_calc_trig (const RAYSUM *rs, ImageFile& im, const double *t, + const double view_angle, const int interp_type); +void backproj_term_trig (const RAYSUM *rs, ImageFile& im); +void backproj_init_table (const RAYSUM *rs, ImageFile& im); +int backproj_calc_table (const RAYSUM *rs, ImageFile& im, const double *t, + const double view_angle, const int interp_type); +void backproj_term_table (const RAYSUM *rs, ImageFile& im); +void backproj_init_d (const RAYSUM *rs, ImageFile& im); +int backproj_calc_d (const RAYSUM *rs, ImageFile& im, const double *t, + const double view_angle, const int interp_type); +void backproj_term_d (const RAYSUM *rs, ImageFile& im); +void backproj_init_d2 (const RAYSUM *rs, ImageFile& im); +int backproj_calc_d2 (const RAYSUM *rs, ImageFile& im, const double *t, + const double view_angle, const int interp_type); +void backproj_term_d2 (const RAYSUM *rs, ImageFile& im); +void backproj_init_id (const RAYSUM *rs, ImageFile& im); +int backproj_calc_id (const RAYSUM *rs, ImageFile& im, const double *t, + const double view_angle, const int interp_type); +void backproj_term_id (const RAYSUM *rs, ImageFile& im); +void backproj_init_id2 (const RAYSUM *rs, ImageFile& im); +int backproj_calc_id2 (const RAYSUM *rs, ImageFile& im, const double *t, + const double view_angle, const int interp_type); +void backproj_term_id2 (const RAYSUM *rs, ImageFile& im); + #endif /* __cplusplus */