+2.0.0-b5 - 7/20/00
+ Added capabilities to graphical ctsim program
+
2.0.0-b4 - 7/13/00
Fixed compiler warnings at -Wall level
Began work on CTSim program to be graphical front-end of all functions
not work.
fftw (http://www.fftw.org)
- Fastest Fourier Transform in the West. Currently, the only FFT
- routines used by CTSim.
+ Fastest Fourier Transform in the West. Currently, this library is the
+ only FFT routines used by CTSim.
wxWindows (http://www.wxwindows.org)
- Used by CTSim (src/*) graphic front-end
+ Used by CTSim (src/*) graphic front-end. Platform independent for
+ UNIX and Windows
g2 (http://g2.sourceforge.net)
Currently, used partially by SGP (Simple Graphics Package) for
-graphical display by command-line tools (tools/*). This library
-will likely be deprecated in favor of wxWindows.
+ graphical display by command-line tools (tools/*). This library
+ will likely be deprecated in favor of wxWindows.
lam (http://www.mpi.nd.edu/lam/)
There is support is MPI clustering. I use this code at home for my
Visual C++ Installation
-----------------------
-Run make.bat from the root directory (Note, make.bat is out of date)
+Run make.bat from the root directory (Note, make.bat is out of date
+and is currently broken)
CYGWIN v1.1.0
-------------
The file /usr/i686-pc-wygwin/include/cygwin/in.h has a bug. The line
struct in_addr6 sin6_addr;
should be deleted.
+
getopt_long appears broken, configure.in checks for cygwin to use
bundled version of getopt_long.
EXTRA_DIRS3=
endif
-SUBDIRS=$(EXTRA_DIRS1) $(EXTRA_DIRS2) libctsupport libctsim man html cgi-bin include tools $(EXTRA_DIRS3)
+SUBDIRS=$(EXTRA_DIRS1) $(EXTRA_DIRS2) libctsupport libctsim man doc html cgi-bin include tools $(EXTRA_DIRS3)
EXTRA_DIST=acsite.m4 make.bat
New Features of CTSim version 2.0:
-- Entire code-base, except for SGP & EZPlot, cleaned up and
- re-written. All code converted to C++.
+- Entire code-base, except for SGP & EZPlot, cleaned up,
+ re-written, and converted from C to C++.
- Integrated G2 library for graphical display from command line tools
+ (UNIX only)
- Graphic front-end (ctsim) initial implemention. Can display
- projection and image files.
+ projection and image files. Uses platform-independent wxWindows
+ so can run on UNIX and Windows platforms.
- Added frequency-based filtering. Can provide significant speed-up
in reconstructions compared to convolution-based filtering.
THE PROGRAMS
============
+ctsim - a graphical user interface for all functions. Currently, this is
+still under development and incomplete compared to command-line tools.
+
phm2if - generates an image file of a phantom object
phm2pj - Simulates the collection of CT data, or projections, of a phantom
TYPICAL USAGE
=============
+Graphical User Interface
+------------------------
+
+Use ctsim, but most functions are not yet incorporated.
+
+Command Line Interface
+----------------------
+
When evaluating CT simulation, in general, these steps are followed:
Create a phantom image and viewable image file
ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL"
-trap 'rm -fr `echo "Makefile libctgraphics/Makefile libctsupport/Makefile libctsim/Makefile Makefile man/Makefile cgi-bin/ctsim.cgi cgi-bin/Makefile html/simulate.html html/Makefile include/Makefile getopt/Makefile tools/sample-ctsim.sh cgi-bin/ctsim.conf tools/Makefile src/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+trap 'rm -fr `echo "Makefile libctgraphics/Makefile libctsupport/Makefile libctsim/Makefile Makefile man/Makefile doc/Makefile cgi-bin/ctsim.cgi cgi-bin/Makefile html/simulate.html html/Makefile include/Makefile getopt/Makefile tools/sample-ctsim.sh cgi-bin/ctsim.conf tools/Makefile src/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
cat >> $CONFIG_STATUS <<EOF
-CONFIG_FILES=\${CONFIG_FILES-"Makefile libctgraphics/Makefile libctsupport/Makefile libctsim/Makefile Makefile man/Makefile cgi-bin/ctsim.cgi cgi-bin/Makefile html/simulate.html html/Makefile include/Makefile getopt/Makefile tools/sample-ctsim.sh cgi-bin/ctsim.conf tools/Makefile src/Makefile"}
+CONFIG_FILES=\${CONFIG_FILES-"Makefile libctgraphics/Makefile libctsupport/Makefile libctsim/Makefile Makefile man/Makefile doc/Makefile cgi-bin/ctsim.cgi cgi-bin/Makefile html/simulate.html html/Makefile include/Makefile getopt/Makefile tools/sample-ctsim.sh cgi-bin/ctsim.conf tools/Makefile src/Makefile"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
dnl CDPATH=
AC_INIT(src/ctsim.cpp)
-AM_INIT_AUTOMAKE(ctsim,2.0.0-b4)
+AM_INIT_AUTOMAKE(ctsim,2.0.0-b5)
AM_CONFIG_HEADER(config.h)
dnl Checks for programs.
CXXFLAGS="$CFLAGS"
-AC_OUTPUT(Makefile libctgraphics/Makefile libctsupport/Makefile libctsim/Makefile Makefile man/Makefile cgi-bin/ctsim.cgi cgi-bin/Makefile html/simulate.html html/Makefile include/Makefile getopt/Makefile tools/sample-ctsim.sh cgi-bin/ctsim.conf tools/Makefile src/Makefile)
+AC_OUTPUT(Makefile libctgraphics/Makefile libctsupport/Makefile libctsim/Makefile Makefile man/Makefile doc/Makefile cgi-bin/ctsim.cgi cgi-bin/Makefile html/simulate.html html/Makefile include/Makefile getopt/Makefile tools/sample-ctsim.sh cgi-bin/ctsim.conf tools/Makefile src/Makefile)
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: phantom.h,v 1.6 2000/07/15 08:36:13 kevin Exp $
+** $Id: phantom.h,v 1.7 2000/07/18 03:14:35 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
~PhantomElement (void);
- bool isPointInside (double x, double y, const CoordType coord_type);
+ bool isPointInside (double x, double y, const CoordType coord_type) const;
bool clipLineNormalizedCoords (double& x1, double& y1, double& x2, double& y2) const;
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: phantom.cpp,v 1.7 2000/07/15 08:36:13 kevin Exp $
+** $Id: phantom.cpp,v 1.8 2000/07/18 03:14:35 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
ImageFileArray v = im.getArray();
+ for (int ix = 0; ix < colCount; ix++)
+ for (int iy = 0; iy < ny; iy++)
+ v[ix][iy] = 0;
+
double x_start = xmin + (colStart * xinc);
for (PElemConstIterator pelem = m_listPElem.begin(); pelem != m_listPElem.end(); pelem++) {
- double x, y, xi, yi;
- int ix, iy, kx, ky;
- for (ix = 0, x = x_start; ix < colCount; ix++, x += xinc) {
- for (iy = 0, y = ymin; iy < ny; iy++, y += yinc) {
- for (kx = 0, xi = x + kxofs; kx < nsample; kx++, xi += kxinc) {
- for (ky = 0, yi = y + kyofs; ky < nsample; ky++, yi += kyinc)
- if ((*pelem)->isPointInside (xi, yi, PHM_COORD) == TRUE)
- v[ix][iy] += (*pelem)->atten();
- } // for kx
- } /* for iy */
- } /* for ix */
+ const PhantomElement& rPElem = **pelem;
+ double x, y, xi, yi;
+ int ix, iy, kx, ky;
+ for (ix = 0, x = x_start; ix < colCount; ix++, x += xinc) {
+ for (iy = 0, y = ymin; iy < ny; iy++, y += yinc) {
+ for (kx = 0, xi = x + kxofs; kx < nsample; kx++, xi += kxinc) {
+ for (ky = 0, yi = y + kyofs; ky < nsample; ky++, yi += kyinc)
+ if (rPElem.isPointInside (xi, yi, PHM_COORD) == TRUE)
+ v[ix][iy] += rPElem.atten();
+ } // for kx
+ } /* for iy */
+ } /* for ix */
} /* for pelem */
// false if point lies outside of pelem
bool
-PhantomElement::isPointInside (double x, double y, const CoordType coord_type)
+PhantomElement::isPointInside (double x, double y, const CoordType coord_type) const
{
if (coord_type == PHM_COORD) {
xform_mtx2 (m_xformPhmToObj, x, y);
bin_PROGRAMS=ctsim
-ctsim_SOURCES=ctsim.cpp docs.cpp views.cpp ctsim.h docs.h views.h
+ctsim_SOURCES=ctsim.cpp docs.cpp views.cpp dialogs.cpp ctsim.h docs.h views.h dialogs.h
ctsim_DEPENDENCIES=../libctgraphics/libctgraphics.a ../libctsupport/libctsupport.a ../libctsim/libctsim.a ../include/ct.h
ctsim_LDADD=-L../libctgraphics -L../libctsupport -L../libctsim @wxlibs@
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: ctsim.h,v 1.2 2000/07/15 08:36:13 kevin Exp $
+** $Id: ctsim.h,v 1.3 2000/07/18 03:14:35 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
PHMMENU_FILE_PROPERTIES,
PJMENU_PROCESS_RECONSTRUCT,
IFMENU_VIEW_WINDOW_AUTO,
+ IFMENU_VIEW_WINDOW_MINMAX,
PHMMENU_PROCESS_RASTERIZE,
PHMMENU_PROCESS_PROJECTIONS,
};
--- /dev/null
+/*****************************************************************************
+** FILE IDENTIFICATION
+**
+** Name: dialogs.cpp
+** Purpose: Dialog routines for CTSim program
+** Programmer: Kevin Rosenberg
+** Date Started: July 2000
+**
+** This is part of the CTSim program
+** Copyright (C) 1983-2000 Kevin Rosenberg
+**
+** $Id: dialogs.cpp,v 1.1 2000/07/18 03:14:35 kevin Exp $
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License (version 2) as
+** published by the Free Software Foundation.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+******************************************************************************/
+
+#ifdef __GNUG__
+// #pragma implementation
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+#include "wx/wx.h"
+#endif
+
+#if !wxUSE_DOC_VIEW_ARCHITECTURE
+#error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h!
+#endif
+
+#include "wx/statline.h"
+#include "wx/sizer.h"
+#include "dialogs.h"
+#include <sstream>
+
+DialogGetImageMinMax::DialogGetImageMinMax (wxFrame* pParent, const ImageFile& rImagefile, double dDefaultMin = 0., double dDefaultMax = 0.)
+ : wxDialog (pParent, -1, "Set Image Display Minimum & Maximum", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxCAPTION), m_pTopSizer(NULL), m_pTextCtrlMin(NULL), m_pTextCtrlMax(NULL), m_pButtonSizer(NULL), m_pButtonOk(NULL), m_pButtonCancel(NULL), m_dDefaultMin(dDefaultMin), m_dDefaultMax(dDefaultMax)
+{
+ wxBoxSizer* m_pTopSizer = new wxBoxSizer (wxVERTICAL);
+
+ m_pTopSizer->Add (new wxStaticText (this, -1, "Set Image Display Minimum and Maximum"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
+
+ ostringstream os;
+ os << dDefaultMin;
+ m_pTextCtrlMin = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+ ostringstream osMax;
+ osMax << dDefaultMax;
+ m_pTextCtrlMax = new wxTextCtrl (this, -1, osMax.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+
+ wxGridSizer *pGridSizer = new wxGridSizer (2, 2, 5);
+ pGridSizer->Add (new wxStaticText (this, -1, "Minimum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pGridSizer->Add (m_pTextCtrlMin, 0, wxALIGN_CENTER_VERTICAL);
+ pGridSizer->Add (new wxStaticText (this, -1, "Maximum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pGridSizer->Add (m_pTextCtrlMax, 0, wxALIGN_CENTER_VERTICAL);
+ m_pTopSizer->Add (pGridSizer, 1, wxALL, 10);
+
+ m_pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
+
+ m_pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
+ m_pButtonOk = new wxButton (this, wxID_OK, "Okay");
+ m_pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
+ m_pButtonSizer->Add (m_pButtonOk, 0, wxEXPAND | wxALL, 10);
+ m_pButtonSizer->Add (m_pButtonCancel, 0, wxEXPAND | wxALL, 10);
+
+ m_pTopSizer->Add (m_pButtonSizer, 0, wxALIGN_CENTER);
+
+ SetAutoLayout (true);
+ SetSizer (m_pTopSizer);
+ m_pTopSizer->Fit (this);
+ m_pTopSizer->SetSizeHints (this);
+}
+
+DialogGetImageMinMax::~DialogGetImageMinMax (void)
+{
+#if 0
+ delete m_pTopSizer;
+ delete m_pTextCtrlMin;
+ delete m_pTextCtrlMax;
+ delete m_pButtonSizer;
+ delete m_pButtonOk;
+ delete m_pButtonCancel;
+#endif
+}
+
+double
+DialogGetImageMinMax::getMinimum (void)
+{
+ wxString strCtrl = m_pTextCtrlMin->GetValue();
+ double dValue;
+ if (strCtrl.ToDouble (&dValue))
+ return dValue;
+ else
+ return (m_dDefaultMin);
+}
+
+double
+DialogGetImageMinMax::getMaximum (void)
+{
+ wxString strCtrl = m_pTextCtrlMax->GetValue();
+ double dValue;
+ if (strCtrl.ToDouble (&dValue))
+ return dValue;
+ else
+ return (m_dDefaultMax);
+}
+
--- /dev/null
+/*****************************************************************************
+** FILE IDENTIFICATION
+**
+** Name: dialogs.h
+** Purpose: Header file for Dialogs of CTSim program
+** Programmer: Kevin Rosenberg
+** Date Started: July 2000
+**
+** This is part of the CTSim program
+** Copyright (C) 1983-2000 Kevin Rosenberg
+**
+** $Id: dialogs.h,v 1.1 2000/07/18 03:14:35 kevin Exp $
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License (version 2) as
+** published by the Free Software Foundation.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+******************************************************************************/
+
+
+#ifndef __DIALOGSH__
+#define __DIALOGSH__
+
+#include "wx/wx.h"
+
+class ImageFile;
+class DialogGetImageMinMax : public wxDialog
+{
+ public:
+ DialogGetImageMinMax (wxFrame* pParent, const ImageFile& rImagefile, double dDefaultMin = 0., double dDefaultMax = 0.);
+ ~DialogGetImageMinMax (void);
+
+ double getMinimum (void);
+ double getMaximum (void);
+
+ private:
+ wxBoxSizer* m_pTopSizer;
+ wxTextCtrl* m_pTextCtrlMin;
+ wxTextCtrl* m_pTextCtrlMax;
+ wxBoxSizer* m_pButtonSizer;
+ wxButton* m_pButtonOk;
+ wxButton* m_pButtonCancel;
+
+ double m_dDefaultMin;
+ double m_dDefaultMax;
+};
+
+#endif
+
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: views.cpp,v 1.2 2000/07/15 08:36:13 kevin Exp $
+** $Id: views.cpp,v 1.3 2000/07/18 03:14:35 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
#include "ctsim.h"
#include "docs.h"
#include "views.h"
+#include "dialogs.h"
#include <sstream>
-#include "ct.h"
// ImageFileCanvas
IMPLEMENT_DYNAMIC_CLASS(ImageFileView, wxView)
BEGIN_EVENT_TABLE(ImageFileView, wxView)
- EVT_MENU(IFMENU_FILE_PROPERTIES, ImageFileView::OnProperties)
- EVT_MENU(IFMENU_VIEW_WINDOW_AUTO, ImageFileView::OnWindowAuto)
+ EVT_MENU(IFMENU_FILE_PROPERTIES, ImageFileView::OnProperties)
+ EVT_MENU(IFMENU_VIEW_WINDOW_MINMAX, ImageFileView::OnWindowMinMax)
+ EVT_MENU(IFMENU_VIEW_WINDOW_AUTO, ImageFileView::OnWindowAuto)
END_EVENT_TABLE()
ImageFileView::ImageFileView(void)
const string& rFilename = rIF.getFilename();
rIF.statistics (min, max, mean, mode, median, stddev);
ostringstream os;
- os << "file: " << rFilename << "\nmin: "<<min<<"\nmax: "<<max<<"\nmean: "<<mean<<"\nmode: "<<mode<<"\nstddev: "<<stddev;
+ os << "file: " << rFilename << "\nmin: "<<min<<"\nmax: "<<max<<"\nmean: "<<mean<<"\nmode: "<<mode<<"\nstddev: "<<stddev << "\n";
*theApp->getLog() << os.str().c_str();
}
}
ImageFileView::OnWindowAuto (wxCommandEvent& event)
{
*theApp->getLog() << "ImageFile: Window Auto\n";
- m_minPixel = .2;
- m_maxPixel = .22;
- m_bMinSpecified = true;
- m_bMaxSpecified = true;
- OnUpdate(this, NULL);
+}
+
+void
+ImageFileView::OnWindowMinMax (wxCommandEvent& event)
+{
+ const ImageFile& rIF = GetDocument()->getImageFile();
+ double min, max;
+ if (! m_bMinSpecified && ! m_bMaxSpecified)
+ rIF.getMinMax (min, max);
+
+ if (m_bMinSpecified)
+ min = m_dMinPixel;
+ if (m_bMaxSpecified)
+ max = m_dMaxPixel;
+
+ DialogGetImageMinMax dialogMinMax (m_frame, rIF, min, max);
+ int retVal = dialogMinMax.ShowModal();
+ if (retVal == wxID_OK) {
+ m_bMinSpecified = true;
+ m_bMaxSpecified = true;
+ m_dMinPixel = dialogMinMax.getMinimum();
+ m_dMaxPixel = dialogMinMax.getMaximum();
+ OnUpdate (this, NULL);
+ }
}
wxMenu *view_menu = new wxMenu;
view_menu->Append(IFMENU_VIEW_WINDOW_AUTO, "&Window auto");
+ view_menu->Append(IFMENU_VIEW_WINDOW_MINMAX, "&Set Window Min/Max");
wxMenu *help_menu = new wxMenu;
help_menu->Append(MAINMENU_HELP_ABOUT, "&About");
double min, max;
rIF.getMinMax (min, max);
if (! m_bMinSpecified)
- m_minPixel = min;
+ m_dMinPixel = min;
if (! m_bMaxSpecified)
- m_maxPixel = max;
+ m_dMaxPixel = max;
}
- double scaleWidth = m_maxPixel - m_minPixel;
+ double scaleWidth = m_dMaxPixel - m_dMinPixel;
unsigned char imageData [nx * ny * 3];
for (int ix = 0; ix < nx; ix++) {
for (int iy = 0; iy < ny; iy++) {
- double scaleValue = ((v[ix][iy] - m_minPixel) / scaleWidth) * 255;
+ double scaleValue = ((v[ix][iy] - m_dMinPixel) / scaleWidth) * 255;
int intensity = static_cast<int>(scaleValue + 0.5);
intensity = clamp (intensity, 0, 255);
int baseAddr = ((ny - 1 - iy) * nx + ix) * 3;
m_bitmap = image.ConvertToBitmap();
}
- if (m_canvas) {
+ if (m_canvas)
m_canvas->Refresh();
- }
-
-#ifdef __WXMSW__
- if (m_canvas)
- m_canvas->Refresh();
-#else
- if (m_canvas) {
- wxClientDC dc(m_canvas);
- dc.Clear();
- OnDraw (&dc);
- }
-#endif
}
bool
ostringstream os;
os << "Phantom " << namePhantom << " (" << static_cast<int>(idPhantom) << ")\n";
*theApp->getLog() << os.str().c_str();
- const Phantom& rPhantom = GetDocument()->getPhantom();
#if DEBUG
+ const Phantom& rPhantom = GetDocument()->getPhantom();
rPhantom.print();
#endif
}
void
PhantomView::OnProjections (wxCommandEvent& event)
{
+ const Phantom& rPhantom = GetDocument()->getPhantom();
+ ProjectionFileDocument* pProjectionDoc = dynamic_cast<ProjectionFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.pj", wxDOC_SILENT));
+ Projections& rProj = pProjectionDoc->getProjections();
+ Scanner theScanner (rPhantom, "parallel", 367, 320, 2, PI);
+ rProj.initFromScanner (theScanner);
+ theScanner.collectProjections (rProj, rPhantom, 0, TRACE_NONE);
+ pProjectionDoc->Modify(true);
+ pProjectionDoc->UpdateAllViews(this);
}
ImageFileDocument* pRasterDoc = dynamic_cast<ImageFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.if", wxDOC_SILENT));
ImageFile& imageFile = pRasterDoc->getImageFile();
imageFile.setArraySize (256, 256);
- imageFile.arrayDataClear();
rPhantom.convertToImagefile (imageFile, 1, TRACE_NONE);
pRasterDoc->Modify(true);
pRasterDoc->UpdateAllViews(this);
void
PhantomView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
{
- if (m_canvas) {
+ if (m_canvas)
m_canvas->Refresh();
- }
-
-#ifdef __WXMSW__
- if (m_canvas)
- m_canvas->Refresh();
-#else
- if (m_canvas) {
- wxClientDC dc(m_canvas);
- dc.Clear();
- OnDraw (&dc);
- }
-#endif
}
bool
const Projections& rProj = GetDocument()->getProjections();
const int nDet = rProj.nDet();
const int nView = rProj.nView();
- const DetectorArray& detarray = rProj.getDetectorArray(0);
- const DetectorValue* detval = detarray.detValues();
- double min = detval[0];
- double max = detval[0];
- for (int iy = 0; iy < nView; iy++) {
- const DetectorArray& detarray = rProj.getDetectorArray(iy);
- const DetectorValue* detval = detarray.detValues();
- for (int ix = 0; ix < nDet; ix++) {
- if (min > detval[ix])
- min = detval[ix];
- else if (max < detval[ix])
- max = detval[ix];
- }
- }
+ if (nDet != 0 && nView != 0) {
+ const DetectorArray& detarray = rProj.getDetectorArray(0);
+ const DetectorValue* detval = detarray.detValues();
+ double min = detval[0];
+ double max = detval[0];
+ for (int iy = 0; iy < nView; iy++) {
+ const DetectorArray& detarray = rProj.getDetectorArray(iy);
+ const DetectorValue* detval = detarray.detValues();
+ for (int ix = 0; ix < nDet; ix++) {
+ if (min > detval[ix])
+ min = detval[ix];
+ else if (max < detval[ix])
+ max = detval[ix];
+ }
+ }
- unsigned char imageData [nDet * nView * 3];
- double scale = (max - min) / 255;
- for (int iy = 0; iy < nView; iy++) {
- const DetectorArray& detarray = rProj.getDetectorArray(iy);
- const DetectorValue* detval = detarray.detValues();
- for (int ix = 0; ix < nDet; ix++) {
- int intensity = static_cast<int>(((detval[ix] - min) / scale) + 0.5);
- intensity = clamp(intensity, 0, 255);
- int baseAddr = (iy * nDet + ix) * 3;
- imageData[baseAddr] = imageData[baseAddr+1] = imageData[baseAddr+2] = intensity;
- }
- }
- wxImage image (nDet, nView, imageData, true);
- m_bitmap = image.ConvertToBitmap();
-
- if (m_canvas) {
- m_canvas->Refresh();
+ unsigned char imageData [nDet * nView * 3];
+ double scale = (max - min) / 255;
+ for (int iy = 0; iy < nView; iy++) {
+ const DetectorArray& detarray = rProj.getDetectorArray(iy);
+ const DetectorValue* detval = detarray.detValues();
+ for (int ix = 0; ix < nDet; ix++) {
+ int intensity = static_cast<int>(((detval[ix] - min) / scale) + 0.5);
+ intensity = clamp(intensity, 0, 255);
+ int baseAddr = (iy * nDet + ix) * 3;
+ imageData[baseAddr] = imageData[baseAddr+1] = imageData[baseAddr+2] = intensity;
+ }
+ }
+ wxImage image (nDet, nView, imageData, true);
+ m_bitmap = image.ConvertToBitmap();
}
-#ifdef __WXMSW__
- if (m_canvas)
- m_canvas->Refresh();
-#else
- if (m_canvas) {
- wxClientDC dc(m_canvas);
- dc.Clear();
- OnDraw (&dc);
- }
-#endif
+ if (m_canvas)
+ m_canvas->Refresh();
}
bool
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: views.h,v 1.2 2000/07/15 08:36:13 kevin Exp $
+** $Id: views.h,v 1.3 2000/07/18 03:14:35 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
wxFrame *m_frame;
bool m_bMinSpecified;
bool m_bMaxSpecified;
- double m_minPixel;
- double m_maxPixel;
+ double m_dMinPixel;
+ double m_dMaxPixel;
public:
ImageFileView(void);
bool OnClose (bool deleteWindow = true);
void OnProperties (wxCommandEvent& event);
void OnWindowAuto (wxCommandEvent& event);
+ void OnWindowMinMax (wxCommandEvent& event);
ImageFileDocument* GetDocument(void)
{ return dynamic_cast<ImageFileDocument*>(wxView::GetDocument()); }