r2169: *** empty log message ***
[ctsim.git] / libctsim / imagefile.cpp
index d10e1bd8a2d9eaaeb058c526800abaaa97a93b0b..4a49465065257ba2f02dd5c4df6c20e2b1cd4ebc 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (c) 1983-2001 Kevin Rosenberg
 **
-**  $Id: imagefile.cpp,v 1.45 2001/09/24 09:40:42 kevin Exp $
+**  $Id: imagefile.cpp,v 1.46 2002/06/27 03:19:23 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
@@ -841,7 +841,7 @@ ImageFile::fftRows (ImageFile& result) const
 
   fftw_complex* in = new fftw_complex [m_nx];
   std::complex<double>* pcRow = new std::complex<double> [m_nx];  
-  for (int iy = 0; iy < m_ny; iy++) {
+  for (unsigned int iy = 0; iy < m_ny; iy++) {
     unsigned int ix;
     for (ix = 0; ix < m_nx; ix++) {
       in[ix].re = vReal[ix][iy];
@@ -892,7 +892,7 @@ ImageFile::ifftRows (ImageFile& result) const
   std::complex<double>* pcRow = new std::complex<double> [m_nx];
   
   unsigned int ix, iy;
-  unsigned int iArray = 0;
+  // unsigned int iArray = 0;
   for (iy = 0; iy < m_ny; iy++) {
     for (ix = 0; ix < m_nx; ix++) {
       double dImag = 0;
@@ -943,7 +943,7 @@ ImageFile::fftCols (ImageFile& result) const
 
   std::complex<double>* pcCol = new std::complex<double> [m_ny];  
   fftw_complex* in = new fftw_complex [m_ny];
-  for (int ix = 0; ix < m_nx; ix++) {
+  for (unsigned int ix = 0; ix < m_nx; ix++) {
     unsigned int iy;
     for (iy = 0; iy < m_ny; iy++) {
       in[iy].re = vReal[ix][iy];
@@ -994,7 +994,7 @@ ImageFile::ifftCols (ImageFile& result) const
   std::complex<double>* pcCol = new std::complex<double> [m_ny];
   
   unsigned int ix, iy;
-  unsigned int iArray = 0;
+  // unsigned int iArray = 0;
   for (ix = 0; ix < m_nx; ix++) {
     for (iy = 0; iy < m_ny; iy++) {
       double dImag = 0;
@@ -1609,22 +1609,24 @@ ImageFile::readImagePNG (const char* const pszFile)
   ImageFileArray v = getArray();
   for (int iy = 0; iy < height; iy++) {
     for (int ix = 0; ix < width; ix++) {
-      double dV;
+      double dV = 0;
       if (color_type == PNG_COLOR_TYPE_GRAY) {
         if (bit_depth == 8)
           dV = row_pointers[iy][ix] / 255.;
         else if (bit_depth == 16) {
           int iBase = ix * 2;
           dV = (row_pointers[iy][iBase] + (row_pointers[iy][iBase+1] << 8)) / 65536.;
-        }
+        } else
+         dV = 0;
       } else if (color_type == PNG_COLOR_TYPE_RGB) {
         if (bit_depth == 8) {
           int iBase = ix * 3;
           double dR = row_pointers[iy][iBase] / 255.;
           double dG = row_pointers[iy][iBase+1] / 255.;
           double dB = row_pointers[iy][iBase+2] / 255.;
-          dV = colorToGrayscale (dR, dG, dR);
-        }
+          dV = colorToGrayscale (dR, dG, dB);
+        } else
+         dV = 0;
       }
       v[ix][height-iy-1] = dV;
     }