From 806adf54f5b8d061662696b3b498bfab3cd8b2e6 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Mon, 4 Dec 2000 19:50:57 +0000 Subject: [PATCH] r245: *** empty log message *** --- libctsim/array2dfile.cpp | 14 ++++++++++---- libctsim/backprojectors.cpp | 10 ++++++---- libctsim/filter.cpp | 7 ++++--- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/libctsim/array2dfile.cpp b/libctsim/array2dfile.cpp index f918471..2999470 100644 --- a/libctsim/array2dfile.cpp +++ b/libctsim/array2dfile.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: array2dfile.cpp,v 1.13 2000/12/04 04:15:48 kevin Exp $ +** $Id: array2dfile.cpp,v 1.14 2000/12/04 19:50:57 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 @@ -278,7 +278,11 @@ Array2dFile::fileRead (const char* const filename) { m_filename = filename; - frnetorderstream fs (m_filename.c_str(), ios::out | ios::in | ios::binary | ios::nocreate); +#ifdef MSVC + frnetorderstream fs (m_filename.c_str(), ios::out | ios::in | ios::binary); +#else + frnetorderstream fs (m_filename.c_str(), ios::out | ios::in | ios::binary | ios::nocreate); +#endif if (fs.fail()) { sys_error (ERR_WARNING, "Unable to open file %s [fileRead]", m_filename.c_str()); return false; @@ -476,13 +480,15 @@ Array2dFile::labelsRead (frnetorderstream& fs) kuint16 strLength; fs.readInt16 (strLength); - char labelStr [strLength+1]; + char* labelStr = new char [strLength+1]; fs.read (labelStr, strLength); labelStr[strLength] = 0; Array2dFileLabel* pLabel = new Array2dFileLabel(labelType, labelStr, calcTime); + delete labelStr; + pLabel->setDateTime (year, month, day, hour, minute, second); - m_labels.push_back (pLabel); + m_labels.push_back (pLabel); } return true; diff --git a/libctsim/backprojectors.cpp b/libctsim/backprojectors.cpp index 152e026..5f674ec 100644 --- a/libctsim/backprojectors.cpp +++ b/libctsim/backprojectors.cpp @@ -8,7 +8,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: backprojectors.cpp,v 1.15 2000/12/03 15:16:18 kevin Exp $ +** $Id: backprojectors.cpp,v 1.16 2000/12/04 19:50:57 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 @@ -256,7 +256,7 @@ Backprojector::convertInterpIDToTitle (const int interpID) // PURPOSE // Pure virtual base class for all backprojectors. -Backproject::Backproject (const Projections& proj, ImageFile& im, const int interpType, const int interpFactor) +Backproject::Backproject (const Projections& proj, ImageFile& im, int interpType, const int interpFactor) : proj(proj), im(im), interpType(interpType), m_interpFactor(interpFactor) { detInc = proj.detInc(); @@ -599,7 +599,7 @@ BackprojectIntDiff3::BackprojectView (const double* const filteredProj, const do kint32 detPosColStart = nearest ((start_r * cos (theta - start_phi) / detInc + iDetCenter) * scale); // precalculate scaled difference for linear interpolation - double deltaFilteredProj [nDet]; + double* deltaFilteredProj = new double [nDet]; if (interpType == Backprojector::INTERP_LINEAR) { for (int i = 0; i < nDet - 1; i++) deltaFilteredProj[i] = (filteredProj[i+1] - filteredProj[i]) * dInvScale; @@ -631,7 +631,9 @@ BackprojectIntDiff3::BackprojectView (const double* const filteredProj, const do *pImCol++ += filteredProj[iDetPos] + (detRemainder * deltaFilteredProj[iDetPos]); } // end for iy } //end linear - } // end for ix + } // end for ix + + delete deltaFilteredProj; } diff --git a/libctsim/filter.cpp b/libctsim/filter.cpp index ef47938..5a4b0ef 100644 --- a/libctsim/filter.cpp +++ b/libctsim/filter.cpp @@ -9,7 +9,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: filter.cpp,v 1.31 2000/11/28 14:54:29 kevin Exp $ +** $Id: filter.cpp,v 1.32 2000/12/04 19:50:57 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 @@ -364,12 +364,13 @@ SignalFilter::spatialResponseCalc (int filterID, double bw, double x, double par double zinc = (zmax - zmin) / (n - 1); double z = zmin; - double q [n]; + double* q = new double [n]; for (int i = 0; i < n; i++, z += zinc) q[i] = frequencyResponse (filterID, bw, z, param) * cos (TWOPI * z * x); double y = 2 * integrateSimpson (zmin, zmax, q, n); - + delete q; + return (y); } -- 2.34.1