From 4f15a69a3150f180bd93fcbe1c87dbaca92a77ad Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Sun, 23 Mar 2003 18:37:42 +0000 Subject: [PATCH] r4228: Interpolation fixes --- ChangeLog | 8 +++ INSTALL | 2 +- configure | 4 +- configure.ac | 4 +- debian/changelog | 6 ++ include/ct.h | 3 +- include/ctsupport.h | 3 +- include/interpolator.h | 106 ++++++++++++++++++++++++++++------ libctsim/backprojectors.cpp | 3 +- libctsim/imagefile.cpp | 3 +- libctsim/projections.cpp | 31 +++++----- libctsupport/interpolator.cpp | 4 +- libctsupport/syserror.cpp | 22 ++++--- src/graph3dview.cpp | 53 +++++++++-------- src/views.cpp | 5 +- 15 files changed, 174 insertions(+), 83 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3e71b69..409b9e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Mar 22, 2003 Version 4.2.3 + + * Added Fourier reconstruction method + + * Support gcc 3.2, wxWindows 2.4, and MacOS X + + * Fix polar interpolation + Jun 26, 2002 Version 3.5.6 * Fix minor color PNG image importing bug diff --git a/INSTALL b/INSTALL index c4f00ba..d9ac974 100644 --- a/INSTALL +++ b/INSTALL @@ -18,7 +18,7 @@ fftw (http://www.fftw.org) wxWindows (http://www.wxwindows.org) Used by CTSim (src/*) graphic front-end. Platform independent for - GTK, Motif, and Windows32 API's. Requires version 2.3.x. + GTK, Motif, and Windows32 API's. Requires version 2.4.0 or later. ctn (http://www.erl.wustl.edu/DICOM/ctn.html) Used by CTSim for DICOM file import and export diff --git a/configure b/configure index 26a4a05..3f8f09f 100755 --- a/configure +++ b/configure @@ -1492,7 +1492,7 @@ fi PACKAGE=ctsim -VERSION=4.2.0 +VERSION=4.2.3 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 @@ -7734,7 +7734,7 @@ cat >>confdefs.h <<\_ACEOF _ACEOF else - CFLAGS="$CFLAGS -O3 -DNDEBUG -fomit-frame-pointer -funroll-loops" + CFLAGS="$CFLAGS -O2 -DNDEBUG -fomit-frame-pointer" cat >>confdefs.h <<\_ACEOF #define NDEBUG 1 diff --git a/configure.ac b/configure.ac index b46a7f5..2db05ae 100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,7 @@ dnl CDPATH= AC_INIT AC_CONFIG_SRCDIR([src/ctsim.cpp]) -AM_INIT_AUTOMAKE(ctsim,4.2.1) +AM_INIT_AUTOMAKE(ctsim,4.2.3) AM_CONFIG_HEADER(config.h) dnl Checks for programs. @@ -120,7 +120,7 @@ if test "$debug" = "true" ; then CFLAGS="$CFLAGS -g -DDEBUG" AC_DEFINE(DEBUG,1,[turn on debugging]) else - CFLAGS="$CFLAGS -O3 -DNDEBUG -fomit-frame-pointer -funroll-loops" + CFLAGS="$CFLAGS -O2 -DNDEBUG -fomit-frame-pointer" AC_DEFINE(NDEBUG,1,[no debugging]) fi diff --git a/debian/changelog b/debian/changelog index 31f3e2a..86271a8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ctsim (4.2.3-1) unstable; urgency=low + + * New upstream version, fix polar interpolation + + -- Kevin M. Rosenberg Sun, 23 Mar 2003 01:27:10 -0700 + ctsim (4.2.2-1) unstable; urgency=low * Depend on mesa3g diff --git a/include/ct.h b/include/ct.h index 72ca08b..97e52f1 100644 --- a/include/ct.h +++ b/include/ct.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: ct.h,v 1.59 2001/03/05 21:59:55 kevin Exp $ +** $Id: ct.h,v 1.60 2003/03/23 18:37:42 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 @@ -164,7 +164,6 @@ extern "C" { #endif #include "ctsupport.h" -#include "interpolator.h" #include "fnetorderstream.h" #ifdef HAVE_SGP diff --git a/include/ctsupport.h b/include/ctsupport.h index 9df0c68..4b42791 100644 --- a/include/ctsupport.h +++ b/include/ctsupport.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: ctsupport.h,v 1.25 2003/01/22 22:15:10 kevin Exp $ +** $Id: ctsupport.h,v 1.26 2003/03/23 18:37:42 kevin Exp $ ** ** ** This program is free software; you can redistribute it and/or modify @@ -161,6 +161,7 @@ char *str_upper(char *str); void sys_error(int severity, const char *msg, ...); void sys_verror (std::string& strOutput, int severity, const char *msg, va_list arg); void sys_error_level(int severity); +extern unsigned long int g_lSysErrorMaxCount; // Math Section diff --git a/include/interpolator.h b/include/interpolator.h index 6b3469b..a3dd43a 100644 --- a/include/interpolator.h +++ b/include/interpolator.h @@ -2,7 +2,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: interpolator.h,v 1.8 2003/01/30 21:53:16 kevin Exp $ +** $Id: interpolator.h,v 1.9 2003/03/23 18:37:42 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 @@ -62,30 +62,98 @@ public: {} T interpolate (double dXPos, double dYPos) - { - int iFloorX = static_cast(floor(dXPos)); - int iFloorY = static_cast(floor (dYPos)); - double dXFrac = dXPos - iFloorX; - double dYFrac = dYPos - iFloorY; - - T result = 0; - - if (iFloorX < 0 || iFloorY < 0 || iFloorX > m_nx-1 || iFloorY > m_ny-1) - result = 0; - else if (iFloorX == m_nx - 1 && iFloorY == m_ny - 1) +{ + int iFloorX = static_cast(floor(dXPos)); + int iFloorY = static_cast(floor (dYPos)); + double dXFrac = dXPos - iFloorX; + double dYFrac = dYPos - iFloorY; + + T result = 0; + + if (iFloorX < 0 || iFloorY < 0 || iFloorX > m_nx-1 || iFloorY > m_ny-1) + result = 0; + else if (iFloorX == m_nx - 1 && iFloorY == m_ny - 1) result = static_cast(m_ppMatrix[m_nx-1][m_ny-1]); - else if (iFloorX == m_nx - 1) - result = static_cast(m_ppMatrix[iFloorX][iFloorY] + dYFrac * (m_ppMatrix[iFloorX][iFloorY+1] - m_ppMatrix[iFloorX][iFloorY])); + else if (iFloorX == m_nx - 1) + result = static_cast(m_ppMatrix[iFloorX][iFloorY] + dYFrac * (m_ppMatrix[iFloorX][iFloorY+1] - m_ppMatrix[iFloorX][iFloorY])); else if (iFloorY == m_ny - 1) result = static_cast(m_ppMatrix[iFloorX][iFloorY] + dXFrac * (m_ppMatrix[iFloorX+1][iFloorY] - m_ppMatrix[iFloorX][iFloorY])); + else + result = static_cast + ((1 - dXFrac) * (1 - dYFrac) * m_ppMatrix[iFloorX][iFloorY] + + dXFrac * (1 - dYFrac) * m_ppMatrix[iFloorX+1][iFloorY] + + dYFrac * (1 - dXFrac) * m_ppMatrix[iFloorX][iFloorY+1] + + dXFrac * dYFrac * m_ppMatrix[iFloorX+1][iFloorY+1]); + + return result; +} + }; + + +template +class BilinearPolarInterpolator { +private: + T** const m_ppMatrix; + const int m_nAngle; + const int m_nPos; + int m_nCenterPos; + +public: + BilinearPolarInterpolator (T** ppMatrix, unsigned int nAngle, + unsigned int nPos) + : m_ppMatrix(ppMatrix), m_nAngle(nAngle), m_nPos(nPos) + { + if (m_nPos %2) + m_nCenterPos = (m_nPos - 1) / 2; else - result = static_cast((1 - dXFrac) * (1 - dYFrac) * m_ppMatrix[iFloorX][iFloorY] + - dXFrac * (1 - dYFrac) * m_ppMatrix[iFloorX+1][iFloorY] + - dYFrac * (1 - dXFrac) * m_ppMatrix[iFloorX][iFloorY+1] + - dXFrac * dYFrac * m_ppMatrix[iFloorX+1][iFloorY+1]); + m_nCenterPos = m_nPos / 2; + } - return result; + T interpolate (double dAngle, double dPos) +{ + int iFloorAngle = static_cast(floor(dAngle)); + int iFloorPos = static_cast(floor (dPos)); + double dAngleFrac = dAngle - iFloorAngle; + double dPosFrac = dPos - iFloorPos; + + T result = 0; + + if (iFloorAngle < -1 || iFloorPos < 0 || iFloorAngle > m_nAngle-1 || iFloorPos > m_nPos-1) + result = 0; + else if (iFloorAngle == -1 && iFloorPos == m_nPos-1) + result = static_cast(m_ppMatrix[0][m_nPos-1] + dAngleFrac * (m_ppMatrix[m_nAngle-1][iFloorPos] - m_ppMatrix[0][iFloorPos])); + else if (iFloorAngle == m_nAngle - 1 && iFloorPos == m_nPos-1) + result = static_cast(m_ppMatrix[m_nAngle-1][m_nPos-1] + dAngleFrac * (m_ppMatrix[0][iFloorPos] - m_ppMatrix[m_nAngle-1][iFloorPos])); + else if (iFloorPos == m_nPos - 1) + result = static_cast(m_ppMatrix[iFloorAngle][iFloorPos] + dAngleFrac * (m_ppMatrix[iFloorAngle+1][iFloorPos] - m_ppMatrix[iFloorAngle][iFloorPos])); + else { + if (iFloorAngle == m_nAngle-1) { + int iUpperAngle = 0; + int iLowerPos = (m_nPos-1) - iFloorPos; + int iUpperPos = (m_nPos-1) - (iFloorPos+1); + result = static_cast + ((1-dAngleFrac) * (1-dPosFrac) * m_ppMatrix[iFloorAngle][iFloorPos] + + dAngleFrac * (1-dPosFrac) * m_ppMatrix[iUpperAngle][iLowerPos] + + dPosFrac * (1-dAngleFrac) * m_ppMatrix[iFloorAngle][iFloorPos+1] + + dAngleFrac * dPosFrac * m_ppMatrix[iUpperAngle][iUpperPos]); + } else if (iFloorAngle == -1) { + int iLowerAngle = m_nAngle - 1; + int iLowerPos = (m_nPos-1) - iFloorPos; + int iUpperPos = (m_nPos-1) - (iFloorPos+1); + result = static_cast + ((1-dAngleFrac) * (1-dPosFrac) * m_ppMatrix[iLowerAngle][iLowerPos] + + dAngleFrac * (1-dPosFrac) * m_ppMatrix[iFloorAngle+1][iFloorPos] + + dPosFrac * (1-dAngleFrac) * m_ppMatrix[iLowerAngle][iUpperPos] + + dAngleFrac * dPosFrac * m_ppMatrix[iFloorAngle+1][iFloorPos+1]); + } else + result = static_cast + ((1-dAngleFrac) * (1-dPosFrac) * m_ppMatrix[iFloorAngle][iFloorPos] + + dAngleFrac * (1-dPosFrac) * m_ppMatrix[iFloorAngle+1][iFloorPos] + + dPosFrac * (1-dAngleFrac) * m_ppMatrix[iFloorAngle][iFloorPos+1] + + dAngleFrac * dPosFrac * m_ppMatrix[iFloorAngle+1][iFloorPos+1]); } + return result; +} }; diff --git a/libctsim/backprojectors.cpp b/libctsim/backprojectors.cpp index 825b1e3..7551ff9 100644 --- a/libctsim/backprojectors.cpp +++ b/libctsim/backprojectors.cpp @@ -8,7 +8,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: backprojectors.cpp,v 1.32 2001/03/18 18:08:25 kevin Exp $ +** $Id: backprojectors.cpp,v 1.33 2003/03/23 18:37:42 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 @@ -25,6 +25,7 @@ ******************************************************************************/ #include "ct.h" +#include "interpolator.h" const int Backprojector::BPROJ_INVALID = -1; const int Backprojector::BPROJ_TRIG = 0; diff --git a/libctsim/imagefile.cpp b/libctsim/imagefile.cpp index 4a49465..c479adb 100644 --- a/libctsim/imagefile.cpp +++ b/libctsim/imagefile.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: imagefile.cpp,v 1.46 2002/06/27 03:19:23 kevin Exp $ +** $Id: imagefile.cpp,v 1.47 2003/03/23 18:37:42 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,7 @@ #ifdef HAVE_CTN_DICOM #include "ctndicom.h" #endif +#include "interpolator.h" const double ImageFile::s_dRedGrayscaleFactor = 0.299; const double ImageFile::s_dGreenGrayscaleFactor = 0.587; diff --git a/libctsim/projections.cpp b/libctsim/projections.cpp index db8fd0c..6473002 100644 --- a/libctsim/projections.cpp +++ b/libctsim/projections.cpp @@ -8,7 +8,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: projections.cpp,v 1.81 2003/03/15 10:27:30 kevin Exp $ +** $Id: projections.cpp,v 1.82 2003/03/23 18:37:42 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,6 +26,7 @@ #include "ct.h" #include +#include "interpolator.h" const kuint16 Projections::m_signature = ('P'*256 + 'J'); @@ -1091,7 +1092,6 @@ Projections::calcArrayPolarCoordinates (unsigned int nx, unsigned int ny, double int iNumDetWithZeros, double dZeropadRatio, double dDetInc) { double dLength = viewDiameter(); -// double dLength = phmLen(); double xMin = -dLength / 2; double xMax = xMin + dLength; double yMin = -dLength / 2; @@ -1120,9 +1120,9 @@ Projections::calcArrayPolarCoordinates (unsigned int nx, unsigned int ny, double double r = ::sqrt (x * x + y * y); double phi = atan2 (y, x); - if (phi < 0) + if (phi <= -m_rotInc / 2) phi += TWOPI; - if (phi >= PI) { + if (phi >= PI - (m_rotInc / 2)) { phi -= PI; r = -r; } @@ -1140,30 +1140,29 @@ Projections::interpolatePolar (ImageFileArray& v, ImageFileArray& vImag, { typedef std::complex complexValue; - BilinearInterpolator* pBilinear = NULL; + BilinearPolarInterpolator* pBilinear = NULL; + BicubicPolyInterpolator* pBicubic = NULL; if (iInterpolationID == POLAR_INTERP_BILINEAR) - pBilinear = new BilinearInterpolator (ppcDetValue, nView, nDetWithZeros); - - BicubicPolyInterpolator* pBicubic; - if (iInterpolationID == POLAR_INTERP_BICUBIC) + pBilinear = new BilinearPolarInterpolator (ppcDetValue, nView, nDetWithZeros); + else if (iInterpolationID == POLAR_INTERP_BICUBIC) pBicubic = new BicubicPolyInterpolator (ppcDetValue, nView, nDetWithZeros); - + for (unsigned int ix = 0; ix < ny; ix++) { for (unsigned int iy = 0; iy < ny; iy++) { - if (iInterpolationID == POLAR_INTERP_NEAREST) { unsigned int iView = nearest (ppdView[ix][iy]); unsigned int iDet = nearest (ppdDet[ix][iy]); - if (iView == nView) { - iView = 0; - iDet = m_nDet - iDet; - } + if (iView == nView) + iView = 0; if (iDet >= 0 && iDet < nDetWithZeros && iView >= 0 && iView < nView) { v[ix][iy] = ppcDetValue[iView][iDet].real(); if (vImag) vImag[ix][iy] = ppcDetValue[iView][iDet].imag(); - } else + } else { v[ix][iy] = 0; + if (vImag) + vImag[ix][iy] = 0; + } } else if (iInterpolationID == POLAR_INTERP_BILINEAR) { std::complex vInterp = pBilinear->interpolate (ppdView[ix][iy], ppdDet[ix][iy]); diff --git a/libctsupport/interpolator.cpp b/libctsupport/interpolator.cpp index d5167ad..1e728cc 100644 --- a/libctsupport/interpolator.cpp +++ b/libctsupport/interpolator.cpp @@ -2,7 +2,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: interpolator.cpp,v 1.3 2001/03/21 21:45:31 kevin Exp $ +** $Id: interpolator.cpp,v 1.4 2003/03/23 18:37:42 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 @@ -134,8 +134,6 @@ CubicSplineInterpolator::interpolate (double x) return y; } - - diff --git a/libctsupport/syserror.cpp b/libctsupport/syserror.cpp index 4aca185..4795349 100644 --- a/libctsupport/syserror.cpp +++ b/libctsupport/syserror.cpp @@ -2,7 +2,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: syserror.cpp,v 1.24 2003/03/15 14:52:36 kevin Exp $ +** $Id: syserror.cpp,v 1.25 2003/03/23 18:37:42 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 @@ -57,9 +57,11 @@ void sys_error (int severity, const char *msg, ...) if (theApp) { wxCommandEvent eventLog (wxEVT_COMMAND_MENU_SELECTED, MAINMENU_LOG_EVENT ); wxString msg (strOutput.c_str()); - msg += "\n"; - eventLog.SetString( msg ); - wxPostEvent( theApp->getMainFrame(), eventLog ); // send log event, thread safe + if (msg.length() > 0) { + msg += "\n"; + eventLog.SetString( msg ); + wxPostEvent( theApp->getMainFrame(), eventLog ); // send log event, thread safe + } } else { wxMutexGuiEnter(); wxLog::OnLog (wxLOG_Message, strOutput.c_str(), time(NULL)); @@ -67,14 +69,16 @@ void sys_error (int severity, const char *msg, ...) } } else -#endif std::cout << strOutput << "\n"; +#else + std::cout << strOutput << "\n"; +#endif va_end(arg); } -static int s_nErrorCount = 0; -const static int MAX_ERROR_COUNT = 20; +static unsigned long s_nErrorCount = 0; +unsigned long int g_lSysErrorMaxCount = 2000; void sys_verror (std::string& strOutput, int severity, const char *msg, va_list arg) @@ -88,9 +92,9 @@ void sys_verror (std::string& strOutput, int severity, const char *msg, va_list s_nErrorCount++; if (severity != ERR_FATAL) { - if (s_nErrorCount > MAX_ERROR_COUNT) + if (s_nErrorCount > g_lSysErrorMaxCount) return; - else if (s_nErrorCount == MAX_ERROR_COUNT) { + else if (s_nErrorCount == g_lSysErrorMaxCount) { os << "*****************************************************************\n"; os << "*** M A X I M U M E R R O R C O U N T R E A C H E D ***\n"; os << "*** ***\n"; diff --git a/src/graph3dview.cpp b/src/graph3dview.cpp index 3a4221a..0025029 100644 --- a/src/graph3dview.cpp +++ b/src/graph3dview.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: graph3dview.cpp,v 1.34 2003/01/30 22:02:30 kevin Exp $ +** $Id: graph3dview.cpp,v 1.35 2003/03/23 18:37:42 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 @@ -145,7 +145,7 @@ Graph3dFileView::Graph3dFileView () : m_pFileMenu(NULL), m_pViewMenu(NULL), m_pStatusBar(NULL), m_pCanvas(NULL), m_dXRotate(-180), m_dYRotate(-210), m_dZRotate(195), m_bDoubleBuffer(true), m_bSmooth(true), m_bWireframe(false), - m_bLighting(true), m_bColor(true), m_bUseVertexArrays(false), + m_bLighting(false), m_bColor(true), m_bUseVertexArrays(false), m_bColorScaleMinSet(false), m_bColorScaleMaxSet(false), m_pFrame(NULL) {} @@ -231,17 +231,23 @@ Graph3dFileView::DrawSurface() glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); glCallList (DISPLAYLIST_COLOR); - glColor3f (0.0f, 0.0f, 0.0f); + glEnable (GL_DEPTH_TEST); + glColor3f (1.0f, 1.0f, 1.0f); glPolygonOffset (0.0f, 0.0f); glPolygonMode (GL_FRONT_AND_BACK, GL_LINE); glCallList (DISPLAYLIST_NO_COLOR); + } else { glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); if (! m_bColor) { glColor3f (1.0f, 1.0f, 1.0f); glCallList (DISPLAYLIST_NO_COLOR); - } else + } else { + glColorMaterial (GL_FRONT_AND_BACK, GL_DIFFUSE); + glEnable (GL_COLOR_MATERIAL); + glShadeModel (GL_FLAT); glCallList (DISPLAYLIST_COLOR); + } } } @@ -342,7 +348,7 @@ Graph3dFileView::CreateDisplayList() for (unsigned int iy = 1; iy < ny - 1; iy++, dYPos++) { p1[0] = dXPos; p1[1] = actScale * (v[ix][iy] + actOffset); p1[2] = dYPos; p2[0] = dXPos+1; p2[1] = actScale * (v[ix+1][iy] + actOffset); p2[2] = dYPos; - CalculateVectorNormal (p1, p2, lastP, &n1[0], &n1[1], &n1[2]); + CalculateVectorNormal (p1, p2, lastP, &n1[0], &n1[1], &n1[2]); lastP[0] = p1[0]; lastP[1] = p1[1]; lastP[2] = p1[2]; glVertex3dv (p1); glNormal3dv (n1); glVertex3dv (p2); glNormal3dv (n1); @@ -438,31 +444,29 @@ Graph3dFileView::InitMaterials() int ny = GetDocument()->ny(); #if 1 - static float ambient[] = {0.1f, 0.1f, 0.1f, 1.0f}; - static float diffuse[] = {1.0f, 1.0f, 1.0f, 1.0f}; - static float position0[] = {-nx/2, -ny/2, ny/2, 0.0f, 0.0f}; - static float position1[] = {-nx/2, -ny/2, -ny/2, 0.0f}; - static float ambient1[] = {0.5f, 0.5f, 0.5f, 1.0f}; + static float position0[] = {nx/2, ny*2, -ny*2, 0.0f,}; + static float ambient0[] = {.1f, .1f, .1f, 1.0f}; + static float diffuse0[] = {1.0f, 1.0f, 1.0f, 1.0f}; + static float position1[] = {-nx/2, -ny*2, -ny*2, 0.0f,}; + static float ambient1[] = {.1f, .1f, .1f, .1f}; static float diffuse1[] = {1.0f, 1.0f, 1.0f, 1.0f}; // static float position0[] = {0.0f, 0.0f, 20.0f, 0.0f}; // static float position1[] = {0.0f, 0.0f, -20.0f, 0.0f}; - static float front_mat_shininess[] = {5.0f}; - static float front_mat_specular[] = {0.1f, 0.1f, 0.1f, 1.0f}; + static float front_mat_shininess[] = {60.0f}; + static float front_mat_specular[] = {0.2f, 0.2f, 0.2f, 1.0f}; static float front_mat_diffuse[] = {0.3f, 0.3f, 0.3f, 1.0f}; - /* - static float back_mat_shininess[] = {60.0f}; - static float back_mat_specular[] = {0.2f, 0.2f, 0.2f, 1.0f}; + static float back_mat_shininess[] = {10.0f}; + static float back_mat_specular[] = {0.1f, 0.1f, 0.1f, 1.0f}; static float back_mat_diffuse[] = {1.0f, 1.0f, 1.0f, 1.0f}; - */ static float lmodel_ambient[] = {1.0f, 1.0f, 1.0f, 1.0f}; - static float lmodel_twoside[] = {GL_FALSE}; + static float lmodel_twoside[] = {GL_TRUE}; - glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); + //glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glHint(GL_LINE_SMOOTH, GL_DONT_CARE); glEnable(GL_NORMALIZE); - glLightfv (GL_LIGHT0, GL_AMBIENT, ambient); - glLightfv (GL_LIGHT0, GL_DIFFUSE, diffuse); + glLightfv (GL_LIGHT0, GL_AMBIENT, ambient0); + glLightfv (GL_LIGHT0, GL_DIFFUSE, diffuse0); glLightfv (GL_LIGHT0, GL_POSITION, position0); glEnable (GL_LIGHT0); @@ -477,9 +481,12 @@ Graph3dFileView::InitMaterials() glMaterialfv (GL_FRONT_AND_BACK, GL_SHININESS, front_mat_shininess); glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, front_mat_specular); glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, front_mat_diffuse); + glMaterialfv (GL_BACK, GL_SHININESS, back_mat_shininess); + glMaterialfv (GL_BACK, GL_SPECULAR, back_mat_specular); + glMaterialfv (GL_BACK, GL_DIFFUSE, back_mat_diffuse); glColorMaterial (GL_FRONT_AND_BACK, GL_DIFFUSE); - // glColorMaterial (GL_FRONT_AND_BACK, GL_SPECULAR); + glColorMaterial (GL_FRONT_AND_BACK, GL_SPECULAR); glEnable(GL_COLOR_MATERIAL); #else GLfloat impLPos[] = {1.0f, 1.0f, 1.0f, 0.0f}; @@ -775,10 +782,10 @@ Graph3dFileView::CreateChildFrame (wxDocument *doc, wxView *view) m_pFileMenu->Append(wxID_PRINT, "&Print..."); m_pFileMenu->Append(wxID_PRINT_SETUP, "Print &Setup..."); m_pFileMenu->Append(wxID_PREVIEW, "Print Preview"); -#ifdef CTSIM_MDI m_pFileMenu->AppendSeparator(); + m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces..."); m_pFileMenu->Append(MAINMENU_FILE_EXIT, "E&xit"); -#endif + GetDocumentManager()->FileHistoryAddFilesToMenu(m_pFileMenu); GetDocumentManager()->FileHistoryUseMenu(m_pFileMenu); diff --git a/src/views.cpp b/src/views.cpp index cb76637..2273a87 100644 --- a/src/views.cpp +++ b/src/views.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: views.cpp,v 1.171 2003/03/15 10:27:30 kevin Exp $ +** $Id: views.cpp,v 1.172 2003/03/23 18:37:42 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 @@ -2597,7 +2597,6 @@ ProjectionFileView::OnConvertPolar (wxCommandEvent& event) wxString strInterpolation (dialogPolar.getInterpolationName()); m_iDefaultPolarNX = dialogPolar.getXSize(); m_iDefaultPolarNY = dialogPolar.getYSize(); - ImageFileDocument* pPolarDoc = theApp->newImageDoc(); ImageFile* pIF = new ImageFile (m_iDefaultPolarNX, m_iDefaultPolarNY); m_iDefaultPolarInterpolation = Projections::convertInterpNameToID (strInterpolation.c_str()); @@ -2607,7 +2606,7 @@ ProjectionFileView::OnConvertPolar (wxCommandEvent& event) return; } - pPolarDoc = theApp->newImageDoc (); + ImageFileDocument* pPolarDoc = theApp->newImageDoc(); if (! pPolarDoc) { sys_error (ERR_SEVERE, "Unable to create image file"); return; -- 2.34.1