1 /*****************************************************************************
5 ** Purpose: View & Canvas routines for CTSim program
6 ** Programmer: Kevin Rosenberg
7 ** Date Started: July 2000
9 ** This is part of the CTSim program
10 ** Copyright (C) 1983-2000 Kevin Rosenberg
12 ** $Id: views.cpp,v 1.34 2000/12/20 20:08:48 kevin Exp $
14 ** This program is free software; you can redistribute it and/or modify
15 ** it under the terms of the GNU General Public License (version 2) as
16 ** published by the Free Software Foundation.
18 ** This program is distributed in the hope that it will be useful,
19 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ** GNU General Public License for more details.
23 ** You should have received a copy of the GNU General Public License
24 ** along with this program; if not, write to the Free Software
25 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 ******************************************************************************/
28 // For compilers that support precompilation, includes "wx/wx.h".
29 #include "wx/wxprec.h"
39 #if !wxUSE_DOC_VIEW_ARCHITECTURE
40 #error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h!
44 #include "wx/progdlg.h"
51 #include "dlgprojections.h"
52 #include "dlgreconstruct.h"
53 #include "backprojectors.h"
54 #include "reconstruct.h"
57 #if defined(MSVC) || HAVE_SSTREAM
\r
60 #include <sstream_subst>
\r
66 BEGIN_EVENT_TABLE(ImageFileCanvas, wxScrolledWindow)
67 EVT_MOUSE_EVENTS(ImageFileCanvas::OnMouseEvent)
71 ImageFileCanvas::ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style)
72 : wxScrolledWindow(frame, -1, pos, size, style)
80 ImageFileCanvas::OnDraw(wxDC& dc)
83 m_pView->OnDraw(& dc);
87 ImageFileCanvas::DrawRubberBandCursor (wxDC& dc, int x, int y)
\r
89 const ImageFile& rIF = m_pView->GetDocument()->getImageFile();
\r
90 ImageFileArrayConst v = rIF.getArray();
\r
94 dc.SetLogicalFunction (wxINVERT);
\r
95 dc.SetPen (*wxGREEN_PEN);
\r
96 dc.DrawLine (0, y, nx, y);
\r
97 dc.DrawLine (x, 0, x, ny);
\r
98 dc.SetLogicalFunction (wxCOPY);
\r
102 ImageFileCanvas::GetCurrentCursor (int& x, int& y)
\r
107 if (m_xCursor >= 0 && m_yCursor >= 0)
\r
114 ImageFileCanvas::OnMouseEvent(wxMouseEvent& event)
122 wxPoint pt(event.GetLogicalPosition(dc));
124 if (event.RightIsDown()) {
\r
125 const ImageFile& rIF = m_pView->GetDocument()->getImageFile();
\r
126 ImageFileArrayConst v = rIF.getArray();
\r
130 if (pt.x >= 0 && pt.x < nx && pt.y >= 0 && pt.y < ny) {
\r
131 std::ostringstream os;
\r
132 os << "Image value (" << pt.x << "," << pt.y << ") = " << v[pt.x][ny - 1 - pt.y] << "\n";
\r
133 *theApp->getLog() << os.str().c_str();
\r
135 *theApp->getLog() << "Mouse out of image range (" << pt.x << "," << pt.y << ")\n";
\r
137 else if (event.LeftIsDown() || event.LeftUp()) {
\r
138 const ImageFile& rIF = m_pView->GetDocument()->getImageFile();
\r
139 ImageFileArrayConst v = rIF.getArray();
\r
143 if (pt.x >= 0 && pt.x < nx && pt.y >= 0 && pt.y < ny) {
\r
144 if (m_xCursor >= 0 && m_yCursor >= 0) {
\r
145 DrawRubberBandCursor (dc, m_xCursor, m_yCursor);
\r
147 DrawRubberBandCursor (dc, pt.x, pt.y);
\r
151 *theApp->getLog() << "Mouse out of image range (" << pt.x << "," << pt.y << ")\n";
\r
153 if (event.LeftUp()) {
\r
154 std::ostringstream os;
\r
155 os << "Selected column" << pt.x << " and row" << pt.y << "\n";
\r
156 *theApp->getLog() << os.str().c_str();
\r
162 IMPLEMENT_DYNAMIC_CLASS(ImageFileView, wxView)
164 BEGIN_EVENT_TABLE(ImageFileView, wxView)
165 EVT_MENU(IFMENU_FILE_PROPERTIES, ImageFileView::OnProperties)
166 EVT_MENU(IFMENU_VIEW_SCALE_MINMAX, ImageFileView::OnScaleMinMax)
167 EVT_MENU(IFMENU_VIEW_SCALE_AUTO, ImageFileView::OnScaleAuto)
\r
168 EVT_MENU(IFMENU_PLOT_ROW, ImageFileView::OnPlotRow)
169 EVT_MENU(IFMENU_PLOT_COL, ImageFileView::OnPlotCol)
\r
172 ImageFileView::ImageFileView(void)
173 : wxView(), m_canvas(NULL), m_frame(NULL), m_bMinSpecified(false), m_bMaxSpecified(false)
177 ImageFileView::~ImageFileView(void)
182 ImageFileView::OnProperties (wxCommandEvent& event)
184 double min, max, mean, mode, median, stddev;
185 const ImageFile& rIF = GetDocument()->getImageFile();
186 if (rIF.nx() == 0 || rIF.ny() == 0)
187 *theApp->getLog() << "Properties: empty imagefile\n";
189 const std::string& rFilename = rIF.getFilename();
190 rIF.statistics (min, max, mean, mode, median, stddev);
191 std::ostringstream os;
192 os << "file: " << rFilename << "\nmin: "<<min<<"\nmax: "<<max<<"\nmean: "<<mean<<"\nmedian: "<<median<<"\nmode: "<<mode<<"\nstddev: "<<stddev << "\n";
193 *theApp->getLog() << os.str().c_str();
194 wxMessageDialog dialogMsg (m_frame, os.str().c_str(), "Imagefile Properties", wxOK | wxICON_INFORMATION);
195 dialogMsg.ShowModal();
200 ImageFileView::OnScaleAuto (wxCommandEvent& event)
202 const ImageFile& rIF = GetDocument()->getImageFile();
203 double min, max, mean, mode, median, stddev;
\r
204 rIF.statistics(min, max, mean, mode, median, stddev);
\r
205 DialogAutoScaleParameters dialogAutoScale (m_frame, mean, mode, median, stddev, m_dAutoScaleFactor);
206 int iRetVal = dialogAutoScale.ShowModal();
207 if (iRetVal == wxID_OK) {
208 m_bMinSpecified = true;
209 m_bMaxSpecified = true;
211 if (dialogAutoScale.getMinMax (&dMin, &dMax)) {
214 m_dAutoScaleFactor = dialogAutoScale.getAutoScaleFactor();
215 OnUpdate (this, NULL);
\r
221 ImageFileView::OnScaleMinMax (wxCommandEvent& event)
223 const ImageFile& rIF = GetDocument()->getImageFile();
225 if (! m_bMinSpecified && ! m_bMaxSpecified)
226 rIF.getMinMax (min, max);
233 DialogGetMinMax dialogMinMax (m_frame, "Set Image Minimum & Maximum", min, max);
234 int retVal = dialogMinMax.ShowModal();
235 if (retVal == wxID_OK) {
236 m_bMinSpecified = true;
237 m_bMaxSpecified = true;
238 m_dMinPixel = dialogMinMax.getMinimum();
239 m_dMaxPixel = dialogMinMax.getMaximum();
240 OnUpdate (this, NULL);
246 ImageFileView::CreateCanvas (wxView *view, wxFrame *parent)
248 ImageFileCanvas* pCanvas;
250 parent->GetClientSize(&width, &height);
252 pCanvas = new ImageFileCanvas (dynamic_cast<ImageFileView*>(view), parent, wxPoint(0, 0), wxSize(width, height), 0);
254 pCanvas->SetScrollbars(20, 20, 50, 50);
255 pCanvas->SetBackgroundColour(*wxWHITE);
262 ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view)
264 wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, theApp->getMainFrame(), -1, "ImageFile Frame", wxPoint(-1, -1), wxSize(0, 0), wxDEFAULT_FRAME_STYLE);
266 wxMenu *file_menu = new wxMenu;
268 file_menu->Append(MAINMENU_FILE_CREATE_PHANTOM, "Cr&eate Phantom...");
269 file_menu->Append(wxID_OPEN, "&Open...");
270 file_menu->Append(wxID_SAVE, "&Save");
271 file_menu->Append(wxID_SAVEAS, "Save &As...");
272 file_menu->Append(wxID_CLOSE, "&Close");
274 file_menu->AppendSeparator();
275 file_menu->Append(IFMENU_FILE_PROPERTIES, "P&roperties");
277 file_menu->AppendSeparator();
278 file_menu->Append(wxID_PRINT, "&Print...");
279 file_menu->Append(wxID_PRINT_SETUP, "Print &Setup...");
280 file_menu->Append(wxID_PREVIEW, "Print Pre&view");
282 wxMenu *view_menu = new wxMenu;
283 view_menu->Append(IFMENU_VIEW_SCALE_MINMAX, "Display Scale &Set...");
284 view_menu->Append(IFMENU_VIEW_SCALE_AUTO, "Display Scale &Auto...");
286 wxMenu *plot_menu = new wxMenu;
\r
287 plot_menu->Append (IFMENU_PLOT_ROW, "Plot &Row");
\r
288 plot_menu->Append (IFMENU_PLOT_COL, "Plot &Column");
\r
290 wxMenu *help_menu = new wxMenu;
291 help_menu->Append(MAINMENU_HELP_ABOUT, "&About");
293 wxMenuBar *menu_bar = new wxMenuBar;
295 menu_bar->Append(file_menu, "&File");
296 menu_bar->Append(view_menu, "&View");
\r
297 menu_bar->Append(plot_menu, "&Plot");
298 menu_bar->Append(help_menu, "&Help");
300 subframe->SetMenuBar(menu_bar);
302 subframe->Centre(wxBOTH);
309 ImageFileView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
311 m_frame = CreateChildFrame(doc, this);
314 m_bMinSpecified = false;
315 m_bMaxSpecified = false;
316 m_dAutoScaleFactor = 1.;
319 m_frame->GetClientSize (&width, &height);
320 m_frame->SetTitle("ImageFileView");
321 m_canvas = CreateCanvas (this, m_frame);
323 int x, y; // X requires a forced resize
324 m_frame->GetSize(&x, &y);
325 m_frame->SetSize(-1, -1, x, y);
326 m_frame->SetFocus();
\r
334 ImageFileView::OnDraw (wxDC* dc)
337 dc->DrawBitmap(m_bitmap, 0, 0, false);
339 int xCursor, yCursor;
\r
340 if (m_canvas->GetCurrentCursor (xCursor, yCursor))
\r
341 m_canvas->DrawRubberBandCursor (*dc, xCursor, yCursor);
\r
346 ImageFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
348 const ImageFile& rIF = dynamic_cast<ImageFileDocument*>(GetDocument())->getImageFile();
349 ImageFileArrayConst v = rIF.getArray();
352 if (v != NULL && nx != 0 && ny != 0) {
353 if (! m_bMinSpecified || ! m_bMaxSpecified) {
355 rIF.getMinMax (min, max);
356 if (! m_bMinSpecified)
358 if (! m_bMaxSpecified)
361 double scaleWidth = m_dMaxPixel - m_dMinPixel;
363 unsigned char* imageData = new unsigned char [nx * ny * 3];
364 for (int ix = 0; ix < nx; ix++) {
365 for (int iy = 0; iy < ny; iy++) {
366 double scaleValue = ((v[ix][iy] - m_dMinPixel) / scaleWidth) * 255;
367 int intensity = static_cast<int>(scaleValue + 0.5);
368 intensity = clamp (intensity, 0, 255);
369 int baseAddr = ((ny - 1 - iy) * nx + ix) * 3;
370 imageData[baseAddr] = imageData[baseAddr+1] = imageData[baseAddr+2] = intensity;
373 wxImage image (nx, ny, imageData, true);
374 m_bitmap = image.ConvertToBitmap();
378 xSize = clamp (xSize, 0, 800);
379 ySize = clamp (ySize, 0, 800);
380 m_frame->SetClientSize (xSize, ySize);
381 m_canvas->SetScrollbars(20, 20, nx/20, ny/20);
382 m_canvas->SetBackgroundColour(*wxWHITE);
\r
390 ImageFileView::OnClose (bool deleteWindow)
392 if (!GetDocument()->Close())
396 m_canvas->m_pView = NULL;
398 wxString s(theApp->GetAppName());
400 m_frame->SetTitle(s);
412 #include "wx/plot.h"
\r
415 ImageFileView::OnPlotRow (wxCommandEvent& event)
\r
417 int xCursor, yCursor;
\r
418 if (! m_canvas->GetCurrentCursor (xCursor, yCursor)) {
\r
419 *theApp->getLog() << "No row selected. Please use left mouse button on image to select row\n";
\r
423 const ImageFile& rIF = dynamic_cast<ImageFileDocument*>(GetDocument())->getImageFile();
\r
424 ImageFileArrayConst v = rIF.getArray();
\r
428 if (v != NULL && yCursor < ny) {
\r
429 double* pX = new double [nx];
\r
430 double* pY = new double [nx];
\r
431 for (int i = 0; i < nx; i++) {
\r
433 pY[i] = v[i][yCursor];
\r
435 PlotFileDocument* pPlotDoc = dynamic_cast<PlotFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.plt", wxDOC_SILENT));
\r
437 sys_error (ERR_SEVERE, "Internal error: unable to create Plot file");
\r
439 PlotFile& rPlotFile = pPlotDoc->getPlotFile();
\r
440 std::ostringstream title;
\r
441 title << "Row " << yCursor;
\r
442 rPlotFile.setTitle(title.str());
\r
443 rPlotFile.setXLabel("Column");
\r
444 rPlotFile.setYLabel("Pixel Value");
\r
445 rPlotFile.setCurveSize (2, nx);
\r
446 rPlotFile.addColumn (0, pX);
\r
447 rPlotFile.addColumn (1, pY);
\r
451 pPlotDoc->Modify(true);
\r
457 ImageFileView::OnPlotCol (wxCommandEvent& event)
\r
459 int xCursor, yCursor;
\r
460 if (! m_canvas->GetCurrentCursor (xCursor, yCursor)) {
\r
461 // os << "No column selected. Please use left mouse button on image to select column\n";
\r
465 const ImageFile& rIF = dynamic_cast<ImageFileDocument*>(GetDocument())->getImageFile();
\r
466 ImageFileArrayConst v = rIF.getArray();
\r
470 if (v != NULL && xCursor < nx) {
\r
471 double* pX = new double [ny];
\r
472 double* pY = new double [ny];
\r
473 double minVal = v[xCursor][0];
\r
474 double maxVal = minVal;
\r
475 for (int i = 0; i < ny; i++) {
\r
476 double y = v[xCursor][i];
\r
479 else if (maxVal > y)
\r
484 PlotFileDocument* pPlotDoc = dynamic_cast<PlotFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.plt", wxDOC_SILENT));
\r
486 sys_error (ERR_SEVERE, "Internal error: unable to create Plot file");
\r
488 PlotFile& rPlotFile = pPlotDoc->getPlotFile();
\r
489 std::ostringstream title;
\r
490 title << "Column " << xCursor;
\r
491 rPlotFile.setTitle(title.str());
\r
492 rPlotFile.setXLabel("Row");
\r
493 rPlotFile.setYLabel("Pixel Value");
\r
494 rPlotFile.setCurveSize (2, nx);
\r
495 rPlotFile.addColumn (0, pX);
\r
496 rPlotFile.addColumn (1, pY);
\r
500 pPlotDoc->Modify(true);
\r
507 PhantomCanvas::PhantomCanvas (PhantomView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style)
508 : wxScrolledWindow(frame, -1, pos, size, style)
514 PhantomCanvas::OnDraw(wxDC& dc)
517 m_pView->OnDraw(& dc);
523 IMPLEMENT_DYNAMIC_CLASS(PhantomView, wxView)
525 BEGIN_EVENT_TABLE(PhantomView, wxView)
526 EVT_MENU(PHMMENU_FILE_PROPERTIES, PhantomView::OnProperties)
527 EVT_MENU(PHMMENU_PROCESS_RASTERIZE, PhantomView::OnRasterize)
528 EVT_MENU(PHMMENU_PROCESS_PROJECTIONS, PhantomView::OnProjections)
531 PhantomView::PhantomView(void)
532 : wxView(), m_canvas(NULL), m_frame(NULL)
534 m_iDefaultNDet = 367;
535 m_iDefaultNView = 320;
536 m_iDefaultNSample = 2;
537 m_dDefaultRotation = 2;
538 m_dDefaultFocalLength = 2;
539 m_dDefaultFieldOfView = 1;
540 m_iDefaultGeometry = Scanner::GEOMETRY_PARALLEL;
541 m_iDefaultTrace = Trace::TRACE_NONE;
544 PhantomView::~PhantomView(void)
549 PhantomView::OnProperties (wxCommandEvent& event)
551 const int idPhantom = GetDocument()->getPhantomID();
552 const wxString& namePhantom = GetDocument()->getPhantomName();
553 std::ostringstream os;
554 os << "Phantom " << namePhantom.c_str() << " (" << idPhantom << ")\n";
555 *theApp->getLog() << os.str().c_str();
557 const Phantom& rPhantom = GetDocument()->getPhantom();
564 PhantomView::OnProjections (wxCommandEvent& event)
566 DialogGetProjectionParameters dialogProjection (m_frame, m_iDefaultNDet, m_iDefaultNView, m_iDefaultNSample, m_dDefaultRotation, m_dDefaultFocalLength, m_dDefaultFieldOfView, m_iDefaultGeometry, m_iDefaultTrace);
567 int retVal = dialogProjection.ShowModal();
568 if (retVal == wxID_OK) {
569 m_iDefaultNDet = dialogProjection.getNDet();
570 m_iDefaultNView = dialogProjection.getNView();
571 m_iDefaultNSample = dialogProjection.getNSamples();
572 m_iDefaultTrace = dialogProjection.getTrace();
573 m_dDefaultRotation = dialogProjection.getRotAngle();
574 m_dDefaultFocalLength = dialogProjection.getFocalLengthRatio();
575 m_dDefaultFieldOfView = dialogProjection.getFieldOfViewRatio();
576 wxString sGeometry = dialogProjection.getGeometry();
577 m_iDefaultGeometry = Scanner::convertGeometryNameToID (sGeometry.c_str());
579 if (m_iDefaultNDet > 0 && m_iDefaultNView > 0 && sGeometry != "") {
580 const Phantom& rPhantom = GetDocument()->getPhantom();
581 ProjectionFileDocument* pProjectionDoc = dynamic_cast<ProjectionFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.pj", wxDOC_SILENT));
\r
582 if (! pProjectionDoc) {
\r
583 sys_error (ERR_SEVERE, "Unable to create projection document");
\r
586 Projections& rProj = pProjectionDoc->getProjections();
587 Scanner theScanner (rPhantom, sGeometry.c_str(), m_iDefaultNDet, m_iDefaultNView, m_iDefaultNSample, m_dDefaultRotation, m_dDefaultFocalLength, m_dDefaultFieldOfView);
588 if (theScanner.fail()) {
589 *theApp->getLog() << "Failed making scanner: " << theScanner.failMessage().c_str() << "\n";
592 rProj.initFromScanner (theScanner);
593 m_dDefaultRotation /= PI; // convert back to PI units
595 if (m_iDefaultTrace > Trace::TRACE_CONSOLE) {
596 ProjectionsDialog dialogProjections (theScanner, rProj, rPhantom, m_iDefaultTrace, dynamic_cast<wxWindow*>(m_frame));
597 for (int iView = 0; iView < rProj.nView(); iView++) {
600 if (dialogProjections.isCancelled() || ! dialogProjections.projectView (iView)) {
601 pProjectionDoc->DeleteAllViews();
606 while (dialogProjections.isPaused()) {
612 wxProgressDialog dlgProgress (wxString("Projection"), wxString("Projection Progress"), rProj.nView() + 1, m_frame, wxPD_CAN_ABORT);
613 for (int i = 0; i < rProj.nView(); i++) {
614 theScanner.collectProjections (rProj, rPhantom, i, 1, true, m_iDefaultTrace);
615 if (! dlgProgress.Update (i+1)) {
616 pProjectionDoc->DeleteAllViews();
622 std::ostringstream os;
623 os << "Projections for " << rPhantom.name() << ": nDet=" << m_iDefaultNDet << ", nView=" << m_iDefaultNView << ", nSamples=" << m_iDefaultNSample << ", RotAngle=" << m_dDefaultRotation << ", FocalLengthRatio=" << m_dDefaultFocalLength << ", FieldOfViewRatio=" << m_dDefaultFieldOfView << ", Geometry=" << sGeometry.c_str();
624 rProj.setRemark (os.str());
625 *theApp->getLog() << os.str().c_str() << "\n";
629 ProjectionFileView* projView = dynamic_cast<ProjectionFileView*>(pProjectionDoc->GetFirstView());
\r
631 projView->getFrame()->SetFocus();
\r
632 projView->OnUpdate (projView, NULL);
\r
634 if (wxView* pView = pProjectionDoc->GetFirstView()) {
635 if (wxFrame* pFrame = pView->GetFrame()) {
639 theApp->getDocManager()->ActivateView (pView, true, false);
642 pProjectionDoc->Modify(true);
643 pProjectionDoc->UpdateAllViews(this);
650 PhantomView::OnRasterize (wxCommandEvent& event)
652 DialogGetRasterParameters dialogRaster (m_frame, 256, 256, 1);
653 int retVal = dialogRaster.ShowModal();
654 if (retVal == wxID_OK) {
655 int xSize = dialogRaster.getXSize();
656 int ySize = dialogRaster.getYSize();
657 int nSamples = dialogRaster.getNSamples();
660 if (xSize > 0 && ySize > 0) {
661 const Phantom& rPhantom = GetDocument()->getPhantom();
662 ImageFileDocument* pRasterDoc = dynamic_cast<ImageFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.if", wxDOC_SILENT));
\r
663 if (! pRasterDoc) {
\r
664 sys_error (ERR_SEVERE, "Unable to create image file");
\r
667 ImageFile& imageFile = pRasterDoc->getImageFile();
669 imageFile.setArraySize (xSize, ySize);
670 wxProgressDialog dlgProgress (wxString("Rasterize"), wxString("Rasterization Progress"), imageFile.nx() + 1, m_frame, wxPD_CAN_ABORT);
671 for (unsigned int i = 0; i < imageFile.nx(); i++) {
672 rPhantom.convertToImagefile (imageFile, nSamples, Trace::TRACE_NONE, i, 1, true);
673 if (! dlgProgress.Update(i+1)) {
674 pRasterDoc->DeleteAllViews();
678 pRasterDoc->Modify(true);
679 pRasterDoc->UpdateAllViews(this);
680 ImageFileView* rasterView = dynamic_cast<ImageFileView*>(pRasterDoc->GetFirstView());
\r
682 rasterView->getFrame()->SetFocus();
\r
683 rasterView->OnUpdate (rasterView, NULL);
\r
686 std::ostringstream os;
687 os << "Rasterize Phantom " << rPhantom.name() << ": XSize=" << xSize << ", YSize=" << ySize << ", nSamples=" << nSamples << "\n";
688 *theApp->getLog() << os.str().c_str();
695 PhantomView::CreateCanvas (wxView *view, wxFrame *parent)
697 PhantomCanvas* pCanvas;
699 parent->GetClientSize(&width, &height);
701 pCanvas = new PhantomCanvas (dynamic_cast<PhantomView*>(view), parent, wxPoint(0, 0), wxSize(width, height), 0);
703 pCanvas->SetBackgroundColour(*wxWHITE);
710 PhantomView::CreateChildFrame(wxDocument *doc, wxView *view)
712 wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, theApp->getMainFrame(), -1, "Phantom Frame", wxPoint(10, 10), wxSize(256, 256), wxDEFAULT_FRAME_STYLE);
714 wxMenu *file_menu = new wxMenu;
716 file_menu->Append(MAINMENU_FILE_CREATE_PHANTOM, "Cr&eate Phantom...");
717 file_menu->Append(wxID_OPEN, "&Open...");
718 file_menu->Append(wxID_CLOSE, "&Close");
720 file_menu->AppendSeparator();
721 file_menu->Append(PHMMENU_FILE_PROPERTIES, "P&roperties");
723 file_menu->AppendSeparator();
724 file_menu->Append(wxID_PRINT, "&Print...");
725 file_menu->Append(wxID_PRINT_SETUP, "Print &Setup...");
726 file_menu->Append(wxID_PREVIEW, "Print Pre&view");
728 wxMenu *process_menu = new wxMenu;
729 process_menu->Append(PHMMENU_PROCESS_RASTERIZE, "&Rasterize...");
730 process_menu->Append(PHMMENU_PROCESS_PROJECTIONS, "&Projections...");
732 wxMenu *help_menu = new wxMenu;
733 help_menu->Append(MAINMENU_HELP_CONTENTS, "&Contents");
734 help_menu->Append(MAINMENU_HELP_ABOUT, "&About");
736 wxMenuBar *menu_bar = new wxMenuBar;
738 menu_bar->Append(file_menu, "&File");
739 menu_bar->Append(process_menu, "&Process");
740 menu_bar->Append(help_menu, "&Help");
742 subframe->SetMenuBar(menu_bar);
744 subframe->Centre(wxBOTH);
751 PhantomView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
753 m_frame = CreateChildFrame(doc, this);
757 m_frame->GetClientSize(&width, &height);
758 m_frame->SetTitle("PhantomView");
759 m_canvas = CreateCanvas(this, m_frame);
762 int x, y; // X requires a forced resize
763 m_frame->GetSize(&x, &y);
764 m_frame->SetSize(-1, -1, x, y);
775 PhantomView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
782 PhantomView::OnClose (bool deleteWindow)
784 if (!GetDocument()->Close())
788 m_canvas->m_pView = NULL;
790 wxString s(wxTheApp->GetAppName());
792 m_frame->SetTitle(s);
805 PhantomView::OnDraw (wxDC* dc)
808 m_canvas->GetClientSize (&xsize, &ysize);
809 SGPDriver driver (dc, xsize, ysize);
811 const Phantom& rPhantom = GetDocument()->getPhantom();
812 sgp.setColor (C_RED);
818 ProjectionFileCanvas::ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style)
819 : wxScrolledWindow(frame, -1, pos, size, style)
825 ProjectionFileCanvas::OnDraw(wxDC& dc)
828 m_pView->OnDraw(& dc);
831 // ProjectionFileView
833 IMPLEMENT_DYNAMIC_CLASS(ProjectionFileView, wxView)
835 BEGIN_EVENT_TABLE(ProjectionFileView, wxView)
836 EVT_MENU(PJMENU_FILE_PROPERTIES, ProjectionFileView::OnProperties)
837 EVT_MENU(PJMENU_PROCESS_RECONSTRUCT, ProjectionFileView::OnReconstruct)
840 ProjectionFileView::ProjectionFileView(void)
841 : wxView(), m_canvas(NULL), m_frame(NULL)
845 m_iDefaultFilter = SignalFilter::FILTER_ABS_BANDLIMIT;
846 m_dDefaultFilterParam = 1.;
848 m_iDefaultFilterMethod = ProcessSignal::FILTER_METHOD_RFFTW;
849 m_iDefaultFilterGeneration = ProcessSignal::FILTER_GENERATION_INVERSE_FOURIER;
851 m_iDefaultFilterMethod = ProcessSignal::FILTER_METHOD_CONVOLUTION;
852 m_iDefaultFilterGeneration = ProcessSignal::FILTER_GENERATION_DIRECT;
854 m_iDefaultZeropad = 1;
855 m_iDefaultBackprojector = Backprojector::BPROJ_IDIFF3;
856 m_iDefaultInterpolation = Backprojector::INTERP_LINEAR;
857 m_iDefaultInterpParam = 1;
858 m_iDefaultTrace = Trace::TRACE_NONE;
861 ProjectionFileView::~ProjectionFileView(void)
866 ProjectionFileView::OnProperties (wxCommandEvent& event)
868 const Projections& rProj = GetDocument()->getProjections();
869 std::ostringstream os;
870 rProj.printScanInfo(os);
871 *theApp->getLog() << os.str().c_str();
872 wxMessageDialog dialogMsg (m_frame, os.str().c_str(), "Projection File Properties", wxOK | wxICON_INFORMATION);
873 dialogMsg.ShowModal();
878 ProjectionFileView::OnReconstruct (wxCommandEvent& event)
880 DialogGetReconstructionParameters dialogReconstruction (m_frame, m_iDefaultNX, m_iDefaultNY, m_iDefaultFilter, m_dDefaultFilterParam, m_iDefaultFilterMethod, m_iDefaultFilterGeneration, m_iDefaultZeropad, m_iDefaultInterpolation, m_iDefaultInterpParam, m_iDefaultBackprojector, m_iDefaultTrace);
882 int retVal = dialogReconstruction.ShowModal();
883 if (retVal == wxID_OK) {
884 m_iDefaultNX = dialogReconstruction.getXSize();
885 m_iDefaultNY = dialogReconstruction.getYSize();
886 wxString optFilterName = dialogReconstruction.getFilterName();
887 m_iDefaultFilter = SignalFilter::convertFilterNameToID (optFilterName.c_str());
888 m_dDefaultFilterParam = dialogReconstruction.getFilterParam();
889 wxString optFilterMethodName = dialogReconstruction.getFilterMethodName();
890 m_iDefaultFilterMethod = ProcessSignal::convertFilterMethodNameToID(optFilterMethodName.c_str());
891 m_iDefaultZeropad = dialogReconstruction.getZeropad();
892 wxString optFilterGenerationName = dialogReconstruction.getFilterGenerationName();
893 m_iDefaultFilterGeneration = ProcessSignal::convertFilterGenerationNameToID (optFilterGenerationName.c_str());
894 wxString optInterpName = dialogReconstruction.getInterpName();
895 m_iDefaultInterpolation = Backprojector::convertInterpNameToID (optInterpName.c_str());
896 m_iDefaultInterpParam = dialogReconstruction.getInterpParam();
897 wxString optBackprojectName = dialogReconstruction.getBackprojectName();
898 m_iDefaultBackprojector = Backprojector::convertBackprojectNameToID (optBackprojectName.c_str());
899 m_iDefaultTrace = dialogReconstruction.getTrace();
900 if (m_iDefaultNX > 0 && m_iDefaultNY > 0) {
901 ImageFileDocument* pReconDoc = dynamic_cast<ImageFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.if", wxDOC_SILENT));
\r
903 sys_error (ERR_SEVERE, "Unable to create image file");
\r
906 ImageFile& imageFile = pReconDoc->getImageFile();
907 const Projections& rProj = GetDocument()->getProjections();
908 imageFile.setArraySize (m_iDefaultNX, m_iDefaultNY);
910 if (m_iDefaultFilterMethod != ProcessSignal::FILTER_METHOD_CONVOLUTION && m_iDefaultFilterGeneration == ProcessSignal::FILTER_GENERATION_DIRECT && rProj.geometry() != Scanner::GEOMETRY_PARALLEL) {
911 wxMessageBox ("Sorry!\nCurrently, frequency-based filtering with direct filter generation is not support for geometries other than parallel.\nAborting command.", "Not Supported", wxOK | wxICON_WARNING, m_frame);
915 SGPDriver* pSGPDriver = NULL;
917 wxMemoryDC* pDCPlot = NULL;
919 if (m_iDefaultTrace >= Trace::TRACE_PLOT) {
920 bitmap.Create (500, 500);
921 pDCPlot = new wxMemoryDC;
922 pDCPlot->SelectObject (bitmap);
923 pSGPDriver = new SGPDriver (dynamic_cast<wxDC*>pDCPlot, 500, 500);
924 pSGP = new SGP (*pSGPDriver);
926 Reconstructor* pReconstruct = new Reconstructor (rProj, imageFile, optFilterName.c_str(), m_dDefaultFilterParam, optFilterMethodName.c_str(), m_iDefaultZeropad, optFilterGenerationName.c_str(), optInterpName.c_str(), m_iDefaultInterpParam, optBackprojectName.c_str(), m_iDefaultTrace, pSGP);
929 Reconstructor* pReconstruct = new Reconstructor (rProj, imageFile, optFilterName.c_str(), m_dDefaultFilterParam, optFilterMethodName.c_str(), m_iDefaultZeropad, optFilterGenerationName.c_str(), optInterpName.c_str(), m_iDefaultInterpParam, optBackprojectName.c_str(), m_iDefaultTrace);
933 if (m_iDefaultTrace > Trace::TRACE_CONSOLE) {
934 ReconstructDialog* pDlgReconstruct = new ReconstructDialog (*pReconstruct, rProj, imageFile, m_iDefaultTrace, m_frame);
935 for (int iView = 0; iView < rProj.nView(); iView++) {
938 if (pDlgReconstruct->isCancelled() || ! pDlgReconstruct->reconstructView (iView)) {
939 delete pDlgReconstruct;
941 pReconDoc->DeleteAllViews();
946 while (pDlgReconstruct->isPaused()) {
951 delete pDlgReconstruct;
953 wxProgressDialog dlgProgress (wxString("Reconstruction"), wxString("Reconstruction Progress"), rProj.nView() + 1, m_frame, wxPD_CAN_ABORT);
954 for (int i = 0; i < rProj.nView(); i++) {
955 pReconstruct->reconstructView (i, 1);
956 if (! dlgProgress.Update(i + 1)) {
958 pReconDoc->DeleteAllViews();
964 pReconDoc->Modify(true);
965 pReconDoc->UpdateAllViews(this);
966 ImageFileView* rasterView = dynamic_cast<ImageFileView*>(pReconDoc->GetFirstView());
\r
968 rasterView->getFrame()->SetFocus();
\r
969 rasterView->OnUpdate (rasterView, NULL);
\r
971 std::ostringstream os;
972 os << "Reconstruct " << rProj.getFilename() << ": xSize=" << m_iDefaultNX << ", ySize=" << m_iDefaultNY << ", Filter=" << optFilterName.c_str() << ", FilterParam=" << m_dDefaultFilterParam << ", FilterMethod=" << optFilterMethodName.c_str() << ", FilterGeneration=" << optFilterGenerationName.c_str() << ", Zeropad=" << m_iDefaultZeropad << ", Interpolation=" << optInterpName.c_str() << ", InterpolationParam=" << m_iDefaultInterpParam << ", Backprojection=" << optBackprojectName.c_str();
973 *theApp->getLog() << os.str().c_str() << "\n";
974 imageFile.labelAdd (rProj.getLabel());
975 imageFile.labelAdd (Array2dFileLabel::L_HISTORY, os.str().c_str(), timerRecon.timerEnd());
981 ProjectionFileCanvas*
982 ProjectionFileView::CreateCanvas (wxView *view, wxFrame *parent)
984 ProjectionFileCanvas* pCanvas;
986 parent->GetClientSize(&width, &height);
988 pCanvas = new ProjectionFileCanvas (dynamic_cast<ProjectionFileView*>(view), parent, wxPoint(0, 0), wxSize(width, height), 0);
990 pCanvas->SetScrollbars(20, 20, 50, 50);
991 pCanvas->SetBackgroundColour(*wxWHITE);
998 ProjectionFileView::CreateChildFrame(wxDocument *doc, wxView *view)
1000 wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, theApp->getMainFrame(), -1, "Projection Frame", wxPoint(10, 10), wxSize(0, 0), wxDEFAULT_FRAME_STYLE);
1002 wxMenu *file_menu = new wxMenu;
1004 file_menu->Append(MAINMENU_FILE_CREATE_PHANTOM, "Cr&eate Phantom...");
1005 file_menu->Append(wxID_OPEN, "&Open...");
1006 file_menu->Append(wxID_SAVE, "&Save");
1007 file_menu->Append(wxID_SAVEAS, "Save &As...");
1008 file_menu->Append(wxID_CLOSE, "&Close");
1010 file_menu->AppendSeparator();
1011 file_menu->Append(PJMENU_FILE_PROPERTIES, "P&roperties");
1013 file_menu->AppendSeparator();
1014 file_menu->Append(wxID_PRINT, "&Print...");
1015 file_menu->Append(wxID_PRINT_SETUP, "Print &Setup...");
1016 file_menu->Append(wxID_PREVIEW, "Print Pre&view");
1018 wxMenu *process_menu = new wxMenu;
1019 process_menu->Append(PJMENU_PROCESS_RECONSTRUCT, "R&econstruct...");
1021 wxMenu *help_menu = new wxMenu;
1022 help_menu->Append(MAINMENU_HELP_CONTENTS, "&Contents");
1023 help_menu->AppendSeparator();
1024 help_menu->Append(MAINMENU_HELP_ABOUT, "&About");
1026 wxMenuBar *menu_bar = new wxMenuBar;
1028 menu_bar->Append(file_menu, "&File");
1029 menu_bar->Append(process_menu, "&Process");
1030 menu_bar->Append(help_menu, "&Help");
1032 subframe->SetMenuBar(menu_bar);
1034 subframe->Centre(wxBOTH);
1041 ProjectionFileView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
1043 m_frame = CreateChildFrame(doc, this);
1047 m_frame->GetClientSize(&width, &height);
1048 m_frame->SetTitle("ProjectionFileView");
1049 m_canvas = CreateCanvas(this, m_frame);
1052 int x, y; // X requires a forced resize
1053 m_frame->GetSize(&x, &y);
1054 m_frame->SetSize(-1, -1, x, y);
1057 m_frame->Show(true);
1064 ProjectionFileView::OnDraw (wxDC* dc)
1067 dc->DrawBitmap (m_bitmap, 0, 0, false);
1072 ProjectionFileView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
1074 const Projections& rProj = GetDocument()->getProjections();
1075 const int nDet = rProj.nDet();
1076 const int nView = rProj.nView();
1077 if (nDet != 0 && nView != 0) {
1078 const DetectorArray& detarray = rProj.getDetectorArray(0);
1079 const DetectorValue* detval = detarray.detValues();
1080 double min = detval[0];
1081 double max = detval[0];
1082 for (int iy = 0; iy < nView; iy++) {
1083 const DetectorArray& detarray = rProj.getDetectorArray(iy);
1084 const DetectorValue* detval = detarray.detValues();
1085 for (int ix = 0; ix < nDet; ix++) {
1086 if (min > detval[ix])
1088 else if (max < detval[ix])
1093 unsigned char* imageData = new unsigned char [nDet * nView * 3];
1094 double scale = (max - min) / 255;
1095 for (int iy2 = 0; iy2 < nView; iy2++) {
1096 const DetectorArray& detarray = rProj.getDetectorArray (iy2);
1097 const DetectorValue* detval = detarray.detValues();
1098 for (int ix = 0; ix < nDet; ix++) {
1099 int intensity = static_cast<int>(((detval[ix] - min) / scale) + 0.5);
1100 intensity = clamp(intensity, 0, 255);
1101 int baseAddr = (iy2 * nDet + ix) * 3;
1102 imageData[baseAddr] = imageData[baseAddr+1] = imageData[baseAddr+2] = intensity;
1105 wxImage image (nDet, nView, imageData, true);
1106 m_bitmap = image.ConvertToBitmap();
1110 xSize = clamp (xSize, 0, 800);
1111 ySize = clamp (ySize, 0, 800);
1112 m_frame->SetClientSize (xSize, ySize);
1113 m_canvas->SetScrollbars (20, 20, nDet/20, nView/20);
1117 m_canvas->Refresh();
1121 ProjectionFileView::OnClose (bool deleteWindow)
1123 if (!GetDocument()->Close())
1127 m_canvas->m_pView = NULL;
1129 wxString s(wxTheApp->GetAppName());
1131 m_frame->SetTitle(s);
1146 PlotFileCanvas::PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style)
1147 : wxScrolledWindow(frame, -1, pos, size, style)
1153 PlotFileCanvas::OnDraw(wxDC& dc)
1156 m_pView->OnDraw(& dc);
1162 IMPLEMENT_DYNAMIC_CLASS(PlotFileView, wxView)
1164 BEGIN_EVENT_TABLE(PlotFileView, wxView)
1165 EVT_MENU(PJMENU_FILE_PROPERTIES, PlotFileView::OnProperties)
1166 EVT_MENU(PLOTMENU_VIEW_SCALE_MINMAX, PlotFileView::OnScaleMinMax)
\r
1167 EVT_MENU(PLOTMENU_VIEW_SCALE_AUTO, PlotFileView::OnScaleAuto)
\r
1170 PlotFileView::PlotFileView(void)
1171 : wxView(), m_canvas(NULL), m_frame(NULL), m_bMinSpecified(false), m_bMaxSpecified(false)
1175 PlotFileView::~PlotFileView(void)
1180 PlotFileView::OnProperties (wxCommandEvent& event)
1182 const PlotFile& rProj = GetDocument()->getPlotFile();
1183 std::ostringstream os;
\r
1184 os << "Columns: " << rProj.getNumColumns() << ", Records: " << rProj.getNumRecords() << "\n";
1185 *theApp->getLog() << os.str().c_str();
1186 wxMessageDialog dialogMsg (m_frame, os.str().c_str(), "Plot File Properties", wxOK | wxICON_INFORMATION);
1187 dialogMsg.ShowModal();
1192 PlotFileView::OnScaleAuto (wxCommandEvent& event)
\r
1194 const PlotFile& rPlotFile = GetDocument()->getPlotFile();
\r
1195 double min, max, mean, mode, median, stddev;
\r
1196 rPlotFile.statistics (1, min, max, mean, mode, median, stddev);
\r
1197 DialogAutoScaleParameters dialogAutoScale (m_frame, mean, mode, median, stddev, m_dAutoScaleFactor);
\r
1198 int iRetVal = dialogAutoScale.ShowModal();
\r
1199 if (iRetVal == wxID_OK) {
\r
1200 m_bMinSpecified = true;
\r
1201 m_bMaxSpecified = true;
\r
1202 double dMin, dMax;
\r
1203 if (dialogAutoScale.getMinMax (&dMin, &dMax)) {
\r
1204 m_dMinPixel = dMin;
\r
1205 m_dMaxPixel = dMax;
\r
1206 m_dAutoScaleFactor = dialogAutoScale.getAutoScaleFactor();
\r
1207 OnUpdate (this, NULL);
\r
1213 PlotFileView::OnScaleMinMax (wxCommandEvent& event)
\r
1215 const PlotFile& rPlotFile = GetDocument()->getPlotFile();
\r
1218 if (! m_bMinSpecified && ! m_bMaxSpecified) {
\r
1219 if (! rPlotFile.getMinMax (1, min, max)) {
\r
1220 *theApp->getLog() << "Error: unable to find Min/Max\n";
\r
1225 if (m_bMinSpecified)
\r
1226 min = m_dMinPixel;
\r
1227 if (m_bMaxSpecified)
\r
1228 max = m_dMaxPixel;
\r
1230 DialogGetMinMax dialogMinMax (m_frame, "Set Y-axis Minimum & Maximum", min, max);
\r
1231 int retVal = dialogMinMax.ShowModal();
\r
1232 if (retVal == wxID_OK) {
\r
1233 m_bMinSpecified = true;
\r
1234 m_bMaxSpecified = true;
\r
1235 m_dMinPixel = dialogMinMax.getMinimum();
\r
1236 m_dMaxPixel = dialogMinMax.getMaximum();
\r
1237 OnUpdate (this, NULL);
\r
1243 PlotFileView::CreateCanvas (wxView *view, wxFrame *parent)
1245 PlotFileCanvas* pCanvas;
1247 parent->GetClientSize(&width, &height);
1249 pCanvas = new PlotFileCanvas (dynamic_cast<PlotFileView*>(view), parent, wxPoint(0, 0), wxSize(width, height), 0);
1251 pCanvas->SetBackgroundColour(*wxWHITE);
1258 PlotFileView::CreateChildFrame(wxDocument *doc, wxView *view)
1260 wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, theApp->getMainFrame(), -1, "Plot Frame", wxPoint(10, 10), wxSize(500, 300), wxDEFAULT_FRAME_STYLE);
1262 wxMenu *file_menu = new wxMenu;
1264 file_menu->Append(MAINMENU_FILE_CREATE_PHANTOM, "Cr&eate Phantom...");
1265 file_menu->Append(wxID_OPEN, "&Open...");
1266 file_menu->Append(wxID_SAVE, "&Save");
1267 file_menu->Append(wxID_SAVEAS, "Save &As...");
1268 file_menu->Append(wxID_CLOSE, "&Close");
1270 file_menu->AppendSeparator();
1271 file_menu->Append(PJMENU_FILE_PROPERTIES, "P&roperties");
1273 file_menu->AppendSeparator();
1274 file_menu->Append(wxID_PRINT, "&Print...");
1275 file_menu->Append(wxID_PRINT_SETUP, "Print &Setup...");
1276 file_menu->Append(wxID_PREVIEW, "Print Pre&view");
1278 wxMenu *view_menu = new wxMenu;
\r
1279 view_menu->Append(PLOTMENU_VIEW_SCALE_MINMAX, "Display Scale &Set...");
\r
1280 view_menu->Append(PLOTMENU_VIEW_SCALE_AUTO, "Display Scale &Auto...");
\r
1282 wxMenu *help_menu = new wxMenu;
1283 help_menu->Append(MAINMENU_HELP_CONTENTS, "&Contents");
1284 help_menu->AppendSeparator();
1285 help_menu->Append(MAINMENU_HELP_ABOUT, "&About");
1287 wxMenuBar *menu_bar = new wxMenuBar;
1289 menu_bar->Append(file_menu, "&File");
\r
1290 menu_bar->Append(view_menu, "&View");
1291 menu_bar->Append(help_menu, "&Help");
1293 subframe->SetMenuBar(menu_bar);
1295 subframe->Centre(wxBOTH);
1302 PlotFileView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
1304 m_frame = CreateChildFrame(doc, this);
1308 m_frame->GetClientSize(&width, &height);
1309 m_frame->SetTitle ("Plot File");
1310 m_canvas = CreateCanvas (this, m_frame);
1313 int x, y; // X requires a forced resize
1314 m_frame->GetSize(&x, &y);
1315 m_frame->SetSize(-1, -1, x, y);
1318 m_frame->Show(true);
1325 PlotFileView::OnDraw (wxDC* dc)
1327 const PlotFile& rPlotFile = GetDocument()->getPlotFile();
\r
1328 const int iNColumns = rPlotFile.getNumColumns();
\r
1329 const int iNRecords = rPlotFile.getNumRecords();
\r
1331 if (iNColumns > 0 && iNRecords > 0) {
\r
1333 m_canvas->GetClientSize (&xsize, &ysize);
\r
1334 SGPDriver driver (dc, xsize, ysize);
\r
1336 const PlotFile& rPhantom = GetDocument()->getPlotFile();
\r
1337 EZPlot plot (sgp);
\r
1339 if (! rPlotFile.getTitle().empty()) {
\r
1340 std::string s("title ");
\r
1341 s += rPlotFile.getTitle();
\r
1344 if (! rPlotFile.getXLabel().empty()) {
\r
1345 std::string s("xlabel ");
\r
1346 s += rPlotFile.getXLabel();
\r
1349 if (! rPlotFile.getYLabel().empty()) {
\r
1350 std::string s("ylabel ");
\r
1351 s += rPlotFile.getYLabel();
\r
1355 if (m_bMinSpecified) {
\r
1356 std::ostringstream os;
\r
1357 os << "ymin " << m_dMinPixel;
\r
1358 plot.ezset (os.str());
\r
1361 if (m_bMaxSpecified) {
\r
1362 std::ostringstream os;
\r
1363 os << "ymax " << m_dMaxPixel;
\r
1364 plot.ezset (os.str());
\r
1367 plot.ezset("box");
\r
1368 plot.ezset("grid");
\r
1370 double* pdXaxis = new double [iNRecords];
\r
1371 rPlotFile.getColumn (0, pdXaxis);
\r
1373 double* pdY = new double [iNRecords];
\r
1374 for (int iCol = 1; iCol < iNColumns; iCol++) {
\r
1375 rPlotFile.getColumn (iCol, pdY);
\r
1376 plot.addCurve (pdXaxis, pdY, iNRecords);
\r
1388 PlotFileView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
1391 m_canvas->Refresh();
1395 PlotFileView::OnClose (bool deleteWindow)
1397 if (!GetDocument()->Close())
1401 m_canvas->m_pView = NULL;
1403 wxString s(wxTheApp->GetAppName());
1405 m_frame->SetTitle(s);