Skip to content

Commit

Permalink
Remove identifiers starting with a single underscore
Browse files Browse the repository at this point in the history
Identifiers in global scope starting with a single underscore are reserved and isn't allowed to use
  • Loading branch information
onurulgen committed Oct 23, 2023
1 parent 67cc123 commit 694ec87
Show file tree
Hide file tree
Showing 32 changed files with 178 additions and 180 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
#-----------------------------------------------------------------------------
Expand All @@ -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)
#-----------------------------------------------------------------------------
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion niftyreg_build_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
348
349
54 changes: 27 additions & 27 deletions reg-apps/reg_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand All @@ -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

Expand Down Expand Up @@ -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);
Expand All @@ -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)
{
Expand All @@ -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);
Expand All @@ -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)
{
Expand All @@ -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<maxIt; ++i)
Expand All @@ -374,7 +374,7 @@ int main(int argc, char **argv)
}

// LINEAR INTERPOLATION
#ifdef _USE_CUDA
#ifdef USE_CUDA
float *resultImageArray_d;
if(runGPU)
Cuda::Allocate<float>(&resultImageArray_d, targetImage->dim);
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -571,15 +571,15 @@ 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);
}
#endif

// NODE-BASED NMI GRADIENT COMPUTATION
#ifdef _USE_CUDA
#ifdef USE_CUDA
float4 *nodeNMIGradientArray_d;
if(runGPU)
Cuda::Allocate(&nodeNMIGradientArray_d, controlPointImage->dim);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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 );
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion reg-apps/reg_f3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

// OpenCL isn't supported!
#undef _USE_OPENCL
#undef USE_OPENCL

#include "_reg_ReadWriteImage.h"
#include "_reg_ReadWriteMatrix.h"
Expand Down
10 changes: 5 additions & 5 deletions reg-apps/reg_gpuinfo.cpp
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion reg-io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions reg-io/_reg_ReadWriteImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions reg-io/_reg_ReadWriteImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
/* @} */
Expand Down
Loading

0 comments on commit 694ec87

Please sign in to comment.