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

Method TestCase6

Modules/ImageStatistics/Testing/mitkImageStatisticsCalculatorTest.cpp:308–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306}
307
308void mitkImageStatisticsCalculatorTestSuite::TestCase6()
309{
310 /*****************************
311 * quarter pixel (black) + whole pixel (white) + half pixel (gray) in x-direction
312 * -> mean of 191.5 expected
313 ******************************/
314 MITK_INFO << std::endl << "Test case 6:-----------------------------------------------------------------------------------";
315
316 std::string filename = this->GetTestDataFilePath("ImageStatisticsTestData/testimage.nrrd");
317 m_TestImage = mitk::IOUtil::Load<mitk::Image>(filename);
318 m_Geometry = m_TestImage->GetSlicedGeometry()->GetPlaneGeometry(0);
319
320 mitk::Point2D pnt1; pnt1[0] = 11.0; pnt1[1] = 3.5;
321 mitk::Point2D pnt2; pnt2[0] = 9.25; pnt2[1] = 3.5;
322 mitk::Point2D pnt3; pnt3[0] = 9.25; pnt3[1] = 4.5;
323 mitk::Point2D pnt4; pnt4[0] = 11.0; pnt4[1] = 4.5;
324 std::vector<mitk::Point2D> points{ pnt1,pnt2,pnt3,pnt4 };
325 auto figure = GeneratePlanarPolygon(m_Geometry, points);
326
327 mitk::PlanarFigureMaskGenerator::Pointer planFigMaskGen = mitk::PlanarFigureMaskGenerator::New();
328 planFigMaskGen->SetInputImage(m_TestImage);
329 planFigMaskGen->SetPlanarFigure(figure.GetPointer());
330
331 mitk::ImageStatisticsContainer::Pointer statisticsContainer;
332 CPPUNIT_ASSERT_NO_THROW(statisticsContainer = ComputeStatistics(m_TestImage, planFigMaskGen.GetPointer()));
333 auto statisticsObjectTimestep0 = statisticsContainer->GetStatistics(1, 0);
334
335 this->VerifyStatistics(statisticsObjectTimestep0, 191.5, 89.802561210691536, 128.63499999046327);
336}
337
338void mitkImageStatisticsCalculatorTestSuite::TestCase7()
339{

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