Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmake/KWStyle/RTKOverwrite.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
test/.*\.cxx Namespace Disable
test/.*\.cxx Header Disable
test/.*\.cxx Comments Disable
test/.*\.h Namespace Disable
examples/.*\.cxx Namespace Disable
examples/.*\.cxx Header Disable
2 changes: 1 addition & 1 deletion examples/AddNoise/AddNoise.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const float I0 = 1e4; // Number of photons before attenuation
const float mu = 0.01879; // mm^-1, attenuation coefficient of water at 75 keV

int
main()
main(int, char *[])
{
// Simulate a Shepp Logan projection
auto geometry = rtk::ThreeDCircularProjectionGeometry::New();
Expand Down
2 changes: 1 addition & 1 deletion examples/FirstReconstruction/FirstCudaReconstruction.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <itkImageFileWriter.h>

int
main(int argc, char ** argv)
main(int argc, char * argv[])
{
if (argc < 3)
{
Expand Down
2 changes: 1 addition & 1 deletion examples/FirstReconstruction/FirstReconstruction.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <itkImageFileWriter.h>

int
main(int argc, char ** argv)
main(int argc, char * argv[])
{
if (argc < 3)
{
Expand Down
2 changes: 1 addition & 1 deletion examples/GeometricPhantom/GeometricPhantom.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "rtkThreeDCircularProjectionGeometryXMLFileWriter.h"

int
main(int argc, char ** argv)
main(int argc, char * argv[])
{
if (argc < 2)
{
Expand Down
2 changes: 1 addition & 1 deletion examples/InlineReconstruction/InlineReconstruction.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Acquisition()
}

int
main()
main(int, char *[])
{
// Launch the simulated acquisition
std::thread acquisitionThread(Acquisition);
Expand Down
108 changes: 78 additions & 30 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,52 +27,93 @@ find_package(
include(itkVersion)
if("${ITK_VERSION_MAJOR}" VERSION_LESS "6")
include(${ITK_USE_FILE})
set(
RTK_TEST_TARGETS
${RTK_LIBRARIES}
${ITK_LIBRARIES}
)
else()
itk_generate_factory_registration()
set(
RTK_TEST_TARGETS
ITK::RTKModule
ITK::ITKImageIO
ITK::ITKFFTImageFilterInit
ITK::ITKTestKernel
)
endif()

#-----------------------------------------------------------------------------
# rtk_add_test(testname testfile [DATA{}])
# Add regular test as opposed to tests depending on CUDA
set(RTKTests)
function(rtk_add_test testname testfile)
add_executable(${testname} ${testfile})
target_link_libraries(${testname} ${RTK_TEST_TARGETS})
set(options USE_MAIN)
cmake_parse_arguments(RTK_ADD_TEST "${options}" "" "" ${ARGN})

# Collect unique test sources used to build the test driver.
if(NOT "${testfile}" IN_LIST RTKTests)
list(APPEND RTKTests "${testfile}")
set(RTKTests "${RTKTests}" PARENT_SCOPE)
endif()

# Match create_test_sourcelist naming: keep path, drop extension.
get_filename_component(rtk_test_dir "${testfile}" DIRECTORY)
get_filename_component(rtk_test_name_we "${testfile}" NAME_WE)
if(rtk_test_dir STREQUAL "")
set(rtk_test_entry "${rtk_test_name_we}")
else()
set(rtk_test_entry "${rtk_test_dir}/${rtk_test_name_we}")
endif()

string(FIND "${testfile}" "../examples/" rtk_examples_prefix)
if(rtk_examples_prefix EQUAL 0)
# For sources that only define main(), remap main to the generated test symbol.
string(MAKE_C_IDENTIFIER "${rtk_test_entry}" rtk_test_symbol)
set_property(
SOURCE
${testfile}
APPEND
PROPERTY
COMPILE_DEFINITIONS
"main=${rtk_test_symbol}"
)
endif()

itk_add_test(NAME ${testname}
COMMAND itkTestDriver
$<TARGET_FILE:${testname}>
${ARGN}
COMMAND RTKTestDriver
${rtk_test_entry}
${RTK_ADD_TEST_UNPARSED_ARGUMENTS}
)
endfunction()

#-----------------------------------------------------------------------------
# rtk_add_cuda_test(testname testfile [DATA{}])
# Add test depending on CUDA
set(RTKCudaTests)
function(rtk_add_cuda_test testname testfile)
set(options USE_MAIN)
cmake_parse_arguments(RTK_ADD_TEST "${options}" "" "" ${ARGN})

if(RTK_USE_CUDA)
add_executable(${testname} ${testfile})
target_link_libraries(${testname} ${RTK_TEST_TARGETS})
if(NOT "${testfile}" IN_LIST RTKCudaTests)
list(APPEND RTKCudaTests "${testfile}")
set(RTKCudaTests "${RTKCudaTests}" PARENT_SCOPE)
endif()

get_filename_component(rtk_test_dir "${testfile}" DIRECTORY)
get_filename_component(rtk_test_name_we "${testfile}" NAME_WE)
if(rtk_test_dir STREQUAL "")
set(rtk_test_entry "${rtk_test_name_we}")
else()
set(rtk_test_entry "${rtk_test_dir}/${rtk_test_name_we}")
endif()

string(FIND "${testfile}" "../examples/" rtk_examples_prefix)
if(rtk_examples_prefix EQUAL 0)
string(MAKE_C_IDENTIFIER "${rtk_test_entry}" rtk_test_symbol)
set_property(
SOURCE
${testfile}
APPEND
PROPERTY
COMPILE_DEFINITIONS
"main=${rtk_test_symbol}"
)
endif()

itk_add_test(NAME ${testname}
COMMAND itkTestDriver
$<TARGET_FILE:${testname}>
${ARGN}
)
set_target_properties(
${testname}
PROPERTIES
COMPILE_FLAGS
-DUSE_CUDA
COMMAND RTKCudaTestDriver
${rtk_test_entry}
${RTK_ADD_TEST_UNPARSED_ARGUMENTS}
)
endif()
endfunction()
Expand Down Expand Up @@ -359,8 +400,6 @@ rtk_add_test(rtkBioscanTest rtkbioscantest.cxx

rtk_add_test(rtkVarianceReconstructionTest rtkvariancereconstructiontest.cxx)

#-----------------------------------------------------------------------------
# Test examples
rtk_add_test(rtkFirstReconstructionExampleTest
../examples/FirstReconstruction/FirstReconstruction.cxx
${CMAKE_CURRENT_BINARY_DIR}/FirstReconstruction.mha
Expand Down Expand Up @@ -390,3 +429,12 @@ if(ITK_WRAP_PYTHON)
itk_python_add_test(NAME rtkMaximumIntensityPythonTest COMMAND rtkMaximumIntensity.py)
itk_python_add_test(NAME rtkOutputArgumentWrappingTest COMMAND rtkOutputArgumentWrapping.py)
endif()

#-----------------------------------------------------------------------------
# Test drivers
createtestdriver(RTK "${RTK-Test_LIBRARIES}" "${RTKTests}")

if(RTK_USE_CUDA AND RTKCudaTests)
createtestdriver(RTKCuda "${RTK-Test_LIBRARIES}" "${RTKCudaTests}")
target_compile_definitions(RTKCudaTestDriver PRIVATE USE_CUDA)
endif()
2 changes: 1 addition & 1 deletion test/rtkI0estimationtest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

int
main(int, char **)
rtkI0estimationtest(int, char *[])
{
constexpr unsigned int Dimension = 3;
using ImageType = itk::Image<unsigned short, Dimension>;
Expand Down
2 changes: 1 addition & 1 deletion test/rtkTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ CheckVariableLengthVectorImageQuality(typename TImage::Pointer recon,
}
#endif // FAST_TESTS_NO_CHECKS

void
inline void
CheckGeometries(const rtk::ThreeDCircularProjectionGeometry * g1, const rtk::ThreeDCircularProjectionGeometry * g2)
{
// // It is often necessary to write the geometries and look at them
Expand Down
2 changes: 1 addition & 1 deletion test/rtkTestReg23ProjectionGeometry.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ IntersectPlaneWithLine(const GeometryType::PointType & S,
* @return EXIT_SUCCESS if the test approves correctness of the utility class
*/
int
main(int argc, char * argv[])
rtkTestReg23ProjectionGeometry(int argc, char * argv[])
{
// parse cmdln args:
std::string sarg;
Expand Down
2 changes: 1 addition & 1 deletion test/rtkadjointoperatorstest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*/

int
main(int, char **)
rtkadjointoperatorstest(int, char *[])
{
constexpr unsigned int Dimension = 3;

Expand Down
2 changes: 1 addition & 1 deletion test/rtkadmmtotalvariationtest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

int
main(int argc, char * argv[])
rtkadmmtotalvariationtest(int argc, char * argv[])
{
if (argc < 3)
{
Expand Down
2 changes: 1 addition & 1 deletion test/rtkadmmwaveletstest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ CheckImageQuality(typename TImage::Pointer recon, typename TImage::Pointer ref)
*/

int
main(int, char **)
rtkadmmwaveletstest(int, char *[])
{
using OutputPixelType = float;
constexpr unsigned int Dimension = 3;
Expand Down
2 changes: 1 addition & 1 deletion test/rtkamsterdamshroudtest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* \author Marc Vila
*/
int
main(int argc, char * argv[])
rtkamsterdamshroudtest(int argc, char * argv[])
{
constexpr unsigned int Dimension = 3;
using reg1DPixelType = double;
Expand Down
2 changes: 1 addition & 1 deletion test/rtkargsinfomanagertest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ cleanup_function(args_info_test * args_info)
}

int
main(int, char **)
rtkargsinfomanagertest(int, char *[])
{
args_info_test args_info_1, args_info_2;

Expand Down
2 changes: 1 addition & 1 deletion test/rtkbinningtest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

int
main(int, char **)
rtkbinningtest(int, char *[])
{
constexpr unsigned int Dimension = 2;
using OutputImageType = itk::Image<unsigned short, Dimension>;
Expand Down
2 changes: 1 addition & 1 deletion test/rtkbioscantest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

int
main(int argc, char * argv[])
rtkbioscantest(int argc, char * argv[])
{
if (argc < 3)
{
Expand Down
2 changes: 1 addition & 1 deletion test/rtkconjugategradientreconstructiontest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/

int
main(int, char **)
rtkconjugategradientreconstructiontest(int, char *[])
{
constexpr unsigned int Dimension = 3;
using OutputPixelType = float;
Expand Down
2 changes: 1 addition & 1 deletion test/rtkconjugategradienttest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ CheckImageQuality(typename TImage1::Pointer recon, typename TImage2::Pointer ref
*/

int
main(int, char **)
rtkconjugategradienttest(int, char *[])
{
constexpr unsigned int Dimension = 3;

Expand Down
2 changes: 1 addition & 1 deletion test/rtkcroptest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* \author Julien Jomier
*/
int
main(int, char **)
rtkcroptest(int, char *[])
{
constexpr unsigned int Dimension = 3;
using ImageType = itk::CudaImage<float, Dimension>;
Expand Down
2 changes: 1 addition & 1 deletion test/rtkcudaraycastadjointoperatorstest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

int
main(int, char **)
rtkcudaraycastadjointoperatorstest(int, char *[])
{
constexpr unsigned int Dimension = 3;
using OutputPixelType = float;
Expand Down
2 changes: 1 addition & 1 deletion test/rtkcyclicdeformationtest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/

int
main(int, char **)
rtkcyclicdeformationtest(int, char *[])
{
using OutputPixelType = itk::CovariantVector<float, 3>;

Expand Down
2 changes: 1 addition & 1 deletion test/rtkcylindricaldetectorreconstructiontest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

int
main(int, char **)
rtkcylindricaldetectorreconstructiontest(int, char *[])
{
constexpr unsigned int Dimension = 3;
using OutputPixelType = float;
Expand Down
2 changes: 1 addition & 1 deletion test/rtkdecomposespectralprojectionstest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/

int
main(int argc, char * argv[])
rtkdecomposespectralprojectionstest(int argc, char * argv[])
{
if (argc < 4)
{
Expand Down
2 changes: 1 addition & 1 deletion test/rtkdigisenstest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/

int
main(int argc, char * argv[])
rtkdigisenstest(int argc, char * argv[])
{
if (argc < 5)
{
Expand Down
2 changes: 1 addition & 1 deletion test/rtkdisplaceddetectorcompcudatest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

int
main(int, char **)
rtkdisplaceddetectorcompcudatest(int, char *[])
{
constexpr unsigned int Dimension = 3;
using OutputImageType = itk::CudaImage<float, Dimension>;
Expand Down
2 changes: 1 addition & 1 deletion test/rtkdisplaceddetectorcompoffsettest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

int
main(int, char **)
rtkdisplaceddetectorcompoffsettest(int, char *[])
{
constexpr unsigned int Dimension = 3;
using OutputImageType = itk::Image<float, Dimension>;
Expand Down
2 changes: 1 addition & 1 deletion test/rtkdisplaceddetectortest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/

int
main(int, char **)
rtkdisplaceddetectortest(int, char *[])
{
constexpr unsigned int Dimension = 3;
using OutputPixelType = float;
Expand Down
2 changes: 1 addition & 1 deletion test/rtkdivergencetest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/

int
main(int, char **)
rtkdivergencetest(int, char *[])
{
constexpr unsigned int Dimension = 3;
using OutputPixelType = double;
Expand Down
Loading
Loading