X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctsim%2Fimagefile.cpp;h=b6525e1fda69077f252b2994aede0cb997d01d21;hp=84c66741ec86b223bdac6254ebd6b6bc6be0bc15;hb=7ae47cb0ff0a16d1c36797576155263434cc73ff;hpb=ee405282853525f1fa25c4f4321ba85652353564 diff --git a/libctsim/imagefile.cpp b/libctsim/imagefile.cpp index 84c6674..b6525e1 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.26 2000/12/29 19:30:08 kevin Exp $ +** $Id: imagefile.cpp,v 1.27 2000/12/29 20:15:37 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 @@ -298,9 +298,9 @@ ImageFile::convertRealToComplex () return false; ImageFileArray vImag = getImaginaryArray(); - for (int ix = 0; ix < m_nx; ix++) { + for (unsigned int ix = 0; ix < m_nx; ix++) { ImageFileColumn vCol = vImag[ix]; - for (int iy = 0; iy < m_ny; iy++) + for (unsigned int iy = 0; iy < m_ny; iy++) *vCol++ = 0; } @@ -315,10 +315,10 @@ ImageFile::convertComplexToReal () ImageFileArray vReal = getArray(); ImageFileArray vImag = getImaginaryArray(); - for (int ix = 0; ix < m_nx; ix++) { + for (unsigned int ix = 0; ix < m_nx; ix++) { ImageFileColumn vRealCol = vReal[ix]; ImageFileColumn vImagCol = vImag[ix]; - for (int iy = 0; iy < m_ny; iy++) { + for (unsigned int iy = 0; iy < m_ny; iy++) { std::complex c (*vRealCol, *vImagCol); *vRealCol++ = std::abs (c); vImagCol++; @@ -340,11 +340,11 @@ ImageFile::subtractImages (const ImageFile& rRHS, ImageFile& result) const ImageFileArrayConst vRHS = rRHS.getArray(); ImageFileArray vResult = result.getArray(); - for (int ix = 0; ix < m_nx; ix++) { + for (unsigned int ix = 0; ix < m_nx; ix++) { ImageFileColumnConst in1 = vLHS[ix]; ImageFileColumnConst in2 = vRHS[ix]; ImageFileColumn out = vResult[ix]; - for (int iy = 0; iy < m_ny; iy++) + for (unsigned int iy = 0; iy < m_ny; iy++) *out++ = *in1++ - *in2++; } @@ -363,11 +363,11 @@ ImageFile::addImages (const ImageFile& rRHS, ImageFile& result) const ImageFileArrayConst vRHS = rRHS.getArray(); ImageFileArray vResult = result.getArray(); - for (int ix = 0; ix < m_nx; ix++) { + for (unsigned int ix = 0; ix < m_nx; ix++) { ImageFileColumnConst in1 = vLHS[ix]; ImageFileColumnConst in2 = vRHS[ix]; ImageFileColumn out = vResult[ix]; - for (int iy = 0; iy < m_ny; iy++) + for (unsigned int iy = 0; iy < m_ny; iy++) *out++ = *in1++ + *in2++; } @@ -386,11 +386,11 @@ ImageFile::multiplyImages (const ImageFile& rRHS, ImageFile& result) const ImageFileArrayConst vRHS = rRHS.getArray(); ImageFileArray vResult = result.getArray(); - for (int ix = 0; ix < m_nx; ix++) { + for (unsigned int ix = 0; ix < m_nx; ix++) { ImageFileColumnConst in1 = vLHS[ix]; ImageFileColumnConst in2 = vRHS[ix]; ImageFileColumn out = vResult[ix]; - for (int iy = 0; iy < m_ny; iy++) + for (unsigned int iy = 0; iy < m_ny; iy++) *out++ = *in1++ * *in2++; } @@ -409,11 +409,11 @@ ImageFile::divideImages (const ImageFile& rRHS, ImageFile& result) const ImageFileArrayConst vRHS = rRHS.getArray(); ImageFileArray vResult = result.getArray(); - for (int ix = 0; ix < m_nx; ix++) { + for (unsigned int ix = 0; ix < m_nx; ix++) { ImageFileColumnConst in1 = vLHS[ix]; ImageFileColumnConst in2 = vRHS[ix]; ImageFileColumn out = vResult[ix]; - for (int iy = 0; iy < m_ny; iy++) { + for (unsigned int iy = 0; iy < m_ny; iy++) { if (*in2 != 0.) *out++ = *in1++ / *in2++; else @@ -436,10 +436,10 @@ ImageFile::invertPixelValues (ImageFile& result) const ImageFileArrayConst vLHS = getArray(); ImageFileArray vResult = result.getArray(); - for (int ix = 0; ix < m_nx; ix++) { + for (unsigned int ix = 0; ix < m_nx; ix++) { ImageFileColumnConst in = vLHS[ix]; ImageFileColumn out = vResult[ix]; - for (int iy = 0; iy < m_ny; iy++) + for (unsigned int iy = 0; iy < m_ny; iy++) *out++ = - *in++; } @@ -457,10 +457,10 @@ ImageFile::sqrt (ImageFile& result) const ImageFileArrayConst vLHS = getArray(); ImageFileArray vResult = result.getArray(); - for (int ix = 0; ix < m_nx; ix++) { + for (unsigned int ix = 0; ix < m_nx; ix++) { ImageFileColumnConst in = vLHS[ix]; ImageFileColumn out = vResult[ix]; - for (int iy = 0; iy < m_ny; iy++) + for (unsigned int iy = 0; iy < m_ny; iy++) if (*in < 0) *out++ = -::sqrt(-*in++); else @@ -481,10 +481,10 @@ ImageFile::log (ImageFile& result) const ImageFileArrayConst vLHS = getArray(); ImageFileArray vResult = result.getArray(); - for (int ix = 0; ix < m_nx; ix++) { + for (unsigned int ix = 0; ix < m_nx; ix++) { ImageFileColumnConst in = vLHS[ix]; ImageFileColumn out = vResult[ix]; - for (int iy = 0; iy < m_ny; iy++) + for (unsigned int iy = 0; iy < m_ny; iy++) if (*in <= 0) *out++ = 0; else @@ -505,10 +505,10 @@ ImageFile::exp (ImageFile& result) const ImageFileArrayConst vLHS = getArray(); ImageFileArray vResult = result.getArray(); - for (int ix = 0; ix < m_nx; ix++) { + for (unsigned int ix = 0; ix < m_nx; ix++) { ImageFileColumnConst in = vLHS[ix]; ImageFileColumn out = vResult[ix]; - for (int iy = 0; iy < m_ny; iy++) + for (unsigned int iy = 0; iy < m_ny; iy++) *out++ = ::exp (*in++); } @@ -543,7 +543,7 @@ ImageFile::fourier (ImageFile& result) const ImageFileArray vRealResult = result.getArray(); ImageFileArray vImagResult = result.getImaginaryArray(); - int ix, iy; + unsigned int ix, iy; double* pY = new double [m_ny]; std::complex** complexOut = new std::complex* [m_nx]; for (ix = 0; ix < m_nx; ix++) @@ -611,13 +611,13 @@ ImageFile::magnitude (ImageFile& result) const ImageFileArray vRealResult = result.getArray(); if (result.dataType() == Array2dFile::DATA_TYPE_COMPLEX) { ImageFileArray vImagResult = result.getImaginaryArray(); - for (int ix = 0; ix < m_nx; ix++) - for (int iy = 0; iy < m_ny; iy++) + for (unsigned int ix = 0; ix < m_nx; ix++) + for (unsigned int iy = 0; iy < m_ny; iy++) vImagResult[ix][iy] = 0; } - for (int ix = 0; ix < m_nx; ix++) - for (int iy = 0; iy < m_ny; iy++) { + for (unsigned int ix = 0; ix < m_nx; ix++) + for (unsigned int iy = 0; iy < m_ny; iy++) { if (dataType() == Array2dFile::DATA_TYPE_COMPLEX) vRealResult[ix][iy] = ::sqrt (vReal[ix][iy] * vReal[ix][iy] + vImag[ix][iy] * vImag[ix][iy]); else @@ -643,13 +643,13 @@ ImageFile::phase (ImageFile& result) const ImageFileArray vRealResult = result.getArray(); if (result.dataType() == Array2dFile::DATA_TYPE_COMPLEX) { ImageFileArray vImagResult = result.getImaginaryArray(); - for (int ix = 0; ix < m_nx; ix++) - for (int iy = 0; iy < m_ny; iy++) + for (unsigned int ix = 0; ix < m_nx; ix++) + for (unsigned int iy = 0; iy < m_ny; iy++) vImagResult[ix][iy] = 0; } - for (int ix = 0; ix < m_nx; ix++) - for (int iy = 0; iy < m_ny; iy++) { + for (unsigned int ix = 0; ix < m_nx; ix++) + for (unsigned int iy = 0; iy < m_ny; iy++) { if (dataType() == Array2dFile::DATA_TYPE_COMPLEX) vRealResult[ix][iy] = ::atan (vImag[ix][iy] / vReal[ix][iy]); else @@ -670,10 +670,10 @@ ImageFile::square (ImageFile& result) const ImageFileArrayConst vLHS = getArray(); ImageFileArray vResult = result.getArray(); - for (int ix = 0; ix < m_nx; ix++) { + for (unsigned int ix = 0; ix < m_nx; ix++) { ImageFileColumnConst in = vLHS[ix]; ImageFileColumn out = vResult[ix]; - for (int iy = 0; iy < m_ny; iy++) { + for (unsigned int iy = 0; iy < m_ny; iy++) { *out++ = *in * *in; in++; }