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

Function SetUpBeforeTest

Modules/Core/test/mitkPlanePositionManagerTest.cpp:35–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33mitk::PlanePositionManagerService *m_Service;
34
35int SetUpBeforeTest()
36{
37 // Getting Service
38 us::ServiceReference<mitk::PlanePositionManagerService> serviceRef =
39 us::GetModuleContext()->GetServiceReference<mitk::PlanePositionManagerService>();
40 m_Service = us::GetModuleContext()->GetService(serviceRef);
41
42 if (m_Service == nullptr)
43 return EXIT_FAILURE;
44
45 // Creating different Geometries
46 m_Geometries.reserve(100);
47 mitk::AnatomicalPlane views[] = {
48 mitk::AnatomicalPlane::Axial, mitk::AnatomicalPlane::Sagittal, mitk::AnatomicalPlane::Coronal};
49 for (unsigned int i = 0; i < 100; ++i)
50 {
51 mitk::PlaneGeometry::Pointer plane = mitk::PlaneGeometry::New();
52
53 mitk::ScalarType width = 256 + (0.01 * i);
54 mitk::ScalarType height = 256 + (0.002 * i);
55
56 mitk::Vector3D right;
57 mitk::Vector3D down;
58 right[0] = 1;
59 right[1] = i;
60 right[2] = 0.5;
61 down[0] = i * 0.02;
62 down[1] = 1;
63 down[2] = i * 0.03;
64
65 mitk::Vector3D spacing;
66 mitk::FillVector3D(spacing, 1.0 * 0.02 * i, 1.0 * 0.15 * i, 1.0);
67
68 mitk::Vector3D rightVector;
69 mitk::FillVector3D(rightVector, 0.02 * (i + 1), 0 + (0.05 * i), 1.0);
70
71 mitk::Vector3D downVector;
72 mitk::FillVector3D(downVector, 1, 3 - 0.01 * i, 0.0345 * i);
73
74 vnl_vector<mitk::ScalarType> normal = vnl_cross_3d(rightVector.GetVnlVector(), downVector.GetVnlVector());
75 normal.normalize();
76 normal *= 1.5;
77
78 mitk::Vector3D origin;
79 origin.Fill(1);
80 origin[0] = 12 + 0.03 * i;
81
82 mitk::AffineTransform3D::Pointer transform = mitk::AffineTransform3D::New();
83 mitk::Matrix3D matrix;
84 matrix.GetVnlMatrix().set_column(0, rightVector.GetVnlVector());
85 matrix.GetVnlMatrix().set_column(1, downVector.GetVnlVector());
86 matrix.GetVnlMatrix().set_column(2, normal);
87 transform->SetMatrix(matrix);
88 transform->SetOffset(origin);
89
90 plane->InitializeStandardPlane(width, height, transform, views[i % 3], i, true, false);
91
92 m_Geometries.push_back(plane);

Callers 1

Calls 8

GetModuleContextFunction · 0.85
FillVector3DFunction · 0.85
GetVnlMatrixMethod · 0.80
SetMatrixMethod · 0.80
NewFunction · 0.50
GetServiceMethod · 0.45
FillMethod · 0.45

Tested by

no test coverage detected