r358: no message
authorKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 7 Jan 2001 22:53:36 +0000 (22:53 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 7 Jan 2001 22:53:36 +0000 (22:53 +0000)
ChangeLog
configure.in
include/plotfile.h
libctsim/projections.cpp
libctsupport/plotfile.cpp
msvc/copy-binaries.bat
src/views.cpp
tools/Makefile.am

index cf77c83946f900268efcb72cde3cec77d9c6a9f8..ff11c491e13e3cc46a407107328f219f10378ceb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,13 +1,18 @@
 3.0.0alpha4
 
-       * ctsim: Fixed initialization of min/max for PlotFiles
-
        * ctsim: Added reset to full-intensity scale menu item
 
-       * ctsim: Add conversion of projections to polar plot
+       * ctsim: Add conversion of projections to polar plot [Thanks to
+       Ian Kay for reference and math hints in polar bilinear scaling]
 
        * ctsim: improve bilinear scaling of image size
+
+       * ctsim: copies imagefile labels to plotfiles
+
+       * ctsim: Added more analyze menuitems
        
+       * ctsim: Fixed initialization of min/max for PlotFiles
+
        * ezplot: Cleaned up y-tick label placement
 
        * sgp: Added better support for projection/reconstruction animation
index b2ebb1adc7fbd1a21d182f965964d6504b397dfd..e4784718162dd3721353da1ccfd1f4790a87490e 100644 (file)
@@ -4,7 +4,7 @@ dnl Must reset CDPATH so that bash's cd does not print to stdout
 dnl CDPATH=
 
 AC_INIT(src/ctsim.cpp)
-AM_INIT_AUTOMAKE(ctsim,3.0.0beta1)
+AM_INIT_AUTOMAKE(ctsim,3.0.0alpha4)
 AM_CONFIG_HEADER(config.h)
 
 dnl Checks for programs.
index 409746965ff014e898bf24e2141b7232451264f3..42ddf5530430fe760a7289551428912f0e800102 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: plotfile.h,v 1.6 2001/01/02 16:02:12 kevin Exp $
+**  $Id: plotfile.h,v 1.7 2001/01/07 22:53:36 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
@@ -132,6 +132,8 @@ public:
 
   void printHeaders (std::ostream& os) const;
   void printHeaders (std::ostringstream& os) const;
+  void printHeadersBrief (std::ostream& os) const;
+  void printHeadersBrief (std::ostringstream& os) const;
 };
 
 
index 22171504420064543e7d958bb168e461f9f9f79c..3c4f956e891c6f0ab2a644703df81a84e3f74a8d 100644 (file)
@@ -8,7 +8,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: projections.cpp,v 1.38 2001/01/06 15:33:15 kevin Exp $
+**  $Id: projections.cpp,v 1.39 2001/01/07 22:53:36 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
@@ -722,16 +722,16 @@ Projections::convertFFTPolar (ImageFile& rIF, int iInterpolationID, int iZeropad
   fftw_plan plan = fftw_create_plan (m_nDet, FFTW_FORWARD, FFTW_IN_PLACE);
 
   for (iView = 0; iView < m_nView; iView++) {
-    ppcDetValue[iView] = new std::complex<double> [m_nDet];
     unsigned int iDet;
     for (iDet = 0; iDet < m_nDet; iDet++) {
       pcIn[iDet].re = getDetectorArray(iView).detValues()[iDet];
       pcIn[iDet].im = 0;
     }
     fftw_one (plan, pcIn, NULL);
+    ppcDetValue[iView] = new std::complex<double> [m_nDet];
     for (iDet = 0; iDet < m_nDet; iDet++)
-      ppcDetValue[iView][iDet] = std::complex<double> (pcIn[iDet].re, pcIn[iDet].im);
-   Fourier::shuffleFourierToNaturalOrder (ppcDetValue[iView], m_nDet);
+      ppcDetValue[iView][iDet] = std::complex<double> (pcIn[iDet].re, pcIn[iDet].im); 
+    Fourier::shuffleFourierToNaturalOrder (ppcDetValue[iView], m_nDet);
   }
 
   fftw_destroy_plan (plan);  
@@ -748,6 +748,7 @@ Projections::convertFFTPolar (ImageFile& rIF, int iInterpolationID, int iZeropad
   return true;
 }
 
+
 void
 Projections::calcArrayPolarCoordinates (unsigned int nx, unsigned int ny, double** ppdView, double** ppdDet)
 {
@@ -763,8 +764,10 @@ Projections::calcArrayPolarCoordinates (unsigned int nx, unsigned int ny, double
 
   if (m_geometry != Scanner::GEOMETRY_PARALLEL) {
     sys_error (ERR_WARNING, "convertPolar supports Parallel only");
+    return;
   }
   
+  // Calculates polar coordinates (view#, det#) for each point on phantom grid
   double x = xMin + xInc / 2;  // Rectang coords of center of pixel 
   for (unsigned int ix = 0; ix < nx; x += xInc, ix++) {
     double y = yMin + yInc / 2;
index b7e1d57584ec6d6942d00ca6fbd3f86d21e29c37..ef492d64d47a06f7b6761cbff812d093ad772ef9 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: plotfile.cpp,v 1.10 2001/01/02 16:02:13 kevin Exp $
+**  $Id: plotfile.cpp,v 1.11 2001/01/07 22:53:36 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
@@ -359,3 +359,31 @@ PlotFile::printHeaders (std::ostringstream& os) const
   for (unsigned int iDesc = 0; iDesc < m_vecStrDescriptions.size(); iDesc++)
     os << m_vecStrDescriptions[iDesc] << "\n";
 }
+
+void
+PlotFile::printHeadersBrief (std::ostream& os) const
+{
+  os << "EZSet Commands\n";
+  for (unsigned int iEZ = 0; iEZ < m_vecStrEzsetCommands.size(); iEZ++)
+    os << m_vecStrEzsetCommands[iEZ] << "; ";
+  if (m_vecStrEzsetCommands.size() > 0)
+    os << "\n";
+
+  os << "Descriptions\n";
+  for (unsigned int iDesc = 0; iDesc < m_vecStrDescriptions.size(); iDesc++)
+    os << m_vecStrDescriptions[iDesc] << "\n";
+}
+
+void
+PlotFile::printHeadersBrief (std::ostringstream& os) const
+{
+  os << "EZSet Commands\n";
+  for (unsigned int iEZ = 0; iEZ < m_vecStrEzsetCommands.size(); iEZ++)
+    os << m_vecStrEzsetCommands[iEZ] << "; ";
+  if (m_vecStrEzsetCommands.size() > 0)
+    os << "\n";
+
+  os << "Descriptions\n";
+  for (unsigned int iDesc = 0; iDesc < m_vecStrDescriptions.size(); iDesc++)
+    os << m_vecStrDescriptions[iDesc] << "\n";
+}
index 2e7c4f1ef808d601c18a8ea45682d2cb60d8273a..1097990372ed195fd05cc5b94164e935a8e865d7 100755 (executable)
@@ -2,6 +2,7 @@
 \r
 mkdir c:\ctsim\bin\r
 copy ctsim\Release\ctsim.exe c:\ctsim\bin\r
+copy ctsimtext\Release\ctsimtext.exe c:\ctsim\bin\r
 copy if1\Release\if1.exe c:\ctsim\bin\r
 copy if2\Release\if2.exe c:\ctsim\bin\r
 copy ifexport\Release\ifexport.exe c:\ctsim\bin\r
index 7c47aa6415671807810ac4274111fdee5f3d90de..f52b6116e37c99685b3c5f11cc87af252a789d33 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: views.cpp,v 1.52 2001/01/06 15:33:15 kevin Exp $
+**  $Id: views.cpp,v 1.53 2001/01/07 22:53:36 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
@@ -1049,15 +1049,25 @@ ImageFileView::OnPlotRow (wxCommandEvent& event)
   
   const ImageFile& rIF = dynamic_cast<ImageFileDocument*>(GetDocument())->getImageFile();
   ImageFileArrayConst v = rIF.getArray();
+  ImageFileArrayConst vImag = rIF.getImaginaryArray();
   int nx = rIF.nx();
   int ny = rIF.ny();
   
   if (v != NULL && yCursor < ny) {
     double* pX = new double [nx];
-    double* pY = new double [nx];
+    double* pYReal = new double [nx];
+    double *pYImag, *pYMag;
+    if (rIF.isComplex()) {
+      pYImag = new double [nx];
+      pYMag = new double [nx];
+    }
     for (int i = 0; i < nx; i++) {
       pX[i] = i;
-      pY[i] = v[i][yCursor];
+      pYReal[i] = v[i][yCursor];
+      if (rIF.isComplex()) {
+        pYImag[i] = vImag[i][yCursor];
+        pYMag[i] = ::sqrt (v[i][yCursor] * v[i][yCursor] + vImag[i][yCursor] * vImag[i][yCursor]);
+      }
     }
     PlotFileDocument* pPlotDoc = dynamic_cast<PlotFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.plt", wxDOC_SILENT));
     if (! pPlotDoc) {
@@ -1074,12 +1084,37 @@ ImageFileView::OnPlotRow (wxCommandEvent& event)
       rPlotFile.addEzsetCommand ("lxfrac 0");
       rPlotFile.addEzsetCommand ("box");
       rPlotFile.addEzsetCommand ("grid");
-      rPlotFile.setCurveSize (2, nx);
+      rPlotFile.addEzsetCommand ("curve 1");
+      rPlotFile.addEzsetCommand ("color 1");
+      if (rIF.isComplex()) {
+        rPlotFile.addEzsetCommand ("dash 1");
+        rPlotFile.addEzsetCommand ("curve 2");
+        rPlotFile.addEzsetCommand ("color 4");
+        rPlotFile.addEzsetCommand ("dash 3");
+        rPlotFile.addEzsetCommand ("curve 3");
+        rPlotFile.addEzsetCommand ("color 0");
+        rPlotFile.addEzsetCommand ("solid");
+        rPlotFile.setCurveSize (4, nx);
+      } else
+        rPlotFile.setCurveSize (2, nx);
       rPlotFile.addColumn (0, pX);
-      rPlotFile.addColumn (1, pY);
+      rPlotFile.addColumn (1, pYReal); 
+      if (rIF.isComplex()) {
+        rPlotFile.addColumn (2, pYImag);
+        rPlotFile.addColumn (3, pYMag);
+      }
+      for (int iL = 0; iL < rIF.nLabels(); iL++)
+        rPlotFile.addDescription (rIF.labelGet(iL).getLabelString().c_str());
+      os << " Plot of " << GetDocument()->GetFirstView()->GetFrame()->GetTitle().c_str();
+      *theApp->getLog() << os.str().c_str() << "\n";
+      rPlotFile.addDescription (os.str().c_str());
     }
     delete pX;
-    delete pY;
+    delete pYReal;
+    if (rIF.isComplex()) {
+      delete pYImag;
+      delete pYMag;
+    }
     if (theApp->getSetModifyNewDocs())
       pPlotDoc->Modify(true);
     pPlotDoc->UpdateAllViews();
@@ -1097,15 +1132,25 @@ ImageFileView::OnPlotCol (wxCommandEvent& event)
   
   const ImageFile& rIF = dynamic_cast<ImageFileDocument*>(GetDocument())->getImageFile();
   ImageFileArrayConst v = rIF.getArray();
+  ImageFileArrayConst vImag = rIF.getImaginaryArray();
   int nx = rIF.nx();
   int ny = rIF.ny();
   
   if (v != NULL && xCursor < nx) {
     double* pX = new double [ny];
-    double* pY = new double [ny];
+    double* pYReal = new double [nx];
+    double *pYImag, *pYMag;
+    if (rIF.isComplex()) {
+      pYImag = new double [nx];
+      pYMag = new double [nx];
+    }
     for (int i = 0; i < ny; i++) {
       pX[i] = i;
-      pY[i] = v[xCursor][i];
+      pYReal[i] = v[xCursor][i];
+      if (rIF.isComplex()) {
+        pYImag[i] = vImag[xCursor][i];
+        pYMag[i] = ::sqrt (v[xCursor][i] * v[xCursor][i] + vImag[xCursor][i] * vImag[xCursor][i]);
+      }
     }
     PlotFileDocument* pPlotDoc = dynamic_cast<PlotFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.plt", wxDOC_SILENT));
     if (! pPlotDoc) {
@@ -1122,12 +1167,37 @@ ImageFileView::OnPlotCol (wxCommandEvent& event)
       rPlotFile.addEzsetCommand ("lxfrac 0");
       rPlotFile.addEzsetCommand ("box");
       rPlotFile.addEzsetCommand ("grid");
-      rPlotFile.setCurveSize (2, nx);
+      rPlotFile.addEzsetCommand ("curve 1");
+      rPlotFile.addEzsetCommand ("color 1");
+      if (rIF.isComplex()) {
+        rPlotFile.addEzsetCommand ("dash 1");
+        rPlotFile.addEzsetCommand ("curve 2");
+        rPlotFile.addEzsetCommand ("color 4");
+        rPlotFile.addEzsetCommand ("dash 3");
+        rPlotFile.addEzsetCommand ("curve 3");
+        rPlotFile.addEzsetCommand ("color 0");
+        rPlotFile.addEzsetCommand ("solid");
+        rPlotFile.setCurveSize (4, nx);
+      } else
+        rPlotFile.setCurveSize (2, nx);
       rPlotFile.addColumn (0, pX);
-      rPlotFile.addColumn (1, pY);
+      rPlotFile.addColumn (1, pYReal); 
+      if (rIF.isComplex()) {
+        rPlotFile.addColumn (2, pYImag);
+        rPlotFile.addColumn (3, pYMag);
+      }
+      for (int iL = 0; iL < rIF.nLabels(); iL++)
+        rPlotFile.addDescription (rIF.labelGet(iL).getLabelString().c_str());
+      os << " Plot of " << GetDocument()->GetFirstView()->GetFrame()->GetTitle().c_str();
+      *theApp->getLog() << os.str().c_str() << "\n";
+      rPlotFile.addDescription (os.str().c_str());
     }
     delete pX;
-    delete pY;
+    delete pYReal;
+    if (rIF.isComplex()) {
+      delete pYImag;
+      delete pYMag;
+    }
     if (theApp->getSetModifyNewDocs())
       pPlotDoc->Modify(true);
     pPlotDoc->UpdateAllViews();
@@ -1195,19 +1265,26 @@ ImageFileView::OnPlotFFTRow (wxCommandEvent& event)
       rPlotFile.addEzsetCommand ("lxfrac 0");
       rPlotFile.addEzsetCommand ("curve 1");
       rPlotFile.addEzsetCommand ("color 1");
-      rPlotFile.addEzsetCommand ("curve 2");
-      rPlotFile.addEzsetCommand ("color 2");
-      rPlotFile.addEzsetCommand ("dash 1");
-      rPlotFile.addEzsetCommand ("curve 3");
-      rPlotFile.addEzsetCommand ("dash 2");
-      rPlotFile.addEzsetCommand ("color 3");
-      rPlotFile.addEzsetCommand ("box");
+       rPlotFile.addEzsetCommand ("dash 1");
+        rPlotFile.addEzsetCommand ("curve 2");
+        rPlotFile.addEzsetCommand ("color 4");
+        rPlotFile.addEzsetCommand ("dash 3");
+        rPlotFile.addEzsetCommand ("curve 3");
+        rPlotFile.addEzsetCommand ("color 0");
+        rPlotFile.addEzsetCommand ("solid");
+        rPlotFile.setCurveSize (4, nx);
+       rPlotFile.addEzsetCommand ("box");
       rPlotFile.addEzsetCommand ("grid");
-      rPlotFile.setCurveSize (2, nx);
+      rPlotFile.setCurveSize (4, nx);
       rPlotFile.addColumn (0, pX);
       rPlotFile.addColumn (1, pYReal);
       rPlotFile.addColumn (2, pYImag);
       rPlotFile.addColumn (3, pYMag);
+      for (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";
+      rPlotFile.addDescription (os.str().c_str());
     }
     delete pX;
     delete pYReal;
@@ -1330,6 +1407,24 @@ ImageFileView::OnCompareCol (wxCommandEvent& event)
         rPlotFile.addColumn (0, pX);
         rPlotFile.addColumn (1, pY1);
         rPlotFile.addColumn (2, pY2);
+
+        unsigned int iL;
+        for (iL = 0; iL < rIF.nLabels(); iL++) {
+          std::string s = GetDocument()->GetFirstView()->GetFrame()->GetTitle();
+          s += ": ";
+          s += rIF.labelGet(iL).getLabelString();
+          rPlotFile.addDescription (s.c_str());
+        }
+        for (iL = 0; iL < rIF.nLabels(); iL++) {
+          std::string s = pCompareDoc->GetFirstView()->GetFrame()->GetTitle();
+          s += ": ";
+          s += rCompareIF.labelGet(iL).getLabelString();
+          rPlotFile.addDescription (s.c_str());
+        }
+        os << " Between " << GetDocument()->GetFirstView()->GetFrame()->GetTitle() << " and "
+          << pCompareDoc->GetFirstView()->GetFrame()->GetTitle();
+        *theApp->getLog() << os.str().c_str() << "\n";
+        rPlotFile.addDescription (os.str().c_str());
       }
       delete pX;
       delete pY1;
@@ -1403,6 +1498,23 @@ ImageFileView::OnCompareRow (wxCommandEvent& event)
         rPlotFile.addColumn (0, pX);
         rPlotFile.addColumn (1, pY1);
         rPlotFile.addColumn (2, pY2);
+        unsigned int iL;
+        for (iL = 0; iL < rIF.nLabels(); iL++) {
+          std::string s = GetDocument()->GetFirstView()->GetFrame()->GetTitle();
+          s += ": ";
+          s += rIF.labelGet(iL).getLabelString();
+          rPlotFile.addDescription (s.c_str());
+        }
+        for (iL = 0; iL < rIF.nLabels(); iL++) {
+          std::string s = pCompareDoc->GetFirstView()->GetFrame()->GetTitle();
+          s += ": ";
+          s += rCompareIF.labelGet(iL).getLabelString();
+          rPlotFile.addDescription (s.c_str());
+        }
+        os << " Between " << GetDocument()->GetFirstView()->GetFrame()->GetTitle() << " and "
+          << pCompareDoc->GetFirstView()->GetFrame()->GetTitle();
+        *theApp->getLog() << os.str().c_str() << "\n";
+        rPlotFile.addDescription (os.str().c_str());
       }
       delete pX;
       delete pY1;
@@ -1461,6 +1573,15 @@ ImageFileView::OnPlotHistogram (wxCommandEvent& event)
     rPlotFile.setCurveSize (2, nx);
     rPlotFile.addColumn (0, pX);
     rPlotFile.addColumn (1, pY);
+    for (unsigned int iL = 0; iL < rIF.nLabels(); iL++) {
+      std::string s = GetDocument()->GetFirstView()->GetFrame()->GetTitle();
+      s += ": ";
+      s += rIF.labelGet(iL).getLabelString();
+      rPlotFile.addDescription (s.c_str());
+    }
+    os << " Plot of " << GetDocument()->GetFirstView()->GetFrame()->GetTitle();
+    *theApp->getLog() << os.str().c_str() << "\n";
+    rPlotFile.addDescription (os.str().c_str());
     delete pX;
     delete pY;
     if (theApp->getSetModifyNewDocs())
@@ -2251,7 +2372,7 @@ PlotFileView::OnProperties (wxCommandEvent& event)
   const PlotFile& rPlot = GetDocument()->getPlotFile();
   std::ostringstream os;
   os << "Columns: " << rPlot.getNumColumns() << ", Records: " << rPlot.getNumRecords() << "\n";
-  rPlot.printHeaders (os);
+  rPlot.printHeadersBrief (os);
   *theApp->getLog() << os.str().c_str();
   wxMessageDialog dialogMsg (m_frame, os.str().c_str(), "Plot File Properties", wxOK | wxICON_INFORMATION);
   dialogMsg.ShowModal();
index ca8ef64eadcb43585118654100128523b4c69633..0577039cfe0bb7cd3ed913820a20f57588642d1d 100644 (file)
@@ -1,4 +1,4 @@
-bin_PROGRAMS = pjrec phm2pj pj2if @lamprograms@  ifinfo phm2if if1 if2 ifexport pjinfo
+bin_PROGRAMS = pjrec phm2pj pj2if @lamprograms@  ifinfo phm2if if1 if2 ifexport pjinfo ctsimtext
 bin_SCRIPTS = sample-ctsim.sh
 EXTRA_PROGRAMS = pjrec-lam phm2pj-lam phm2if-lam
 INCLUDES=@my_includes@
@@ -38,6 +38,10 @@ ifinfo_SOURCES = ifinfo.cpp
 ifinfo_LDADD=@ctlibs@
 ifinfo_DEPENDENCIES=$(SOURCE_DEPEND)
 
+ctsimtext_SOURCES = ctsimtext.cpp if1.cpp if2.cpp ifinfo.cpp ifexport.cpp phm2if.cpp phm2pj.cpp pj2if.cpp pjinfo.cpp pjrec.cpp
+ctsimtext_LDADD=@ctlibs@
+ctsim_DEPENDENCIES=$(SOURCE_DEPEND)
+
 pjrec_lam_SOURCES=pjrec.cpp
 pjrec_lam_LDADD=@ctlamlibs@
 phm2if_lam_SOURCES=phm2if.cpp
@@ -52,6 +56,9 @@ if USE_LAM
 CC_LAM = $(lamdir)/bin/hcp
 LAM_EXTRA_SRC = mpiworld.cpp
 
+ctsimtext-lam: ctsimtext.cpp if1.cpp if2.cpp ifinfo.cpp ifexport.cpp phm2if.cpp phm2pj.cpp pj2if.cpp pjinfo.cpp pjrec.cpp mpiworld.cpp ../include/ct.h  ../libctsim/libctsim.a ../libctsupport/libctsupport.a
+       $(CC_LAM) @DEFS@ @lamdefs@ $(CFLAGS) $(INCLUDES) -DHAVE_MPI ctsimtext.cpp if1.cpp if2.cpp ifinfo.cpp ifexport.cpp phm2if.cpp phm2pj.cpp pj2if.cpp pjinfo.cpp pjrec.cpp -o ctsimtext-lam $(LDFLAGS) $(LAM_EXTRA_SRC) @ctlibs@
+
 pjrec-lam: pjrec.cpp mpiworld.cpp ../include/ct.h  ../libctsim/libctsim.a ../libctsupport/libctsupport.a
        $(CC_LAM) @DEFS@ @lamdefs@ $(CFLAGS) $(INCLUDES) -DHAVE_MPI pjrec.cpp -o pjrec-lam $(LDFLAGS) $(LAM_EXTRA_SRC) @ctlibs@