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

Method TestCase11

Modules/ImageStatistics/Testing/mitkImageStatisticsCalculatorTest.cpp:458–486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

456}
457
458void mitkImageStatisticsCalculatorTestSuite::TestCase11()
459{
460 /*****************************
461 * 9 whole pixels (white) + 3 half pixels (white)
462 * + 3 whole pixel (black) [ + 3 slightly less than half pixels (black)]
463 * -> mean of 204.0 expected
464 ******************************/
465 MITK_INFO << std::endl << "Test case 11:-----------------------------------------------------------------------------------";
466 std::string filename = this->GetTestDataFilePath("ImageStatisticsTestData/testimage.nrrd");
467 m_TestImage = mitk::IOUtil::Load<mitk::Image>(filename);
468 m_Geometry = m_TestImage->GetSlicedGeometry()->GetPlaneGeometry(0);
469
470 mitk::Point2D pnt1; pnt1[0] = 0.5; pnt1[1] = 0.5;
471 mitk::Point2D pnt2; pnt2[0] = 3.5; pnt2[1] = 3.5;
472 mitk::Point2D pnt3; pnt3[0] = 8.4999; pnt3[1] = 3.5;
473 mitk::Point2D pnt4; pnt4[0] = 5.4999; pnt4[1] = 0.5;
474 std::vector<mitk::Point2D> points{ pnt1,pnt2,pnt3,pnt4 };
475 auto figure = GeneratePlanarPolygon(m_Geometry, points);
476
477 mitk::PlanarFigureMaskGenerator::Pointer planFigMaskGen = mitk::PlanarFigureMaskGenerator::New();
478 planFigMaskGen->SetInputImage(m_TestImage);
479 planFigMaskGen->SetPlanarFigure(figure.GetPointer());
480
481 mitk::ImageStatisticsContainer::Pointer statisticsContainer;
482 CPPUNIT_ASSERT_NO_THROW(statisticsContainer = ComputeStatistics(m_TestImage, planFigMaskGen.GetPointer()));
483 auto statisticsObjectTimestep0 = statisticsContainer->GetStatistics(1, 0);
484
485 this->VerifyStatistics(statisticsObjectTimestep0, 204.0, 105.58003057938019, 253.724998474121083);
486}
487
488void mitkImageStatisticsCalculatorTestSuite::TestCase12()
489{

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