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

Method TestCase3

Modules/ImageStatistics/Testing/mitkImageStatisticsCalculatorTest.cpp:219–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217}
218
219void mitkImageStatisticsCalculatorTestSuite::TestCase3()
220{
221 /*****************************
222 * half pixel in diagonal-direction (white)
223 * -> mean of 255 expected
224 ******************************/
225 MITK_INFO << std::endl << "Test case 3:-----------------------------------------------------------------------------------";
226
227 std::string filename = this->GetTestDataFilePath("ImageStatisticsTestData/testimage.nrrd");
228 m_TestImage = mitk::IOUtil::Load<mitk::Image>(filename);
229 m_Geometry = m_TestImage->GetSlicedGeometry()->GetPlaneGeometry(0);
230
231 mitk::Point2D pnt1; pnt1[0] = 10.5; pnt1[1] = 3.5;
232 mitk::Point2D pnt2; pnt2[0] = 9.5; pnt2[1] = 3.5;
233 mitk::Point2D pnt3; pnt3[0] = 9.5; pnt3[1] = 4.5;
234 std::vector<mitk::Point2D> points{ pnt1,pnt2,pnt3 };
235 auto figure = GeneratePlanarPolygon(m_Geometry, points);
236
237 mitk::PlanarFigureMaskGenerator::Pointer planFigMaskGen = mitk::PlanarFigureMaskGenerator::New();
238 planFigMaskGen->SetInputImage(m_TestImage);
239 planFigMaskGen->SetPlanarFigure(figure.GetPointer());
240
241 mitk::ImageStatisticsContainer::Pointer statisticsContainer;
242 CPPUNIT_ASSERT_NO_THROW(statisticsContainer = ComputeStatistics(m_TestImage, planFigMaskGen.GetPointer()));
243 auto statisticsObjectTimestep0 = statisticsContainer->GetStatistics(1, 0);
244
245 this->VerifyStatistics(statisticsObjectTimestep0, 255.0, 0.0, 255.0);
246}
247
248void mitkImageStatisticsCalculatorTestSuite::TestCase4()
249{

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