X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=src%2Fviews.cpp;h=93d49b336da6917fd89d3ffce46677b70a07754b;hp=9188b34714abb25b48898c89476271b96d76c679;hb=7ec2cd66921180a624813dff9f8bac76c6b268cc;hpb=5ec5449357eaae253d6b1026621262480e2efa63 diff --git a/src/views.cpp b/src/views.cpp index 9188b34..93d49b3 100644 --- a/src/views.cpp +++ b/src/views.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: views.cpp,v 1.38 2000/12/25 21:54:26 kevin Exp $ +** $Id: views.cpp,v 1.43 2001/01/01 10:14:34 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 @@ -87,13 +87,13 @@ void ImageFileCanvas::DrawRubberBandCursor (wxDC& dc, int x, int y) { const ImageFile& rIF = m_pView->GetDocument()->getImageFile(); - ImageFileArrayConst v = rIF.getArray(); int nx = rIF.nx(); int ny = rIF.ny(); + int yPt = ny - y - 1; dc.SetLogicalFunction (wxINVERT); dc.SetPen (*wxGREEN_PEN); - dc.DrawLine (0, y, nx, y); + dc.DrawLine (0, yPt, nx, yPt); dc.DrawLine (x, 0, x, ny); dc.SetLogicalFunction (wxCOPY); } @@ -121,38 +121,42 @@ ImageFileCanvas::OnMouseEvent(wxMouseEvent& event) wxPoint pt(event.GetLogicalPosition(dc)); + const ImageFile& rIF = m_pView->GetDocument()->getImageFile(); + ImageFileArrayConst v = rIF.getArray(); + int nx = rIF.nx(); + int ny = rIF.ny(); + const int yPt = ny - 1 - pt.y; if (event.RightIsDown()) { - const ImageFile& rIF = m_pView->GetDocument()->getImageFile(); - ImageFileArrayConst v = rIF.getArray(); - int nx = rIF.nx(); - int ny = rIF.ny(); - if (pt.x >= 0 && pt.x < nx && pt.y >= 0 && pt.y < ny) { std::ostringstream os; - os << "Image value (" << pt.x << "," << pt.y << ") = " << v[pt.x][ny - 1 - pt.y] << "\n"; + os << "Image value (" << pt.x << "," << yPt << ") = " << v[pt.x][yPt]; + if (rIF.isComplex()) { + double dImag = rIF.getImaginaryArray()[pt.x][yPt]; + if (dImag < 0) + os << " - " << -dImag; + else + os << " + " << dImag; + os << "i\n"; + } else + os << "\n"; *theApp->getLog() << os.str().c_str(); } else - *theApp->getLog() << "Mouse out of image range (" << pt.x << "," << pt.y << ")\n"; + *theApp->getLog() << "Mouse out of image range (" << pt.x << "," << yPt << ")\n"; } - else if (event.LeftIsDown() || event.LeftUp()) { - const ImageFile& rIF = m_pView->GetDocument()->getImageFile(); - ImageFileArrayConst v = rIF.getArray(); - int nx = rIF.nx(); - int ny = rIF.ny(); - + else if (event.LeftIsDown() || event.LeftUp() || event.RightUp()) { if (pt.x >= 0 && pt.x < nx && pt.y >= 0 && pt.y < ny) { if (m_xCursor >= 0 && m_yCursor >= 0) { DrawRubberBandCursor (dc, m_xCursor, m_yCursor); } - DrawRubberBandCursor (dc, pt.x, pt.y); + DrawRubberBandCursor (dc, pt.x, yPt); m_xCursor = pt.x; - m_yCursor = pt.y; + m_yCursor = yPt; } else - *theApp->getLog() << "Mouse out of image range (" << pt.x << "," << pt.y << ")\n"; + *theApp->getLog() << "Mouse out of image range (" << pt.x << "," << yPt << ")\n"; } if (event.LeftUp()) { std::ostringstream os; - os << "Selected column " << pt.x << " , row " << pt.y << "\n"; + os << "Selected column " << pt.x << " , row " << yPt << "\n"; *theApp->getLog() << os.str().c_str(); } } @@ -168,6 +172,19 @@ EVT_MENU(IFMENU_VIEW_SCALE_AUTO, ImageFileView::OnScaleAuto) EVT_MENU(IFMENU_COMPARE_IMAGES, ImageFileView::OnCompare) EVT_MENU(IFMENU_COMPARE_ROW, ImageFileView::OnCompareRow) EVT_MENU(IFMENU_COMPARE_COL, ImageFileView::OnCompareCol) +EVT_MENU(IFMENU_PROCESS_INVERTVALUES, ImageFileView::OnInvertValues) +EVT_MENU(IFMENU_PROCESS_SQUARE, ImageFileView::OnSquare) +EVT_MENU(IFMENU_PROCESS_SQRT, ImageFileView::OnSquareRoot) +EVT_MENU(IFMENU_PROCESS_LOG, ImageFileView::OnLog) +EVT_MENU(IFMENU_PROCESS_EXP, ImageFileView::OnExp) +EVT_MENU(IFMENU_PROCESS_FOURIER, ImageFileView::OnFourier) +EVT_MENU(IFMENU_PROCESS_INVERSE_FOURIER, ImageFileView::OnInverseFourier) +#ifdef HAVE_FFTW +EVT_MENU(IFMENU_PROCESS_FFT, ImageFileView::OnFFT) +EVT_MENU(IFMENU_PROCESS_IFFT, ImageFileView::OnIFFT) +#endif +EVT_MENU(IFMENU_PROCESS_MAGNITUDE, ImageFileView::OnMagnitude) +EVT_MENU(IFMENU_PROCESS_PHASE, ImageFileView::OnPhase) EVT_MENU(IFMENU_PLOT_ROW, ImageFileView::OnPlotRow) EVT_MENU(IFMENU_PLOT_COL, ImageFileView::OnPlotCol) END_EVENT_TABLE() @@ -184,15 +201,26 @@ ImageFileView::~ImageFileView(void) void ImageFileView::OnProperties (wxCommandEvent& event) { - double min, max, mean, mode, median, stddev; const ImageFile& rIF = GetDocument()->getImageFile(); if (rIF.nx() == 0 || rIF.ny() == 0) *theApp->getLog() << "Properties: empty imagefile\n"; else { const std::string& rFilename = rIF.getFilename(); - rIF.statistics (min, max, mean, mode, median, stddev); std::ostringstream os; - os << "file: " << rFilename << "\nmin: "<getLog() << os.str().c_str(); wxMessageDialog dialogMsg (m_frame, os.str().c_str(), "Imagefile Properties", wxOK | wxICON_INFORMATION); dialogMsg.ShowModal(); @@ -249,22 +277,22 @@ ImageFileView::OnCompare (wxCommandEvent& event) { std::vector vecIF; theApp->getCompatibleImages (GetDocument(), vecIF); - + if (vecIF.size() == 0) { wxMessageBox("There are no compatible image files open for comparision", "No comparison images"); } else { DialogGetComparisonImage dialogGetCompare(m_frame, "Get Comparison Image", vecIF, true); - + if (dialogGetCompare.ShowModal() == wxID_OK) { - ImageFileDocument* pCompareDoc = dialogGetCompare.getImageFileDocument(); const ImageFile& rIF = GetDocument()->getImageFile(); + ImageFileDocument* pCompareDoc = dialogGetCompare.getImageFileDocument(); const ImageFile& rCompareIF = pCompareDoc->getImageFile(); std::ostringstream os; double min, max, mean, mode, median, stddev; rIF.statistics (min, max, mean, mode, median, stddev); os << rIF.getFilename() << ": minimum=" << min << ", maximum=" << max << ", mean=" << mean << ", mode=" << mode << ", median=" << median << ", stddev=" << stddev << "\n"; rCompareIF.statistics (min, max, mean, mode, median, stddev); - os << rCompareIF.getFilename() << ": minimum=" << min << ", maximum=" << max << ", mean=" << mean << ", mode=" << mode << ", median=" << median << ", stddev=" << stddev << "\n"; + os << pCompareDoc->GetTitle().c_str() << ": minimum=" << min << ", maximum=" << max << ", mean=" << mean << ", mode=" << mode << ", median=" << median << ", stddev=" << stddev << "\n"; os << "\n"; double d, r, e; rIF.comparativeStatistics (rCompareIF, d, r, e); @@ -277,13 +305,13 @@ ImageFileView::OnCompare (wxCommandEvent& event) return; } ImageFile& differenceImage = pDifferenceDoc->getImageFile(); - + differenceImage.setArraySize (rIF.nx(), rIF.ny()); if (! rIF.subtractImages (rCompareIF, differenceImage)) { pDifferenceDoc->DeleteAllViews(); return; } - + if (theApp->getSetModifyNewDocs()) pDifferenceDoc->Modify(true); pDifferenceDoc->UpdateAllViews(this); @@ -294,6 +322,135 @@ ImageFileView::OnCompare (wxCommandEvent& event) } } +void +ImageFileView::OnInvertValues (wxCommandEvent& event) +{ + ImageFile& rIF = GetDocument()->getImageFile(); + rIF.invertPixelValues (rIF); + if (theApp->getSetModifyNewDocs()) + GetDocument()->Modify(TRUE); + GetDocument()->UpdateAllViews(this); +} + +void +ImageFileView::OnSquare (wxCommandEvent& event) +{ + ImageFile& rIF = GetDocument()->getImageFile(); + rIF.square (rIF); + if (theApp->getSetModifyNewDocs()) + GetDocument()->Modify(TRUE); + GetDocument()->UpdateAllViews(this); +} + +void +ImageFileView::OnSquareRoot (wxCommandEvent& event) +{ + ImageFile& rIF = GetDocument()->getImageFile(); + rIF.sqrt (rIF); + if (theApp->getSetModifyNewDocs()) + GetDocument()->Modify(TRUE); + GetDocument()->UpdateAllViews(this); +} + +void +ImageFileView::OnLog (wxCommandEvent& event) +{ + ImageFile& rIF = GetDocument()->getImageFile(); + rIF.log (rIF); + if (theApp->getSetModifyNewDocs()) + GetDocument()->Modify(TRUE); + GetDocument()->UpdateAllViews(this); +} + +void +ImageFileView::OnExp (wxCommandEvent& event) +{ + ImageFile& rIF = GetDocument()->getImageFile(); + rIF.exp (rIF); + if (theApp->getSetModifyNewDocs()) + GetDocument()->Modify(TRUE); + GetDocument()->UpdateAllViews(this); +} + +void +ImageFileView::OnFourier (wxCommandEvent& event) +{ + ImageFile& rIF = GetDocument()->getImageFile(); + wxProgressDialog dlgProgress (wxString("Fourier"), wxString("Fourier Progress"), 1, m_frame, wxPD_APP_MODAL); + rIF.fourier (rIF); + m_bMinSpecified = false; + m_bMaxSpecified = false; + if (theApp->getSetModifyNewDocs()) + GetDocument()->Modify(TRUE); + GetDocument()->UpdateAllViews(this); +} + +#ifdef HAVE_FFTW +void +ImageFileView::OnFFT (wxCommandEvent& event) +{ + ImageFile& rIF = GetDocument()->getImageFile(); + wxProgressDialog dlgProgress (wxString("FFT"), wxString("FFT Progress"), 1, m_frame, wxPD_APP_MODAL); + rIF.fft (rIF); + m_bMinSpecified = false; + m_bMaxSpecified = false; + if (theApp->getSetModifyNewDocs()) + GetDocument()->Modify(TRUE); + GetDocument()->UpdateAllViews(this); +} + +void +ImageFileView::OnIFFT (wxCommandEvent& event) +{ + ImageFile& rIF = GetDocument()->getImageFile(); + wxProgressDialog dlgProgress (wxString("IFFT"), wxString("IFFT Progress"), 1, m_frame, wxPD_APP_MODAL); + rIF.ifft (rIF); + m_bMinSpecified = false; + m_bMaxSpecified = false; + if (theApp->getSetModifyNewDocs()) + GetDocument()->Modify(TRUE); + GetDocument()->UpdateAllViews(this); +} +#endif + +void +ImageFileView::OnInverseFourier (wxCommandEvent& event) +{ + ImageFile& rIF = GetDocument()->getImageFile(); + wxProgressDialog dlgProgress (wxString("Inverse Fourier"), wxString("Inverse Fourier Progress"), 1, m_frame, wxPD_APP_MODAL); + rIF.inverseFourier (rIF); + m_bMinSpecified = false; + m_bMaxSpecified = false; + if (theApp->getSetModifyNewDocs()) + GetDocument()->Modify(TRUE); + GetDocument()->UpdateAllViews(this); +} + +void +ImageFileView::OnMagnitude (wxCommandEvent& event) +{ + ImageFile& rIF = GetDocument()->getImageFile(); + rIF.magnitude (rIF); + m_bMinSpecified = false; + m_bMaxSpecified = false; + if (theApp->getSetModifyNewDocs()) + GetDocument()->Modify(TRUE); + GetDocument()->UpdateAllViews(this); +} + +void +ImageFileView::OnPhase (wxCommandEvent& event) +{ + ImageFile& rIF = GetDocument()->getImageFile(); + rIF.phase (rIF); + m_bMinSpecified = false; + m_bMaxSpecified = false; + if (theApp->getSetModifyNewDocs()) + GetDocument()->Modify(TRUE); + GetDocument()->UpdateAllViews(this); +} + + ImageFileCanvas* ImageFileView::CreateCanvas (wxView *view, wxFrame *parent) { @@ -317,7 +474,8 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view) wxMenu *file_menu = new wxMenu; - file_menu->Append(MAINMENU_FILE_CREATE_PHANTOM, "Cr&eate Phantom..."); + file_menu->Append(MAINMENU_FILE_CREATE_PHANTOM, "Cr&eate Phantom..."); + file_menu->Append(MAINMENU_FILE_CREATE_FILTER, "Create &Filter..."); file_menu->Append(wxID_OPEN, "&Open..."); file_menu->Append(wxID_SAVE, "&Save"); file_menu->Append(wxID_SAVEAS, "Save &As..."); @@ -335,6 +493,25 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view) view_menu->Append(IFMENU_VIEW_SCALE_MINMAX, "Display Scale &Set..."); view_menu->Append(IFMENU_VIEW_SCALE_AUTO, "Display Scale &Auto..."); + wxMenu* process_menu = new wxMenu; + process_menu->Append (IFMENU_PROCESS_INVERTVALUES, "&Invert Values"); + process_menu->Append (IFMENU_PROCESS_SQUARE, "&Square"); + process_menu->Append (IFMENU_PROCESS_SQRT, "Square &Root"); + process_menu->Append (IFMENU_PROCESS_LOG, "&Log"); + process_menu->Append (IFMENU_PROCESS_EXP, "&Exp"); + process_menu->AppendSeparator(); +#ifdef HAVE_FFTW + process_menu->Append (IFMENU_PROCESS_FFT, "&FFT"); + process_menu->Append (IFMENU_PROCESS_IFFT, "&IFFT"); + process_menu->Append (IFMENU_PROCESS_FOURIER, "F&ourier"); + process_menu->Append (IFMENU_PROCESS_INVERSE_FOURIER, "Inverse Fo&urier"); +#else + process_menu->Append (IFMENU_PROCESS_FOURIER, "&Fourier"); + process_menu->Append (IFMENU_PROCESS_INVERSE_FOURIER, "&Inverse Fourier"); +#endif + process_menu->Append (IFMENU_PROCESS_MAGNITUDE, "&Magnitude"); + process_menu->Append (IFMENU_PROCESS_PHASE, "&Phase"); + wxMenu *plot_menu = new wxMenu; plot_menu->Append (IFMENU_PLOT_ROW, "Plot &Row"); plot_menu->Append (IFMENU_PLOT_COL, "Plot &Column"); @@ -343,7 +520,7 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view) compare_menu->Append (IFMENU_COMPARE_IMAGES, "Compare &Images..."); compare_menu->Append (IFMENU_COMPARE_ROW, "Compare &Row"); compare_menu->Append (IFMENU_COMPARE_COL, "Compare &Column"); - + wxMenu *help_menu = new wxMenu; help_menu->Append(MAINMENU_HELP_ABOUT, "&About"); @@ -351,7 +528,8 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view) menu_bar->Append(file_menu, "&File"); menu_bar->Append(view_menu, "&View"); - menu_bar->Append(plot_menu, "&Plot"); + menu_bar->Append(process_menu, "&Process"); + menu_bar->Append(plot_menu, "P&lot"); menu_bar->Append(compare_menu, "&Compare"); menu_bar->Append(help_menu, "&Help"); @@ -501,6 +679,7 @@ ImageFileView::OnPlotRow (wxCommandEvent& event) rPlotFile.addEzsetCommand (title.c_str()); rPlotFile.addEzsetCommand ("xlabel Column"); rPlotFile.addEzsetCommand ("ylabel Pixel Value"); + rPlotFile.addEzsetCommand ("lxfrac 0"); rPlotFile.addEzsetCommand ("box"); rPlotFile.addEzsetCommand ("grid"); rPlotFile.setCurveSize (2, nx); @@ -510,9 +689,9 @@ ImageFileView::OnPlotRow (wxCommandEvent& event) delete pX; delete pY; if (theApp->getSetModifyNewDocs()) - pPlotDoc->Modify(true); + pPlotDoc->Modify(true); + pPlotDoc->UpdateAllViews(); } - } void @@ -548,6 +727,7 @@ ImageFileView::OnPlotCol (wxCommandEvent& event) rPlotFile.addEzsetCommand (title.c_str()); rPlotFile.addEzsetCommand ("xlabel Row"); rPlotFile.addEzsetCommand ("ylabel Pixel Value"); + rPlotFile.addEzsetCommand ("lxfrac 0"); rPlotFile.addEzsetCommand ("box"); rPlotFile.addEzsetCommand ("grid"); rPlotFile.setCurveSize (2, nx); @@ -558,6 +738,7 @@ ImageFileView::OnPlotCol (wxCommandEvent& event) delete pY; if (theApp->getSetModifyNewDocs()) pPlotDoc->Modify(true); + pPlotDoc->UpdateAllViews(); } } @@ -609,6 +790,7 @@ ImageFileView::OnCompareCol (wxCommandEvent& event) rPlotFile.addEzsetCommand (title.c_str()); rPlotFile.addEzsetCommand ("xlabel Row"); rPlotFile.addEzsetCommand ("ylabel Pixel Value"); + rPlotFile.addEzsetCommand ("lxfrac 0"); rPlotFile.addEzsetCommand ("curve 1"); rPlotFile.addEzsetCommand ("color 2"); rPlotFile.addEzsetCommand ("curve 2"); @@ -626,6 +808,7 @@ ImageFileView::OnCompareCol (wxCommandEvent& event) delete pY2; if (theApp->getSetModifyNewDocs()) pPlotDoc->Modify(true); + pPlotDoc->UpdateAllViews(); } } } @@ -646,7 +829,7 @@ ImageFileView::OnCompareRow (wxCommandEvent& event) wxMessageBox ("No compatible images for Row Comparison", "Error"); return; } - + DialogGetComparisonImage dialogGetCompare (m_frame, "Get Comparison Image", vecIFDoc, false); if (dialogGetCompare.ShowModal() == wxID_OK) { @@ -680,6 +863,7 @@ ImageFileView::OnCompareRow (wxCommandEvent& event) rPlotFile.addEzsetCommand (title.c_str()); rPlotFile.addEzsetCommand ("xlabel Column"); rPlotFile.addEzsetCommand ("ylabel Pixel Value"); + rPlotFile.addEzsetCommand ("lxfrac 0"); rPlotFile.addEzsetCommand ("curve 1"); rPlotFile.addEzsetCommand ("color 2"); rPlotFile.addEzsetCommand ("curve 2"); @@ -697,6 +881,7 @@ ImageFileView::OnCompareRow (wxCommandEvent& event) delete pY2; if (theApp->getSetModifyNewDocs()) pPlotDoc->Modify(true); + pPlotDoc->UpdateAllViews(); } } } @@ -916,6 +1101,7 @@ PhantomView::CreateChildFrame(wxDocument *doc, wxView *view) wxMenu *file_menu = new wxMenu; file_menu->Append(MAINMENU_FILE_CREATE_PHANTOM, "Cr&eate Phantom..."); + file_menu->Append(MAINMENU_FILE_CREATE_FILTER, "Create &Filter..."); file_menu->Append(wxID_OPEN, "&Open..."); file_menu->Append(wxID_CLOSE, "&Close"); @@ -1205,6 +1391,7 @@ ProjectionFileView::CreateChildFrame(wxDocument *doc, wxView *view) wxMenu *file_menu = new wxMenu; file_menu->Append(MAINMENU_FILE_CREATE_PHANTOM, "Cr&eate Phantom..."); + file_menu->Append(MAINMENU_FILE_CREATE_FILTER, "Create &Filter..."); file_menu->Append(wxID_OPEN, "&Open..."); file_menu->Append(wxID_SAVE, "&Save"); file_menu->Append(wxID_SAVEAS, "Save &As..."); @@ -1371,12 +1558,14 @@ EVT_MENU(PLOTMENU_VIEW_SCALE_AUTO, PlotFileView::OnScaleAuto) END_EVENT_TABLE() PlotFileView::PlotFileView(void) -: wxView(), m_canvas(NULL), m_frame(NULL) +: wxView(), m_canvas(NULL), m_frame(NULL), m_pEZPlot(NULL) { } PlotFileView::~PlotFileView(void) -{ +{ + if (m_pEZPlot) + delete m_pEZPlot; } void @@ -1465,6 +1654,7 @@ PlotFileView::CreateChildFrame(wxDocument *doc, wxView *view) wxMenu *file_menu = new wxMenu; file_menu->Append(MAINMENU_FILE_CREATE_PHANTOM, "Cr&eate Phantom..."); + file_menu->Append(MAINMENU_FILE_CREATE_FILTER, "Create &Filter..."); file_menu->Append(wxID_OPEN, "&Open..."); file_menu->Append(wxID_SAVE, "&Save"); file_menu->Append(wxID_SAVEAS, "Save &As..."); @@ -1502,7 +1692,7 @@ PlotFileView::CreateChildFrame(wxDocument *doc, wxView *view) bool -PlotFileView::OnCreate(wxDocument *doc, long WXUNUSED(flags) ) +PlotFileView::OnCreate (wxDocument *doc, long WXUNUSED(flags) ) { m_frame = CreateChildFrame(doc, this); SetFrame(m_frame); @@ -1524,7 +1714,7 @@ PlotFileView::OnCreate(wxDocument *doc, long WXUNUSED(flags) ) m_frame->Show(true); Activate(true); - + return true; } @@ -1540,49 +1730,58 @@ PlotFileView::OnDraw (wxDC* dc) m_canvas->GetClientSize (&xsize, &ysize); SGPDriver driver (dc, xsize, ysize); SGP sgp (driver); - const PlotFile& rPhantom = GetDocument()->getPlotFile(); - EZPlot plot (sgp); - - for (int iEzset = 0; iEzset < rPlotFile.getNumEzsetCommands(); iEzset++) - plot.ezset (rPlotFile.getEzsetCommand (iEzset)); - - if (m_bMinSpecified) { - std::ostringstream os; - os << "ymin " << m_dMinPixel; - plot.ezset (os.str()); - } - - if (m_bMaxSpecified) { - std::ostringstream os; - os << "ymax " << m_dMaxPixel; - plot.ezset (os.str()); - } - - plot.ezset("box"); - plot.ezset("grid"); - - double* pdXaxis = new double [iNRecords]; - rPlotFile.getColumn (0, pdXaxis); - - double* pdY = new double [iNRecords]; - for (int iCol = 1; iCol < iNColumns; iCol++) { - rPlotFile.getColumn (iCol, pdY); - plot.addCurve (pdXaxis, pdY, iNRecords); - } - - delete pdXaxis; - delete pdY; - - plot.plot(); + if (m_pEZPlot) + m_pEZPlot->plot (&sgp); } } void -PlotFileView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) ) +PlotFileView::OnUpdate (wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) ) { - if (m_canvas) - m_canvas->Refresh(); + if (m_canvas) { + const PlotFile& rPlotFile = GetDocument()->getPlotFile(); + const int iNColumns = rPlotFile.getNumColumns(); + const int iNRecords = rPlotFile.getNumRecords(); + + if (iNColumns > 0 && iNRecords > 0) { + if (m_pEZPlot) + delete m_pEZPlot; + m_pEZPlot = new EZPlot; + + for (unsigned int iEzset = 0; iEzset < rPlotFile.getNumEzsetCommands(); iEzset++) + m_pEZPlot->ezset (rPlotFile.getEzsetCommand (iEzset)); + + if (m_bMinSpecified) { + std::ostringstream os; + os << "ymin " << m_dMinPixel; + m_pEZPlot->ezset (os.str()); + } + + if (m_bMaxSpecified) { + std::ostringstream os; + os << "ymax " << m_dMaxPixel; + m_pEZPlot->ezset (os.str()); + } + + m_pEZPlot->ezset("box"); + m_pEZPlot->ezset("grid"); + + double* pdXaxis = new double [iNRecords]; + rPlotFile.getColumn (0, pdXaxis); + + double* pdY = new double [iNRecords]; + for (int iCol = 1; iCol < iNColumns; iCol++) { + rPlotFile.getColumn (iCol, pdY); + m_pEZPlot->addCurve (pdXaxis, pdY, iNRecords); + } + + delete pdXaxis; + delete pdY; + } + + m_canvas->Refresh(); + } } bool