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

Method TestCase12

Modules/ImageStatistics/Testing/mitkImageStatisticsCalculatorTest.cpp:488–515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

486}
487
488void mitkImageStatisticsCalculatorTestSuite::TestCase12()
489{
490 /*****************************
491 * half pixel (white) + whole pixel (white) + half pixel (black)
492 * -> mean of 212.66 expected
493 ******************************/
494 MITK_INFO << std::endl << "Test case 12:-----------------------------------------------------------------------------------";
495
496 std::string filename = this->GetTestDataFilePath("ImageStatisticsTestData/testimage.nrrd");
497 m_TestImage = mitk::IOUtil::Load<mitk::Image>(filename);
498 m_Geometry = m_TestImage->GetSlicedGeometry()->GetPlaneGeometry(0);
499
500 mitk::Point2D pnt1; pnt1[0] = 9.5; pnt1[1] = 0.5;
501 mitk::Point2D pnt2; pnt2[0] = 9.5; pnt2[1] = 2.5;
502 mitk::Point2D pnt3; pnt3[0] = 11.5; pnt3[1] = 2.5;
503 std::vector<mitk::Point2D> points{ pnt1,pnt2,pnt3 };
504 auto figure = GeneratePlanarPolygon(m_Geometry, points);
505
506 mitk::PlanarFigureMaskGenerator::Pointer planFigMaskGen = mitk::PlanarFigureMaskGenerator::New();
507 planFigMaskGen->SetInputImage(m_TestImage);
508 planFigMaskGen->SetPlanarFigure(figure.GetPointer());
509
510 mitk::ImageStatisticsContainer::Pointer statisticsContainer;
511 CPPUNIT_ASSERT_NO_THROW(statisticsContainer = ComputeStatistics(m_TestImage, planFigMaskGen.GetPointer()));
512 auto statisticsObjectTimestep0 = statisticsContainer->GetStatistics(1, 0);
513
514 this->VerifyStatistics(statisticsObjectTimestep0, 212.666666666666667, 73.323484187082443, 254.36499786376954);
515}
516
517// T26098 histogram statistics need to be tested (median, uniformity, UPP, entropy)
518void mitkImageStatisticsCalculatorTestSuite::TestPic3DCroppedNoMask()

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