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

Method TestCase7

Modules/ImageStatistics/Testing/mitkImageStatisticsCalculatorTest.cpp:338–366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

336}
337
338void mitkImageStatisticsCalculatorTestSuite::TestCase7()
339{
340 /*****************************
341 * half pixel (black) + whole pixel (white) + half pixel (gray) in x-direction
342 * -> mean of 127.66 expected
343 ******************************/
344 MITK_INFO << std::endl << "Test case 7:-----------------------------------------------------------------------------------";
345
346 std::string filename = this->GetTestDataFilePath("ImageStatisticsTestData/testimage.nrrd");
347 m_TestImage = mitk::IOUtil::Load<mitk::Image>(filename);
348 m_Geometry = m_TestImage->GetSlicedGeometry()->GetPlaneGeometry(0);
349
350 mitk::Point2D pnt1; pnt1[0] = 11.0; pnt1[1] = 3.5;
351 mitk::Point2D pnt2; pnt2[0] = 9.0; pnt2[1] = 3.5;
352 mitk::Point2D pnt3; pnt3[0] = 9.0; pnt3[1] = 4.0;
353 mitk::Point2D pnt4; pnt4[0] = 11.0; pnt4[1] = 4.0;
354 std::vector<mitk::Point2D> points{ pnt1,pnt2,pnt3,pnt4 };
355 auto figure = GeneratePlanarPolygon(m_Geometry, points);
356
357 mitk::PlanarFigureMaskGenerator::Pointer planFigMaskGen = mitk::PlanarFigureMaskGenerator::New();
358 planFigMaskGen->SetInputImage(m_TestImage);
359 planFigMaskGen->SetPlanarFigure(figure.GetPointer());
360
361 mitk::ImageStatisticsContainer::Pointer statisticsContainer;
362 CPPUNIT_ASSERT_NO_THROW(statisticsContainer = ComputeStatistics(m_TestImage, planFigMaskGen.GetPointer()));
363 auto statisticsObjectTimestep0 = statisticsContainer->GetStatistics(1, 0);
364
365 this->VerifyStatistics(statisticsObjectTimestep0, 127.666666666666667, 127.50032679696680, 128.7750015258789);
366}
367
368void mitkImageStatisticsCalculatorTestSuite::TestCase8()
369{

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