r627: no message
authorKevin M. Rosenberg <kevin@rosenberg.net>
Sat, 10 Mar 2001 23:56:58 +0000 (23:56 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Sat, 10 Mar 2001 23:56:58 +0000 (23:56 +0000)
ChangeLog
include/projections.h
libctsim/projections.cpp
msvc/ctsim/ctsim.plg
src/views.cpp

index 1467907a876c3574e0d7e81c8a0feaf70ce6e64d..5d0a3918c73e03f282a961fc4bd87b29296d3b15 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -28,6 +28,8 @@
        * ctsim: Added "Verbose Logging", "Startup Tips", and
        "Background processes" options  to Preferences dialog.
 
+       * plotfile: Added scattergram plot functions
+
        * ctsim: Added accelerator key for File-Properties
 
        * views.cpp: Added out of memory checks to display for huge
@@ -35,7 +37,9 @@
 
        * distribution: fixed problem with documentation files not
        being included with the distribution [Reported by Ian Kay].
-       
+
+       * sgp.cpp: Fixed bug in drawCircle
+
 3.0.3 - Released 2/20/01
 
        * ctsim: Fixed core dump on Linux with OpenGL
index 39cb09a7a67446a3723a7cb06a6921bc6ddc68a7..9e64f260d49fd9da53e39468223900565053e625 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: projections.h,v 1.28 2001/03/10 23:14:15 kevin Exp $
+**  $Id: projections.h,v 1.29 2001/03/10 23:56:58 kevin Exp $
 **
 **
 **  This program is free software; you can redistribute it and/or modify
@@ -37,6 +37,8 @@ class fnetorderstream;
 #include "array2dfile.h"
 #include "imagefile.h"
 #include <complex>
+#include <vector>
+
 
 //used for rebinning divergent beam projections to parallel
 class ParallelRaysumCoordinate {  
@@ -50,20 +52,34 @@ public:
   {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 compareByT(ParallelRaysumCoordinate* a, ParallelRaysumCoordinate* b)
+  { return a->m_dT > b->m_dT; }
+
 };
 
 class ParallelRaysums {
-private:
-  ParallelRaysumCoordinate** m_ppCoordinates;
-  int m_iNumCoordinates;
-
 public:
   ParallelRaysums (Projections* pProjections);
   ~ParallelRaysums ();
 
-  ParallelRaysumCoordinate** getCoordinates() {return m_ppCoordinates;}
+  typedef std::vector<ParallelRaysumCoordinate*> CoordinateContainer;
+  typedef CoordinateContainer::iterator CoordinateIterator;
+
+  CoordinateContainer& getCoordinates() {return m_vecpCoordinates;}
   int getNumCoordinates() const {return m_iNumCoordinates;}
   void getLimits (double* dMinT, double* dMaxT, double* dMinTheta, double* dMaxTheta) const;
+  CoordinateContainer& getSortedByT();
+  CoordinateContainer& getSortedByTheta();
+
+private:
+  CoordinateContainer m_vecpCoordinates;
+  CoordinateContainer m_vecpSortedByT;
+  CoordinateContainer m_vecpSortedByTheta;
+  int m_iNumCoordinates;
 };
 
 
index b3d6d35b2df647b5595d60c01bebcf30771af957..d6a484335943945d8f4ffa02a6bb77e495412fb7 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: projections.cpp,v 1.55 2001/03/10 23:14:16 kevin Exp $
+**  $Id: projections.cpp,v 1.56 2001/03/10 23:56:58 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
@@ -970,7 +970,7 @@ Projections::initFromSomatomAR_STAR (int iNViews, int iNDets, unsigned char* pDa
 
 
 ParallelRaysums::ParallelRaysums (Projections* pProjections)
-: m_ppCoordinates(NULL), m_iNumCoordinates(0)
+: m_iNumCoordinates(0)
 {
   int nDet = pProjections->nDet();
   int nView = pProjections->nView();
@@ -980,30 +980,33 @@ ParallelRaysums::ParallelRaysums (Projections* pProjections)
   double dFocalLength = pProjections->focalLength();
 
   m_iNumCoordinates =  nDet * nView;
-  m_ppCoordinates = new ParallelRaysumCoordinate* [m_iNumCoordinates];
+  m_vecpCoordinates.reserve (m_iNumCoordinates);
   for (int i = 0; i < m_iNumCoordinates; i++)
-    m_ppCoordinates[i] = new ParallelRaysumCoordinate;
-
-  ParallelRaysumCoordinate** ppCurrentCoordinate = m_ppCoordinates;
+    m_vecpCoordinates[i] = new ParallelRaysumCoordinate;
 
+  int iCoordinate = 0;
   for (int iV = 0; iV < nView; iV++) {
     double dViewAngle = pProjections->getDetectorArray(iV).viewAngle();
+
+    double dDetPos = dDetStart;
     for (int iD = 0; iD < nDet; iD++) {
-      ParallelRaysumCoordinate* pC = *ppCurrentCoordinate;
+      ParallelRaysumCoordinate* pC = m_vecpCoordinates[iCoordinate++];
+
       if (iGeometry == Scanner::GEOMETRY_PARALLEL) {
-        pC->m_dTheta = dViewAngle;
-        pC->m_dT = dDetStart + (iD * dDetInc);
+        pC->m_dTheta = normalizeAngle (dViewAngle);
+        pC->m_dT = dDetPos;
+
       } else if (iGeometry == Scanner::GEOMETRY_EQUILINEAR) {
-        double dDetPos = dDetStart + (iD * dDetInc);
         double dFanAngle = atan (dDetPos / pProjections->sourceDetectorLength());
-        pC->m_dTheta = dViewAngle + dFanAngle;
+        pC->m_dTheta = normalizeAngle (dViewAngle + dFanAngle);
         pC->m_dT = dFocalLength * sin(dFanAngle);        
+
       } else if (iGeometry == Scanner::GEOMETRY_EQUIANGULAR) {
-        double dFanAngle = dDetStart + (iD * dDetInc);
-        pC->m_dTheta = dViewAngle + dFanAngle;
-        pC->m_dT = dFocalLength * sin(dFanAngle);        
+        // fan angle is same as dDetPos
+        pC->m_dTheta = normalizeAngle (dViewAngle + dDetPos);
+        pC->m_dT = dFocalLength * sin (dDetPos);        
       }
-      ++ppCurrentCoordinate;
+      dDetPos += dDetInc;
     }
   }
 }
@@ -1011,23 +1014,49 @@ ParallelRaysums::ParallelRaysums (Projections* pProjections)
 ParallelRaysums::~ParallelRaysums()
 {
   for (int i = 0; i < m_iNumCoordinates; i++)
-    delete m_ppCoordinates[i];
+    delete m_vecpCoordinates[i];
+}
 
-  delete m_ppCoordinates;
+ParallelRaysums::CoordinateContainer&
+ParallelRaysums::getSortedByTheta()
+{
+  if (m_vecpSortedByTheta.size() == 0) {
+    m_vecpSortedByTheta.reserve (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);
+  }
+
+  return m_vecpSortedByTheta;
+}
+
+ParallelRaysums::CoordinateContainer&
+ParallelRaysums::getSortedByT()
+{
+  if (m_vecpSortedByT.size() == 0) {
+    m_vecpSortedByT.reserve (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);
+  }
+
+  return m_vecpSortedByT;
 }
 
+
 void
 ParallelRaysums::getLimits (double* dMinT, double* dMaxT, double* dMinTheta, double* dMaxTheta) const
 {
   if (m_iNumCoordinates <= 0)
     return;
 
-  *dMinT = *dMaxT = m_ppCoordinates[0]->m_dT;
-  *dMinTheta = *dMaxTheta = m_ppCoordinates[0]->m_dTheta;
+  *dMinT = *dMaxT = m_vecpCoordinates[0]->m_dT;
+  *dMinTheta = *dMaxTheta = m_vecpCoordinates[0]->m_dTheta;
 
   for (int i = 0; i < m_iNumCoordinates; i++) {
-    double dT = m_ppCoordinates[i]->m_dT;
-    double dTheta = m_ppCoordinates[i]->m_dTheta;
+    double dT = m_vecpCoordinates[i]->m_dT;
+    double dTheta = m_vecpCoordinates[i]->m_dTheta;
+
     if (dT < *dMinT)
       *dMinT = dT;
     else if (dT > *dMaxT)
index 375e1028b16f6ac93a1e1020eb1323356cc4e647..2a1a9212ac6e0c438f173e9c31b1c71e324965b0 100644 (file)
@@ -6,13 +6,13 @@
 --------------------Configuration: libctsim - Win32 Debug--------------------
 </h3>
 <h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1B8.tmp" with contents
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1EE.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\libctgraphics\ezplot.cpp"
+"C:\ctsim\libctsim\projections.cpp"
 ]
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1B8.tmp" 
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1B9.tmp" with contents
+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
 [
 /nologo /out:"Debug\libctsim.lib" 
 .\Debug\array2dfile.obj
@@ -48,22 +48,16 @@ Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1B9.tmp" with conten
 .\Debug\transformmatrix.obj
 .\Debug\xform.obj
 ]
-Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1B9.tmp"
+Creating command line "link.exe -lib @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1EF.tmp"
 <h3>Output Window</h3>
 Compiling...
-ezplot.cpp
+projections.cpp
 Creating library...
 <h3>
 --------------------Configuration: ctsim - Win32 Debug--------------------
 </h3>
 <h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1BA.tmp" with contents
-[
-/nologo /G6 /MTd /W3 /Gm /Gi /GR /GX /Zi /Od /Gy /I "\wx2.2.5\include" /I "..\..\..\fftw-2.1.3\fftw" /I "\wx2.2.5\src\png" /I "\wx2.2.5\src\zlib" /I "..\..\include" /I "..\..\getopt" /I "..\..\..\fftw-2.1.3\rfftw" /I "\dicom\ctn\include" /D VERSION=\"3.0.0beta1\" /D "_DEBUG" /D "__WXMSW__" /D "HAVE_SGP" /D "HAVE_PNG" /D "HAVE_WXWINDOWS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_FFTW" /D "HAVE_RFFTW" /D "HAVE_GETOPT_H" /D "MSVC" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D CTSIMVERSION=\"3.1.0\" /D "HAVE_CTN_DICOM" /D CTSIMVERSION=\"3.0.0alpha5\" /FR"Debug/" /Fp"Debug/ctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c 
-"C:\ctsim\src\views.cpp"
-]
-Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1BA.tmp" 
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1BB.tmp" with contents
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1F0.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
@@ -90,10 +84,8 @@ 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\RSP1BB.tmp"
+Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP1F0.tmp"
 <h3>Output Window</h3>
-Compiling...
-views.cpp
 Linking...
 
 
index 6f55604e11f4c69ee725b19455e897d1c148c66a..19d564ef84ecbd11f9d913623b2e4284cd1ada81 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: views.cpp,v 1.130 2001/03/10 23:14:16 kevin Exp $
+**  $Id: views.cpp,v 1.131 2001/03/10 23:56:58 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
@@ -2419,13 +2419,13 @@ ProjectionFileView::OnPlotTThetaSampling (wxCommandEvent& event)
     ParallelRaysums parallel (&rProj);
     PlotFileDocument* pPlotDoc = theApp->newPlotDoc();
     PlotFile& rPlot = pPlotDoc->getPlotFile();
-    ParallelRaysumCoordinate** ppCoord = parallel.getCoordinates();
+    ParallelRaysums::CoordinateContainer& coordContainer = parallel.getCoordinates();
     double* pdT = new double [parallel.getNumCoordinates()];
     double* pdTheta = new double [parallel.getNumCoordinates()];
+
     for (int i = 0; i < parallel.getNumCoordinates(); i++) {
-      pdT[i] = (*ppCoord)->m_dT;
-      pdTheta[i] = (*ppCoord)->m_dTheta;
-      ++ppCoord;
+      pdT[i] = coordContainer[i]->m_dT;
+      pdTheta[i] = coordContainer[i]->m_dTheta;
     }
     rPlot.setCurveSize (2, parallel.getNumCoordinates(), true);
     rPlot.addEzsetCommand ("title T-Theta Sampling");