14 #include "itkImageRegionIterator.h" 34 FilterType::Pointer testFilter = FilterType::New();
36 testFilter->SetInput(0,img1);
37 testFilter->SetInput(1,img2);
41 FilterType::PixelVectorType
max = testFilter->GetMaximum();
42 FilterType::PixelVectorType
min = testFilter->GetMinimum();
43 FilterType::RealVectorType mean = testFilter->GetMean();
44 FilterType::RealVectorType sig = testFilter->GetSigma();
45 FilterType::RealVectorType variance = testFilter->GetVariance();
46 FilterType::RealVectorType sum = testFilter->GetSum();
55 CPPUNIT_ASSERT_MESSAGE(
"Check computed maximum[0]",9 == max[0]);
56 CPPUNIT_ASSERT_MESSAGE(
"Check computed minimum[0]",1 == min[0]);
57 CPPUNIT_ASSERT_MESSAGE(
"Check computed mean[0]",5 == mean[0]);
58 CPPUNIT_ASSERT_MESSAGE(
"Check computed sigma[0]",sqrt(7.5) == sig[0]);
59 CPPUNIT_ASSERT_MESSAGE(
"Check computed variance[0]",7.5 == variance[0]);
60 CPPUNIT_ASSERT_MESSAGE(
"Check computed sum[0]",45 == sum[0]);
62 CPPUNIT_ASSERT_MESSAGE(
"Check computed maximum[1]",90 == max[1]);
63 CPPUNIT_ASSERT_MESSAGE(
"Check computed minimum[1]",10 == min[1]);
64 CPPUNIT_ASSERT_MESSAGE(
"Check computed mean[1]",50 == mean[1]);
65 CPPUNIT_ASSERT_MESSAGE(
"Check computed sigma[1]",sqrt(750.0) == sig[1]);
66 CPPUNIT_ASSERT_MESSAGE(
"Check computed variance[1]",750 == variance[1]);
67 CPPUNIT_ASSERT_MESSAGE(
"Check computed sum[1]",450 == sum[1]);
72 testFilter->SetMask(mask);
76 max = testFilter->GetMaximum();
77 min = testFilter->GetMinimum();
78 mean = testFilter->GetMean();
79 sig = testFilter->GetSigma();
80 variance = testFilter->GetVariance();
81 sum = testFilter->GetSum();
90 CPPUNIT_ASSERT_MESSAGE(
"Check computed maximum[0]",4 == max[0]);
91 CPPUNIT_ASSERT_MESSAGE(
"Check computed minimum[0]",2 == min[0]);
92 CPPUNIT_ASSERT_MESSAGE(
"Check computed mean[0]",3 == mean[0]);
93 CPPUNIT_ASSERT_MESSAGE(
"Check computed sigma[0]",1 == sig[0]);
94 CPPUNIT_ASSERT_MESSAGE(
"Check computed variance[0]",1 == variance[0]);
95 CPPUNIT_ASSERT_MESSAGE(
"Check computed sum[0]",9 == sum[0]);
97 CPPUNIT_ASSERT_MESSAGE(
"Check computed maximum[1]",40 == max[1]);
98 CPPUNIT_ASSERT_MESSAGE(
"Check computed minimum[1]",20 == min[1]);
99 CPPUNIT_ASSERT_MESSAGE(
"Check computed mean[1]",30 == mean[1]);
100 CPPUNIT_ASSERT_MESSAGE(
"Check computed sigma[1]",10 == sig[1]);
101 CPPUNIT_ASSERT_MESSAGE(
"Check computed variance[1]",100 == variance[1]);
102 CPPUNIT_ASSERT_MESSAGE(
"Check computed sum[1]",90 == sum[1]);
int itkMaskedNaryStatisticsImageFilterTest(int, char *[])
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
TestImageType::Pointer MITKTESTINGHELPER_EXPORT GenerateTestImage(int factor=1)
#define MITK_TEST_CONDITION(COND, MSG)
Computes a masked statistic on N images and produces vectors of those statistic results.
mitk::Image::Pointer mask
TestMaskType::Pointer MITKTESTINGHELPER_EXPORT GenerateTestMask()