MCPcopy Create free account
hub / github.com/MITK/MITK / TestCase10

Method TestCase10

Modules/ImageStatistics/Testing/mitkImageStatisticsCalculatorTest.cpp:428–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

426}
427
428void mitkImageStatisticsCalculatorTestSuite::TestCase10()
429{
430 /*****************************
431 * 2 whole pixel (white) + 2 whole pixel (black) in y-direction
432 * -> mean of 127.66 expected
433 ******************************/
434 MITK_INFO << std::endl << "Test case 10:-----------------------------------------------------------------------------------";
435
436 std::string filename = this->GetTestDataFilePath("ImageStatisticsTestData/testimage.nrrd");
437 m_TestImage = mitk::IOUtil::Load<mitk::Image>(filename);
438 m_Geometry = m_TestImage->GetSlicedGeometry()->GetPlaneGeometry(0);
439
440 mitk::Point2D pnt1; pnt1[0] = 11.5; pnt1[1] = 10.5;
441 mitk::Point2D pnt2; pnt2[0] = 11.5; pnt2[1] = 13.5;
442 mitk::Point2D pnt3; pnt3[0] = 12.5; pnt3[1] = 13.5;
443 mitk::Point2D pnt4; pnt4[0] = 12.5; pnt4[1] = 10.5;
444 std::vector<mitk::Point2D> points{ pnt1,pnt2,pnt3,pnt4 };
445 auto figure = GeneratePlanarPolygon(m_Geometry, points);
446
447 mitk::PlanarFigureMaskGenerator::Pointer planFigMaskGen = mitk::PlanarFigureMaskGenerator::New();
448 planFigMaskGen->SetInputImage(m_TestImage);
449 planFigMaskGen->SetPlanarFigure(figure.GetPointer());
450
451 mitk::ImageStatisticsContainer::Pointer statisticsContainer;
452 CPPUNIT_ASSERT_NO_THROW(statisticsContainer = ComputeStatistics(m_TestImage, planFigMaskGen.GetPointer()));
453 auto statisticsObjectTimestep0 = statisticsContainer->GetStatistics(1, 0);
454
455 this->VerifyStatistics(statisticsObjectTimestep0, 127.666666666666667, 127.50032679696680, 128.7750015258789);
456}
457
458void mitkImageStatisticsCalculatorTestSuite::TestCase11()
459{

Callers

nothing calls this directly

Calls 9

VerifyStatisticsMethod · 0.95
GetTestDataFilePathMethod · 0.80
GetSlicedGeometryMethod · 0.80
SetInputImageMethod · 0.80
SetPlanarFigureMethod · 0.80
GetPointerMethod · 0.80
GetStatisticsMethod · 0.80
NewFunction · 0.50
GetPlaneGeometryMethod · 0.45

Tested by

no test coverage detected