Skip to content

Commit

Permalink
Add regression tests for Compute::GetDeformationField() #92
Browse files Browse the repository at this point in the history
  • Loading branch information
onurulgen committed Oct 23, 2023
1 parent a4e1918 commit 67cc123
Show file tree
Hide file tree
Showing 6 changed files with 588 additions and 9 deletions.
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,17 @@ else(BUILD_SHARED_LIBS)
set(NIFTYREG_LIBRARY_TYPE STATIC)
endif(BUILD_SHARED_LIBS)
#-----------------------------------------------------------------------------
if(BUILD_TESTING)
enable_testing()
add_definitions(-DBUILD_TESTS)
endif(BUILD_TESTING)
#-----------------------------------------------------------------------------
add_subdirectory(third-party)
add_subdirectory(reg-io)
add_subdirectory(reg-lib)
add_subdirectory(reg-apps)
add_subdirectory(cmake)
#-----------------------------------------------------------------------------
if(BUILD_TESTING)
enable_testing()
add_subdirectory(${CMAKE_SOURCE_DIR}/reg-test)
endif(BUILD_TESTING)
#-----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion niftyreg_build_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
347
348
10 changes: 6 additions & 4 deletions reg-lib/cpu/_reg_localTrans.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
#include "_reg_localTrans.h"
#include "_reg_maths_eigen.h"

#ifdef BUILD_TESTS
#undef _USE_SSE
#endif

/* *************************************************************** */
template <class DataType>
void reg_createControlPointGrid(NiftiImage& controlPointGridImage,
Expand Down Expand Up @@ -681,11 +685,9 @@ void reg_cubic_spline_getDeformationField2D(nifti_image *splineControlPoint,
}
#if _USE_SSE
coord = 0;
for (b = 0; b < 4; b++) {
for (a = 0; a < 4; a++) {
for (b = 0; b < 4; b++)
for (a = 0; a < 4; a++)
xyBasis.f[coord++] = xBasis[a] * yBasis[b];
}
}

tempX = _mm_set_ps1(0);
tempY = _mm_set_ps1(0);
Expand Down
2 changes: 1 addition & 1 deletion reg-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ set(EXEC_LIST reg_test_lncc ${EXEC_LIST})
set(EXEC_LIST reg_test_nmi ${EXEC_LIST})
set(EXEC_LIST reg_test_nmi_gradient ${EXEC_LIST})
set(EXEC_LIST reg_test_normaliseGradient ${EXEC_LIST})
set(EXEC_LIST reg_test_regr_getDeformationField ${EXEC_LIST})
set(EXEC_LIST reg_test_voxelCentricToNodeCentric ${EXEC_LIST})
if(USE_CUDA)
set(EXEC_LIST reg_test_regr_approxLinearEnergyGradient ${EXEC_LIST})
Expand All @@ -130,7 +131,6 @@ if(USE_CUDA)
set(EXEC_LIST reg_test_regr_measure ${EXEC_LIST})
endif(USE_CUDA)


foreach(EXEC ${EXEC_LIST})
add_executable(${EXEC} ${EXEC}.cpp)
target_link_libraries(${EXEC} PRIVATE Catch2::Catch2WithMain _reg_aladin _reg_f3d)
Expand Down
2 changes: 1 addition & 1 deletion reg-test/reg_test_common.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define NR_TESTING // Enable testing
#define EPS 0.000001
#define EPS 0.000001f

#include <array>
#include <random>
Expand Down
Loading

0 comments on commit 67cc123

Please sign in to comment.