/*****************************************************************************
** FILE IDENTIFICATION
**
-** Name: view.cpp
+** Name: views.cpp
** Purpose: View & Canvas routines for CTSim program
** Programmer: Kevin Rosenberg
** Date Started: July 2000
** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: views.cpp,v 1.143 2001/03/30 19:17:32 kevin Exp $
+** $Id: views.cpp,v 1.149 2002/04/30 18:13:40 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
EVT_MENU(IFMENU_IMAGE_MULTIPLY, ImageFileView::OnMultiply)
EVT_MENU(IFMENU_IMAGE_DIVIDE, ImageFileView::OnDivide)
EVT_MENU(IFMENU_IMAGE_SCALESIZE, ImageFileView::OnScaleSize)
-#ifdef wxUSE_GLCANVAS
+#if wxUSE_GLCANVAS
EVT_MENU(IFMENU_IMAGE_CONVERT3D, ImageFileView::OnConvert3d)
#endif
#ifdef HAVE_FFT
accelEntries[iEntry++].Set (wxACCEL_CTRL, static_cast<int>('2'), IFMENU_FILTER_FFT);
accelEntries[iEntry++].Set (wxACCEL_ALT, static_cast<int>('2'), IFMENU_FILTER_IFFT);
#endif
-#ifdef wxUSE_GLCANVAS
+#if wxUSE_GLCANVAS
accelEntries[iEntry++].Set (wxACCEL_CTRL, static_cast<int>('3'), IFMENU_IMAGE_CONVERT3D);
#endif
wxAcceleratorTable accelTable (iEntry, accelEntries);
m_bMaxSpecified = false;
m_dAutoScaleFactor = 1.;
- int width, height;
- m_pFrame->GetClientSize (&width, &height);
+ // int width, height;
+ // m_pFrame->GetClientSize (&width, &height);
m_pFrame->SetTitle("ImageFileView");
m_pCanvas = CreateCanvas (m_pFrame);
- int x, y; // X requires a forced resize
- m_pFrame->GetSize(&x, &y);
- m_pFrame->SetSize(-1, -1, x, y);
+ // int x, y; // X requires a forced resize
+ // m_pFrame->GetSize(&x, &y);
+ // m_pFrame->SetSize(-1, -1, x, y);
m_pFrame->SetFocus();
m_pFrame->Show(true);
- Activate(true);
+ // Activate(true);
return true;
}
int xSize = nx;
int ySize = ny;
ySize = clamp (ySize, 0, 800);
- m_pFrame->SetClientSize (xSize, ySize);
+ // m_pFrame->SetClientSize (xSize, ySize); // KMR
m_pCanvas->SetScrollbars(20, 20, nx/20, ny/20);
m_pCanvas->SetBackgroundColour(*wxWHITE);
}
int xSize, ySize;
theApp->getMainFrame()->GetClientSize (&xSize, &ySize);
xSize = maxValue<int> (xSize, ySize);
+#ifdef CTSIM_MDI
ySize = xSize = (xSize / 4);
+#else
+ ySize = xSize;
+#endif
return wxSize (xSize, ySize);
}
m_iDefaultNView = 320;
m_iDefaultNSample = 2;
#endif
+ m_iDefaultOffsetView = 0;
m_dDefaultRotation = 1;
m_dDefaultFocalLength = 2;
m_dDefaultCenterDetectorLength = 2;
PhantomFileView::OnProjections (wxCommandEvent& event)
{
DialogGetProjectionParameters dialogProjection (getFrameForChild(),
- m_iDefaultNDet, m_iDefaultNView, m_iDefaultNSample, m_dDefaultRotation,
+ m_iDefaultNDet, m_iDefaultNView, m_iDefaultOffsetView, m_iDefaultNSample, m_dDefaultRotation,
m_dDefaultFocalLength, m_dDefaultCenterDetectorLength, m_dDefaultViewRatio, m_dDefaultScanRatio,
m_iDefaultGeometry, m_iDefaultTrace);
int retVal = dialogProjection.ShowModal();
m_iDefaultNDet = dialogProjection.getNDet();
m_iDefaultNView = dialogProjection.getNView();
+ m_iDefaultOffsetView = dialogProjection.getOffsetView();
m_iDefaultNSample = dialogProjection.getNSamples();
m_iDefaultTrace = dialogProjection.getTrace();
m_dDefaultRotation = dialogProjection.getRotAngle();
return;
const Phantom& rPhantom = GetDocument()->getPhantom();
- Scanner theScanner (rPhantom, sGeometry.c_str(), m_iDefaultNDet, m_iDefaultNView, m_iDefaultNSample,
+ Scanner theScanner (rPhantom, sGeometry.c_str(), m_iDefaultNDet, m_iDefaultNView, m_iDefaultOffsetView, m_iDefaultNSample,
dRotationRadians, m_dDefaultFocalLength, m_dDefaultCenterDetectorLength, m_dDefaultViewRatio, m_dDefaultScanRatio);
if (theScanner.fail()) {
wxString msg = "Failed making scanner\n";
}
std::ostringstream os;
- os << "Projections for " << rPhantom.name() << ": nDet=" << m_iDefaultNDet
- << ", nView=" << m_iDefaultNView << ", nSamples=" << m_iDefaultNSample
- << ", RotAngle=" << m_dDefaultRotation << ", FocalLengthRatio=" << m_dDefaultFocalLength
+ os << "Projections for " << rPhantom.name()
+ << ": nDet=" << m_iDefaultNDet
+ << ", nView=" << m_iDefaultNView
+ << ", gantry offset=" << m_iDefaultOffsetView
+ << ", nSamples=" << m_iDefaultNSample
+ << ", RotAngle=" << m_dDefaultRotation
+ << ", FocalLengthRatio=" << m_dDefaultFocalLength
<< ", CenterDetectorLengthRatio=" << m_dDefaultCenterDetectorLength
- << ", ViewRatio=" << m_dDefaultViewRatio << ", ScanRatio=" << m_dDefaultScanRatio
- << ", Geometry=" << sGeometry.c_str() << ", FanBeamAngle=" <<
- convertRadiansToDegrees (theScanner.fanBeamAngle());
+ << ", ViewRatio=" << m_dDefaultViewRatio
+ << ", ScanRatio=" << m_dDefaultScanRatio
+ << ", Geometry=" << sGeometry.c_str()
+ << ", FanBeamAngle=" << convertRadiansToDegrees (theScanner.fanBeamAngle());
Timer timer;
Projections* pProj = NULL;
#if HAVE_WXTHREADS
if (theApp->getUseBackgroundTasks()) {
ProjectorSupervisorThread* pProjector = new ProjectorSupervisorThread (this, m_iDefaultNDet,
- m_iDefaultNView, sGeometry.c_str(), m_iDefaultNSample, dRotationRadians,
+ m_iDefaultNView, m_iDefaultOffsetView, sGeometry.c_str(), m_iDefaultNSample, dRotationRadians,
m_dDefaultFocalLength, m_dDefaultCenterDetectorLength, m_dDefaultViewRatio, m_dDefaultScanRatio, os.str().c_str());
if (pProjector->Create() != wxTHREAD_NO_ERROR) {
sys_error (ERR_SEVERE, "Error creating projector thread");
pProj->initFromScanner (theScanner);
wxProgressDialog dlgProgress (wxString("Projection"), wxString("Projection Progress"), pProj->nView() + 1, getFrameForChild(), wxPD_CAN_ABORT );
for (int i = 0; i < pProj->nView(); i++) {
- theScanner.collectProjections (*pProj, rPhantom, i, 1, true, m_iDefaultTrace);
+ //theScanner.collectProjections (*pProj, rPhantom, i, 1, true, m_iDefaultTrace);
+ theScanner.collectProjections (*pProj, rPhantom, i, 1, theScanner.offsetView(), true, m_iDefaultTrace);
if (! dlgProgress.Update (i+1)) {
delete pProj;
return;
#endif
{
ImageFile* pImageFile = new ImageFile (m_iDefaultRasterNX, m_iDefaultRasterNY);
+
wxProgressDialog dlgProgress (wxString("Rasterize"), wxString("Rasterization Progress"),
- pImageFile->nx() + 1, getFrameForChild(), wxPD_CAN_ABORT );
+ pImageFile->nx() + 1, getFrameForChild(), wxPD_CAN_ABORT );
Timer timer;
for (unsigned int i = 0; i < pImageFile->nx(); i++) {
rPhantom.convertToImagefile (*pImageFile, m_dDefaultRasterViewRatio, m_iDefaultRasterNSamples, Trace::TRACE_NONE, i, 1, true);
if (! dlgProgress.Update (i+1)) {
- delete pImageFile;
- return;
+ delete pImageFile;
+ return;
}
}
pRasterDoc->setImageFile (pImageFile);
if (theApp->getAskDeleteNewDocs())
pRasterDoc->Modify (true);
- pRasterDoc->UpdateAllViews (this);
- pRasterDoc->getView()->getFrame()->Show(true);
*theApp->getLog() << os.str().c_str() << "\n";
pImageFile->labelAdd (os.str().c_str(), timer.timerEnd());
- ImageFileView* rasterView = pRasterDoc->getView();
- if (rasterView) {
+
+ if (ImageFileView* rasterView = pRasterDoc->getView()) {
+ rasterView->getFrame()->Show(true);
rasterView->getFrame()->SetFocus();
rasterView->OnUpdate (rasterView, NULL);
}
- pRasterDoc->Activate();
+ // Causes loss of frame in wxGTK
+ // pRasterDoc->UpdateAllViews (this);
+ // pRasterDoc->Activate();
}
}
EVT_MENU(PJMENU_CONVERT_PARALLEL, ProjectionFileView::OnConvertParallel)
EVT_MENU(PJMENU_PLOT_TTHETA_SAMPLING, ProjectionFileView::OnPlotTThetaSampling)
EVT_MENU(PJMENU_PLOT_HISTOGRAM, ProjectionFileView::OnPlotHistogram)
-EVT_MENU(PJMENU_ARTIFACT_REDUCTION, ProjectionFileView::OnArtifactReduction)
+ // EVT_MENU(PJMENU_ARTIFACT_REDUCTION, ProjectionFileView::OnArtifactReduction)
END_EVENT_TABLE()
*theApp->getLog() << "Error converting to polar\n";
return;
}
+#ifdef HAVE_FFT
pIF->ifft(*pIF);
+#endif
pIF->magnitude(*pIF);
Fourier::shuffleFourierToNaturalOrder (*pIF);
pReconDoc->setImageFile (pImageFile);
if (theApp->getAskDeleteNewDocs())
pReconDoc->Modify (true);
- pReconDoc->UpdateAllViews (this);
- pReconDoc->Activate();
- if (ImageFileView* rasterView = pReconDoc->getView()) {
- rasterView->OnUpdate (rasterView, NULL);
- rasterView->getFrame()->SetFocus();
- rasterView->getFrame()->Show(true);
- }
*theApp->getLog() << os.str().c_str() << "\n";
pImageFile->labelAdd (rProj.getLabel());
pImageFile->labelAdd (os.str().c_str(), timerRecon.timerEnd());
+
+ // if (ImageFileView* rasterView = pReconDoc->getView()) {
+ // rasterView->getFrame()->Show(true);
+ // rasterView->getFrame()->SetFocus();
+ // rasterView->OnUpdate (rasterView, NULL);
+ // }
+ // causes loss of frame in wxGTK
+ pReconDoc->GetFirstView()->GetFrame()->Show(true);
+ pReconDoc->UpdateAllViews ();
+ // pReconDoc->Activate();
}
convert_menu->AppendSeparator();
convert_menu->Append (PJMENU_CONVERT_PARALLEL, "&Interpolate to Parallel");
- wxMenu* filter_menu = new wxMenu;
- filter_menu->Append (PJMENU_ARTIFACT_REDUCTION, "&Artifact Reduction");
+ // wxMenu* filter_menu = new wxMenu;
+ // filter_menu->Append (PJMENU_ARTIFACT_REDUCTION, "&Artifact Reduction");
wxMenu* analyze_menu = new wxMenu;
analyze_menu->Append (PJMENU_PLOT_HISTOGRAM, "&Plot Histogram");
menu_bar->Append (m_pFileMenu, "&File");
menu_bar->Append (convert_menu, "&Convert");
- menu_bar->Append (filter_menu, "Fi<er");
+ // menu_bar->Append (filter_menu, "Fi<er");
menu_bar->Append (analyze_menu, "&Analyze");
menu_bar->Append (reconstruct_menu, "&Reconstruct");
menu_bar->Append (help_menu, "&Help");