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

Function TestIsclosed

Modules/ContourModel/Testing/mitkContourModelTest.cpp:187–216  ·  view source on GitHub ↗

Check closeable contour

Source from the content-addressed store, hash-verified

185
186// Check closeable contour
187static void TestIsclosed()
188{
189 mitk::ContourModel::Pointer contour = mitk::ContourModel::New();
190
191 mitk::Point3D p;
192 p[0] = p[1] = p[2] = 0;
193
194 contour->AddVertex(p);
195
196 mitk::Point3D p2;
197 p2[0] = p2[1] = p2[2] = 1;
198
199 contour->AddVertex(p2);
200
201 contour->Close();
202
203 MITK_TEST_CONDITION(contour->IsClosed(), "closed contour");
204
205 // no vertices should be added to a closed contour
206 int oldNumberOfVertices = contour->GetNumberOfVertices();
207
208 mitk::Point3D p3;
209 p3[0] = p3[1] = p3[2] = 4;
210
211 contour->AddVertex(p3);
212
213 int newNumberOfVertices = contour->GetNumberOfVertices();
214
215 MITK_TEST_CONDITION(oldNumberOfVertices != newNumberOfVertices, "vertices added to closed contour");
216}
217
218// Test concatenating two contours
219static void TestConcatenate()

Callers 1

mitkContourModelTestFunction · 0.85

Calls 5

GetNumberOfVerticesMethod · 0.80
NewFunction · 0.50
AddVertexMethod · 0.45
CloseMethod · 0.45
IsClosedMethod · 0.45

Tested by

no test coverage detected