From 694ec8760b8b30545998e1cce2a05919225c8729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Onur=20=C3=9Clgen?= Date: Mon, 23 Oct 2023 18:22:43 +0100 Subject: [PATCH] Remove identifiers starting with a single underscore Identifiers in global scope starting with a single underscore are reserved and isn't allowed to use --- CMakeLists.txt | 6 +- Doxyfile.in | 2 +- niftyreg_build_version.txt | 2 +- reg-apps/reg_benchmark.cpp | 54 +++---- reg-apps/reg_f3d.cpp | 2 +- reg-apps/reg_gpuinfo.cpp | 10 +- reg-io/CMakeLists.txt | 2 +- reg-io/_reg_ReadWriteImage.cpp | 8 +- reg-io/_reg_ReadWriteImage.h | 4 +- reg-io/niftilib/nifti1_io.c | 6 +- reg-io/niftilib/nifti1_io.h | 6 +- reg-io/niftilib/nifti2_io.c | 4 +- reg-io/niftilib/nifti2_io.h | 6 +- reg-io/nrrd/NrrdIO/mangle.pl | 14 +- reg-lib/Platform.cpp | 14 +- reg-lib/Platform.h | 8 +- reg-lib/cpu/_reg_localTrans.cpp | 132 +++++++++--------- reg-lib/cpu/_reg_localTrans_jac.cpp | 44 +++--- reg-lib/cpu/_reg_maths.h | 2 +- reg-lib/cpu/_reg_tools.cpp | 6 +- reg-test/reg_test_be.cpp | 2 +- reg-test/reg_test_composeField.cpp | 2 +- reg-test/reg_test_conjugateGradient.cpp | 2 +- reg-test/reg_test_getDeformationField.cpp | 2 +- reg-test/reg_test_imageGradient.cpp | 2 +- reg-test/reg_test_interpolation.cpp | 2 +- reg-test/reg_test_lncc.cpp | 4 +- reg-test/reg_test_nmi.cpp | 2 +- reg-test/reg_test_nmi_gradient.cpp | 2 +- reg-test/reg_test_normaliseGradient.cpp | 2 +- .../reg_test_regr_getDeformationField.cpp | 2 +- .../reg_test_voxelCentricToNodeCentric.cpp | 2 +- 32 files changed, 178 insertions(+), 180 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d7122ef..a5aa1fc3 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,7 +152,7 @@ if(USE_OPENCL) message(STATUS "Found OpenCL") include_directories(${CMAKE_SOURCE_DIR}/reg-lib/cl) include_directories(${OpenCL_INCLUDE_DIRS}) - add_definitions(-D_USE_OPENCL) + add_definitions(-DUSE_OPENCL) endif(NOT OpenCL_FOUND) endif(USE_OPENCL) #----------------------------------------------------------------------------- @@ -168,7 +168,7 @@ if(USE_CUDA) else(NOT CUDA_FOUND) include_directories(${CMAKE_SOURCE_DIR}/reg-lib/cuda) include_directories(${CUDA_INCLUDE_DIRS}) - add_definitions(-D_USE_CUDA) + add_definitions(-DUSE_CUDA) endif(NOT CUDA_FOUND) endif(USE_CUDA) #----------------------------------------------------------------------------- @@ -177,7 +177,7 @@ if(USE_SSE) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse3") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse3") endif(NOT MSVC) - add_definitions(-D_USE_SSE) + add_definitions(-DUSE_SSE) endif(USE_SSE) #----------------------------------------------------------------------------- if(USE_OPENMP) diff --git a/Doxyfile.in b/Doxyfile.in index 8257d784..df013886 100644 --- a/Doxyfile.in +++ b/Doxyfile.in @@ -1449,7 +1449,7 @@ INCLUDE_FILE_PATTERNS = # undefined via #undef or recursively expanded use the := operator # instead of the = operator. -PREDEFINED = _USE_CUDA +PREDEFINED = USE_CUDA # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. diff --git a/niftyreg_build_version.txt b/niftyreg_build_version.txt index 71627d71..aef2e272 100644 --- a/niftyreg_build_version.txt +++ b/niftyreg_build_version.txt @@ -1 +1 @@ -348 +349 diff --git a/reg-apps/reg_benchmark.cpp b/reg-apps/reg_benchmark.cpp index 8606f563..aab0086c 100644 --- a/reg-apps/reg_benchmark.cpp +++ b/reg-apps/reg_benchmark.cpp @@ -19,7 +19,7 @@ #include "_reg_tools.h" #include "_reg_blockMatching.h" -#ifdef _USE_CUDA +#ifdef USE_CUDA #include "_reg_cudaCommon.h" #include "_reg_resampling_gpu.h" #include "_reg_affineTransformation_gpu.h" @@ -179,7 +179,7 @@ int main(int argc, char **argv) nodeNMIGradientImage->nbyper = sizeof(float); nodeNMIGradientImage->data = calloc(nodeNMIGradientImage->nvox, nodeNMIGradientImage->nbyper); -#ifdef _USE_CUDA +#ifdef USE_CUDA float *targetImageArray_d; cudaArray *sourceImageArray_d; int *targetMask_d; @@ -198,7 +198,7 @@ int main(int argc, char **argv) time_t start,end; int minutes, seconds, cpuTime, maxIt; -#ifdef _USE_CUDA +#ifdef USE_CUDA int gpuTime #endif @@ -249,7 +249,7 @@ int main(int argc, char **argv) seconds = (int)(cpuTime - 60*minutes); printf( "CPU - %i affine deformation field computations - %i min %i sec\n", maxIt, minutes, seconds); fprintf(outputFile, "CPU - %i affine deformation field computations - %i min %i sec\n", maxIt, minutes, seconds); -#ifdef _USE_CUDA +#ifdef USE_CUDA if(runGPU) { time(&start); @@ -273,7 +273,7 @@ int main(int argc, char **argv) } // SPLINE DEFORMATION FIELD CREATION -#ifdef _USE_CUDA +#ifdef USE_CUDA float4 *controlPointImageArray_d; if(runGPU) { @@ -299,7 +299,7 @@ int main(int argc, char **argv) seconds = (int)(cpuTime - 60*minutes); printf("CPU - %i spline deformation field computations - %i min %i sec\n", maxIt, minutes, seconds); fprintf(outputFile, "CPU - %i spline deformation field computations - %i min %i sec\n", maxIt, minutes, seconds); -#ifdef _USE_CUDA +#ifdef USE_CUDA if(runGPU) { time(&start); @@ -326,7 +326,7 @@ int main(int argc, char **argv) } // SCALING-AND-SQUARING APPROACH -#ifdef _USE_CUDA +#ifdef USE_CUDA float4 *velocityFieldImageArray_d; if(runGPU) { @@ -350,7 +350,7 @@ int main(int argc, char **argv) printf("CPU - %i scaling-and-squaring - %i min %i sec\n", maxIt, minutes, seconds); fprintf(outputFile, "CPU - %i scaling-and-squarings - %i min %i sec\n", maxIt, minutes, seconds); time(&start); -#ifdef _USE_CUDA +#ifdef USE_CUDA if(runGPU) { for(int i=0; i(&resultImageArray_d, targetImage->dim); @@ -399,7 +399,7 @@ int main(int argc, char **argv) seconds = (int)(cpuTime - 60*minutes); printf("CPU - %i linear interpolation computations - %i min %i sec\n", maxIt, minutes, seconds); fprintf(outputFile, "CPU - %i linear interpolation computations - %i min %i sec\n", maxIt, minutes, seconds); -#ifdef _USE_CUDA +#ifdef USE_CUDA if(runGPU) { time(&start); @@ -428,7 +428,7 @@ int main(int argc, char **argv) } // SPATIAL GRADIENT COMPUTATION -#ifdef _USE_CUDA +#ifdef USE_CUDA float4 *resultGradientArray_d; CUDA_SAFE_CALL(cudaMalloc((void **)&resultGradientArray_d, targetImage->nvox*sizeof(float4))); #endif @@ -451,7 +451,7 @@ int main(int argc, char **argv) seconds = (int)(cpuTime - 60*minutes); printf("CPU - %i spatial gradient computations - %i min %i sec\n", maxIt, minutes, seconds); fprintf(outputFile, "CPU - %i spatial gradient computations - %i min %i sec\n", maxIt, minutes, seconds); -#ifdef _USE_CUDA +#ifdef USE_CUDA if(runGPU) { time(&start); @@ -479,7 +479,7 @@ int main(int argc, char **argv) } nifti_image_free(sourceImage); -#ifdef _USE_CUDA +#ifdef USE_CUDA if(runGPU) { Cuda::Free(deformationFieldImageArray_d); @@ -501,7 +501,7 @@ int main(int argc, char **argv) } // VOXEL-BASED NMI GRADIENT COMPUTATION -#ifdef _USE_CUDA +#ifdef USE_CUDA float4 *voxelNMIGradientArray_d; if(runGPU) Cuda::Allocate(&voxelNMIGradientArray_d, resultImage->dim); @@ -529,7 +529,7 @@ int main(int argc, char **argv) seconds = (int)(cpuTime - 60*minutes); printf("CPU - %i voxel-based NMI gradient computations - %i min %i sec\n", maxIt, minutes, seconds); fprintf(outputFile, "CPU - %i voxel-based NMI gradient computations - %i min %i sec\n", maxIt, minutes, seconds); -#ifdef _USE_CUDA +#ifdef USE_CUDA float *logJointHistogram_d; if(runGPU) { @@ -571,7 +571,7 @@ int main(int argc, char **argv) printf("Voxel-based NMI gradient done\n\n"); } -#ifdef _USE_CUDA +#ifdef USE_CUDA if(runGPU) { Cuda::Free(resultGradientArray_d); @@ -579,7 +579,7 @@ int main(int argc, char **argv) #endif // NODE-BASED NMI GRADIENT COMPUTATION -#ifdef _USE_CUDA +#ifdef USE_CUDA float4 *nodeNMIGradientArray_d; if(runGPU) Cuda::Allocate(&nodeNMIGradientArray_d, controlPointImage->dim); @@ -603,7 +603,7 @@ int main(int argc, char **argv) seconds = (int)(cpuTime - 60*minutes); printf("CPU - %i node-based NMI gradient computations - %i min %i sec\n", maxIt, minutes, seconds); fprintf(outputFile, "CPU - %i node-based NMI gradient computations - %i min %i sec\n", maxIt, minutes, seconds); -#ifdef _USE_CUDA +#ifdef USE_CUDA if(runGPU) { time(&start); @@ -631,7 +631,7 @@ int main(int argc, char **argv) printf("Node-based NMI gradient done\n\n"); } -#ifdef _USE_CUDA +#ifdef USE_CUDA if(runGPU) { Cuda::Free(voxelNMIGradientArray_d); @@ -654,7 +654,7 @@ int main(int argc, char **argv) seconds = (int)(cpuTime - 60*minutes); printf("CPU - %i BE computations - %i min %i sec\n", maxIt, minutes, seconds); fprintf(outputFile, "CPU - %i BE computations - %i min %i sec\n", maxIt, minutes, seconds); -#ifdef _USE_CUDA +#ifdef USE_CUDA if(runGPU) { time(&start); @@ -694,7 +694,7 @@ int main(int argc, char **argv) seconds = (int)(cpuTime - 60*minutes); printf("CPU - %i BE gradient computations - %i min %i sec\n", maxIt, minutes, seconds); fprintf(outputFile, "CPU - %i BE gradient computations - %i min %i sec\n", maxIt, minutes, seconds); -#ifdef _USE_CUDA +#ifdef USE_CUDA if(runGPU) { time(&start); @@ -733,7 +733,7 @@ int main(int argc, char **argv) seconds = (int)(cpuTime - 60*minutes); printf("CPU - %i |Jac| penalty term computations - %i min %i sec\n", maxIt, minutes, seconds); fprintf(outputFile, "CPU - %i |Jac| penalty term computations - %i min %i sec\n", maxIt, minutes, seconds); -#ifdef _USE_CUDA +#ifdef USE_CUDA if(runGPU) { time(&start); @@ -768,7 +768,7 @@ int main(int argc, char **argv) seconds = (int)(cpuTime - 60*minutes); printf("CPU - %i Approx. |Jac| penalty term computations - %i min %i sec\n", maxIt, minutes, seconds); fprintf(outputFile, "CPU - %i Approx. |Jac| penalty term computations - %i min %i sec\n", maxIt, minutes, seconds); -#ifdef _USE_CUDA +#ifdef USE_CUDA if(runGPU) { time(&start); @@ -789,7 +789,7 @@ int main(int argc, char **argv) printf("Approx. |Jac| penalty term done\n\n"); } -#ifdef _USE_CUDA +#ifdef USE_CUDA if(runGPU) { Cuda::Free(controlPointImageArray_d ); @@ -806,7 +806,7 @@ int main(int argc, char **argv) 100, // percentage of block kept 50, // percentage of inlier in the optimisation process maskImage); -#ifdef _USE_CUDA +#ifdef USE_CUDA int *activeBlock_d; float *targetPosition_d; float *resultPosition_d; @@ -835,7 +835,7 @@ int main(int argc, char **argv) seconds = (int)(cpuTime - 60*minutes); printf("CPU - %i block matching computations - %i min %i sec\n", maxIt, minutes, seconds); fprintf(outputFile, "CPU - %i block matching computations - %i min %i sec\n", maxIt, minutes, seconds); -#ifdef _USE_CUDA +#ifdef USE_CUDA if(runGPU) { time(&start); @@ -880,7 +880,7 @@ int main(int argc, char **argv) free(probaJointHistogram); free(logJointHistogram); -#ifdef _USE_CUDA +#ifdef USE_CUDA if(runGPU) { Cuda::Free(targetImageArray_d); diff --git a/reg-apps/reg_f3d.cpp b/reg-apps/reg_f3d.cpp index 104803a4..ad804dcd 100755 --- a/reg-apps/reg_f3d.cpp +++ b/reg-apps/reg_f3d.cpp @@ -11,7 +11,7 @@ */ // OpenCL isn't supported! -#undef _USE_OPENCL +#undef USE_OPENCL #include "_reg_ReadWriteImage.h" #include "_reg_ReadWriteMatrix.h" diff --git a/reg-apps/reg_gpuinfo.cpp b/reg-apps/reg_gpuinfo.cpp index 22008d4e..d4858ead 100644 --- a/reg-apps/reg_gpuinfo.cpp +++ b/reg-apps/reg_gpuinfo.cpp @@ -1,25 +1,25 @@ #include "_reg_maths.h" #include "Platform.h" -#ifdef _USE_CUDA +#ifdef USE_CUDA #include "../reg-lib/cuda/_reg_cudainfo.h" #endif -#ifdef _USE_OPENCL +#ifdef USE_OPENCL #include "../reg-lib/cl/_reg_openclinfo.h" #endif /* *************************************************************** */ int main() { -#ifdef _USE_CUDA +#ifdef USE_CUDA showCUDAInfo(); #else -#ifndef _USE_OPENCL +#ifndef USE_OPENCL NR_WARN("NiftyReg has not been compiled with CUDA or OpenCL"); NR_WARN("No GPU device information to display"); #endif #endif -#ifdef _USE_OPENCL +#ifdef USE_OPENCL showCLInfo(); #endif diff --git a/reg-io/CMakeLists.txt b/reg-io/CMakeLists.txt index 82a541ca..639785ea 100644 --- a/reg-io/CMakeLists.txt +++ b/reg-io/CMakeLists.txt @@ -17,7 +17,7 @@ set(LIBRARIES reg_nifti reg_png) # Build the NRRD file format library if required if(USE_NRRD) - add_definitions(-D_USE_NRRD) + add_definitions(-DUSE_NRRD) subdirs(nrrd) set(LIBRARIES ${LIBRARIES} reg_nrrd) endif(USE_NRRD) diff --git a/reg-io/_reg_ReadWriteImage.cpp b/reg-io/_reg_ReadWriteImage.cpp index 4902881d..b5413b21 100644 --- a/reg-io/_reg_ReadWriteImage.cpp +++ b/reg-io/_reg_ReadWriteImage.cpp @@ -42,7 +42,7 @@ int reg_io_checkFileFormat(const std::string& filename) { return NR_NII_FORMAT; else if (filename.find(".png") != std::string::npos) return NR_PNG_FORMAT; -#ifdef _USE_NRRD +#ifdef USE_NRRD else if (filename.find(".nrrd") != std::string::npos) return NR_NRRD_FORMAT; else if (filename.find(".nhdr") != std::string::npos) @@ -72,7 +72,7 @@ nifti_image* reg_io_ReadImageFile(const char *filename) { image = reg_io_readPNGfile(filename, true); reg_hack_filename(image, filename); break; -#ifdef _USE_NRRD +#ifdef USE_NRRD case NR_NRRD_FORMAT: Nrrd *nrrdImage = reg_io_readNRRDfile(filename); image = reg_io_nrdd2nifti(nrrdImage); @@ -103,7 +103,7 @@ nifti_image* reg_io_ReadImageHeader(const char *filename) { image = reg_io_readPNGfile(filename, false); reg_hack_filename(image, filename); break; -#ifdef _USE_NRRD +#ifdef USE_NRRD case NR_NRRD_FORMAT: Nrrd *nrrdImage = reg_io_readNRRDfile(filename); image = reg_io_nrdd2nifti(nrrdImage); @@ -154,7 +154,7 @@ void reg_io_WriteImageFile(nifti_image *image, const char *filename) { case NR_PNG_FORMAT: reg_io_writePNGfile(image, filename); break; -#ifdef _USE_NRRD +#ifdef USE_NRRD case NR_NRRD_FORMAT: Nrrd *nrrdImage = reg_io_nifti2nrrd(image); reg_io_writeNRRDfile(nrrdImage, filename); diff --git a/reg-io/_reg_ReadWriteImage.h b/reg-io/_reg_ReadWriteImage.h index a012f6c0..c1356f02 100644 --- a/reg-io/_reg_ReadWriteImage.h +++ b/reg-io/_reg_ReadWriteImage.h @@ -18,7 +18,7 @@ #include "_reg_tools.h" #include "reg_png.h" -#ifdef _USE_NRRD +#ifdef USE_NRRD #include "reg_nrrd.h" #endif /** @defgroup NIFTYREG_FILEFORMAT_TYPE @@ -27,7 +27,7 @@ */ #define NR_NII_FORMAT 0 #define NR_PNG_FORMAT 1 -#ifdef _USE_NRRD +#ifdef USE_NRRD #define NR_NRRD_FORMAT 2 #endif /* @} */ diff --git a/reg-io/niftilib/nifti1_io.c b/reg-io/niftilib/nifti1_io.c index afd444c9..d8bee4da 100644 --- a/reg-io/niftilib/nifti1_io.c +++ b/reg-io/niftilib/nifti1_io.c @@ -1,4 +1,4 @@ -#define _NIFTI1_IO_C_ +#define NIFTI1_IO_C #include "niftilib/nifti1_io.h" /* typedefs, prototypes, macros, etc. */ @@ -192,7 +192,7 @@ static char const * const gni_history[] = "\n", "1.3 09 Feb 2005 [rickr]\n" " - nifti1.h: added doxygen comments for extension structs\n" - " - nifti1_io.h: put most #defines in #ifdef _NIFTI1_IO_C_ block\n" + " - nifti1_io.h: put most #defines in #ifdef NIFTI1_IO_C block\n" " - added a doxygen-style description to every exported function\n" " - added doxygen-style comments within some functions\n" " - re-exported many znzFile functions that I had made static\n" @@ -7188,7 +7188,7 @@ static int make_pivot_list(nifti_image * nim, const int dims[], int pivots[], dim_index = nim->dim[0]; while( dim_index > 0 ){ prods[len] = 1; - while( dim_index > 0 && + while( dim_index > 0 && (nim->dim[dim_index] == 1 || dims[dim_index] == -1) ){ prods[len] *= nim->dim[dim_index]; dim_index--; diff --git a/reg-io/niftilib/nifti1_io.h b/reg-io/niftilib/nifti1_io.h index 14ed0d3a..0e95531c 100644 --- a/reg-io/niftilib/nifti1_io.h +++ b/reg-io/niftilib/nifti1_io.h @@ -517,9 +517,9 @@ int valid_nifti_extensions(const nifti_image *nim); #endif /*------------------------------------------------------------------------*/ -/*-- the rest of these apply only to nifti1_io.c, check for _NIFTI1_IO_C_ */ +/*-- the rest of these apply only to nifti1_io.c, check for NIFTI1_IO_C */ /* Feb 9, 2005 [rickr] */ -#ifdef _NIFTI1_IO_C_ +#ifdef NIFTI1_IO_C typedef struct { int debug; /*!< debug level for status reports */ @@ -574,7 +574,7 @@ typedef struct { #define LNI_MAX_NIA_EXT_LEN 100000 /* consider a longer extension invalid */ -#endif /* _NIFTI1_IO_C_ section */ +#endif /* NIFTI1_IO_C section */ /*------------------------------------------------------------------------*/ /*=================*/ diff --git a/reg-io/niftilib/nifti2_io.c b/reg-io/niftilib/nifti2_io.c index da972895..a87fa3fd 100644 --- a/reg-io/niftilib/nifti2_io.c +++ b/reg-io/niftilib/nifti2_io.c @@ -1,4 +1,4 @@ -#define _NIFTI2_IO_C_ +#define NIFTI2_IO_C #include "niftilib/nifti2_io.h" /* typedefs, prototypes, macros, etc. */ @@ -192,7 +192,7 @@ static char const * const gni1_history[] = "\n", "1.3 09 Feb 2005 [rickr]\n" " - nifti1.h: added doxygen comments for extension structs\n" - " - nifti1_io.h: put most #defines in #ifdef _NIFTI1_IO_C_ block\n" + " - nifti1_io.h: put most #defines in #ifdef NIFTI1_IO_C block\n" " - added a doxygen-style description to every exported function\n" " - added doxygen-style comments within some functions\n" " - re-exported many znzFile functions that I had made static\n" diff --git a/reg-io/niftilib/nifti2_io.h b/reg-io/niftilib/nifti2_io.h index ff215d19..946e6d4e 100644 --- a/reg-io/niftilib/nifti2_io.h +++ b/reg-io/niftilib/nifti2_io.h @@ -756,9 +756,9 @@ int nifti_valid_header_size(int ni_ver, int whine); #endif /*------------------------------------------------------------------------*/ -/*-- the rest of these apply only to nifti2_io.c, check for _NIFTI2_IO_C_ */ +/*-- the rest of these apply only to nifti2_io.c, check for NIFTI2_IO_C */ -#ifdef _NIFTI2_IO_C_ +#ifdef NIFTI2_IO_C typedef struct { int debug; /*!< debug level for status reports */ @@ -817,7 +817,7 @@ typedef struct { #undef NIFTI_IS_16_BIT_INT #define NIFTI_IS_16_BIT_INT(x) ((x) <= 32767 && (x) >= -32768) -#endif /* _NIFTI2_IO_C_ section */ +#endif /* NIFTI2_IO_C section */ /*------------------------------------------------------------------------*/ /*=================*/ diff --git a/reg-io/nrrd/NrrdIO/mangle.pl b/reg-io/nrrd/NrrdIO/mangle.pl index 37c44fa9..f71c3299 100644 --- a/reg-io/nrrd/NrrdIO/mangle.pl +++ b/reg-io/nrrd/NrrdIO/mangle.pl @@ -2,23 +2,23 @@ # NrrdIO: stand-alone code for basic nrrd functionality # Copyright (C) 2005 Gordon Kindlmann # Copyright (C) 2004, 2003, 2002, 2001, 2000, 1999, 1998 University of Utah -# +# # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any # damages arising from the use of this software. -# +# # Permission is granted to anyone to use this software for any # purpose, including commercial applications, and to alter it and # redistribute it freely, subject to the following restrictions: -# +# # 1. The origin of this software must not be misrepresented; you must # not claim that you wrote the original software. If you use this # software in a product, an acknowledgment in the product # documentation would be appreciated but is not required. -# +# # 2. Altered source versions must be plainly marked as such, and must # not be misrepresented as being the original software. -# +# # 3. This notice may not be removed or altered from any source distribution. # # @@ -41,8 +41,7 @@ $mac = 0; } -print "#ifndef __${prefix}_NrrdIO_mangle_h\n"; -print "#define __${prefix}_NrrdIO_mangle_h\n"; +print "#pragma once\n"; print "\n"; print "/*\n"; print "\n"; @@ -89,4 +88,3 @@ } } close(NM); -print "#endif /* __${prefix}_NrrdIO_mangle_h */ \n"; diff --git a/reg-lib/Platform.cpp b/reg-lib/Platform.cpp index 271273f4..19826418 100755 --- a/reg-lib/Platform.cpp +++ b/reg-lib/Platform.cpp @@ -1,6 +1,6 @@ #include "Platform.h" #include "CpuKernelFactory.h" -#ifdef _USE_CUDA +#ifdef USE_CUDA #include "CudaContext.hpp" #include "CudaF3dContent.h" #include "CudaComputeFactory.h" @@ -9,7 +9,7 @@ #include "CudaMeasureFactory.h" #include "_reg_optimiser_gpu.h" #endif -#ifdef _USE_OPENCL +#ifdef USE_OPENCL #include "ClContextSingleton.h" #include "ClComputeFactory.h" #include "ClContentCreatorFactory.h" @@ -26,7 +26,7 @@ Platform::Platform(const PlatformType& platformTypeIn) { kernelFactory = new CpuKernelFactory(); measureFactory = new MeasureFactory(); } -#ifdef _USE_CUDA +#ifdef USE_CUDA else if (platformType == PlatformType::Cuda) { platformName = "CUDA"; SetGpuIdx(999); @@ -36,7 +36,7 @@ Platform::Platform(const PlatformType& platformTypeIn) { measureFactory = new CudaMeasureFactory(); } #endif -#ifdef _USE_OPENCL +#ifdef USE_OPENCL else if (platformType == PlatformType::OpenCl) { platformName = "OpenCL"; SetGpuIdx(999); @@ -71,7 +71,7 @@ void Platform::SetGpuIdx(unsigned gpuIdxIn) { if (platformType == PlatformType::Cpu) { gpuIdx = 999; } -#ifdef _USE_CUDA +#ifdef USE_CUDA else if (platformType == PlatformType::Cuda) { CudaContext& cudaContext = CudaContext::GetInstance(); if (gpuIdxIn != 999) { @@ -80,7 +80,7 @@ void Platform::SetGpuIdx(unsigned gpuIdxIn) { } } #endif -#ifdef _USE_OPENCL +#ifdef USE_OPENCL else if (platformType == PlatformType::OpenCl) { ClContextSingleton& clContext = ClContextSingleton::GetInstance(); if (gpuIdxIn != 999) { @@ -138,7 +138,7 @@ reg_optimiser* Platform::CreateOptimiser(F3dContent& con, transformationGradientDataBw = (Type*)conBw->GetTransformationGradient()->data; } } -#ifdef _USE_CUDA +#ifdef USE_CUDA else if (platformType == PlatformType::Cuda) { optimiser = dynamic_cast*>(useConjGradient ? new reg_conjugateGradient_gpu() : new reg_optimiser_gpu()); controlPointGridData = (Type*)dynamic_cast(con).GetControlPointGridCuda(); diff --git a/reg-lib/Platform.h b/reg-lib/Platform.h index 5c7ed55f..42a0a823 100755 --- a/reg-lib/Platform.h +++ b/reg-lib/Platform.h @@ -10,10 +10,10 @@ enum class PlatformType { Cpu, Cuda, OpenCl }; constexpr PlatformType PlatformTypes[] = { PlatformType::Cpu, -#ifdef _USE_CUDA +#ifdef USE_CUDA PlatformType::Cuda, #endif -#ifdef _USE_OPENCL +#ifdef USE_OPENCL PlatformType::OpenCl #endif }; @@ -43,13 +43,13 @@ class Platform { F3dContent *conBw = nullptr) const; static constexpr bool IsCudaEnabled() { -#ifdef _USE_CUDA +#ifdef USE_CUDA return true; #endif return false; } static constexpr bool IsOpenClEnabled() { -#ifdef _USE_OPENCL +#ifdef USE_OPENCL return true; #endif return false; diff --git a/reg-lib/cpu/_reg_localTrans.cpp b/reg-lib/cpu/_reg_localTrans.cpp index 15185c8a..6f95de7a 100755 --- a/reg-lib/cpu/_reg_localTrans.cpp +++ b/reg-lib/cpu/_reg_localTrans.cpp @@ -14,7 +14,7 @@ #include "_reg_maths_eigen.h" #ifdef BUILD_TESTS -#undef _USE_SSE +#undef USE_SSE #endif /* *************************************************************** */ @@ -559,7 +559,7 @@ void reg_cubic_spline_getDeformationField2D(nifti_image *splineControlPoint, int *mask, bool composition, bool bspline) { -#if _USE_SSE +#if USE_SSE union { __m128 m; float f[4]; @@ -596,13 +596,13 @@ void reg_cubic_spline_getDeformationField2D(nifti_image *splineControlPoint, DataType f[16] __attribute__((aligned(16))); } xyBasis; #endif // _WIN32 -#else // _USE_SSE +#else // USE_SSE DataType xBasis[4]; DataType yBasis[4]; DataType xyBasis[16]; DataType xControlPointCoordinates[16]; DataType yControlPointCoordinates[16]; -#endif // _USE_SSE +#endif // USE_SSE DataType *controlPointPtrX = static_cast(splineControlPoint->data); DataType *controlPointPtrY = &controlPointPtrX[NiftiImage::calcVoxelNumber(splineControlPoint, 2)]; @@ -659,7 +659,7 @@ void reg_cubic_spline_getDeformationField2D(nifti_image *splineControlPoint, yVoxel >= 0 && yVoxel <= deformationField->ny - 1) { // The control point positions are extracted if (oldXpre != xPre || oldYpre != yPre) { -#ifdef _USE_SSE +#ifdef USE_SSE get_GridValues(xPre, yPre, splineControlPoint, @@ -669,7 +669,7 @@ void reg_cubic_spline_getDeformationField2D(nifti_image *splineControlPoint, yControlPointCoordinates.f, false, // no approximation false); // not a displacement field -#else // _USE_SSE +#else // USE_SSE get_GridValues(xPre, yPre, splineControlPoint, @@ -679,11 +679,11 @@ void reg_cubic_spline_getDeformationField2D(nifti_image *splineControlPoint, yControlPointCoordinates, false, // no approximation false); // not a displacement field -#endif // _USE_SSE +#endif // USE_SSE oldXpre = xPre; oldYpre = yPre; } -#if _USE_SSE +#if USE_SSE coord = 0; for (b = 0; b < 4; b++) for (a = 0; a < 4; a++) @@ -722,14 +722,14 @@ void reg_cubic_spline_getDeformationField2D(nifti_image *splineControlPoint, } } else { // starting deformation field is blank - !composition #ifdef _OPENMP -#ifdef _USE_SSE +#ifdef USE_SSE #pragma omp parallel for default(none) \ shared(deformationField, gridVoxelSpacing, splineControlPoint, controlPointPtrX, \ controlPointPtrY, mask, fieldPtrX, fieldPtrY, bspline) \ private(x, a, xPre, yPre, oldXpre, oldYpre, index, xReal, yReal, basis, \ val, xBasis, yBasis, tempCurrent, xyBasis, tempX, tempY, \ xControlPointCoordinates, yControlPointCoordinates) -#else // _USE_SSE +#else // USE_SSE #pragma omp parallel for default(none) \ shared(deformationField, gridVoxelSpacing, splineControlPoint, controlPointPtrX, \ controlPointPtrY, mask, fieldPtrX, fieldPtrY, bspline) \ @@ -753,7 +753,7 @@ void reg_cubic_spline_getDeformationField2D(nifti_image *splineControlPoint, if (basis < 0) basis = 0; // rounding error if (bspline) get_BSplineBasisValues(basis, xBasis); else get_SplineBasisValues(basis, xBasis); -#if _USE_SSE +#if USE_SSE val.f[0] = static_cast(xBasis[0]); val.f[1] = static_cast(xBasis[1]); val.f[2] = static_cast(xBasis[2]); @@ -773,7 +773,7 @@ void reg_cubic_spline_getDeformationField2D(nifti_image *splineControlPoint, } #endif if (oldXpre != xPre || oldYpre != yPre) { -#ifdef _USE_SSE +#ifdef USE_SSE get_GridValues(xPre, yPre, splineControlPoint, @@ -783,7 +783,7 @@ void reg_cubic_spline_getDeformationField2D(nifti_image *splineControlPoint, yControlPointCoordinates.f, false, // no approximation false); // not a deformation field -#else // _USE_SSE +#else // USE_SSE get_GridValues(xPre, yPre, splineControlPoint, @@ -793,7 +793,7 @@ void reg_cubic_spline_getDeformationField2D(nifti_image *splineControlPoint, yControlPointCoordinates, false, // no approximation false); // not a deformation field -#endif // _USE_SSE +#endif // USE_SSE oldXpre = xPre; oldYpre = yPre; } @@ -802,7 +802,7 @@ void reg_cubic_spline_getDeformationField2D(nifti_image *splineControlPoint, yReal = 0; if (mask[index] > -1) { -#if _USE_SSE +#if USE_SSE tempX = _mm_set_ps1(0); tempY = _mm_set_ps1(0); //addition and multiplication of the 64 basis value and CP displacement for each axis @@ -837,7 +837,7 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, bool composition, bool bspline, bool forceNoLut = false) { -#if _USE_SSE +#if USE_SSE union { __m128 m; float f[4]; @@ -876,14 +876,14 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, DataType f[16] __attribute__((aligned(16))); } zControlPointCoordinates; #endif // _WIN32 -#else // _USE_SSE +#else // USE_SSE DataType temp[4]; DataType zBasis[4]; DataType xControlPointCoordinates[64]; DataType yControlPointCoordinates[64]; DataType zControlPointCoordinates[64]; int coord; -#endif // _USE_SSE +#endif // USE_SSE const size_t splineControlPointVoxelNumber = NiftiImage::calcVoxelNumber(splineControlPoint, 3); DataType *controlPointPtrX = static_cast(splineControlPoint->data); @@ -906,7 +906,7 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, if (splineControlPoint->sform_code > 0) referenceMatrix_real_to_voxel = splineControlPoint->sto_ijk; else referenceMatrix_real_to_voxel = splineControlPoint->qto_ijk; -#ifdef _USE_SSE +#ifdef USE_SSE #ifdef _WIN32 __declspec(align(16)) DataType xBasis[4]; __declspec(align(16)) DataType yBasis[4]; @@ -914,14 +914,14 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, DataType xBasis[4] __attribute__((aligned(16))); DataType yBasis[4] __attribute__((aligned(16))); #endif -#else // _USE_SSE +#else // USE_SSE DataType xBasis[4], yBasis[4]; -#endif // _USE_SSE +#endif // USE_SSE DataType voxel[3]; #ifdef _OPENMP -#ifdef _USE_SSE +#ifdef USE_SSE #pragma omp parallel for default(none) \ private(x, y, b, c, oldPreX, oldPreY, oldPreZ, xPre, yPre, zPre, real, \ index, voxel, basis, xBasis, yBasis, zBasis, xControlPointCoordinates, \ @@ -939,7 +939,7 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, shared(deformationField, fieldPtrX, fieldPtrY, fieldPtrZ, referenceMatrix_real_to_voxel, \ bspline, controlPointPtrX, controlPointPtrY, controlPointPtrZ, \ splineControlPoint, mask) -#endif // _USE_SSE +#endif // USE_SSE #endif // _OPENMP for (z = 0; z < deformationField->nz; z++) { index = z * deformationField->nx * deformationField->ny; @@ -990,7 +990,7 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, // The control point positions are extracted if (xPre != oldPreX || yPre != oldPreY || zPre != oldPreZ) { -#ifdef _USE_SSE +#ifdef USE_SSE get_GridValues(xPre, yPre, zPre, @@ -1003,7 +1003,7 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, zControlPointCoordinates.f, false, // no approximation false); // not a deformation field -#else // _USE_SSE +#else // USE_SSE get_GridValues(xPre, yPre, zPre, @@ -1016,13 +1016,13 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, zControlPointCoordinates, false, // no approximation false); // not a deformation field -#endif // _USE_SSE +#endif // USE_SSE oldPreX = xPre; oldPreY = yPre; oldPreZ = zPre; } -#if _USE_SSE +#if USE_SSE tempX = _mm_set_ps1(0); tempY = _mm_set_ps1(0); tempZ = _mm_set_ps1(0); @@ -1083,7 +1083,7 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, gridVoxelSpacing[1] = splineControlPoint->dy / deformationField->dy; gridVoxelSpacing[2] = splineControlPoint->dz / deformationField->dz; -#ifdef _USE_SSE +#ifdef USE_SSE #ifdef _WIN32 union u1 { __m128 m[4]; @@ -1103,9 +1103,9 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, DataType f[64] __attribute__((aligned(16))); } xyzBasis; #endif // _WIN32 -#else // _USE_SSE +#else // USE_SSE DataType yzBasis[16], xyzBasis[64]; -#endif // _USE_SSE +#endif // USE_SSE // Assess if lookup table can be used if (gridVoxelSpacing[0] == 5. && gridVoxelSpacing[0] == 5. && gridVoxelSpacing[0] == 5. && forceNoLut == false) { @@ -1114,15 +1114,15 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, // Compute and store all required coefficients int coeff_index; #ifdef _OPENMP -#ifdef _USE_SSE +#ifdef USE_SSE #pragma omp parallel for default(none) \ private(x, y, a, coeff_index, basis, zBasis, temp, val, tempCurrent, yzBasis) \ shared(coefficients, bspline) -#else // _USE_SSE +#else // USE_SSE #pragma omp parallel for default(none) \ private(x, y, a, coeff_index, basis, zBasis, temp, yzBasis, coord) \ shared(coefficients, bspline) -#endif // _USE_SSE +#endif // USE_SSE #endif // _OPENMP for (z = 0; z < 5; ++z) { coeff_index = z * 5 * 5 * 64; @@ -1133,7 +1133,7 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, basis = static_cast(y) / 5.f; if (bspline) get_BSplineBasisValues(basis, temp); else get_SplineBasisValues(basis, temp); -#if _USE_SSE +#if USE_SSE val.f[0] = static_cast(temp[0]); val.f[1] = static_cast(temp[1]); val.f[2] = static_cast(temp[2]); @@ -1157,7 +1157,7 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, basis = static_cast(x) / 5.f; if (bspline) get_BSplineBasisValues(basis, temp); else get_SplineBasisValues(basis, temp); -#if _USE_SSE +#if USE_SSE val.f[0] = static_cast(temp[0]); val.f[1] = static_cast(temp[1]); val.f[2] = static_cast(temp[2]); @@ -1184,11 +1184,11 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, } // z // Loop over block of 5x5x5 voxels -#if _USE_SSE +#if USE_SSE int coord; #endif // USE_SSE #ifdef _OPENMP -#ifdef _USE_SSE +#ifdef USE_SSE #pragma omp parallel for default(none) \ private(x, y, z, a, b, c, xPre, yPre, real, \ index, coeff_index, coord, tempX, tempY, tempZ, val,\ @@ -1196,7 +1196,7 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, shared(deformationField, fieldPtrX, fieldPtrY, fieldPtrZ, splineControlPoint, mask, \ gridVoxelSpacing, bspline, controlPointPtrX, controlPointPtrY, controlPointPtrZ, \ coefficients) -#else // _USE_SSE +#else // USE_SSE #pragma omp parallel for default(none) \ private(x, y, z, a, b, c, xPre, yPre, real, \ index, coeff_index, coord, basis, \ @@ -1204,12 +1204,12 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, shared(deformationField, fieldPtrX, fieldPtrY, fieldPtrZ, splineControlPoint, mask, \ gridVoxelSpacing, bspline, controlPointPtrX, controlPointPtrY, controlPointPtrZ, \ coefficients) -#endif // _USE_SSE +#endif // USE_SSE #endif // _OPENMP for (zPre = 0; zPre < splineControlPoint->nz - 3; zPre++) { for (yPre = 0; yPre < splineControlPoint->ny - 3; yPre++) { for (xPre = 0; xPre < splineControlPoint->nx - 3; xPre++) { -#if _USE_SSE +#if USE_SSE get_GridValues(xPre, yPre, zPre, @@ -1222,7 +1222,7 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, zControlPointCoordinates.f, false, // no approximation false); // not a deformation field -#else // _USE_SSE +#else // USE_SSE get_GridValues(xPre, yPre, zPre, @@ -1235,7 +1235,7 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, zControlPointCoordinates, false, // no approximation false); // not a deformation field -#endif // _USE_SSE +#endif // USE_SSE coeff_index = 0; for (c = 0; c < 5; ++c) { z = zPre * 5 + c; @@ -1247,7 +1247,7 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, for (a = 0; a < 5; ++a) { x = xPre * 5 + a; if (xnx && mask[index]>-1) { -#if _USE_SSE +#if USE_SSE tempX = _mm_set_ps1(0); tempY = _mm_set_ps1(0); tempZ = _mm_set_ps1(0); @@ -1276,7 +1276,7 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, val.m = tempZ; real[2] = val.f[0] + val.f[1] + val.f[2] + val.f[3]; #endif -#else // _USE_SSE +#else // USE_SSE real[0] = real[1] = real[2] = 0; for (coord = 0; coord < 64; ++coord) { basis = coefficients[coeff_index++]; @@ -1284,7 +1284,7 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, real[1] += yControlPointCoordinates[coord] * basis; real[2] += zControlPointCoordinates[coord] * basis; } -#endif // _USE_SSE +#endif // USE_SSE fieldPtrX[index] = real[0]; fieldPtrY[index] = real[1]; fieldPtrZ[index] = real[2]; @@ -1304,7 +1304,7 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, free(coefficients); } else { // if spacings!=5 voxels #ifdef _OPENMP -#ifdef _USE_SSE +#ifdef USE_SSE #pragma omp parallel for default(none) \ private(x, y, a, xPre, yPre, zPre, real, \ index, basis, xyzBasis, yzBasis, zBasis, temp, xControlPointCoordinates, \ @@ -1313,14 +1313,14 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, temp_basis_sse, basis_sse, val, tempCurrent) \ shared(deformationField, fieldPtrX, fieldPtrY, fieldPtrZ, splineControlPoint, mask, \ gridVoxelSpacing, bspline, controlPointPtrX, controlPointPtrY, controlPointPtrZ) -#else // _USE_SSE +#else // USE_SSE #pragma omp parallel for default(none) \ private(x, y, a, xPre, yPre, zPre, real, \ index, basis, xyzBasis, yzBasis, zBasis, temp, xControlPointCoordinates, \ yControlPointCoordinates, zControlPointCoordinates, oldBasis, coord) \ shared(deformationField, fieldPtrX, fieldPtrY, fieldPtrZ, splineControlPoint, mask, \ gridVoxelSpacing, bspline, controlPointPtrX, controlPointPtrY, controlPointPtrZ) -#endif // _USE_SSE +#endif // USE_SSE #endif // _OPENMP for (z = 0; z < deformationField->nz; z++) { index = z * deformationField->nx * deformationField->ny; @@ -1338,7 +1338,7 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, if (basis < 0) basis = 0; //rounding error if (bspline) get_BSplineBasisValues(basis, temp); else get_SplineBasisValues(basis, temp); -#if _USE_SSE +#if USE_SSE val.f[0] = static_cast(temp[0]); val.f[1] = static_cast(temp[1]); val.f[2] = static_cast(temp[2]); @@ -1363,7 +1363,7 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, if (basis < 0) basis = 0; //rounding error if (bspline) get_BSplineBasisValues(basis, temp); else get_SplineBasisValues(basis, temp); -#if _USE_SSE +#if USE_SSE val.f[0] = static_cast(temp[0]); val.f[1] = static_cast(temp[1]); val.f[2] = static_cast(temp[2]); @@ -1383,7 +1383,7 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, } #endif if (basis <= oldBasis || x == 0) { -#ifdef _USE_SSE +#ifdef USE_SSE get_GridValues(xPre, yPre, zPre, @@ -1396,7 +1396,7 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, zControlPointCoordinates.f, false, // no approximation false); // not a deformation field -#else // _USE_SSE +#else // USE_SSE get_GridValues(xPre, yPre, zPre, @@ -1409,7 +1409,7 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, zControlPointCoordinates, false, // no approximation false); // not a deformation field -#endif // _USE_SSE +#endif // USE_SSE } oldBasis = basis; @@ -1418,7 +1418,7 @@ void reg_cubic_spline_getDeformationField3D(nifti_image *splineControlPoint, real[2] = 0; if (mask[index] > -1) { -#if _USE_SSE +#if USE_SSE tempX = _mm_set_ps1(0); tempY = _mm_set_ps1(0); tempZ = _mm_set_ps1(0); @@ -1463,7 +1463,7 @@ void reg_spline_getDeformationField(nifti_image *splineControlPoint, if (splineControlPoint->datatype != deformationField->datatype) NR_FATAL_ERROR("The spline control point image and the deformation field image are expected to be of the same type"); -#if _USE_SSE +#if USE_SSE if (splineControlPoint->datatype != NIFTI_TYPE_FLOAT32) NR_FATAL_ERROR("SSE computation has only been implemented for single precision"); #endif @@ -3056,12 +3056,12 @@ void reg_spline_cppComposition_2D(nifti_image *grid1, bool bspline) { // REMINDER Grid2(x)=Grid1(Grid2(x)) -#if _USE_SSE +#if USE_SSE union { __m128 m; float f[4]; } val; -#endif // _USE_SSE +#endif // USE_SSE DataType *outCPPPtrX = static_cast(grid2->data); DataType *outCPPPtrY = &outCPPPtrX[NiftiImage::calcVoxelNumber(grid2, 2)]; @@ -3074,18 +3074,18 @@ void reg_spline_cppComposition_2D(nifti_image *grid1, #ifdef _WIN32 __declspec(align(16)) DataType xBasis[4]; __declspec(align(16)) DataType yBasis[4]; -#if _USE_SSE +#if USE_SSE __declspec(align(16)) DataType xyBasis[16]; -#endif //_USE_SSE +#endif //USE_SSE __declspec(align(16)) DataType xControlPointCoordinates[16]; __declspec(align(16)) DataType yControlPointCoordinates[16]; #else // _WIN32 DataType xBasis[4] __attribute__((aligned(16))); DataType yBasis[4] __attribute__((aligned(16))); -#if _USE_SSE +#if USE_SSE DataType xyBasis[16] __attribute__((aligned(16))); -#endif //_USE_SSE +#endif //USE_SSE DataType xControlPointCoordinates[16] __attribute__((aligned(16))); DataType yControlPointCoordinates[16] __attribute__((aligned(16))); @@ -3153,7 +3153,7 @@ void reg_spline_cppComposition_2D(nifti_image *grid1, displacement1); // displacement field? xReal = 0; yReal = 0; -#if _USE_SSE +#if USE_SSE coord = 0; for (unsigned b = 0; b < 4; b++) { for (unsigned a = 0; a < 4; a++) { @@ -3206,7 +3206,7 @@ void reg_spline_cppComposition_3D(nifti_image *grid1, bool displacement2, bool bspline) { // REMINDER Grid2(x)=Grid1(Grid2(x)) -#if _USE_SSE +#if USE_SSE union { __m128 m; float f[4]; @@ -3272,7 +3272,7 @@ void reg_spline_cppComposition_3D(nifti_image *grid1, else matrix_voxel_to_real2 = &grid2->qto_xyz; #ifdef _OPENMP -#ifdef _USE_SSE +#ifdef USE_SSE #pragma omp parallel for default(none) \ shared(grid1, grid2, displacement1, displacement2, matrix_voxel_to_real2, matrix_real_to_voxel1, \ outCPPPtrX, outCPPPtrY, outCPPPtrZ, controlPointPtrX, controlPointPtrY, controlPointPtrZ, bspline) \ @@ -3380,7 +3380,7 @@ void reg_spline_cppComposition_3D(nifti_image *grid1, xReal = 0; yReal = 0; zReal = 0; -#if _USE_SSE +#if USE_SSE val.f[0] = static_cast(xBasis[0]); val.f[1] = static_cast(xBasis[1]); val.f[2] = static_cast(xBasis[2]); @@ -3450,7 +3450,7 @@ int reg_spline_cppComposition(nifti_image *grid1, if (grid1->datatype != grid2->datatype) NR_FATAL_ERROR("Both input images are expected to have the same data type"); -#if _USE_SSE +#if USE_SSE if (grid1->datatype != NIFTI_TYPE_FLOAT32) NR_FATAL_ERROR("SSE computation has only been implemented for single precision"); #endif diff --git a/reg-lib/cpu/_reg_localTrans_jac.cpp b/reg-lib/cpu/_reg_localTrans_jac.cpp index 26678dde..75c0b6ee 100755 --- a/reg-lib/cpu/_reg_localTrans_jac.cpp +++ b/reg-lib/cpu/_reg_localTrans_jac.cpp @@ -12,7 +12,7 @@ #include "_reg_localTrans_jac.h" -#define _USE_SQUARE_LOG_JAC +#define USE_SQUARE_LOG_JAC /* *************************************************************** */ /* *************************************************************** */ @@ -643,7 +643,7 @@ void reg_cubic_spline_jacobian3D(nifti_image *splineControlPoint, // Allocate variables that are used in both scenarii int pre[3], oldPre[3], incr0; DataType basis, xBasis[4], xFirst[4], yBasis[4], yFirst[4], zBasis[4], zFirst[4]; -#if _USE_SSE +#if USE_SSE union { __m128 m; @@ -805,7 +805,7 @@ void reg_cubic_spline_jacobian3D(nifti_image *splineControlPoint, basis = gridCoord[2] - pre[2]; get_BSplineBasisValues(basis, zBasis, zFirst); // Compute the 64 basis values and the corresponding derivatives -#if _USE_SSE +#if USE_SSE val.f[0]=yBasis[0]; val.f[1]=yBasis[1]; val.f[2]=yBasis[2]; @@ -862,7 +862,7 @@ void reg_cubic_spline_jacobian3D(nifti_image *splineControlPoint, // Fetch the required coefficients if(oldPre[0]!=pre[0] || oldPre[1]!=pre[1] || oldPre[2]!=pre[2]) { -#ifdef _USE_SSE +#ifdef USE_SSE get_GridValues(pre[0]-1, pre[1]-1, pre[2]-1, @@ -876,7 +876,7 @@ void reg_cubic_spline_jacobian3D(nifti_image *splineControlPoint, false, // no approx false // not disp ); -#else // _USE_SSE +#else // USE_SSE get_GridValues(pre[0]-1, pre[1]-1, pre[2]-1, @@ -890,13 +890,13 @@ void reg_cubic_spline_jacobian3D(nifti_image *splineControlPoint, false, // no approx false // not disp ); -#endif // _USE_SSE +#endif // USE_SSE oldPre[0]=pre[0]; oldPre[1]=pre[1]; oldPre[2]=pre[2]; } // Compute the Jacobian matrix -#if _USE_SSE +#if USE_SSE tempX_x = _mm_set_ps1(0); tempX_y = _mm_set_ps1(0); tempX_z = _mm_set_ps1(0); @@ -973,7 +973,7 @@ void reg_cubic_spline_jacobian3D(nifti_image *splineControlPoint, { // The grid is assumed to be aligned with the reference image #ifdef _OPENMP -#ifdef _USE_SSE +#ifdef USE_SSE #pragma omp parallel for default(none) \ shared(referenceImage, gridVoxelSpacing, splineControlPoint, \ coeffPtrX, coeffPtrY, coeffPtrZ,reorientation, JacobianMatrices, \ @@ -1015,7 +1015,7 @@ void reg_cubic_spline_jacobian3D(nifti_image *splineControlPoint, if(basis<0) basis=0; //rounding error get_BSplineBasisValues(basis, yBasis, yFirst); -#if _USE_SSE +#if USE_SSE val.f[0]=yBasis[0]; val.f[1]=yBasis[1]; val.f[2]=yBasis[2]; @@ -1055,7 +1055,7 @@ void reg_cubic_spline_jacobian3D(nifti_image *splineControlPoint, if(basis<0) basis=0; //rounding error get_BSplineBasisValues(basis, xBasis, xFirst); -#if _USE_SSE +#if USE_SSE val.f[0]=xBasis[0]; val.f[1]=xBasis[1]; val.f[2]=xBasis[2]; @@ -1091,7 +1091,7 @@ void reg_cubic_spline_jacobian3D(nifti_image *splineControlPoint, if(oldPre[0]!=pre[0] || oldPre[1]!=pre[1] || oldPre[2]!=pre[2]) { -#ifdef _USE_SSE +#ifdef USE_SSE get_GridValues(pre[0], pre[1], pre[2], @@ -1105,7 +1105,7 @@ void reg_cubic_spline_jacobian3D(nifti_image *splineControlPoint, false, // no approx false // not disp ); -#else // _USE_SSE +#else // USE_SSE get_GridValues(pre[0], pre[1], pre[2], @@ -1119,12 +1119,12 @@ void reg_cubic_spline_jacobian3D(nifti_image *splineControlPoint, false, // no approx false // not disp ); -#endif // _USE_SSE +#endif // USE_SSE oldPre[0]=pre[0]; oldPre[1]=pre[1]; oldPre[2]=pre[2]; } -#if _USE_SSE +#if USE_SSE tempX_x = _mm_set_ps1(0); tempX_y = _mm_set_ps1(0); tempX_z = _mm_set_ps1(0); @@ -1278,7 +1278,7 @@ double reg_spline_getJacobianPenaltyTerm(nifti_image *splineControlPoint, for(size_t i=0; i0) { jacobianMatrix = jacobianMatrices[jacIndex]; -#ifdef _USE_SQUARE_LOG_JAC +#ifdef USE_SQUARE_LOG_JAC detJac = 2.0*log(detJac) / detJac; #else detJac = (log(detJac)>0?1.0:-1.0) / detJac; @@ -1513,7 +1513,7 @@ void reg_spline_jacobianDetGradient2D(nifti_image *splineControlPoint, basisValues[1] = xBasis * yFirst ; jacobianMatrix = jacobianMatrices[jacIndex]; -#ifdef _USE_SQUARE_LOG_JAC +#ifdef USE_SQUARE_LOG_JAC detJac= 2.0*log(detJac) / detJac; #else detJac = (log(detJac)>0?1.0:-1.0) / detJac; @@ -1661,7 +1661,7 @@ void reg_spline_jacobianDetGradient3D(nifti_image *splineControlPoint, if(detJac>0) { jacobianMatrix = jacobianMatrices[jacIndex]; -#ifdef _USE_SQUARE_LOG_JAC +#ifdef USE_SQUARE_LOG_JAC detJac = 2.0*log(detJac) / detJac; #else detJac = (log(detJac)>0?1.0:-1.0) / detJac; @@ -1787,7 +1787,7 @@ void reg_spline_jacobianDetGradient3D(nifti_image *splineControlPoint, basisValues[2] = xBasis * yBasis * zFirst ; jacobianMatrix = jacobianMatrices[jacIndex]; -#ifdef _USE_SQUARE_LOG_JAC +#ifdef USE_SQUARE_LOG_JAC detJac= 2.0*log(detJac) / detJac; #else detJac = (log(detJac)>0?1.0:-1.0) / detJac; @@ -1931,7 +1931,7 @@ double reg_spline_correctFolding2D(nifti_image *splineControlPoint, for(i=0; i< jacobianNumber; i++) { logDet = log(jacobianDeterminant[i]); -#ifdef _USE_SQUARE_LOG_JAC +#ifdef USE_SQUARE_LOG_JAC penaltyTerm += logDet*logDet; #else penaltyTerm += fabs(log(logDet)); @@ -2180,7 +2180,7 @@ double reg_spline_correctFolding3D(nifti_image *splineControlPoint, for(i=0; i< jacobianNumber; i++) { logDet = log(jacobianDeterminant[i]); -#ifdef _USE_SQUARE_LOG_JAC +#ifdef USE_SQUARE_LOG_JAC penaltyTerm += logDet*logDet; #else penaltyTerm += fabs(log(logDet)); diff --git a/reg-lib/cpu/_reg_maths.h b/reg-lib/cpu/_reg_maths.h index 93151883..c77e18fd 100644 --- a/reg-lib/cpu/_reg_maths.h +++ b/reg-lib/cpu/_reg_maths.h @@ -20,7 +20,7 @@ #include #endif -#if _USE_SSE +#if USE_SSE #include #include #ifdef __SSE3__ diff --git a/reg-lib/cpu/_reg_tools.cpp b/reg-lib/cpu/_reg_tools.cpp index 93a0a76c..91a85e3a 100755 --- a/reg-lib/cpu/_reg_tools.cpp +++ b/reg-lib/cpu/_reg_tools.cpp @@ -954,7 +954,7 @@ void reg_tools_kernelConvolution(nifti_image *image, double bufferIntensityCur = 0; double bufferDensityCur = 0; -#ifdef _USE_SSE +#ifdef USE_SSE union { __m128 m; float f[4]; @@ -963,7 +963,7 @@ void reg_tools_kernelConvolution(nifti_image *image, #endif #ifdef _OPENMP -#ifdef _USE_SSE +#ifdef USE_SSE #pragma omp parallel for default(none) \ shared(imageDims, intensityPtr, densityPtr, radius, kernel, lineOffset, n, planeNumber, kernelSum) \ private(realIndex, currentIntensityPtr, currentDensityPtr, lineIndex, bufferIntensity, \ @@ -1015,7 +1015,7 @@ void reg_tools_kernelConvolution(nifti_image *image, if (shiftPst > imageDims[n]) shiftPst = imageDims[n]; // Set the current values to zero // Increment the current value by performing the weighted sum -#ifdef _USE_SSE +#ifdef USE_SSE intensity_sum_sse.m = _mm_set_ps1(0); density_sum_sse.m = _mm_set_ps1(0); k = shiftPre; diff --git a/reg-test/reg_test_be.cpp b/reg-test/reg_test_be.cpp index 445d3959..afe18f83 100644 --- a/reg-test/reg_test_be.cpp +++ b/reg-test/reg_test_be.cpp @@ -1,5 +1,5 @@ // OpenCL is not supported for this test -#undef _USE_OPENCL +#undef USE_OPENCL #include "reg_test_common.h" diff --git a/reg-test/reg_test_composeField.cpp b/reg-test/reg_test_composeField.cpp index 6bd7662e..49550c77 100644 --- a/reg-test/reg_test_composeField.cpp +++ b/reg-test/reg_test_composeField.cpp @@ -1,5 +1,5 @@ // OpenCL is not supported for this test -#undef _USE_OPENCL +#undef USE_OPENCL #include "reg_test_common.h" diff --git a/reg-test/reg_test_conjugateGradient.cpp b/reg-test/reg_test_conjugateGradient.cpp index bb2d4e63..644eb49b 100644 --- a/reg-test/reg_test_conjugateGradient.cpp +++ b/reg-test/reg_test_conjugateGradient.cpp @@ -1,5 +1,5 @@ // OpenCL is not supported for this test -#undef _USE_OPENCL +#undef USE_OPENCL #include "reg_test_common.h" diff --git a/reg-test/reg_test_getDeformationField.cpp b/reg-test/reg_test_getDeformationField.cpp index c49a1a24..b213f3fc 100644 --- a/reg-test/reg_test_getDeformationField.cpp +++ b/reg-test/reg_test_getDeformationField.cpp @@ -1,5 +1,5 @@ // OpenCL is not supported for this test -#undef _USE_OPENCL +#undef USE_OPENCL #include "reg_test_common.h" diff --git a/reg-test/reg_test_imageGradient.cpp b/reg-test/reg_test_imageGradient.cpp index 8689954a..1b243132 100644 --- a/reg-test/reg_test_imageGradient.cpp +++ b/reg-test/reg_test_imageGradient.cpp @@ -1,5 +1,5 @@ // OpenCL is not supported for this test -#undef _USE_OPENCL +#undef USE_OPENCL #include "reg_test_common.h" diff --git a/reg-test/reg_test_interpolation.cpp b/reg-test/reg_test_interpolation.cpp index 3de5aae3..b3d05830 100644 --- a/reg-test/reg_test_interpolation.cpp +++ b/reg-test/reg_test_interpolation.cpp @@ -1,5 +1,5 @@ // OpenCL is not supported for this test -#undef _USE_OPENCL +#undef USE_OPENCL #include "reg_test_common.h" diff --git a/reg-test/reg_test_lncc.cpp b/reg-test/reg_test_lncc.cpp index 6e45e6d1..0355aa84 100644 --- a/reg-test/reg_test_lncc.cpp +++ b/reg-test/reg_test_lncc.cpp @@ -1,6 +1,6 @@ // OpenCL and CUDA are not supported for this test yet -#undef _USE_OPENCL -#undef _USE_CUDA +#undef USE_OPENCL +#undef USE_CUDA #include "reg_test_common.h" #include "_reg_lncc.h" diff --git a/reg-test/reg_test_nmi.cpp b/reg-test/reg_test_nmi.cpp index 1b61ac39..21847f10 100644 --- a/reg-test/reg_test_nmi.cpp +++ b/reg-test/reg_test_nmi.cpp @@ -1,5 +1,5 @@ // OpenCL is not supported for this test yet -#undef _USE_OPENCL +#undef USE_OPENCL #include "reg_test_common.h" #include "_reg_tools.h" diff --git a/reg-test/reg_test_nmi_gradient.cpp b/reg-test/reg_test_nmi_gradient.cpp index f19ac9bd..95283b0f 100644 --- a/reg-test/reg_test_nmi_gradient.cpp +++ b/reg-test/reg_test_nmi_gradient.cpp @@ -1,5 +1,5 @@ // OpenCL is not supported for this test yet -#undef _USE_OPENCL +#undef USE_OPENCL #include "reg_test_common.h" diff --git a/reg-test/reg_test_normaliseGradient.cpp b/reg-test/reg_test_normaliseGradient.cpp index d56cd356..53c6f40e 100644 --- a/reg-test/reg_test_normaliseGradient.cpp +++ b/reg-test/reg_test_normaliseGradient.cpp @@ -1,5 +1,5 @@ // OpenCL is not supported for this test -#undef _USE_OPENCL +#undef USE_OPENCL #include "reg_test_common.h" diff --git a/reg-test/reg_test_regr_getDeformationField.cpp b/reg-test/reg_test_regr_getDeformationField.cpp index d5c0a8de..62955c0b 100644 --- a/reg-test/reg_test_regr_getDeformationField.cpp +++ b/reg-test/reg_test_regr_getDeformationField.cpp @@ -1,5 +1,5 @@ // OpenCL is not supported for this test -#undef _USE_OPENCL +#undef USE_OPENCL #include "reg_test_common.h" diff --git a/reg-test/reg_test_voxelCentricToNodeCentric.cpp b/reg-test/reg_test_voxelCentricToNodeCentric.cpp index 47f56f90..3339cbbc 100644 --- a/reg-test/reg_test_voxelCentricToNodeCentric.cpp +++ b/reg-test/reg_test_voxelCentricToNodeCentric.cpp @@ -1,5 +1,5 @@ // OpenCL is not supported for this test -#undef _USE_OPENCL +#undef USE_OPENCL #include "reg_test_common.h"