Skip to content

Commit

Permalink
ENH: Add tests to the module.
Browse files Browse the repository at this point in the history
Add tests to the module.
  • Loading branch information
jhlegarreta authored and thewtex committed Mar 18, 2019
1 parent e62ab8d commit 05e7d4c
Show file tree
Hide file tree
Showing 5 changed files with 252 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
itk_module_test()

set(NDRegTests
itkMetamorphosisImageRegistrationMethodv4Test.cxx
itkTimeVaryingVelocityFieldSemiLagrangianIntegrationImageFilterTest.cxx
itkTimeVaryingVelocityFieldSemiLagrangianTransformTest.cxx
itkWrapExtrapolateImageFunctionTest.cxx
)

CreateTestDriver(NDReg "${NDReg-Test_LIBRARIES}" "${NDRegTests}")

itk_add_test(NAME itkMetamorphosisImageRegistrationMethodv4Test
COMMAND NDRegTestDriver
--compare ${ITK_TEST_OUTPUT_DIR}/itkMyFilterTestOutput.mha
DATA{Baseline/itkMyFilterTestOutput.mha}
itkMetamorphosisImageRegistrationMethodv4Test ${ITK_TEST_OUTPUT_DIR}/itkMyFilterTestOutput.mha
)

itk_add_test(NAME itkTimeVaryingVelocityFieldSemiLagrangianIntegrationImageFilterTest
COMMAND NDRegTestDriver
--compare ${ITK_TEST_OUTPUT_DIR}/itkMyFilterTestOutput.mha
DATA{Baseline/itkMyFilterTestOutput.mha}
itkTimeVaryingVelocityFieldSemiLagrangianIntegrationImageFilterTest ${ITK_TEST_OUTPUT_DIR}/itkMyFilterTestOutput.mha
)

itk_add_test(NAME itkTimeVaryingVelocityFieldSemiLagrangianTransformTest
COMMAND NDRegTestDriver --without-threads
--compare ${ITK_TEST_OUTPUT_DIR}/itkNormalDistributionImageSourceTestOutput.mha
DATA{Baseline/itkNormalDistributionImageSourceTestOutput.mha}
itkTimeVaryingVelocityFieldSemiLagrangianTransformTest ${ITK_TEST_OUTPUT_DIR}/itkNormalDistributionImageSourceTestOutput.mha
)

itk_add_test(NAME itkWrapExtrapolateImageFunctionTest
COMMAND NDRegTestDriver
--compare ${ITK_TEST_OUTPUT_DIR}/itkMyFilterTestOutput.mha
DATA{Baseline/itkMyFilterTestOutput.mha}
itkWrapExtrapolateImageFunctionTest ${ITK_TEST_OUTPUT_DIR}/itkMyFilterTestOutput.mha
)
53 changes: 53 additions & 0 deletions test/itkMetamorphosisImageRegistrationMethodv4Test.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/

#include "itkMetamorphosisImageRegistrationMethodv4.h"
#include "itkImageFileWriter.h"
#include "itkTestingMacros.h"


int itkMetamorphosisImageRegistrationMethodv4Test( int argc, char * argv[] )
{
if( argc < 2 )
{
std::cerr << "Missing parameters." << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr << " outputImage";
std::cerr << std::endl;
return EXIT_FAILURE;
}


const char * outputImageFileName = argv[1];

const unsigned int Dimension = 2;
using PixelType = float;
using ImageType = itk::Image< PixelType, Dimension >;

using MetamorphosisImageRegistrationMethodv4Type = itk::MetamorphosisImageRegistrationMethodv4< ImageType, ImageType >;
MetamorphosisImageRegistrationMethodv4Type::Pointer metamorphosisImageRegistration =
MetamorphosisImageRegistrationMethodv4Type::New();

EXERCISE_BASIC_OBJECT_METHODS( metamorphosisImageRegistration, MetamorphosisImageRegistrationMethodv4,
TimeVaryingVelocityFieldImageRegistrationMethodv4 );



std::cout << "Test finished." << std::endl;
return EXIT_SUCCESS;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/

#include "itkTimeVaryingVelocityFieldSemiLagrangianIntegrationImageFilter.h"
#include "itkImageFileWriter.h"
#include "itkTestingMacros.h"


int itkTimeVaryingVelocityFieldSemiLagrangianIntegrationImageFilterTest( int argc, char * argv[] )
{
if( argc < 2 )
{
std::cerr << "Missing parameters." << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr << " outputImage";
std::cerr << std::endl;
return EXIT_FAILURE;
}

constexpr unsigned int Dimension = 3;

using PixelType = float;
using ImageType = itk::Image< PixelType, Dimension >;

using VectorType = itk::Vector< PixelType, Dimension >;
using DisplacementFieldType = itk::Image< VectorType, Dimension >;
using TimeVaryingVelocityFieldType = itk::Image< VectorType, Dimension >;

using TimeVaryingVelocityFieldSemiLagrangianIntegrationImageFilterType =
itk::TimeVaryingVelocityFieldSemiLagrangianIntegrationImageFilter< TimeVaryingVelocityFieldType,
DisplacementFieldType >;
TimeVaryingVelocityFieldSemiLagrangianIntegrationImageFilterType::Pointer
timeVaryingVelocityFieldSemiLagrangianIntegrationImageFilter =
TimeVaryingVelocityFieldSemiLagrangianIntegrationImageFilterType::New();

EXERCISE_BASIC_OBJECT_METHODS( timeVaryingVelocityFieldSemiLagrangianIntegrationImageFilter,
TimeVaryingVelocityFieldSemiLagrangianIntegrationImageFilter, TimeVaryingVelocityFieldIntegrationImageFilter );



std::cout << "Test finished." << std::endl;
return EXIT_SUCCESS;
}
52 changes: 52 additions & 0 deletions test/itkTimeVaryingVelocityFieldSemiLagrangianTransformTest.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/

#include "itkTimeVaryingVelocityFieldSemiLagrangianTransform.h"
#include "itkImageFileWriter.h"
#include "itkTestingMacros.h"


int itkTimeVaryingVelocityFieldSemiLagrangianTransformTest( int argc, char * argv[] )
{
if( argc < 2 )
{
std::cerr << "Missing parameters." << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr << " outputImage";
std::cerr << std::endl;
return EXIT_FAILURE;
}

constexpr unsigned int Dimension = 2;

using PixelType = float;
using ImageType = itk::Image< PixelType, Dimension >;

using TimeVaryingVelocityFieldSemiLagrangianTransformType =
itk::TimeVaryingVelocityFieldSemiLagrangianTransform< PixelType >;
TimeVaryingVelocityFieldSemiLagrangianTransform::Pointer timeVaryingVelocityFieldSemiLagrangianTransform =
TimeVaryingVelocityFieldSemiLagrangianTransform::New();

EXERCISE_BASIC_OBJECT_METHODS( timeVaryingVelocityFieldSemiLagrangianTransform,
TimeVaryingVelocityFieldSemiLagrangianTransform, TimeVaryingVelocityFieldTransform );



std::cout << "Test finished." << std::endl;
return EXIT_SUCCESS;
}
51 changes: 51 additions & 0 deletions test/itkWrapExtrapolateImageFunctionTest.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/

#include "itkWrapExtrapolateImageFunction.h"
#include "itkImageFileWriter.h"
#include "itkTestingMacros.h"


int itkWrapExtrapolateImageFunctionTest( int argc, char * argv[] )
{
if( argc < 2 )
{
std::cerr << "Missing parameters." << std::endl;
std::cerr << "Usage: " << argv[0];
std::cerr << " outputImage";
std::cerr << std::endl;
return EXIT_FAILURE;
}

constexpr unsigned int Dimension = 2;

using PixelType = float;
using ImageType = itk::Image< PixelType, Dimension >;

using WrapExtrapolateImageFunctionType = itk::WrapExtrapolateImageFunction< ImageType >;
WrapExtrapolateImageFunctionType::Pointer wrapExtrapolateImageFunction =
WrapExtrapolateImageFunctionType::New();

EXERCISE_BASIC_OBJECT_METHODS( wrapExtrapolateImageFunction, WrapExtrapolateImageFunction,
ExtrapolateImageFunction );



std::cout << "Test finished." << std::endl;
return EXIT_SUCCESS;
}

0 comments on commit 05e7d4c

Please sign in to comment.