20 class mitkGIFNeighbourhoodGreyToneDifferenceFeaturesTestSuite :
public mitk::TestFixture 22 CPPUNIT_TEST_SUITE(mitkGIFNeighbourhoodGreyToneDifferenceFeaturesTestSuite);
24 MITK_TEST(ImageDescription_PhantomTest_3D);
25 MITK_TEST(ImageDescription_PhantomTest_2D);
27 CPPUNIT_TEST_SUITE_END();
37 void setUp(
void)
override 39 m_IBSI_Phantom_Image_Small = mitk::IOUtil::Load<mitk::Image>(
GetTestDataFilePath(
"Radiomics/IBSI_Phantom_Image_Small.nrrd"));
40 m_IBSI_Phantom_Image_Large = mitk::IOUtil::Load<mitk::Image>(
GetTestDataFilePath(
"Radiomics/IBSI_Phantom_Image_Large.nrrd"));
41 m_IBSI_Phantom_Mask_Small = mitk::IOUtil::Load<mitk::Image>(
GetTestDataFilePath(
"Radiomics/IBSI_Phantom_Mask_Small.nrrd"));
42 m_IBSI_Phantom_Mask_Large = mitk::IOUtil::Load<mitk::Image>(
GetTestDataFilePath(
"Radiomics/IBSI_Phantom_Mask_Large.nrrd"));
45 void ImageDescription_PhantomTest_3D()
49 featureCalculator->SetUseBinsize(
true);
50 featureCalculator->SetBinsize(1.0);
51 featureCalculator->SetUseMinimumIntensity(
true);
52 featureCalculator->SetUseMaximumIntensity(
true);
53 featureCalculator->SetMinimumIntensity(0.5);
54 featureCalculator->SetMaximumIntensity(6.5);
56 auto featureList = featureCalculator->CalculateFeatures(m_IBSI_Phantom_Image_Large, m_IBSI_Phantom_Mask_Large);
58 std::map<std::string, double> results;
59 for (
auto valuePair : featureList)
61 MITK_INFO << valuePair.first <<
" : " << valuePair.second;
62 results[valuePair.first] = valuePair.second;
64 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Image Diagnostics should calculate 5 features.", std::size_t(5), featureList.size());
68 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"Neighbourhood Grey Tone Difference::Coarsness with Large IBSI Phantom Image", 0.0296, results[
"Neighbourhood Grey Tone Difference::Coarsness"], 0.01);
69 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"Neighbourhood Grey Tone Difference::Contrast with Large IBSI Phantom Image", 0.584, results[
"Neighbourhood Grey Tone Difference::Contrast"], 0.01);
70 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"Neighbourhood Grey Tone Difference::Busyness with Large IBSI Phantom Image", 6.54, results[
"Neighbourhood Grey Tone Difference::Busyness"], 0.01);
71 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"Neighbourhood Grey Tone Difference::Complexity with Large IBSI Phantom Image", 13.5, results[
"Neighbourhood Grey Tone Difference::Complexity"], 0.1);
72 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"Neighbourhood Grey Tone Difference::Strength with Large IBSI Phantom Image", 0.763, results[
"Neighbourhood Grey Tone Difference::Strength"], 0.01);
75 void ImageDescription_PhantomTest_2D()
79 featureCalculator->SetUseBinsize(
true);
80 featureCalculator->SetBinsize(1.0);
81 featureCalculator->SetUseMinimumIntensity(
true);
82 featureCalculator->SetUseMaximumIntensity(
true);
83 featureCalculator->SetMinimumIntensity(0.5);
84 featureCalculator->SetMaximumIntensity(6.5);
86 auto featureList = featureCalculator->CalculateFeaturesSlicewise(m_IBSI_Phantom_Image_Large, m_IBSI_Phantom_Mask_Large, 2);
88 std::map<std::string, double> results;
89 for (
auto valuePair : featureList)
91 MITK_INFO << valuePair.first <<
" : " << valuePair.second;
92 results[valuePair.first] = valuePair.second;
94 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Image Diagnostics should calculate 30 features.", std::size_t(30), featureList.size());
98 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"SliceWise Mean Neighbourhood Grey Tone Difference::Coarsness with Large IBSI Phantom Image", 0.121, results[
"SliceWise Mean Neighbourhood Grey Tone Difference::Coarsness"], 0.01);
99 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"SliceWise Mean Neighbourhood Grey Tone Difference::Contrast with Large IBSI Phantom Image", 0.925, results[
"SliceWise Mean Neighbourhood Grey Tone Difference::Contrast"], 0.01);
100 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"SliceWise Mean Neighbourhood Grey Tone Difference::Busyness with Large IBSI Phantom Image", 2.99, results[
"SliceWise Mean Neighbourhood Grey Tone Difference::Busyness"], 0.01);
101 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"SliceWise Mean Neighbourhood Grey Tone Difference::Complexity with Large IBSI Phantom Image", 10.4, results[
"SliceWise Mean Neighbourhood Grey Tone Difference::Complexity"], 0.1);
102 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"SliceWise Mean Neighbourhood Grey Tone Difference::Strength with Large IBSI Phantom Image", 2.88, results[
"SliceWise Mean Neighbourhood Grey Tone Difference::Strength"], 0.01);
MITK_TEST_SUITE_REGISTRATION(mitkImageToItk)
#define MITK_TEST(TESTMETHOD)
Adds a test to the current test suite.
static std::string GetTestDataFilePath(const std::string &testData)
Get the absolute path for test data.
Test fixture for parameterized tests.