22 CPPUNIT_TEST_SUITE(mitkGIFImageDescriptionFeaturesTestSuite );
26 CPPUNIT_TEST_SUITE_END();
36 void setUp(
void)
override 38 m_IBSI_Phantom_Image_Small = mitk::IOUtil::Load<mitk::Image>(
GetTestDataFilePath(
"Radiomics/IBSI_Phantom_Image_Small.nrrd"));
39 m_IBSI_Phantom_Image_Large = mitk::IOUtil::Load<mitk::Image>(
GetTestDataFilePath(
"Radiomics/IBSI_Phantom_Image_Large.nrrd"));
40 m_IBSI_Phantom_Mask_Small = mitk::IOUtil::Load<mitk::Image>(
GetTestDataFilePath(
"Radiomics/IBSI_Phantom_Mask_Small.nrrd"));
41 m_IBSI_Phantom_Mask_Large = mitk::IOUtil::Load<mitk::Image>(
GetTestDataFilePath(
"Radiomics/IBSI_Phantom_Mask_Large.nrrd"));
44 void ImageDescription_PhantomTest()
47 auto featureList = featureCalculator->CalculateFeatures(m_IBSI_Phantom_Image_Large, m_IBSI_Phantom_Mask_Large);
49 std::map<std::string, double> results;
50 for (
auto valuePair : featureList)
52 MITK_INFO << valuePair.first <<
" : " << valuePair.second;
53 results[valuePair.first] = valuePair.second;
55 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Image Diagnostics should calculate 22 features.", std::size_t(22), featureList.size());
59 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Diagnostic::Image Dimension X should be 7 with Large IBSI Phantom Image",
int(7),
int(results[
"Diagnostic::Image Dimension X"]));
60 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Diagnostic::Image Dimension Y should be 6 with Large IBSI Phantom Image",
int(6),
int(results[
"Diagnostic::Image Dimension Y"]));
61 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Diagnostic::Image Dimension Z should be 6 with Large IBSI Phantom Image",
int(6),
int(results[
"Diagnostic::Image Dimension Z"]));
63 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"Diagnostic::Image Spacing X should be 2 with Large IBSI Phantom Image", 2.0, results[
"Diagnostic::Image Spacing X"], 0.0001);
64 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"Diagnostic::Image Spacing Y should be 2 with Large IBSI Phantom Image", 2.0, results[
"Diagnostic::Image Spacing Y"], 0.0001);
65 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"Diagnostic::Image Spacing Z should be 2 with Large IBSI Phantom Image", 2.0, results[
"Diagnostic::Image Spacing Z"], 0.0001);
67 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"Diagnostic::Image Mean intensity should be 0.6865 with Large IBSI Phantom Image", 0.686508, results[
"Diagnostic::Image Mean intensity"], 0.0001);
68 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"Diagnostic::Image Minimum intensity should be 0 with Large IBSI Phantom Image", 0, results[
"Diagnostic::Image Minimum intensity"], 0.0001);
69 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"Diagnostic::Image Maximum intensity should be 9 with Large IBSI Phantom Image", 9, results[
"Diagnostic::Image Maximum intensity"], 0.0001);
71 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Diagnostic::Mask Dimension X should be 7 with Large IBSI Phantom Image",
int(7),
int(results[
"Diagnostic::Mask Dimension X"]));
72 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Diagnostic::Mask Dimension Y should be 6 with Large IBSI Phantom Image",
int(6),
int(results[
"Diagnostic::Mask Dimension Y"]));
73 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Diagnostic::Mask Dimension Z should be 6 with Large IBSI Phantom Image",
int(6),
int(results[
"Diagnostic::Mask Dimension Z"]));
75 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Diagnostic::Mask bounding box X should be 5 with Large IBSI Phantom Image",
int(5),
int(results[
"Diagnostic::Mask bounding box X"]));
76 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Diagnostic::Mask bounding box Y should be 4 with Large IBSI Phantom Image",
int(4),
int(results[
"Diagnostic::Mask bounding box Y"]));
77 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Diagnostic::Mask bounding box Z should be 4 with Large IBSI Phantom Image",
int(4),
int(results[
"Diagnostic::Mask bounding box Z"]));
79 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"Diagnostic::Mask Spacing X should be 2 with Large IBSI Phantom Image", 2.0, results[
"Diagnostic::Mask Spacing X"], 0.0001);
80 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"Diagnostic::Mask Spacing Y should be 2 with Large IBSI Phantom Image", 2.0, results[
"Diagnostic::Mask Spacing Y"], 0.0001);
81 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"Diagnostic::Mask Spacing Z should be 2 with Large IBSI Phantom Image", 2.0, results[
"Diagnostic::Mask Spacing Z"], 0.0001);
83 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Diagnostic::Mask Voxel Count should be 74 with Large IBSI Phantom Image",
int(74),
int(results[
"Diagnostic::Mask Voxel Count"]));
84 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"Diagnostic::Mask Mean intensity should be 2.14865 with Large IBSI Phantom Image", 2.14865, results[
"Diagnostic::Mask Mean intensity"], 0.0001);
85 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"Diagnostic::Mask Minimum intensity should be 1 with Large IBSI Phantom Image", 1, results[
"Diagnostic::Mask Minimum intensity"], 0.0001);
86 CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"Diagnostic::Mask Maximum intensity should be 6 with Large IBSI Phantom Image", 6, results[
"Diagnostic::Mask Maximum intensity"], 0.0001);
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.