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

Method TestCase5

Modules/ImageStatistics/Testing/mitkImageStatisticsCalculatorTest.cpp:278–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

276}
277
278void mitkImageStatisticsCalculatorTestSuite::TestCase5()
279{
280 /*****************************
281 * whole pixel (white) + half pixel (gray) in x-direction
282 * -> mean of 191.5 expected
283 ******************************/
284 MITK_INFO << std::endl << "Test case 5:-----------------------------------------------------------------------------------";
285
286 std::string filename = this->GetTestDataFilePath("ImageStatisticsTestData/testimage.nrrd");
287 m_TestImage = mitk::IOUtil::Load<mitk::Image>(filename);
288 m_Geometry = m_TestImage->GetSlicedGeometry()->GetPlaneGeometry(0);
289
290 mitk::Point2D pnt1; pnt1[0] = 11.0; pnt1[1] = 3.5;
291 mitk::Point2D pnt2; pnt2[0] = 9.5; pnt2[1] = 3.5;
292 mitk::Point2D pnt3; pnt3[0] = 9.5; pnt3[1] = 4.5;
293 mitk::Point2D pnt4; pnt4[0] = 11.0; pnt4[1] = 4.5;
294 std::vector<mitk::Point2D> points{ pnt1,pnt2,pnt3,pnt4 };
295 auto figure = GeneratePlanarPolygon(m_Geometry, points);
296
297 mitk::PlanarFigureMaskGenerator::Pointer planFigMaskGen = mitk::PlanarFigureMaskGenerator::New();
298 planFigMaskGen->SetInputImage(m_TestImage);
299 planFigMaskGen->SetPlanarFigure(figure.GetPointer());
300
301 mitk::ImageStatisticsContainer::Pointer statisticsContainer;
302 CPPUNIT_ASSERT_NO_THROW(statisticsContainer = ComputeStatistics(m_TestImage, planFigMaskGen.GetPointer()));
303 auto statisticsObjectTimestep0 = statisticsContainer->GetStatistics(1, 0);
304
305 this->VerifyStatistics(statisticsObjectTimestep0, 191.50, 89.802561210691536, 128.63499999046327);
306}
307
308void mitkImageStatisticsCalculatorTestSuite::TestCase6()
309{

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