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

Method TestCase2

Modules/ImageStatistics/Testing/mitkImageStatisticsCalculatorTest.cpp:189–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187}
188
189void mitkImageStatisticsCalculatorTestSuite::TestCase2()
190{
191 /*****************************
192 * half pixel in x-direction (white)
193 * -> mean of 255 expected
194 ******************************/
195 MITK_INFO << std::endl << "Test case 2:-----------------------------------------------------------------------------------";
196
197 std::string filename = this->GetTestDataFilePath("ImageStatisticsTestData/testimage.nrrd");
198 m_TestImage = mitk::IOUtil::Load<mitk::Image>(filename);
199 m_Geometry = m_TestImage->GetSlicedGeometry()->GetPlaneGeometry(0);
200
201 mitk::Point2D pnt1; pnt1[0] = 10.0; pnt1[1] = 3.5;
202 mitk::Point2D pnt2; pnt2[0] = 9.5; pnt2[1] = 3.5;
203 mitk::Point2D pnt3; pnt3[0] = 9.5; pnt3[1] = 4.5;
204 mitk::Point2D pnt4; pnt4[0] = 10.0; pnt4[1] = 4.5;
205 std::vector<mitk::Point2D> points{ pnt1,pnt2,pnt3,pnt4 };
206 auto figure = GeneratePlanarPolygon(m_Geometry, points);
207
208 mitk::PlanarFigureMaskGenerator::Pointer planFigMaskGen = mitk::PlanarFigureMaskGenerator::New();
209 planFigMaskGen->SetInputImage(m_TestImage);
210 planFigMaskGen->SetPlanarFigure(figure.GetPointer());
211
212 mitk::ImageStatisticsContainer::Pointer statisticsContainer;
213 CPPUNIT_ASSERT_NO_THROW(statisticsContainer = ComputeStatistics(m_TestImage, planFigMaskGen.GetPointer()));
214 auto statisticsObjectTimestep0 = statisticsContainer->GetStatistics(1,0);
215
216 this->VerifyStatistics(statisticsObjectTimestep0, 255.0, 0.0, 255.0);
217}
218
219void mitkImageStatisticsCalculatorTestSuite::TestCase3()
220{

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