** This is part of the CTSim program
** Copyright (c) 1983-2001 Kevin Rosenberg
**
-** $Id: views.cpp,v 1.141 2001/03/28 16:44:41 kevin Exp $
+** $Id: views.cpp,v 1.147 2001/09/27 02:11:29 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
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);
double dScale3 = 3 * 255;
unsigned char* pixels = image.GetData();
ImageFileArray v = rIF.getArray();
- for (int ix = 0; ix < rIF.nx(); ix++) {
- for (int iy = 0; iy < rIF.ny(); iy++) {
+ for (unsigned int ix = 0; ix < rIF.nx(); ix++) {
+ for (unsigned int iy = 0; iy < rIF.ny(); iy++) {
unsigned int iBase = 3 * (iy * nx + ix);
if (ix == 0 && iy == 0 && (pixels[iBase] == pixels[iBase+1] && pixels[iBase+1] == pixels[iBase+2]))
bMonochrome = true;
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;
{
Projections& rProj = GetDocument()->getProjections();
DialogGetConvertPolarParameters dialogPolar (getFrameForChild(), "Convert Polar", m_iDefaultPolarNX, m_iDefaultPolarNY,
- m_iDefaultPolarInterpolation, -1);
+ m_iDefaultPolarInterpolation, -1, IDH_DLG_POLAR);
if (dialogPolar.ShowModal() == wxID_OK) {
wxProgressDialog dlgProgress (wxString("Convert Polar"), wxString("Conversion Progress"), 1, getFrameForChild(), wxPD_APP_MODAL);
wxString strInterpolation (dialogPolar.getInterpolationName());
{
Projections& rProj = GetDocument()->getProjections();
DialogGetConvertPolarParameters dialogPolar (getFrameForChild(), "Convert to FFT Polar", m_iDefaultPolarNX, m_iDefaultPolarNY,
- m_iDefaultPolarInterpolation, m_iDefaultPolarZeropad);
+ m_iDefaultPolarInterpolation, m_iDefaultPolarZeropad, IDH_DLG_FFT_POLAR);
if (dialogPolar.ShowModal() == wxID_OK) {
wxProgressDialog dlgProgress (wxString("Convert FFT Polar"), wxString("Conversion Progress"), 1, getFrameForChild(), wxPD_APP_MODAL);
wxString strInterpolation (dialogPolar.getInterpolationName());
{
Projections& rProj = GetDocument()->getProjections();
DialogGetConvertPolarParameters dialogPolar (getFrameForChild(), "Fourier Reconstruction", m_iDefaultPolarNX, m_iDefaultPolarNY,
- m_iDefaultPolarInterpolation, m_iDefaultPolarZeropad);
+ m_iDefaultPolarInterpolation, m_iDefaultPolarZeropad, IDH_DLG_RECON_FOURIER);
if (dialogPolar.ShowModal() == wxID_OK) {
wxProgressDialog dlgProgress (wxString("Reconstruction Fourier"), wxString("Reconstruction Progress"), 1, getFrameForChild(), wxPD_APP_MODAL);
wxString strInterpolation (dialogPolar.getInterpolationName());
*theApp->getLog() << "Error converting to polar\n";
return;
}
+#ifdef HAVE_FFT
pIF->ifft(*pIF);
+#endif
pIF->magnitude(*pIF);
Fourier::shuffleFourierToNaturalOrder (*pIF);