diff options
author | Daniel M. Pelt <D.M.Pelt@cwi.nl> | 2015-03-09 15:53:07 +0100 |
---|---|---|
committer | Daniel M. Pelt <D.M.Pelt@cwi.nl> | 2015-03-09 15:53:07 +0100 |
commit | 475b1746c133b0286871b7414918704557f1abcc (patch) | |
tree | c945f5a7f6c2773cf5ad0cd46dac3c4a9f1c1c01 | |
parent | 20f329a7a38cd02586ef305d551d288ebcf39501 (diff) | |
download | astra-475b1746c133b0286871b7414918704557f1abcc.tar.gz astra-475b1746c133b0286871b7414918704557f1abcc.tar.bz2 astra-475b1746c133b0286871b7414918704557f1abcc.tar.xz astra-475b1746c133b0286871b7414918704557f1abcc.zip |
Remove old Logging code (only used in fft.cu)
-rw-r--r-- | build/linux/Makefile.in | 1 | ||||
-rw-r--r-- | cuda/2d/astra.cu | 3 | ||||
-rw-r--r-- | cuda/2d/fft.cu | 10 | ||||
-rw-r--r-- | include/astra/Logger.h | 72 | ||||
-rw-r--r-- | src/CudaFilteredBackProjectionAlgorithm.cpp | 14 | ||||
-rw-r--r-- | src/Logger.cpp | 77 |
6 files changed, 10 insertions, 167 deletions
diff --git a/build/linux/Makefile.in b/build/linux/Makefile.in index 92697b2..d9ff045 100644 --- a/build/linux/Makefile.in +++ b/build/linux/Makefile.in @@ -118,7 +118,6 @@ BASE_OBJECTS=\ src/Fourier.lo \ src/GeometryUtil3D.lo \ src/Globals.lo \ - src/Logger.lo \ src/ParallelBeamBlobKernelProjector2D.lo \ src/ParallelBeamLinearKernelProjector2D.lo \ src/ParallelBeamLineKernelProjector2D.lo \ diff --git a/cuda/2d/astra.cu b/cuda/2d/astra.cu index 0b5be06..bcc1a50 100644 --- a/cuda/2d/astra.cu +++ b/cuda/2d/astra.cu @@ -42,7 +42,6 @@ $Id$ #include <fstream> #include <cuda.h> -#include "../../include/astra/Logger.h" #include "../../include/astra/VolumeGeometry2D.h" #include "../../include/astra/ParallelProjectionGeometry2D.h" #include "../../include/astra/FanFlatProjectionGeometry2D.h" @@ -538,7 +537,7 @@ bool AstraFBP::setFilter(E_FBPFILTER _eFilter, const float * _pfHostFilter /* = int iMaxFilterIndex = iStartFilterIndex + iUsedFilterWidth; int iFilterShiftSize = _iFilterWidth / 2; - + for(int iDetectorIndex = iStartFilterIndex; iDetectorIndex < iMaxFilterIndex; iDetectorIndex++) { int iFFTInFilterIndex = (iDetectorIndex + iFFTRealDetCount - iFilterShiftSize) % iFFTRealDetCount; diff --git a/cuda/2d/fft.cu b/cuda/2d/fft.cu index d105e29..5fef360 100644 --- a/cuda/2d/fft.cu +++ b/cuda/2d/fft.cu @@ -34,7 +34,6 @@ $Id$ #include <cuda.h> #include <fstream> -#include "../../include/astra/Logger.h" using namespace astra; @@ -45,7 +44,6 @@ using namespace astra; if( cudaSuccess != err) { \ fprintf(stderr, "Cuda error: %s in file '%s' in line %i : %s.\n", \ errorMessage, __FILE__, __LINE__, cudaGetErrorString( err) );\ - CLogger::writeTerminalCUDAError(__FILE__, __LINE__, cudaGetErrorString( err)); \ exit(EXIT_FAILURE); \ } } while (0) @@ -54,14 +52,12 @@ using namespace astra; if( cudaSuccess != err) { \ fprintf(stderr, "Cuda error in file '%s' in line %i : %s.\n", \ __FILE__, __LINE__, cudaGetErrorString( err) ); \ - CLogger::writeTerminalCUDAError(__FILE__, __LINE__, cudaGetErrorString( err)); \ exit(EXIT_FAILURE); \ } \ err = cudaThreadSynchronize(); \ if( cudaSuccess != err) { \ fprintf(stderr, "Cuda error in file '%s' in line %i : %s.\n", \ __FILE__, __LINE__, cudaGetErrorString( err) ); \ - CLogger::writeTerminalCUDAError(__FILE__, __LINE__, cudaGetErrorString( err)); \ exit(EXIT_FAILURE); \ } } while (0) @@ -460,7 +456,7 @@ void genFilter(E_FBPFILTER _eFilter, float _fD, int _iProjectionCount, const float fA1 = 0.48f; const float fA2 = 0.38f; float fNMinusOne = (float)(_iFFTFourierDetectorCount) - 1.0f; - + for(int iDetectorIndex = 1; iDetectorIndex < _iFFTFourierDetectorCount; iDetectorIndex++) { float fSmallN = (float)iDetectorIndex; @@ -746,7 +742,7 @@ void testCudaFFT() { for(int iDetectorIndex = 0; iDetectorIndex < iDetectorCount; iDetectorIndex++) { -// int +// int // pfHostProj[iIndex] = (float)rand() / (float)RAND_MAX; } @@ -787,7 +783,7 @@ void testCudaFFT() float * pfHostFourProjImaginary = new float[iTotalElementCount]; convertComplexToRealImg(pHostFourProj, iTotalElementCount, pfHostFourProjReal, pfHostFourProjImaginary); - + writeToMatlabFile("proj_four_real.mat", pfHostFourProjReal, iProjectionCount, iDetectorCount); writeToMatlabFile("proj_four_imaginary.mat", pfHostFourProjImaginary, iProjectionCount, iDetectorCount); diff --git a/include/astra/Logger.h b/include/astra/Logger.h deleted file mode 100644 index 34fd364..0000000 --- a/include/astra/Logger.h +++ /dev/null @@ -1,72 +0,0 @@ -/* ------------------------------------------------------------------------ -Copyright: 2010-2015, iMinds-Vision Lab, University of Antwerp - 2014-2015, CWI, Amsterdam - -Contact: astra@uantwerpen.be -Website: http://sf.net/projects/astra-toolbox - -This file is part of the ASTRA Toolbox. - - -The ASTRA Toolbox is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -The ASTRA Toolbox is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with the ASTRA Toolbox. If not, see <http://www.gnu.org/licenses/>. - ------------------------------------------------------------------------ -$Id$ -*/ - -#ifndef _INC_ASTRA_LOGGER -#define _INC_ASTRA_LOGGER - -#include <cstdio> - -namespace astra -{ - -/** - * This is the first stab at a decent logger. If the file "astra_logger.txt", it will be replaced - * with the text sent to this logger. If the file doesn't exist when the app starts, nothing is written. - */ -class CLogger -{ - static std::FILE * m_pOutFile; - static bool m_bInitialized; - - static void _assureIsInitialized(); - - CLogger(); - -public: - - /** - * Writes a line to the log file (newline is added). Ignored if logging is turned off. - * - * @param _text char pointer to text in line - */ - static void writeLine(const char * _text); - - /** - * Formats and writes a CUDA error to the log file. Ignored if logging is turned off. - * - * @param _fileName filename where error occurred (typically __FILE__) - * @param _line line in file (typically __LINE__) - * @param _errString string describing the error, can be output of cudaGetErrorString - */ - static void writeTerminalCUDAError(const char * _fileName, int _iLine, const char * _errString); -}; - -} - -#endif /* _INC_ASTRA_LOGGER */ - diff --git a/src/CudaFilteredBackProjectionAlgorithm.cpp b/src/CudaFilteredBackProjectionAlgorithm.cpp index fcdf860..77bd412 100644 --- a/src/CudaFilteredBackProjectionAlgorithm.cpp +++ b/src/CudaFilteredBackProjectionAlgorithm.cpp @@ -34,8 +34,6 @@ $Id$ #include "astra/AstraObjectManager.h" #include "../cuda/2d/astra.h" -#include <astra/Logger.h> - using namespace std; using namespace astra; @@ -105,7 +103,7 @@ bool CCudaFilteredBackProjectionAlgorithm::initialize(const Config& _cfg) } CC.markNodeParsed("FilterType"); ASTRA_DELETE(node); - + // filter node = _cfg.self->getSingleNode("FilterSinogramId"); if(node != NULL) @@ -168,7 +166,7 @@ bool CCudaFilteredBackProjectionAlgorithm::initialize(const Config& _cfg) CC.markOptionParsed("ShortScan"); } - + m_pFBP = new AstraFBP; @@ -186,7 +184,7 @@ bool CCudaFilteredBackProjectionAlgorithm::initialize(CFloat32ProjectionData2D * { clear(); } - + // required classes m_pSinogram = _pSinogram; m_pReconstruction = _pReconstruction; @@ -326,7 +324,7 @@ void CCudaFilteredBackProjectionAlgorithm::run(int _iNrIterations /* = 0 */) const CVolumeGeometry2D& volgeom = *m_pReconstruction->getGeometry(); ok &= m_pFBP->getReconstruction(m_pReconstruction->getData(), volgeom.getGridColCount()); - + ASTRA_ASSERT(ok); } @@ -335,7 +333,7 @@ bool CCudaFilteredBackProjectionAlgorithm::check() // check pointers ASTRA_CONFIG_CHECK(m_pSinogram, "FBP_CUDA", "Invalid Projection Data Object."); ASTRA_CONFIG_CHECK(m_pReconstruction, "FBP_CUDA", "Invalid Reconstruction Data Object."); - + if((m_eFilter == FILTER_PROJECTION) || (m_eFilter == FILTER_SINOGRAM) || (m_eFilter == FILTER_RPROJECTION) || (m_eFilter == FILTER_RSINOGRAM)) { ASTRA_CONFIG_CHECK(m_pfFilter, "FBP_CUDA", "Invalid filter pointer."); @@ -387,7 +385,7 @@ static bool stringCompareLowerCase(const char * _stringA, const char * _stringB) #else iCmpReturn = strcasecmp(_stringA, _stringB); #endif - + return (iCmpReturn == 0); } diff --git a/src/Logger.cpp b/src/Logger.cpp deleted file mode 100644 index 148e18c..0000000 --- a/src/Logger.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* ------------------------------------------------------------------------ -Copyright: 2010-2015, iMinds-Vision Lab, University of Antwerp - 2014-2015, CWI, Amsterdam - -Contact: astra@uantwerpen.be -Website: http://sf.net/projects/astra-toolbox - -This file is part of the ASTRA Toolbox. - - -The ASTRA Toolbox is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -The ASTRA Toolbox is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with the ASTRA Toolbox. If not, see <http://www.gnu.org/licenses/>. - ------------------------------------------------------------------------ -$Id$ -*/ - -#include <astra/Logger.h> - -using namespace astra; - -const char * g_loggerFileName = "astra_logger.txt"; - -void CLogger::_assureIsInitialized() -{ - if(!m_bInitialized) - { - m_pOutFile = fopen(g_loggerFileName, "r"); - if(m_pOutFile != NULL) - { - // file exists, users wants to log - fclose(m_pOutFile); - m_pOutFile = fopen(g_loggerFileName, "w"); - } - - m_bInitialized = true; - } -} - -void CLogger::writeLine(const char * _text) -{ - _assureIsInitialized(); - - if(m_pOutFile != NULL) - { - fprintf(m_pOutFile, "%s\n", _text); - fflush(m_pOutFile); - } -} - -void CLogger::writeTerminalCUDAError(const char * _fileName, int _iLine, const char * _errString) -{ - char buffer[256]; - - sprintf(buffer, "Cuda error in file '%s' in line %i : %s.", _fileName, _iLine, _errString); - - writeLine(buffer); -} - -CLogger::CLogger() -{ - ; -} - -FILE * CLogger::m_pOutFile = NULL; -bool CLogger::m_bInitialized = false; |