X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctsim%2Fimagefile.cpp;h=b86ff794ae9cd0242201c21e33184bca9c513e3f;hp=d4c973cc3a4a1aeeb1f7be4054c9f9ade7f581ff;hb=f7d2b7144f32a7bd157b7689022e62944b82fcc1;hpb=fd1d136a94a6d20013f38d6a997bdfefad0f5e98 diff --git a/libctsim/imagefile.cpp b/libctsim/imagefile.cpp index d4c973c..b86ff79 100644 --- a/libctsim/imagefile.cpp +++ b/libctsim/imagefile.cpp @@ -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; - std::vector vecImage (nx * ny); + std::vector vecImage; + int iVec = 0; + vecImage.resize (nx * ny); for (int ix = 0; ix < nx; ix++) { for (int iy = 0; iy < ny; iy++) - vecImage.push_back (v[ix][iy]); + vecImage[iVec++] = v[ix][iy]; } - vectorNumericStatistics (vecImage, min, max, mean, mode, median, stddev); + vectorNumericStatistics (vecImage, nx * ny, min, max, mean, mode, median, stddev); }