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

Method TestCase4

Modules/ImageStatistics/Testing/mitkImageStatisticsCalculatorTest.cpp:248–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248void mitkImageStatisticsCalculatorTestSuite::TestCase4()
249{
250 /*****************************
251 * one pixel (white) + 2 half pixels (white) + 1 half pixel (black)
252 * -> mean of 191.25 expected
253 ******************************/
254 MITK_INFO << std::endl << "Test case 4:-----------------------------------------------------------------------------------";
255
256 std::string filename = this->GetTestDataFilePath("ImageStatisticsTestData/testimage.nrrd");
257 m_TestImage = mitk::IOUtil::Load<mitk::Image>(filename);
258 m_Geometry = m_TestImage->GetSlicedGeometry()->GetPlaneGeometry(0);
259
260 mitk::Point2D pnt1; pnt1[0] = 1.1; pnt1[1] = 1.1;
261 mitk::Point2D pnt2; pnt2[0] = 2.0; pnt2[1] = 2.0;
262 mitk::Point2D pnt3; pnt3[0] = 3.0; pnt3[1] = 1.0;
263 mitk::Point2D pnt4; pnt4[0] = 2.0; pnt4[1] = 0.0;
264 std::vector<mitk::Point2D> points{ pnt1,pnt2,pnt3,pnt4 };
265 auto figure = GeneratePlanarPolygon(m_Geometry, points);
266
267 mitk::PlanarFigureMaskGenerator::Pointer planFigMaskGen = mitk::PlanarFigureMaskGenerator::New();
268 planFigMaskGen->SetInputImage(m_TestImage);
269 planFigMaskGen->SetPlanarFigure(figure.GetPointer());
270
271 mitk::ImageStatisticsContainer::Pointer statisticsContainer;
272 CPPUNIT_ASSERT_NO_THROW(statisticsContainer = ComputeStatistics(m_TestImage, planFigMaskGen.GetPointer()));
273 auto statisticsObjectTimestep0 = statisticsContainer->GetStatistics(1, 0);
274
275 this->VerifyStatistics(statisticsObjectTimestep0, 191.25, 127.5, 253.72499847412109);
276}
277
278void mitkImageStatisticsCalculatorTestSuite::TestCase5()
279{

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