Skip to content
Merged
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
64 changes: 8 additions & 56 deletions Modules/Filtering/ImageIntensity/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,12 @@ set(
itkDivideImageFilterTest2.cxx
itkDivideOrZeroOutImageFilterTest.cxx
itkEdgePotentialImageFilterTest.cxx
itkEqualTest.cxx
itkExpImageFilterAndAdaptorTest.cxx
itkExpNegativeImageFilterAndAdaptorTest.cxx
itkGreaterEqualTest.cxx
itkGreaterTest.cxx
itkHistogramMatchingImageFilterTest.cxx
itkImageAdaptorNthElementTest.cxx
itkIntensityWindowingImageFilterTest.cxx
itkInvertIntensityImageFilterTest.cxx
itkLessEqualTest.cxx
itkLessTest.cxx
itkLog10ImageFilterAndAdaptorTest.cxx
itkLogImageFilterAndAdaptorTest.cxx
itkMagnitudeAndPhaseToComplexImageFilterTest.cxx
Expand All @@ -48,7 +43,6 @@ set(
itkNaryMaximumImageFilterTest.cxx
itkNormalizeImageFilterTest.cxx
itkNormalizeToConstantImageFilterTest.cxx
itkNotEqualTest.cxx
itkNotImageFilterTest.cxx
itkNthElementPixelAccessorTest2.cxx
itkOrImageFilterTest.cxx
Expand All @@ -59,12 +53,10 @@ set(
itkRescaleIntensityImageFilterTest.cxx
itkRGBToLuminanceImageFilterAndAdaptorTest.cxx
itkRGBToVectorAdaptImageFilterTest.cxx
itkRoundImageFilterTest.cxx
itkShiftScaleImageFilterTest.cxx
itkSigmoidImageFilterTest.cxx
itkSinImageFilterAndAdaptorTest.cxx
itkSqrtImageFilterAndAdaptorTest.cxx
itkSquareImageFilterTest.cxx
itkSubtractImageFilterTest.cxx
itkSymmetricEigenAnalysisImageFilterTest.cxx
itkTanImageFilterAndAdaptorTest.cxx
Expand Down Expand Up @@ -410,12 +402,6 @@ itk_add_test(
itkMatrixIndexSelectionImageFilterTest
${ITK_TEST_OUTPUT_DIR}/MatrixIndexSelectionImageFilterTest.png
)
itk_add_test(
NAME itkSquareImageFilterTest
COMMAND
ITKImageIntensityTestDriver
itkSquareImageFilterTest
)
itk_add_test(
NAME itkRGBToVectorAdaptImageFilterTest.cxx
COMMAND
Expand Down Expand Up @@ -616,42 +602,6 @@ itk_add_test(
ITKImageIntensityTestDriver
itkNormalizeToConstantImageFilterTest
)
itk_add_test(
NAME itkEqualTest
COMMAND
ITKImageIntensityTestDriver
itkEqualTest
)
itk_add_test(
NAME itkNotEqualTest
COMMAND
ITKImageIntensityTestDriver
itkNotEqualTest
)
itk_add_test(
NAME itkGreaterEqualTest
COMMAND
ITKImageIntensityTestDriver
itkGreaterEqualTest
)
itk_add_test(
NAME itkGreaterTest
COMMAND
ITKImageIntensityTestDriver
itkGreaterTest
)
itk_add_test(
NAME itkLessEqualTest
COMMAND
ITKImageIntensityTestDriver
itkLessEqualTest
)
itk_add_test(
NAME itkLessTest
COMMAND
ITKImageIntensityTestDriver
itkLessTest
)
itk_add_test(
NAME itkClampImageFilterTest
COMMAND
Expand All @@ -676,12 +626,6 @@ itk_add_test(
DATA{Input/itkBrainSliceComplexPhase.mha}
${ITK_TEST_OUTPUT_DIR}/itkMagnitudeAndPhaseToComplexImageFilterTest.mha
)
itk_add_test(
NAME itkRoundImageFilterTest
COMMAND
ITKImageIntensityTestDriver
itkRoundImageFilterTest
)
itk_add_test(
NAME itkDiscreteHessianGaussianImageFunctionTest
COMMAND
Expand Down Expand Up @@ -787,6 +731,14 @@ set(
itkAddImageFilterFrameGTest.cxx
itkArithmeticOpsFunctorsTest.cxx
itkBitwiseOpsFunctorsTest.cxx
itkEqualGTest.cxx
itkGreaterEqualGTest.cxx
itkGreaterGTest.cxx
itkLessEqualGTest.cxx
itkLessGTest.cxx
itkNotEqualGTest.cxx
itkRoundImageFilterGTest.cxx
itkSquareImageFilterGTest.cxx
)

if(MSVC)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@
* limitations under the License.
*
*=========================================================================*/
#include "itkCommonEnums.h"
#include "itkLogicOpsFunctors.h"

#include "itkBinaryFunctorImageFilter.h"
#include "itkCommonEnums.h"
#include "itkImageRegionIteratorWithIndex.h"
#include "itkLogicTestSupport.h"

#include "itkGTest.h"

namespace
{
// A bogus class for testing purposes.
Expand Down Expand Up @@ -60,10 +63,9 @@ class Bogus
};
} // namespace

int
itkEqualTest(int, char *[])
{

TEST(EqualImageFilter, ConvertedLegacyTest)
{
// Define the dimension of the images
constexpr unsigned int myDimension{ 3 };

Expand Down Expand Up @@ -131,10 +133,7 @@ itkEqualTest(int, char *[])
{
// Create a logic Filter
const myFilterTypePointer filter = myFilterType::New();
if (filter.IsNull())
{
return EXIT_FAILURE;
}
ASSERT_FALSE(filter.IsNull());

// Connect the input images
filter->SetInput1(inputImageA);
Expand All @@ -153,15 +152,9 @@ itkEqualTest(int, char *[])
const PixelType FG = filter->GetFunctor().GetForegroundValue();
const PixelType BG = filter->GetFunctor().GetBackgroundValue();

const int status1 =
checkImOnImRes<myImageType1, myImageType2, myImageType3, std::equal_to<myImageType1::PixelType>>(
inputImageA, inputImageB, outputImage, FG, BG);
if (status1 == EXIT_FAILURE)
{
return EXIT_FAILURE;
}

std::cout << "Step 1 passed" << std::endl;
ASSERT_EQ((checkImOnImRes<myImageType1, myImageType2, myImageType3, std::equal_to<myImageType1::PixelType>>(
inputImageA, inputImageB, outputImage, FG, BG)),
EXIT_SUCCESS);
}

{
Expand All @@ -182,14 +175,9 @@ itkEqualTest(int, char *[])
const PixelType FG = filter->GetFunctor().GetForegroundValue();
const PixelType BG = filter->GetFunctor().GetBackgroundValue();
const PixelType C = filter->GetConstant2();
const int status2 = checkImOnConstRes<myImageType1, PixelType, myImageType3, std::equal_to<PixelType>>(
inputImageA, C, outputImage, FG, BG);
if (status2 == EXIT_FAILURE)
{
return EXIT_FAILURE;
}

std::cout << "Step 2 passed " << std::endl;
ASSERT_EQ((checkImOnConstRes<myImageType1, PixelType, myImageType3, std::equal_to<PixelType>>(
inputImageA, C, outputImage, FG, BG)),
EXIT_SUCCESS);
}
// Now try testing with constant : 3 == Im2
{
Expand All @@ -209,26 +197,17 @@ itkEqualTest(int, char *[])
const PixelType FG = filter->GetFunctor().GetForegroundValue();
const PixelType BG = filter->GetFunctor().GetBackgroundValue();

const int status3 = checkConstOnImRes<PixelType, myImageType2, myImageType3, std::equal_to<PixelType>>(
filter->GetConstant1(), inputImageB, outputImage, FG, BG);
if (status3 == EXIT_FAILURE)
{
return EXIT_FAILURE;
}

std::cout << "Step 3 passed" << std::endl;
ASSERT_EQ((checkConstOnImRes<PixelType, myImageType2, myImageType3, std::equal_to<PixelType>>(
filter->GetConstant1(), inputImageB, outputImage, FG, BG)),
EXIT_SUCCESS);
}

{
// BinaryImageFilter
using iFIB = itk::BinaryFunctorImageFilter<itk::Image<double>, itk::Image<double>, itk::Image<double>, Bogus>;
auto FIB = iFIB::New();
if (FIB.IsNull())
{
return EXIT_FAILURE;
}
ASSERT_FALSE(FIB.IsNull());
}

// All objects should be automatically destroyed at this point
return EXIT_SUCCESS;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@
*
*=========================================================================*/
#include "itkLogicOpsFunctors.h"

#include "itkBinaryFunctorImageFilter.h"
#include "itkImageRegionIteratorWithIndex.h"
#include "itkLogicTestSupport.h"

int
itkGreaterEqualTest(int, char *[])
{
#include "itkGTest.h"


TEST(GreaterEqualImageFilter, ConvertedLegacyTest)
{
// Define the dimension of the images
constexpr unsigned int myDimension{ 3 };

Expand Down Expand Up @@ -108,15 +110,9 @@ itkGreaterEqualTest(int, char *[])
const PixelType FG = filter->GetFunctor().GetForegroundValue();
const PixelType BG = filter->GetFunctor().GetBackgroundValue();

const int status1 =
checkImOnImRes<myImageType1, myImageType2, myImageType3, std::greater_equal<myImageType1::PixelType>>(
inputImageA, inputImageB, outputImage, FG, BG);
if (status1 == EXIT_FAILURE)
{
return EXIT_FAILURE;
}

std::cout << "Step 1 passed" << std::endl;
ASSERT_EQ((checkImOnImRes<myImageType1, myImageType2, myImageType3, std::greater_equal<myImageType1::PixelType>>(
inputImageA, inputImageB, outputImage, FG, BG)),
EXIT_SUCCESS);
}

{
Expand All @@ -138,14 +134,9 @@ itkGreaterEqualTest(int, char *[])
const PixelType FG = filter->GetFunctor().GetForegroundValue();
const PixelType BG = filter->GetFunctor().GetBackgroundValue();
const PixelType C = filter->GetConstant2();
const int status2 = checkImOnConstRes<myImageType1, PixelType, myImageType3, std::greater_equal<PixelType>>(
inputImageA, C, outputImage, FG, BG);
if (status2 == EXIT_FAILURE)
{
return EXIT_FAILURE;
}

std::cout << "Step 2 passed " << std::endl;
ASSERT_EQ((checkImOnConstRes<myImageType1, PixelType, myImageType3, std::greater_equal<PixelType>>(
inputImageA, C, outputImage, FG, BG)),
EXIT_SUCCESS);
}
// Now try testing with constant : 3 != Im2
{
Expand All @@ -165,15 +156,9 @@ itkGreaterEqualTest(int, char *[])
const PixelType FG = filter->GetFunctor().GetForegroundValue();
const PixelType BG = filter->GetFunctor().GetBackgroundValue();

const int status3 = checkConstOnImRes<PixelType, myImageType2, myImageType3, std::greater_equal<PixelType>>(
filter->GetConstant1(), inputImageB, outputImage, FG, BG);
if (status3 == EXIT_FAILURE)
{
return EXIT_FAILURE;
}

std::cout << "Step 3 passed" << std::endl;
ASSERT_EQ((checkConstOnImRes<PixelType, myImageType2, myImageType3, std::greater_equal<PixelType>>(
filter->GetConstant1(), inputImageB, outputImage, FG, BG)),
EXIT_SUCCESS);
}
// All objects should be automatically destroyed at this point
return EXIT_SUCCESS;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@
*
*=========================================================================*/
#include "itkLogicOpsFunctors.h"

#include "itkBinaryFunctorImageFilter.h"
#include "itkImageRegionIteratorWithIndex.h"
#include "itkLogicTestSupport.h"

int
itkGreaterTest(int, char *[])
{
#include "itkGTest.h"


TEST(GreaterImageFilter, ConvertedLegacyTest)
{
// Define the dimension of the images
constexpr unsigned int myDimension{ 3 };

Expand Down Expand Up @@ -108,14 +110,9 @@ itkGreaterTest(int, char *[])
const PixelType FG = filter->GetFunctor().GetForegroundValue();
const PixelType BG = filter->GetFunctor().GetBackgroundValue();

const int status1 = checkImOnImRes<myImageType1, myImageType2, myImageType3, std::greater<myImageType1::PixelType>>(
inputImageA, inputImageB, outputImage, FG, BG);
if (status1 == EXIT_FAILURE)
{
return EXIT_FAILURE;
}

std::cout << "Step 1 passed" << std::endl;
ASSERT_EQ((checkImOnImRes<myImageType1, myImageType2, myImageType3, std::greater<myImageType1::PixelType>>(
inputImageA, inputImageB, outputImage, FG, BG)),
EXIT_SUCCESS);
}

{
Expand All @@ -137,14 +134,9 @@ itkGreaterTest(int, char *[])
const PixelType FG = filter->GetFunctor().GetForegroundValue();
const PixelType BG = filter->GetFunctor().GetBackgroundValue();
const PixelType C = filter->GetConstant2();
const int status2 = checkImOnConstRes<myImageType1, PixelType, myImageType3, std::greater<PixelType>>(
inputImageA, C, outputImage, FG, BG);
if (status2 == EXIT_FAILURE)
{
return EXIT_FAILURE;
}

std::cout << "Step 2 passed " << std::endl;
ASSERT_EQ((checkImOnConstRes<myImageType1, PixelType, myImageType3, std::greater<PixelType>>(
inputImageA, C, outputImage, FG, BG)),
EXIT_SUCCESS);
}
// Now try testing with constant : 3 != Im2
{
Expand All @@ -162,15 +154,9 @@ itkGreaterTest(int, char *[])
const PixelType FG = filter->GetFunctor().GetForegroundValue();
const PixelType BG = filter->GetFunctor().GetBackgroundValue();

const int status3 = checkConstOnImRes<PixelType, myImageType2, myImageType3, std::greater<PixelType>>(
filter->GetConstant1(), inputImageB, outputImage, FG, BG);
if (status3 == EXIT_FAILURE)
{
return EXIT_FAILURE;
}

std::cout << "Step 3 passed" << std::endl;
ASSERT_EQ((checkConstOnImRes<PixelType, myImageType2, myImageType3, std::greater<PixelType>>(
filter->GetConstant1(), inputImageB, outputImage, FG, BG)),
EXIT_SUCCESS);
}
// All objects should be automatically destroyed at this point
return EXIT_SUCCESS;
}
Loading
Loading