** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: views.cpp,v 1.121 2001/02/27 03:59:30 kevin Exp $
+** $Id: views.cpp,v 1.123 2001/03/01 20:02:18 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
ImageFileView::ImageFileView()
: wxView(), m_pFrame(NULL), m_pCanvas(NULL), m_pFileMenu(0), m_bMinSpecified(false), m_bMaxSpecified(false)
{
- m_iDefaultExportFormatID = ImageFile::FORMAT_PNG;
+ m_iDefaultExportFormatID = ImageFile::EXPORT_FORMAT_PNG;
}
ImageFileView::~ImageFileView()
m_pFileMenu->Append(wxID_PRINT, "&Print...");
m_pFileMenu->Append(wxID_PRINT_SETUP, "Print &Setup...");
m_pFileMenu->Append(wxID_PREVIEW, "Print Preview");
+ m_pFileMenu->AppendSeparator();
+ m_pFileMenu->Append(MAINMENU_IMPORT, "&Import\tCtrl-I...");
#ifdef CTSIM_MDI
m_pFileMenu->AppendSeparator();
m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
DialogExportParameters dialogExport (getFrameForChild(), m_iDefaultExportFormatID);
if (dialogExport.ShowModal() == wxID_OK) {
wxString strFormatName (dialogExport.getFormatName ());
- m_iDefaultExportFormatID = ImageFile::convertFormatNameToID (strFormatName.c_str());
+ m_iDefaultExportFormatID = ImageFile::convertExportFormatNameToID (strFormatName.c_str());
wxString strExt;
wxString strWildcard;
- if (m_iDefaultExportFormatID == ImageFile::FORMAT_PGM || m_iDefaultExportFormatID == ImageFile::FORMAT_PGMASCII) {
+ if (m_iDefaultExportFormatID == ImageFile::EXPORT_FORMAT_PGM || m_iDefaultExportFormatID == ImageFile::EXPORT_FORMAT_PGMASCII) {
strExt = ".pgm";
strWildcard = "PGM Files (*.pgm)|*.pgm";
}
#ifdef HAVE_PNG
- else if (m_iDefaultExportFormatID == ImageFile::FORMAT_PNG || m_iDefaultExportFormatID == ImageFile::FORMAT_PNG16) {
+ else if (m_iDefaultExportFormatID == ImageFile::EXPORT_FORMAT_PNG || m_iDefaultExportFormatID == ImageFile::EXPORT_FORMAT_PNG16) {
strExt = ".png";
strWildcard = "PNG Files (*.png)|*.png";
}
#endif
+ else {
+ strExt = "";
+ strWildcard = "Miscellaneous (*.*)|*.*";
+ }
const wxString& strFilename = wxFileSelector (wxString("Export Filename"), wxString(""),
wxString(""), strExt, strWildcard, wxOVERWRITE_PROMPT | wxHIDE_READONLY | wxSAVE);
#if defined(DEBUG) || defined(_DEBUG)
m_iDefaultNDet = 165;
m_iDefaultNView = 180;
+ m_iDefaultNSample = 1;
#else
m_iDefaultNDet = 367;
m_iDefaultNView = 320;
-#endif
m_iDefaultNSample = 2;
+#endif
m_dDefaultRotation = 1;
m_dDefaultFocalLength = 2;
+ m_dDefaultCenterDetectorLength = 2;
m_dDefaultViewRatio = 1;
m_dDefaultScanRatio = 1;
m_iDefaultGeometry = Scanner::GEOMETRY_PARALLEL;
{
DialogGetProjectionParameters dialogProjection (getFrameForChild(),
m_iDefaultNDet, m_iDefaultNView, m_iDefaultNSample, m_dDefaultRotation,
- m_dDefaultFocalLength, m_dDefaultViewRatio, m_dDefaultScanRatio, m_iDefaultGeometry,
- m_iDefaultTrace);
+ m_dDefaultFocalLength, m_dDefaultCenterDetectorLength, m_dDefaultViewRatio, m_dDefaultScanRatio,
+ m_iDefaultGeometry, m_iDefaultTrace);
int retVal = dialogProjection.ShowModal();
if (retVal != wxID_OK)
return;
m_iDefaultTrace = dialogProjection.getTrace();
m_dDefaultRotation = dialogProjection.getRotAngle();
m_dDefaultFocalLength = dialogProjection.getFocalLengthRatio();
+ m_dDefaultCenterDetectorLength = dialogProjection.getCenterDetectorLengthRatio();
m_dDefaultViewRatio = dialogProjection.getViewRatio();
m_dDefaultScanRatio = dialogProjection.getScanRatio();
wxString sGeometry = dialogProjection.getGeometry();
const Phantom& rPhantom = GetDocument()->getPhantom();
Scanner theScanner (rPhantom, sGeometry.c_str(), m_iDefaultNDet, m_iDefaultNView, m_iDefaultNSample,
- dRotationRadians, m_dDefaultFocalLength, m_dDefaultViewRatio, m_dDefaultScanRatio);
+ dRotationRadians, m_dDefaultFocalLength, m_dDefaultCenterDetectorLength, m_dDefaultViewRatio, m_dDefaultScanRatio);
if (theScanner.fail()) {
wxString msg = "Failed making scanner\n";
msg += theScanner.failMessage().c_str();
os << "Projections for " << rPhantom.name() << ": nDet=" << m_iDefaultNDet
<< ", nView=" << m_iDefaultNView << ", 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());
if (theApp->getUseBackgroundTasks() || theApp->getNumberCPU() > 1) {
ProjectorSupervisorThread* pProjector = new ProjectorSupervisorThread (this, m_iDefaultNDet,
m_iDefaultNView, sGeometry.c_str(), m_iDefaultNSample, dRotationRadians,
- m_dDefaultFocalLength, m_dDefaultViewRatio, m_dDefaultScanRatio, os.str().c_str());
+ 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");
delete pProjector;
m_pFileMenu->Append(wxID_PRINT, "&Print...");
m_pFileMenu->Append(wxID_PRINT_SETUP, "Print &Setup...");
m_pFileMenu->Append(wxID_PREVIEW, "Print Pre&view");
+ m_pFileMenu->AppendSeparator();
+ m_pFileMenu->Append(MAINMENU_IMPORT, "&Import\tCtrl-I...");
#ifdef CTSIM_MDI
m_pFileMenu->AppendSeparator();
m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
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();
Timer timerRecon;
- ImageFile rImageFile;
+ ImageFile* pImageFile = NULL;
if (m_iDefaultTrace > Trace::TRACE_CONSOLE) {
- rImageFile.setArraySize (m_iDefaultNX, m_iDefaultNY);
- Reconstructor* pReconstructor = new Reconstructor (rProj, rImageFile, optFilterName.c_str(),
+ pImageFile = new ImageFile (m_iDefaultNX, m_iDefaultNY);
+ Reconstructor* pReconstructor = new Reconstructor (rProj, *pImageFile, optFilterName.c_str(),
m_dDefaultFilterParam, optFilterMethodName.c_str(), m_iDefaultZeropad, optFilterGenerationName.c_str(),
optInterpName.c_str(), m_iDefaultInterpParam, optBackprojectName.c_str(), m_iDefaultTrace);
- ReconstructDialog* pDlgReconstruct = new ReconstructDialog (*pReconstructor, rProj, rImageFile, m_iDefaultTrace, getFrameForChild());
+ ReconstructDialog* pDlgReconstruct = new ReconstructDialog (*pReconstructor, rProj, *pImageFile, m_iDefaultTrace, getFrameForChild());
for (int iView = 0; iView < rProj.nView(); iView++) {
::wxYield();
if (pDlgReconstruct->isCancelled() || ! pDlgReconstruct->reconstructView (iView, true)) {
pReconstructor->Run();
return;
} else {
- rImageFile.setArraySize (m_iDefaultNX, m_iDefaultNY);
- Reconstructor* pReconstructor = new Reconstructor (rProj, rImageFile, optFilterName.c_str(),
+ pImageFile = new ImageFile (m_iDefaultNX, m_iDefaultNY);
+ Reconstructor* pReconstructor = new Reconstructor (rProj, *pImageFile, optFilterName.c_str(),
m_dDefaultFilterParam, optFilterMethodName.c_str(), m_iDefaultZeropad, optFilterGenerationName.c_str(),
optInterpName.c_str(), m_iDefaultInterpParam, optBackprojectName.c_str(), m_iDefaultTrace);
}
pReconstructor->postProcessing();
delete pReconstructor;
- ImageFileDocument* pReconDoc = theApp->newImageDoc();
- if (! pReconDoc) {
- sys_error (ERR_SEVERE, "Unable to create image file");
- return;
- }
}
}
ImageFileDocument* pReconDoc = theApp->newImageDoc();
sys_error (ERR_SEVERE, "Unable to create image file");
return;
}
- pReconDoc->setImageFile (&rImageFile);
+ pReconDoc->setImageFile (pImageFile);
if (theApp->getAskDeleteNewDocs())
pReconDoc->Modify (true);
pReconDoc->UpdateAllViews (this);
rasterView->getFrame()->Show(true);
}
*theApp->getLog() << os.str().c_str() << "\n";
- rImageFile.labelAdd (rProj.getLabel());
- rImageFile.labelAdd (os.str().c_str(), timerRecon.timerEnd());
+ pImageFile->labelAdd (rProj.getLabel());
+ pImageFile->labelAdd (os.str().c_str(), timerRecon.timerEnd());
}
m_pFileMenu->Append(wxID_PRINT, "&Print...");
m_pFileMenu->Append(wxID_PRINT_SETUP, "Print &Setup...");
m_pFileMenu->Append(wxID_PREVIEW, "Print Pre&view");
+ m_pFileMenu->AppendSeparator();
+ m_pFileMenu->Append(MAINMENU_IMPORT, "&Import\tCtrl-I...");
#ifdef CTSIM_MDI
m_pFileMenu->AppendSeparator();
m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
m_pFileMenu->Append(wxID_PRINT, "&Print...");
m_pFileMenu->Append(wxID_PRINT_SETUP, "Print &Setup...");
m_pFileMenu->Append(wxID_PREVIEW, "Print Pre&view");
+ m_pFileMenu->AppendSeparator();
+ m_pFileMenu->Append(MAINMENU_IMPORT, "&Import\tCtrl-I...");
#ifdef CTSIM_MDI
m_pFileMenu->AppendSeparator();
m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");
m_pFileMenu->Append(wxID_PRINT, "&Print...");
m_pFileMenu->Append(wxID_PRINT_SETUP, "Print &Setup...");
m_pFileMenu->Append(wxID_PREVIEW, "Print Pre&view");
+ m_pFileMenu->AppendSeparator();
+ m_pFileMenu->Append(MAINMENU_IMPORT, "&Import\tCtrl-I...");
#ifdef CTSIM_MDI
m_pFileMenu->AppendSeparator();
m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");