X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Fviews.cpp;h=54a12b8d764ea05f6d96d71015de8215fe3283cb;hb=276e2f99dbf1ecea92bd7d3d6bb9c9c8035677f3;hp=74458f2d08189292e25ef4b330ae28e10302f2ee;hpb=c953cbb6ffc2fd50e736230f4e6976a025983cff;p=ctsim.git diff --git a/src/views.cpp b/src/views.cpp index 74458f2..54a12b8 100644 --- a/src/views.cpp +++ b/src/views.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: views.cpp,v 1.122 2001/03/01 07:30:49 kevin Exp $ +** $Id: views.cpp,v 1.129 2001/03/07 22:30:16 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 @@ -249,7 +249,7 @@ END_EVENT_TABLE() 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() @@ -840,6 +840,8 @@ ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view) 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-M"); #ifdef CTSIM_MDI m_pFileMenu->AppendSeparator(); m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces..."); @@ -1080,20 +1082,30 @@ ImageFileView::OnExport (wxCommandEvent& event) 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 +#ifdef HAVE_CTN_DICOM + else if (m_iDefaultExportFormatID == ImageFile::EXPORT_FORMAT_DICOM) { + strExt = ""; + strWildcard = "DICOM Files (*.*)|*.*"; + } +#endif + else { + strExt = ""; + strWildcard = "Miscellaneous (*.*)|*.*"; + } const wxString& strFilename = wxFileSelector (wxString("Export Filename"), wxString(""), wxString(""), strExt, strWildcard, wxOVERWRITE_PROMPT | wxHIDE_READONLY | wxSAVE); @@ -1402,7 +1414,7 @@ ImageFileView::OnPlotFFTRow (wxCommandEvent& event) rPlotFile.addColumn (1, pYReal); rPlotFile.addColumn (2, pYImag); rPlotFile.addColumn (3, pYMag); - for (int iL = 0; iL < rIF.nLabels(); iL++) + for (unsigned int iL = 0; iL < rIF.nLabels(); iL++) rPlotFile.addDescription (rIF.labelGet(iL).getLabelString().c_str()); os << " FFT Plot of " << GetDocument()->GetFirstView()->GetFrame()->GetTitle().c_str(); *theApp->getLog() << os.str().c_str() << "\n"; @@ -1502,7 +1514,7 @@ ImageFileView::OnPlotFFTCol (wxCommandEvent& event) rPlotFile.addColumn (1, pYReal); rPlotFile.addColumn (2, pYImag); rPlotFile.addColumn (3, pYMag); - for (int iL = 0; iL < rIF.nLabels(); iL++) + for (unsigned int iL = 0; iL < rIF.nLabels(); iL++) rPlotFile.addDescription (rIF.labelGet(iL).getLabelString().c_str()); os << " FFT Plot of " << GetDocument()->GetFirstView()->GetFrame()->GetTitle().c_str(); *theApp->getLog() << os.str().c_str() << "\n"; @@ -1942,7 +1954,8 @@ PhantomFileView::OnProjections (wxCommandEvent& event) } } } else { - if (theApp->getUseBackgroundTasks() || theApp->getNumberCPU() > 1) { +#if HAVE_WXTHREADS + if (theApp->getUseBackgroundTasks()) { ProjectorSupervisorThread* pProjector = new ProjectorSupervisorThread (this, m_iDefaultNDet, m_iDefaultNView, sGeometry.c_str(), m_iDefaultNSample, dRotationRadians, m_dDefaultFocalLength, m_dDefaultCenterDetectorLength, m_dDefaultViewRatio, m_dDefaultScanRatio, os.str().c_str()); @@ -1954,7 +1967,9 @@ PhantomFileView::OnProjections (wxCommandEvent& event) pProjector->SetPriority(60); pProjector->Run(); return; - } else { + } else +#endif // HAVE_WXTHREADS + { pProj = new Projections; pProj->initFromScanner (theScanner); wxProgressDialog dlgProgress (wxString("Projection"), wxString("Projection Progress"), pProj->nView() + 1, getFrameForChild(), wxPD_CAN_ABORT ); @@ -2022,16 +2037,19 @@ PhantomFileView::OnRasterize (wxCommandEvent& event) << m_iDefaultRasterNY << ", ViewRatio=" << m_dDefaultRasterViewRatio << ", nSamples=" << m_iDefaultRasterNSamples;; - if (theApp->getUseBackgroundTasks() || theApp->getNumberCPU() > 1) { +#if HAVE_WXTHREADS + if (theApp->getUseBackgroundTasks()) { RasterizerSupervisorThread* pThread = new RasterizerSupervisorThread (this, m_iDefaultRasterNX, m_iDefaultRasterNY, - m_dDefaultRasterViewRatio, m_iDefaultRasterNSamples, os.str().c_str()); + m_iDefaultRasterNSamples, m_dDefaultRasterViewRatio, os.str().c_str()); if (pThread->Create() != wxTHREAD_NO_ERROR) { *theApp->getLog() << "Error creating rasterizer thread\n"; return; } pThread->SetPriority (60); pThread->Run(); - } else { + } else +#endif + { ImageFile* pImageFile = new ImageFile (m_iDefaultRasterNX, m_iDefaultRasterNY); wxProgressDialog dlgProgress (wxString("Rasterize"), wxString("Rasterization Progress"), pImageFile->nx() + 1, getFrameForChild(), wxPD_CAN_ABORT ); @@ -2106,6 +2124,8 @@ PhantomFileView::CreateChildFrame(wxDocument *doc, wxView *view) 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-M"); #ifdef CTSIM_MDI m_pFileMenu->AppendSeparator(); m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces..."); @@ -2457,7 +2477,8 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event) delete pDlgReconstruct; delete pReconstructor; } else { - if (theApp->getUseBackgroundTasks() || theApp->getNumberCPU() > 1) { +#if HAVE_WXTHREADS + if (theApp->getUseBackgroundTasks()) { ReconstructorSupervisorThread* pReconstructor = new ReconstructorSupervisorThread (this, m_iDefaultNX, m_iDefaultNY, optFilterName.c_str(), m_dDefaultFilterParam, optFilterMethodName.c_str(), m_iDefaultZeropad, optFilterGenerationName.c_str(), @@ -2470,7 +2491,9 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event) pReconstructor->SetPriority (60); pReconstructor->Run(); return; - } else { + } else +#endif + { 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(), @@ -2554,6 +2577,8 @@ ProjectionFileView::CreateChildFrame(wxDocument *doc, wxView *view) 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-M"); #ifdef CTSIM_MDI m_pFileMenu->AppendSeparator(); m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces..."); @@ -2884,6 +2909,8 @@ PlotFileView::CreateChildFrame(wxDocument *doc, wxView *view) 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-M"); #ifdef CTSIM_MDI m_pFileMenu->AppendSeparator(); m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces..."); @@ -3137,6 +3164,8 @@ TextFileView::CreateChildFrame (wxDocument *doc, wxView *view) 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-M"); #ifdef CTSIM_MDI m_pFileMenu->AppendSeparator(); m_pFileMenu->Append (MAINMENU_FILE_PREFERENCES, "Prefere&nces...");