+void
+ImageFileView::OnPlotRow (wxCommandEvent& event)
+{
+ int xCursor, yCursor;
+ if (! m_canvas->GetCurrentCursor (xCursor, yCursor)) {
+ wxMessageBox ("No row selected. Please use left mouse button on image to select column","Error");
+ return;
+ }
+
+ const ImageFile& rIF = dynamic_cast<ImageFileDocument*>(GetDocument())->getImageFile();
+ ImageFileArrayConst v = rIF.getArray();
+ int nx = rIF.nx();
+ int ny = rIF.ny();
+
+ if (v != NULL && yCursor < ny) {
+ double* pX = new double [nx];
+ double* pY = new double [nx];
+ for (int i = 0; i < nx; i++) {
+ pX[i] = i;
+ pY[i] = v[i][yCursor];
+ }
+ PlotFileDocument* pPlotDoc = dynamic_cast<PlotFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.plt", wxDOC_SILENT));
+ if (! pPlotDoc) {
+ sys_error (ERR_SEVERE, "Internal error: unable to create Plot file");
+ } else {
+ PlotFile& rPlotFile = pPlotDoc->getPlotFile();
+ std::ostringstream os;
+ os << "Row " << yCursor;
+ std::string title("title ");
+ title += os.str();
+ 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);
+ rPlotFile.addColumn (0, pX);
+ rPlotFile.addColumn (1, pY);
+ }
+ delete pX;
+ delete pY;
+ if (theApp->getSetModifyNewDocs())
+ pPlotDoc->Modify(true);
+ pPlotDoc->UpdateAllViews();
+ }
+}
+
+void
+ImageFileView::OnPlotCol (wxCommandEvent& event)
+{
+ int xCursor, yCursor;
+ if (! m_canvas->GetCurrentCursor (xCursor, yCursor)) {
+ wxMessageBox ("No column selected. Please use left mouse button on image to select column","Error");
+ return;
+ }
+
+ const ImageFile& rIF = dynamic_cast<ImageFileDocument*>(GetDocument())->getImageFile();
+ ImageFileArrayConst v = rIF.getArray();
+ int nx = rIF.nx();
+ int ny = rIF.ny();
+
+ if (v != NULL && xCursor < nx) {
+ double* pX = new double [ny];
+ double* pY = new double [ny];
+ for (int i = 0; i < ny; i++) {
+ pX[i] = i;
+ pY[i] = v[xCursor][i];
+ }
+ PlotFileDocument* pPlotDoc = dynamic_cast<PlotFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.plt", wxDOC_SILENT));
+ if (! pPlotDoc) {
+ sys_error (ERR_SEVERE, "Internal error: unable to create Plot file");
+ } else {
+ PlotFile& rPlotFile = pPlotDoc->getPlotFile();
+ std::ostringstream os;
+ os << "Column " << xCursor;
+ std::string title("title ");
+ title += os.str();
+ 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);
+ rPlotFile.addColumn (0, pX);
+ rPlotFile.addColumn (1, pY);
+ }
+ delete pX;
+ delete pY;
+ if (theApp->getSetModifyNewDocs())
+ pPlotDoc->Modify(true);
+ pPlotDoc->UpdateAllViews();
+ }
+}
+
+void
+ImageFileView::OnCompareCol (wxCommandEvent& event)
+{
+ int xCursor, yCursor;
+ if (! m_canvas->GetCurrentCursor (xCursor, yCursor)) {
+ wxMessageBox ("No column selected. Please use left mouse button on image to select column","Error");
+ return;
+ }
+
+ std::vector<ImageFileDocument*> vecIFDoc;
+ theApp->getCompatibleImages (GetDocument(), vecIFDoc);
+ if (vecIFDoc.size() == 0) {
+ wxMessageBox ("No compatible images for Column Comparison", "Error");
+ return;
+ }
+ DialogGetComparisonImage dialogGetCompare (m_frame, "Get Comparison Image", vecIFDoc, false);
+
+ if (dialogGetCompare.ShowModal() == wxID_OK) {
+ ImageFileDocument* pCompareDoc = dialogGetCompare.getImageFileDocument();
+ const ImageFile& rIF = GetDocument()->getImageFile();
+ const ImageFile& rCompareIF = pCompareDoc->getImageFile();
+
+ ImageFileArrayConst v1 = rIF.getArray();
+ ImageFileArrayConst v2 = rCompareIF.getArray();
+ int nx = rIF.nx();
+ int ny = rIF.ny();
+
+ if (v1 != NULL && xCursor < nx) {
+ double* pX = new double [ny];
+ double* pY1 = new double [ny];
+ double* pY2 = new double [ny];
+ for (int i = 0; i < ny; i++) {
+ pX[i] = i;
+ pY1[i] = v1[xCursor][i];
+ pY2[i] = v2[xCursor][i];
+ }
+ PlotFileDocument* pPlotDoc = dynamic_cast<PlotFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.plt", wxDOC_SILENT));
+ if (! pPlotDoc) {
+ sys_error (ERR_SEVERE, "Internal error: unable to create Plot file");
+ } else {
+ PlotFile& rPlotFile = pPlotDoc->getPlotFile();
+ std::ostringstream os;
+ os << "Column " << xCursor << " Comparison";
+ std::string title("title ");
+ title += os.str();
+ 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");
+ rPlotFile.addEzsetCommand ("color 4");
+ rPlotFile.addEzsetCommand ("dash 5");
+ rPlotFile.addEzsetCommand ("box");
+ rPlotFile.addEzsetCommand ("grid");
+ rPlotFile.setCurveSize (3, nx);
+ rPlotFile.addColumn (0, pX);
+ rPlotFile.addColumn (1, pY1);
+ rPlotFile.addColumn (2, pY2);
+ }
+ delete pX;
+ delete pY1;
+ delete pY2;
+ if (theApp->getSetModifyNewDocs())
+ pPlotDoc->Modify(true);
+ pPlotDoc->UpdateAllViews();
+ }
+ }
+}