X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=src%2Fviews.cpp;h=e94ca255c4563dd440d1419f2bdc099160292f5c;hp=c17d50c5b41dc715b2dcedd9fd9fde44662dedc2;hb=484b9ac2ebf8f88dbe36bdc1d3a9c1b6a2b242eb;hpb=3147cd44cff6132e51eac1a179c1fc3d405faacc diff --git a/src/views.cpp b/src/views.cpp index c17d50c..e94ca25 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.21 2000/09/04 09:06:46 kevin Exp $ +** $Id: views.cpp,v 1.24 2000/12/16 03:29:02 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 @@ -96,7 +96,7 @@ ImageFileCanvas::OnMouseEvent(wxMouseEvent& event) int nx = rIF.nx(); int ny = rIF.ny(); - if (pt.x >= 0 && pt.x < nx && pt.y >= 0 & pt.y < ny) { + if (pt.x >= 0 && pt.x < nx && pt.y >= 0 && pt.y < ny) { ostringstream os; os << "Image value (" << pt.x << "," << pt.y << ") = " << v[pt.x][ny - 1 - pt.y] << "\n"; *theApp->getLog() << os.str().c_str(); @@ -396,9 +396,9 @@ void PhantomView::OnProperties (wxCommandEvent& event) { const int idPhantom = GetDocument()->getPhantomID(); - const string& namePhantom = GetDocument()->getPhantomName(); + const wxString& namePhantom = GetDocument()->getPhantomName(); ostringstream os; - os << "Phantom " << namePhantom << " (" << idPhantom << ")\n"; + os << "Phantom " << namePhantom.c_str() << " (" << idPhantom << ")\n"; *theApp->getLog() << os.str().c_str(); #if DEBUG const Phantom& rPhantom = GetDocument()->getPhantom(); @@ -467,16 +467,18 @@ PhantomView::OnProjections (wxCommandEvent& event) rProj.setRemark (os.str()); *theApp->getLog() << os.str().c_str(); + m_frame->Lower(); ::wxYield(); - pProjectionDoc->Modify(true); - pProjectionDoc->UpdateAllViews(this); - ::wxYield(); - if (wxView* pView = pProjectionDoc->GetFirstView()) + if (wxView* pView = pProjectionDoc->GetFirstView()) { if (wxFrame* pFrame = pView->GetFrame()) { pFrame->SetFocus(); pFrame->Raise(); } - m_frame->Lower(); + theApp->getDocManager()->ActivateView (pView, true, false); + } + ::wxYield(); + pProjectionDoc->Modify(true); + pProjectionDoc->UpdateAllViews(this); } } } @@ -731,7 +733,28 @@ ProjectionFileView::OnReconstruct (wxCommandEvent& event) imageFile.setArraySize (m_iDefaultNX, m_iDefaultNY); Timer timerRecon; + if (m_iDefaultFilterMethod != ProcessSignal::FILTER_METHOD_CONVOLUTION && m_iDefaultFilterGeneration == ProcessSignal::FILTER_GENERATION_DIRECT && rProj.geometry() != Scanner::GEOMETRY_PARALLEL) { + 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); + return; + } +#if 0 + SGPDriver* pSGPDriver = NULL; + SGP* pSGP = NULL; + wxMemoryDC* pDCPlot = NULL; + wxBitmap bitmap; + if (m_iDefaultTrace >= Trace::TRACE_PLOT) { + bitmap.Create (500, 500); + pDCPlot = new wxMemoryDC; + pDCPlot->SelectObject (bitmap); + pSGPDriver = new SGPDriver (dynamic_castpDCPlot, 500, 500); + pSGP = new SGP (*pSGPDriver); + } + 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); + delete pSGP; +#else 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); +#endif + if (m_iDefaultTrace > Trace::TRACE_CONSOLE) { ReconstructDialog* pDlgReconstruct = new ReconstructDialog (*pReconstruct, rProj, imageFile, m_iDefaultTrace, m_frame); for (int iView = 0; iView < rProj.nView(); iView++) { @@ -889,13 +912,13 @@ ProjectionFileView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) unsigned char* imageData = new unsigned char [nDet * nView * 3]; double scale = (max - min) / 255; - for (int iy = 0; iy < nView; iy++) { - const DetectorArray& detarray = rProj.getDetectorArray(iy); + for (int iy2 = 0; iy2 < nView; iy2++) { + const DetectorArray& detarray = rProj.getDetectorArray (iy2); const DetectorValue* detval = detarray.detValues(); for (int ix = 0; ix < nDet; ix++) { int intensity = static_cast(((detval[ix] - min) / scale) + 0.5); intensity = clamp(intensity, 0, 255); - int baseAddr = (iy * nDet + ix) * 3; + int baseAddr = (iy2 * nDet + ix) * 3; imageData[baseAddr] = imageData[baseAddr+1] = imageData[baseAddr+2] = intensity; } }