r310: plotfile updates
[ctsim.git] / libctsim / imagefile.cpp
index d4c973cc3a4a1aeeb1f7be4054c9f9ade7f581ff..b86ff794ae9cd0242201c21e33184bca9c513e3f 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: imagefile.cpp,v 1.22 2000/12/20 20:08:48 kevin Exp $
+**  $Id: imagefile.cpp,v 1.23 2000/12/21 03:40: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
@@ -233,13 +233,15 @@ ImageFile::statistics (double& min, double& max, double& mean, double& mode, dou
     if (v == NULL || nx == 0 || ny == 0)
                return;
 \r
-       std::vector<double> vecImage (nx * ny);\r
+       std::vector<double> vecImage;\r
+       int iVec = 0;\r
+       vecImage.resize (nx * ny);\r
     for (int ix = 0; ix < nx; ix++) {\r
                for (int iy = 0; iy < ny; iy++)\r
-                       vecImage.push_back (v[ix][iy]);\r
+                       vecImage[iVec++] = v[ix][iy];\r
        }\r
 \r
-       vectorNumericStatistics (vecImage, min, max, mean, mode, median, stddev);\r
+       vectorNumericStatistics (vecImage, nx * ny, min, max, mean, mode, median, stddev);\r
 }