diff --git a/Modules/Core/Common/test/itkTimeProbeTest.cxx b/Modules/Core/Common/test/itkTimeProbeTest.cxx index f37bf125068..05bf2ae25be 100644 --- a/Modules/Core/Common/test/itkTimeProbeTest.cxx +++ b/Modules/Core/Common/test/itkTimeProbeTest.cxx @@ -17,6 +17,7 @@ *=========================================================================*/ #include +#include "itkIndent.h" #include "itkTimeProbe.h" #include "itkMath.h" @@ -90,6 +91,10 @@ itkTimeProbeTest(int, char *[]) std::cout << "msec " << timeStamp.GetTimeInMilliSeconds() << std::endl; std::cout << "usec " << timeStamp.GetTimeInMicroSeconds() << std::endl; + // Exercise the Print method + itk::Indent indent{}; + localTimer.Print(std::cout, indent); + std::cout << "[PASSED]" << std::endl; return EXIT_SUCCESS; } diff --git a/Modules/Core/ImageFunction/test/itkRayCastInterpolateImageFunctionTest.cxx b/Modules/Core/ImageFunction/test/itkRayCastInterpolateImageFunctionTest.cxx index 422268dbb81..3595a370107 100644 --- a/Modules/Core/ImageFunction/test/itkRayCastInterpolateImageFunctionTest.cxx +++ b/Modules/Core/ImageFunction/test/itkRayCastInterpolateImageFunctionTest.cxx @@ -154,6 +154,9 @@ itkRayCastInterpolateImageFunctionTest(int itkNotUsed(argc), char * itkNotUsed(a ITK_TEST_EXPECT_TRUE(itk::Math::FloatAlmostEqual(integral, 1276.)); + ITK_TEST_EXPECT_TRUE(interp->IsInsideBuffer(query)); + ITK_TEST_EXPECT_TRUE(interp->IsInsideBuffer(index)); + std::cout << "Test finished" << std::endl; return EXIT_SUCCESS; diff --git a/Modules/Filtering/ImageFrequency/test/itkFrequencyBandImageFilterTest.cxx b/Modules/Filtering/ImageFrequency/test/itkFrequencyBandImageFilterTest.cxx index 3eb4d571f60..34e3ef6a945 100644 --- a/Modules/Filtering/ImageFrequency/test/itkFrequencyBandImageFilterTest.cxx +++ b/Modules/Filtering/ImageFrequency/test/itkFrequencyBandImageFilterTest.cxx @@ -259,6 +259,10 @@ itkFrequencyBandImageFilterTest(int argc, char * argv[]) auto testFilter = UnaryFilterType::New(); ITK_EXERCISE_BASIC_OBJECT_METHODS(testFilter, UnaryFrequencyDomainFilter, InPlaceImageFilter); + + auto actualXDimensionIsOdd = false; + ITK_TEST_SET_GET_BOOLEAN(testFilter, ActualXDimensionIsOdd, actualXDimensionIsOdd); + struct TestStruct { static double diff --git a/Modules/Filtering/ImageIntensity/test/itkVectorExpandImageFilterTest.cxx b/Modules/Filtering/ImageIntensity/test/itkVectorExpandImageFilterTest.cxx index c28d25b38e8..fbcd168780c 100644 --- a/Modules/Filtering/ImageIntensity/test/itkVectorExpandImageFilterTest.cxx +++ b/Modules/Filtering/ImageIntensity/test/itkVectorExpandImageFilterTest.cxx @@ -140,6 +140,10 @@ itkVectorExpandImageFilterTest(int, char *[]) using InterpolatorType = itk::VectorNearestNeighborInterpolateImageFunction; auto interpolator = InterpolatorType::New(); + ITK_EXERCISE_BASIC_OBJECT_METHODS( + interpolator, VectorNearestNeighborInterpolateImageFunction, VectorInterpolateImageFunction); + + expander->SetInterpolator(interpolator); ITK_TEST_SET_GET_VALUE(interpolator, expander->GetInterpolator()); diff --git a/Modules/IO/TransformMINC/test/itkMINCTransformAdapterTest.cxx b/Modules/IO/TransformMINC/test/itkMINCTransformAdapterTest.cxx index 0c553200944..3e84702a271 100644 --- a/Modules/IO/TransformMINC/test/itkMINCTransformAdapterTest.cxx +++ b/Modules/IO/TransformMINC/test/itkMINCTransformAdapterTest.cxx @@ -28,6 +28,7 @@ #include "itkIOTestHelper.h" #include "itkMINCTransformAdapter.h" #include "itkMath.h" +#include "itkTestingMacros.h" static constexpr double tolerance = 1e-5; @@ -230,6 +231,63 @@ itkMINCTransformAdapterTest(int argc, char * argv[]) { itksys::SystemTools::ChangeDirectory(argv[1]); } + + + constexpr unsigned int InputDimension = 3; + constexpr unsigned int OutputDimension = 3; + + using ParametersValueType = double; + + using TransformAdapterType = itk::MINCTransformAdapter; + + TransformAdapterType::Pointer xfm = TransformAdapterType::New(); + + ITK_EXERCISE_BASIC_OBJECT_METHODS(xfm, MINCTransformAdapter, Transform); + + + TransformAdapterType::InputVectorType vector{}; + TransformAdapterType::InputPointType point{}; + ITK_TRY_EXPECT_EXCEPTION(xfm->TransformVector(vector, point); + + TransformAdapterType::InputVnlVectorType vnlVector{}; + ITK_TRY_EXPECT_EXCEPTION(xfm->TransformVector(vnlVector, point); + + TransformAdapterType::InputVectorPixelType vectorPixel{}; + ITK_TRY_EXPECT_EXCEPTION(xfm->TransformVector(vectorPixel, point); + + TransformAdapterType::InputCovariantVectorType covariantVector{}; + ITK_TRY_EXPECT_EXCEPTION(xfm->TransformCovariantVector(covariantVector, point); + + ITK_TRY_EXPECT_EXCEPTION(xfm->TransformCovariantVector(vectorPixel, point); + + TransformAdapterType::FixedParametersType covariantVector{}; + ITK_TRY_EXPECT_EXCEPTION(xfm->SetFixedParameters()); + + TransformAdapterType::JacobianType jacobian{}; + ITK_TRY_EXPECT_EXCEPTION(xfm->ComputeJacobianWithRespectToParameters(point, jacobian)); + + ITK_TRY_EXPECT_EXCEPTION(xfm->GetNumberOfParameters()); + + TransformAdapterType::ParametersTYpe params{}; + ITK_TRY_EXPECT_EXCEPTION(xfm->SetParameters(params)); + + ITK_TRY_EXPECT_EXCEPTION(xfm->GetParameters()); + + unsigned int InputDimensionExcp = 1; + unsigned int OutputDimensionExcp = 1; + + using TransformAdapterTypeExcp1 = itk::MINCTransformAdapter; + + ITK_TRY_EXPECT_EXCEPTION(TransformAdapterTypeExcp1::New()); + + unsigned int InputDimensionExcp = 4; + unsigned int OutputDimensionExcp = 4; + + using TransformAdapterTypeExcp2 = itk::MINCTransformAdapter; + + ITK_TRY_EXPECT_EXCEPTION(TransformAdapterTypeExcp2::New()); + + itk::TransformFactory>::RegisterTransform(); itk::ObjectFactoryBase::RegisterFactory(itk::MINCTransformIOFactory::New()); diff --git a/Modules/Numerics/Optimizers/test/itkLBFGSBOptimizerTest.cxx b/Modules/Numerics/Optimizers/test/itkLBFGSBOptimizerTest.cxx index 7989789bd84..38ea7098581 100644 --- a/Modules/Numerics/Optimizers/test/itkLBFGSBOptimizerTest.cxx +++ b/Modules/Numerics/Optimizers/test/itkLBFGSBOptimizerTest.cxx @@ -218,6 +218,8 @@ itkLBFGSBOptimizerTest(int, char *[]) itkOptimizer->SetMaximumNumberOfCorrections(maximumNumberOfCorrections); ITK_TEST_SET_GET_VALUE(maximumNumberOfCorrections, itkOptimizer->GetMaximumNumberOfCorrections()); + ITK_TEST_EXPECT_TRUE(!itkOptimizer->CanUseScales()); + constexpr unsigned int SpaceDimension = 2; OptimizerType::ParametersType initialValue(SpaceDimension); diff --git a/Modules/Registration/Metricsv4/test/itkANTSNeighborhoodCorrelationImageToImageMetricv4Test.cxx b/Modules/Registration/Metricsv4/test/itkANTSNeighborhoodCorrelationImageToImageMetricv4Test.cxx index c85fd7edf22..a780a528de1 100644 --- a/Modules/Registration/Metricsv4/test/itkANTSNeighborhoodCorrelationImageToImageMetricv4Test.cxx +++ b/Modules/Registration/Metricsv4/test/itkANTSNeighborhoodCorrelationImageToImageMetricv4Test.cxx @@ -238,11 +238,17 @@ itkANTSNeighborhoodCorrelationImageToImageMetricv4Test(int, char ** const) using MetricTypePointer = MetricType::Pointer; MetricTypePointer metric = MetricType::New(); + ITK_EXERCISE_BASIC_OBJECT_METHODS(metric, ANTSNeighborhoodCorrelationImageToImageMetricv4, ImageToImageMetricv4); + + const itk::Size neighborhoodRadius0{ { 1 } }; metric->SetRadius(neighborhoodRadius0); ITK_TEST_SET_GET_VALUE(neighborhoodRadius0, metric->GetRadius()); + const MetricType::RadiusType constRadius = metric->GetRadius(); + ITK_TEST_EXPECT_EQUAL(neighborhoodRadius0, constRadius); + itk::Size neighborhoodRadius; neighborhoodRadius.Fill(1); diff --git a/Modules/Registration/RegistrationMethodsv4/test/itkSimpleImageRegistrationTest.cxx b/Modules/Registration/RegistrationMethodsv4/test/itkSimpleImageRegistrationTest.cxx index 8d21c3af180..1a31c74ccd9 100644 --- a/Modules/Registration/RegistrationMethodsv4/test/itkSimpleImageRegistrationTest.cxx +++ b/Modules/Registration/RegistrationMethodsv4/test/itkSimpleImageRegistrationTest.cxx @@ -310,7 +310,13 @@ PerformSimpleImageRegistration(int argc, char * argv[]) displacementFieldSimple->SetNumberOfLevels(numberOfLevels); ITK_TEST_SET_GET_VALUE(numberOfLevels, displacementFieldSimple->GetNumberOfLevels()); - displacementFieldSimple->SetMovingInitialTransformInput(affineSimple->GetTransformOutput()); + typename AffineRegistrationType::DecoratedOutputTransformType * transformOutputNonConst = + affineSimple->GetTransformOutput(); + const typename AffineRegistrationType::DecoratedOutputTransformType * transformOutputConst = + affineSimple->GetTransformOutput(); + ITK_TEST_EXPECT_EQUAL(transformOutputNonConst, transformOutputConst); + + displacementFieldSimple->SetMovingInitialTransformInput(transformOutputNonConst); displacementFieldSimple->SetMetric(correlationMetric); displacementFieldSimple->SetOptimizer(optimizer); diff --git a/Modules/Segmentation/DeformableMesh/test/itkDeformableSimplexMesh3DGradientConstraintForceFilterTest.cxx b/Modules/Segmentation/DeformableMesh/test/itkDeformableSimplexMesh3DGradientConstraintForceFilterTest.cxx index 182083c4b3c..f017bfd2cad 100644 --- a/Modules/Segmentation/DeformableMesh/test/itkDeformableSimplexMesh3DGradientConstraintForceFilterTest.cxx +++ b/Modules/Segmentation/DeformableMesh/test/itkDeformableSimplexMesh3DGradientConstraintForceFilterTest.cxx @@ -145,6 +145,10 @@ itkDeformableSimplexMesh3DGradientConstraintForceFilterTest(int, char *[]) std::cout << "[TEST DONE]" << std::endl; + // Print the filter after its update so that its StartVoxel, Positive and Negative ivars's ImageVoxel class stream + // insertion operator overload gets exercised. + deformFilter->Print(std::cout); + // Test streaming enumeration for DeformableSimplexMesh3DGradientConstraintForceFilterEnums::SIDE elements const std::set allSIDE{ itk::DeformableSimplexMesh3DGradientConstraintForceFilterEnums::SIDE::NORMAL,