From 999a754d1519a49ca062ee87b22bf601c1ee9f21 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Sun, 11 Mar 2001 06:34:37 +0000 Subject: [PATCH] r628: no message --- include/projections.h | 21 +++-- include/scanner.h | 4 +- libctsim/projections.cpp | 160 ++++++++++++++++++++++++++++++++++++--- libctsim/scanner.cpp | 8 +- msvc/ctsim/ctsim.plg | 12 +-- src/backgroundmgr.cpp | 12 ++- src/backgroundsupr.cpp | 4 +- src/ctsim.h | 4 +- src/views.cpp | 48 +++++++++++- src/views.h | 6 +- 10 files changed, 240 insertions(+), 39 deletions(-) diff --git a/include/projections.h b/include/projections.h index 9e64f26..67cae86 100644 --- a/include/projections.h +++ b/include/projections.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: projections.h,v 1.29 2001/03/10 23:56:58 kevin Exp $ +** $Id: projections.h,v 1.30 2001/03/11 06:34:37 kevin Exp $ ** ** ** This program is free software; you can redistribute it and/or modify @@ -45,19 +45,19 @@ class ParallelRaysumCoordinate { public: double m_dT; // Distance from center of origin double m_dTheta; // perpendicular angle to origin - int m_iViewNum; // View number for this raysum - int m_iDetNum; // Detector number for this raysum + double m_dRaysum; bool lessThanT (ParallelRaysumCoordinate& rCompare) {return m_dT < rCompare.m_dT; } bool lessThanTheta (ParallelRaysumCoordinate& rCompare) {return m_dTheta < rCompare.m_dTheta; } - static compareByTheta(ParallelRaysumCoordinate* a, ParallelRaysumCoordinate* b) - { return a->m_dTheta > b->m_dTheta; } + static bool compareByTheta (ParallelRaysumCoordinate* a, ParallelRaysumCoordinate* b) + { return a->m_dTheta == b->m_dTheta ? b->m_dT > a->m_dT : b->m_dTheta > a->m_dTheta; } - static compareByT(ParallelRaysumCoordinate* a, ParallelRaysumCoordinate* b) - { return a->m_dT > b->m_dT; } + // sort first by T, then Theta + static bool compareByT (ParallelRaysumCoordinate* a, ParallelRaysumCoordinate* b) + { return a->m_dT == b->m_dT ? b->m_dTheta > a->m_dTheta : b->m_dT > a->m_dT; } }; @@ -74,12 +74,17 @@ public: void getLimits (double* dMinT, double* dMaxT, double* dMinTheta, double* dMaxTheta) const; CoordinateContainer& getSortedByT(); CoordinateContainer& getSortedByTheta(); + double interpolate (double* pdX, double* pdY, int n, double dXValue); + void getThetaAndRaysumsForT (int iT, double* pdTheta, double* pdRaysum); + void getDetPositions (double* pdDetPos); private: CoordinateContainer m_vecpCoordinates; CoordinateContainer m_vecpSortedByT; CoordinateContainer m_vecpSortedByTheta; int m_iNumCoordinates; + int m_iNumView; + int m_iNumDet; }; @@ -120,7 +125,7 @@ class Projections bool detarrayRead (fnetorderstream& fs, DetectorArray& darray, const int view_num); bool detarrayWrite (fnetorderstream& fs, const DetectorArray& darray, const int view_num); - bool interpolateToParallel(); + Projections* interpolateToParallel(); bool convertPolar (ImageFile& rIF, int iInterpolation); bool convertFFTPolar (ImageFile& rIF, int iInterpolation, int iZeropad); diff --git a/include/scanner.h b/include/scanner.h index 7f8780a..663ebd7 100644 --- a/include/scanner.h +++ b/include/scanner.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: scanner.h,v 1.20 2001/03/01 07:30:49 kevin Exp $ +** $Id: scanner.h,v 1.21 2001/03/11 06:34:37 kevin Exp $ ** ** ** This program is free software; you can redistribute it and/or modify @@ -98,6 +98,7 @@ class Scanner double rotInc() const {return m_rotInc;} double detInc() const {return m_detInc;} double detLen() const {return m_detLen;} + double detStart() const {return m_detStart;} double focalLength() const {return m_dFocalLength;} double sourceDetectorLength() const {return m_dSourceDetectorLength;} double centerDetectorLength() const {return m_dCenterDetectorLength;} @@ -136,6 +137,7 @@ class Scanner double m_rotLen; // Rotation angle length in radians (norm 2PI) double m_detInc; // Increment between centers of detectors double m_rotInc; // Increment in rotation angle between views + double m_detStart; double m_dXCenter; // Center of Phantom double m_dYCenter; double m_dAngularDetIncrement; diff --git a/libctsim/projections.cpp b/libctsim/projections.cpp index d6a4843..c55aa37 100644 --- a/libctsim/projections.cpp +++ b/libctsim/projections.cpp @@ -8,7 +8,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: projections.cpp,v 1.56 2001/03/10 23:56:58 kevin Exp $ +** $Id: projections.cpp,v 1.57 2001/03/11 06:34:37 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 @@ -150,12 +150,12 @@ Projections::initFromScanner (const Scanner& scanner) m_rotInc = scanner.rotInc(); m_detInc = scanner.detInc(); + m_detStart = scanner.detStart(); m_geometry = scanner.geometry(); m_dFocalLength = scanner.focalLength(); m_dSourceDetectorLength = scanner.sourceDetectorLength(); m_dViewDiameter = scanner.viewDiameter(); m_rotStart = 0; - m_detStart = -(scanner.detLen() / 2); m_dFanBeamAngle = scanner.fanBeamAngle(); } @@ -968,34 +968,114 @@ Projections::initFromSomatomAR_STAR (int iNViews, int iNDets, unsigned char* pDa return true; } +Projections* +Projections::interpolateToParallel () +{ + if (m_geometry == Scanner::GEOMETRY_PARALLEL) + return this; + + int nDet = m_nDet; + int nView = m_nView; + Projections* pProjNew = new Projections (nView, nDet); + pProjNew->m_geometry = Scanner::GEOMETRY_PARALLEL; + pProjNew->m_dFocalLength = m_dFocalLength; + pProjNew->m_dSourceDetectorLength = m_dSourceDetectorLength; + pProjNew->m_dViewDiameter = m_dViewDiameter; + pProjNew->m_dFanBeamAngle = m_dFanBeamAngle; + pProjNew->m_calcTime = 0; + pProjNew->m_remark = m_remark; + pProjNew->m_remark += "; Interpolate to Parallel"; + pProjNew->m_label.setLabelType (Array2dFileLabel::L_HISTORY); + pProjNew->m_label.setLabelString (pProjNew->m_remark); + pProjNew->m_label.setCalcTime (pProjNew->m_calcTime); + pProjNew->m_label.setDateTime (pProjNew->m_year, pProjNew->m_month, pProjNew->m_day, pProjNew->m_hour, pProjNew->m_minute, pProjNew->m_second); + + pProjNew->m_rotStart = 0; + pProjNew->m_rotInc = PI / nView;; + pProjNew->m_detStart = -m_dViewDiameter / 2; + pProjNew->m_detInc = m_dViewDiameter / nDet; + if (nDet % 2 == 0) // even + pProjNew->m_detInc = m_dViewDiameter / (nDet - 1); + + ParallelRaysums parallel (this); + + double* pdThetaValuesForT = new double [pProjNew->nView()]; + double* pdRaysumsForT = new double [pProjNew->nView()]; + + // interpolate to evenly spaced theta (views) + double dDetPos = pProjNew->m_detStart; + for (int iD = 0; iD < pProjNew->nDet(); iD++, dDetPos += pProjNew->m_detInc) { + parallel.getThetaAndRaysumsForT (iD, pdThetaValuesForT, pdRaysumsForT); + + double dViewAngle = m_rotStart; + for (int iV = 0; iV < pProjNew->nView(); iV++, dViewAngle += pProjNew->m_rotInc) { + DetectorValue* detValues = pProjNew->getDetectorArray (iV).detValues(); + + detValues[iD] = parallel.interpolate (pdThetaValuesForT, pdRaysumsForT, pProjNew->nView(), dViewAngle); + } + } + delete pdThetaValuesForT; + delete pdRaysumsForT; + + // interpolate to evenly space t (detectors) + double* pdOriginalDetPositions = new double [pProjNew->nDet()]; + parallel.getDetPositions (pdOriginalDetPositions); + + double* pdDetValueCopy = new double [pProjNew->nDet()]; + double dViewAngle = m_rotStart; + for (int iV = 0; iV < pProjNew->nView(); iV++, dViewAngle += pProjNew->m_rotInc) { + DetectorArray& detArray = pProjNew->getDetectorArray (iV); + DetectorValue* detValues = detArray.detValues(); + detArray.setViewAngle (dViewAngle); + + for (int i = 0; i < pProjNew->nDet(); i++) + pdDetValueCopy[i] = detValues[i]; + + double dDetPos = pProjNew->m_detStart; + for (int iD = 0; iD < pProjNew->nDet(); iD++, dDetPos += pProjNew->m_detInc) { + detValues[iD] = parallel.interpolate (pdOriginalDetPositions, pdDetValueCopy, pProjNew->nDet(), dDetPos); + } + } + delete pdDetValueCopy; + delete pdOriginalDetPositions; + + return pProjNew; +} + + +/////////////////////////////////////////////////////////////////////////////// +// +// Class ParallelRaysums +// +// Used for converting divergent beam raysums into Parallel raysums +// +/////////////////////////////////////////////////////////////////////////////// ParallelRaysums::ParallelRaysums (Projections* pProjections) -: m_iNumCoordinates(0) +: m_iNumCoordinates(0), m_iNumView(pProjections->nView()), m_iNumDet(pProjections->nDet()) { - int nDet = pProjections->nDet(); - int nView = pProjections->nView(); int iGeometry = pProjections->geometry(); double dDetInc = pProjections->detInc(); double dDetStart = pProjections->detStart(); double dFocalLength = pProjections->focalLength(); - m_iNumCoordinates = nDet * nView; + m_iNumCoordinates = m_iNumView * m_iNumDet; m_vecpCoordinates.reserve (m_iNumCoordinates); for (int i = 0; i < m_iNumCoordinates; i++) m_vecpCoordinates[i] = new ParallelRaysumCoordinate; int iCoordinate = 0; - for (int iV = 0; iV < nView; iV++) { + for (int iV = 0; iV < m_iNumView; iV++) { double dViewAngle = pProjections->getDetectorArray(iV).viewAngle(); + const DetectorValue* detValues = pProjections->getDetectorArray(iV).detValues(); double dDetPos = dDetStart; - for (int iD = 0; iD < nDet; iD++) { + for (int iD = 0; iD < m_iNumDet; iD++) { ParallelRaysumCoordinate* pC = m_vecpCoordinates[iCoordinate++]; if (iGeometry == Scanner::GEOMETRY_PARALLEL) { pC->m_dTheta = normalizeAngle (dViewAngle); pC->m_dT = dDetPos; - } else if (iGeometry == Scanner::GEOMETRY_EQUILINEAR) { double dFanAngle = atan (dDetPos / pProjections->sourceDetectorLength()); pC->m_dTheta = normalizeAngle (dViewAngle + dFanAngle); @@ -1006,6 +1086,11 @@ ParallelRaysums::ParallelRaysums (Projections* pProjections) pC->m_dTheta = normalizeAngle (dViewAngle + dDetPos); pC->m_dT = dFocalLength * sin (dDetPos); } + if (pC->m_dTheta >= PI) { // convert T/Theta to 0-PI interval + pC->m_dTheta -= PI; + pC->m_dT = -pC->m_dT - pProjections->detInc(); + } + pC->m_dRaysum = detValues[iD]; dDetPos += dDetInc; } } @@ -1021,7 +1106,7 @@ ParallelRaysums::CoordinateContainer& ParallelRaysums::getSortedByTheta() { if (m_vecpSortedByTheta.size() == 0) { - m_vecpSortedByTheta.reserve (m_iNumCoordinates); + m_vecpSortedByTheta.resize (m_iNumCoordinates); for (int i = 0; i < m_iNumCoordinates; i++) m_vecpSortedByTheta[i] = m_vecpCoordinates[i]; std::sort (m_vecpSortedByTheta.begin(), m_vecpSortedByTheta.end(), ParallelRaysumCoordinate::compareByTheta); @@ -1034,7 +1119,7 @@ ParallelRaysums::CoordinateContainer& ParallelRaysums::getSortedByT() { if (m_vecpSortedByT.size() == 0) { - m_vecpSortedByT.reserve (m_iNumCoordinates); + m_vecpSortedByT.resize (m_iNumCoordinates); for (int i = 0; i < m_iNumCoordinates; i++) m_vecpSortedByT[i] = m_vecpCoordinates[i]; std::sort (m_vecpSortedByT.begin(), m_vecpSortedByT.end(), ParallelRaysumCoordinate::compareByT); @@ -1068,3 +1153,56 @@ ParallelRaysums::getLimits (double* dMinT, double* dMaxT, double* dMinTheta, dou *dMaxTheta = dTheta; } } + +void +ParallelRaysums::getThetaAndRaysumsForT (int iTheta, double* pTheta, double* pRaysum) +{ + const CoordinateContainer& coordsT = getSortedByT(); + + int iBase = iTheta * m_iNumView; + for (int i = 0; i < m_iNumView; i++) { + int iPos = iBase + i; + pTheta[i] = coordsT[iPos]->m_dTheta; + pRaysum[i] = coordsT[iPos]->m_dRaysum; + } +} + +void +ParallelRaysums::getDetPositions (double* pdDetPos) +{ + const CoordinateContainer& coordsT = getSortedByT(); + + int iPos = 0; + for (int i = 0; i < m_iNumDet; i++) { + pdDetPos[i] = coordsT[iPos]->m_dT; + iPos += m_iNumView; + } +} + +// locate by bisection, O(log2(n)) +double +ParallelRaysums::interpolate (double* pdX, double* pdY, int n, double dX) +{ + int iLower = -1; + int iUpper = n; + + while (iUpper - iLower > 1) { + int iMiddle = (iUpper + iLower) >> 1; + if (dX >= pdX[iMiddle]) + iLower = iMiddle; + else + iUpper = iMiddle; + } + if (dX <= pdX[0]) + return pdY[0]; + else if (dX >= pdX[n-1]) + return pdY[1]; + + if (iLower < 0 || iLower >= n) { + sys_error (ERR_SEVERE, "Coordinate out of range [locateThetaBase]"); + return 0; + } + + return pdY[iLower] + (pdY[iUpper] - pdY[iLower]) * ((dX - pdX[iLower]) / (pdX[iUpper] - pdX[iLower])); +} + diff --git a/libctsim/scanner.cpp b/libctsim/scanner.cpp index ff3cd9a..f28d9fa 100644 --- a/libctsim/scanner.cpp +++ b/libctsim/scanner.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: scanner.cpp,v 1.34 2001/03/10 23:14:16 kevin Exp $ +** $Id: scanner.cpp,v 1.35 2001/03/11 06:34:37 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 @@ -125,6 +125,7 @@ Scanner::Scanner (const Phantom& phm, const char* const geometryName, if (m_idGeometry == GEOMETRY_PARALLEL) { m_dFanBeamAngle = 0; m_detLen = m_dScanDiameter; + m_detStart = -m_detLen / 2; m_detInc = m_detLen / m_nDet; double dDetectorArrayEndOffset = 0; // For even number of detectors, make detInc slightly larger so that center lies @@ -144,6 +145,7 @@ Scanner::Scanner (const Phantom& phm, const char* const geometryName, m_initPos.xd2 = m_dXCenter + dHalfDetLen + dDetectorArrayEndOffset; m_initPos.yd2 = m_dYCenter - m_dCenterDetectorLength; m_initPos.angle = 0.0; + m_detLen += dDetectorArrayEndOffset; } else if (m_idGeometry == GEOMETRY_EQUILINEAR) { if (m_dScanDiameter / 2 >= m_dFocalLength) { m_fail = true; @@ -155,11 +157,13 @@ Scanner::Scanner (const Phantom& phm, const char* const geometryName, const double dHalfDetLen = m_dSourceDetectorLength * tan (dAngle); m_detLen = dHalfDetLen * 2; + m_detStart = -dHalfDetLen; m_detInc = m_detLen / m_nDet; double dDetectorArrayEndOffset = 0; if (m_nDet % 2 == 0) { // Adjust for Even number of detectors m_detInc = m_detLen / (m_nDet - 1); // center detector = (nDet/2) dDetectorArrayEndOffset = m_detInc; + m_detLen += dDetectorArrayEndOffset; } m_dFanBeamAngle = dAngle * 2; @@ -182,6 +186,7 @@ Scanner::Scanner (const Phantom& phm, const char* const geometryName, const double dAngle = asin ((m_dScanDiameter / 2) / m_dFocalLength); m_detLen = 2 * dAngle; + m_detStart = -dAngle; m_detInc = m_detLen / m_nDet; double dDetectorArrayEndOffset = 0; if (m_nDet % 2 == 0) { // Adjust for Even number of detectors @@ -202,6 +207,7 @@ Scanner::Scanner (const Phantom& phm, const char* const geometryName, m_initPos.ys1 = m_dYCenter + m_dFocalLength;; m_initPos.xs2 = m_dXCenter; m_initPos.ys2 = m_dYCenter + m_dFocalLength; + m_detLen += dDetectorArrayEndOffset; } // Calculate incrementatal rotation matrix diff --git a/msvc/ctsim/ctsim.plg b/msvc/ctsim/ctsim.plg index 2a1a921..d0e65d4 100644 --- a/msvc/ctsim/ctsim.plg +++ b/msvc/ctsim/ctsim.plg @@ -6,13 +6,13 @@ --------------------Configuration: libctsim - Win32 Debug--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1EE.tmp" with contents +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP377.tmp" with contents [ /nologo /G6 /MTd /W3 /Gm /Gi /GR /GX /Zi /Od /Gy /I "..\..\..\wx2.2.5\src\png" /I "..\..\..\wx2.2.5\src\zlib" /I "..\..\INCLUDE" /I "..\..\getopt" /I "..\..\..\fftw-2.1.3\fftw" /I "..\..\..\fftw-2.1.3\rfftw" /I "..\..\..\wx2.2.5\include" /I "\dicom\ctn\include" /D "_DEBUG" /D "HAVE_WXWIN" /D "HAVE_STRING_H" /D "HAVE_GETOPT_H" /D "WIN32" /D "_MBCS" /D "_LIB" /D "MSVC" /D "HAVE_FFTW" /D "HAVE_PNG" /D "HAVE_SGP" /D "HAVE_WXWINDOWS" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "HAVE_CTN_DICOM" /D VERSION=\"3.1.0\" /FR"Debug/" /Fp"Debug/libctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c "C:\ctsim\libctsim\projections.cpp" ] -Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1EE.tmp" -Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1EF.tmp" with contents +Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP377.tmp" +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP378.tmp" with contents [ /nologo /out:"Debug\libctsim.lib" .\Debug\array2dfile.obj @@ -48,7 +48,7 @@ Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1EF.tmp" with conten .\Debug\transformmatrix.obj .\Debug\xform.obj ] -Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1EF.tmp" +Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP378.tmp"

Output Window

Compiling... projections.cpp @@ -57,7 +57,7 @@ Creating library... --------------------Configuration: ctsim - Win32 Debug--------------------

Command Lines

-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1F0.tmp" with contents +Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP379.tmp" with contents [ winmm.lib rpcrt4.lib ws2_32.lib ../libctsim/Debug/libctsim.lib libcmtd.lib ..\..\..\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib ..\..\..\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib wxd.lib xpmd.lib tiffd.lib zlibd.lib pngd.lib comctl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib htmlhelp.lib ctn_lib.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/ctsim.pdb" /debug /machine:I386 /out:"Debug/ctsim.exe" /pdbtype:sept /libpath:"\wx2.2.5\lib" /libpath:"\dicom\ctn\winctn\ctn_lib\Debug" .\Debug\backgroundmgr.obj @@ -84,7 +84,7 @@ winmm.lib rpcrt4.lib ws2_32.lib ../libctsim/Debug/libctsim.lib libcmtd.lib ..\.. \wx2.2.5\lib\zlibd.lib \wx2.2.5\lib\tiffd.lib ] -Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1F0.tmp" +Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP379.tmp"

Output Window

Linking... diff --git a/src/backgroundmgr.cpp b/src/backgroundmgr.cpp index 6d4a50c..52ee796 100644 --- a/src/backgroundmgr.cpp +++ b/src/backgroundmgr.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2001 Kevin Rosenberg ** -** $Id: backgroundmgr.cpp,v 1.15 2001/03/09 21:31:51 kevin Exp $ +** $Id: backgroundmgr.cpp,v 1.16 2001/03/11 06:34:37 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 @@ -67,6 +67,7 @@ BackgroundManager::BackgroundManager () m_sizeCell.Set (m_sizeGauge.x + m_sizeLabel.x + m_sizeCellSpacing.x + m_sizeButton.x, 25); + theApp->getMainFrame()->SetFocus(); Show(false); } @@ -150,9 +151,9 @@ BackgroundManager::OnAddTask (wxCommandEvent& event) resizeWindow(); if (m_iNumTasks == 1) { - SetFocus(); + theApp->getMainFrame()->SetFocus(); Show(true); - theApp->getMainFrame()->SetFocus(); // necessary to keep wxWindows from crashing + theApp->getMainFrame()->SetFocus(); } } @@ -186,8 +187,11 @@ BackgroundManager::OnRemoveTask (wxCommandEvent& event) } pSupervisor->ackRemoveBackgroundManager(); resizeWindow(); - if (m_iNumTasks <= 0) + if (m_iNumTasks <= 0) { + theApp->getMainFrame()->SetFocus(); Show(false); + theApp->getMainFrame()->SetFocus(); + } } void diff --git a/src/backgroundsupr.cpp b/src/backgroundsupr.cpp index 13c1e32..8107a9e 100644 --- a/src/backgroundsupr.cpp +++ b/src/backgroundsupr.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2001 Kevin Rosenberg ** -** $Id: backgroundsupr.cpp,v 1.18 2001/03/09 21:31:51 kevin Exp $ +** $Id: backgroundsupr.cpp,v 1.19 2001/03/11 06:34:37 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 @@ -62,7 +62,7 @@ BackgroundSupervisor::BackgroundSupervisor (SupervisorThread* pMyThread, wxFrame m_iNumThreads = theApp->getNumberCPU(); // ++m_iNumThreads; - m_vecpThreads.reserve (m_iNumThreads); + m_vecpThreads.resize (m_iNumThreads); for (int iThread = 0; iThread < m_iNumThreads; iThread++) m_vecpThreads[iThread] = NULL; diff --git a/src/ctsim.h b/src/ctsim.h index 7ced875..9ca514c 100644 --- a/src/ctsim.h +++ b/src/ctsim.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: ctsim.h,v 1.56 2001/03/10 23:14:16 kevin Exp $ +** $Id: ctsim.h,v 1.57 2001/03/11 06:34:37 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 @@ -309,7 +309,9 @@ enum { PJMENU_RECONSTRUCT_FOURIER, PJMENU_CONVERT_POLAR, PJMENU_CONVERT_FFT_POLAR, + PJMENU_CONVERT_PARALLEL, PJMENU_PLOT_TTHETA_SAMPLING, + PJMENU_ARTIFACT_REDUCTION, IFMENU_FILE_EXPORT, IFMENU_FILE_PROPERTIES, diff --git a/src/views.cpp b/src/views.cpp index 19d564e..9a2eb31 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.131 2001/03/10 23:56:58 kevin Exp $ +** $Id: views.cpp,v 1.132 2001/03/11 06:34:37 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 @@ -2277,9 +2277,12 @@ EVT_MENU(PJMENU_RECONSTRUCT_FBP, ProjectionFileView::OnReconstructFBP) EVT_MENU(PJMENU_RECONSTRUCT_FOURIER, ProjectionFileView::OnReconstructFourier) EVT_MENU(PJMENU_CONVERT_POLAR, ProjectionFileView::OnConvertPolar) EVT_MENU(PJMENU_CONVERT_FFT_POLAR, ProjectionFileView::OnConvertFFTPolar) +EVT_MENU(PJMENU_CONVERT_PARALLEL, ProjectionFileView::OnConvertParallel) EVT_MENU(PJMENU_PLOT_TTHETA_SAMPLING, ProjectionFileView::OnPlotTThetaSampling) +EVT_MENU(PJMENU_ARTIFACT_REDUCTION, ProjectionFileView::OnArtifactReduction) END_EVENT_TABLE() + ProjectionFileView::ProjectionFileView() : wxView(), m_pFrame(0), m_pCanvas(0), m_pFileMenu(0) { @@ -2344,13 +2347,12 @@ ProjectionFileView::OnConvertPolar (wxCommandEvent& event) ImageFile* pIF = new ImageFile (m_iDefaultPolarNX, m_iDefaultPolarNY); m_iDefaultPolarInterpolation = Projections::convertInterpNameToID (strInterpolation.c_str()); - if (! rProj.convertPolar (*pIF, m_iDefaultPolarInterpolation)) { + if (! rProj.convertPolar (*pIF, m_iDefaultPolarInterpolation)) { delete pIF; *theApp->getLog() << "Error converting to Polar\n"; return; } - pPolarDoc = theApp->newImageDoc (); if (! pPolarDoc) { sys_error (ERR_SEVERE, "Unable to create image file"); @@ -2449,6 +2451,34 @@ ProjectionFileView::OnPlotTThetaSampling (wxCommandEvent& event) return; } +void +ProjectionFileView::OnConvertParallel (wxCommandEvent& event) +{ + Projections& rProj = GetDocument()->getProjections(); + if (rProj.geometry() == Scanner::GEOMETRY_PARALLEL) { + wxMessageBox ("Projections are already parallel", "Error"); + return; + } + Projections* pProjNew = rProj.interpolateToParallel(); + ProjectionFileDocument* pProjDocNew = theApp->newProjectionDoc(); + pProjDocNew->setProjections (pProjNew); + + if (ProjectionFileView* projView = pProjDocNew->getView()) { + projView->OnUpdate (projView, NULL); + if (projView->getCanvas()) + projView->getCanvas()->SetClientSize (pProjNew->nDet(), pProjNew->nView()); + if (wxFrame* pFrame = projView->getFrame()) { + pFrame->Show(true); + pFrame->SetFocus(); + pFrame->Raise(); + } + GetDocumentManager()->ActivateView (projView, true, false); + } + if (theApp->getAskDeleteNewDocs()) + pProjDocNew-> Modify(true); + pProjDocNew->UpdateAllViews (this); +} + void ProjectionFileView::OnReconstructFourier (wxCommandEvent& event) { @@ -2572,6 +2602,12 @@ ProjectionFileView::OnReconstructFBP (wxCommandEvent& event) } +void +ProjectionFileView::OnArtifactReduction (wxCommandEvent& event) +{ +} + + ProjectionFileCanvas* ProjectionFileView::CreateCanvas (wxFrame *parent) { @@ -2631,6 +2667,11 @@ ProjectionFileView::CreateChildFrame(wxDocument *doc, wxView *view) wxMenu *convert_menu = new wxMenu; convert_menu->Append (PJMENU_CONVERT_POLAR, "&Polar Image...\tCtrl-L"); convert_menu->Append (PJMENU_CONVERT_FFT_POLAR, "&FFT->Polar Image...\tCtrl-M"); + 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* analyze_menu = new wxMenu; analyze_menu->Append (PJMENU_PLOT_TTHETA_SAMPLING, "&Plot T-Theta Sampling\tCtrl-T"); @@ -2650,6 +2691,7 @@ ProjectionFileView::CreateChildFrame(wxDocument *doc, wxView *view) menu_bar->Append (m_pFileMenu, "&File"); menu_bar->Append (convert_menu, "&Convert"); + 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"); diff --git a/src/views.h b/src/views.h index 38ea685..1946806 100644 --- a/src/views.h +++ b/src/views.h @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: views.h,v 1.48 2001/03/10 23:14:16 kevin Exp $ +** $Id: views.h,v 1.49 2001/03/11 06:34:37 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 @@ -241,7 +241,9 @@ public: void OnConvertPolar (wxCommandEvent& event); void OnConvertFFTPolar (wxCommandEvent& event); void OnPlotTThetaSampling (wxCommandEvent& event); - + void OnConvertParallel (wxCommandEvent& event); + void OnArtifactReduction (wxCommandEvent& event); + #if CTSIM_MDI wxDocMDIChildFrame* getFrame() { return m_pFrame; } #else -- 2.34.1