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

Function testGetPlanePosition

Modules/Core/test/mitkPlanePositionManagerTest.cpp:151–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151int testGetPlanePosition()
152{
153 bool error(true);
154
155 MITK_TEST_OUTPUT(<< "Starting Test: ######### G e t P l a n e P o s i t i o n #########");
156
157 // Testing for existing planepositions
158 for (unsigned int i = 0; i < m_Geometries.size(); ++i)
159 {
160 auto plane = m_Geometries.at(i);
161 auto op = m_Service->GetPlanePosition(i);
162 error =
163 (!mitk::Equal(op->GetHeight(), plane->GetExtent(1)) || !mitk::Equal(op->GetWidth(), plane->GetExtent(0)) ||
164 !mitk::Equal(op->GetSpacing(), plane->GetSpacing()) ||
165 !mitk::Equal(op->GetTransform()->GetOffset(), plane->GetIndexToWorldTransform()->GetOffset()) ||
166 !mitk::Equal(op->GetDirectionVector().GetVnlVector(),
167 plane->GetIndexToWorldTransform()->GetMatrix().GetVnlMatrix().get_column(2).normalize().as_ref()) ||
168 !mitk::MatrixEqualElementWise(op->GetTransform()->GetMatrix(), plane->GetIndexToWorldTransform()->GetMatrix()));
169
170 if (error)
171 {
172 MITK_TEST_OUTPUT(<< "Iteration: " << i)
173 MITK_TEST_CONDITION(
174 mitk::Equal(op->GetHeight(), plane->GetExtent(1)) && mitk::Equal(op->GetWidth(), plane->GetExtent(0)),
175 "Checking for correct extent");
176 MITK_TEST_CONDITION(mitk::Equal(op->GetSpacing(), plane->GetSpacing()), "Checking for correct spacing");
177 MITK_TEST_CONDITION(mitk::Equal(op->GetTransform()->GetOffset(), plane->GetIndexToWorldTransform()->GetOffset()),
178 "Checking for correct offset");
179 MITK_INFO << "Op: " << op->GetDirectionVector()
180 << " plane: " << plane->GetIndexToWorldTransform()->GetMatrix().GetVnlMatrix().get_column(2) << "\n";
181 MITK_TEST_CONDITION(mitk::Equal(op->GetDirectionVector().GetVnlVector(),
182 plane->GetIndexToWorldTransform()->GetMatrix().GetVnlMatrix().get_column(2).as_ref()),
183 "Checking for correct direction");
184 MITK_TEST_CONDITION(
185 mitk::MatrixEqualElementWise(op->GetTransform()->GetMatrix(), plane->GetIndexToWorldTransform()->GetMatrix()),
186 "Checking for correct matrix");
187 return EXIT_FAILURE;
188 }
189 }
190
191 // Testing for not existing planepositions
192 error = (m_Service->GetPlanePosition(100000000) != nullptr || m_Service->GetPlanePosition(-1) != nullptr);
193
194 if (error)
195 {
196 MITK_TEST_CONDITION(m_Service->GetPlanePosition(100000000) == nullptr, "Trying to get non existing pos");
197 MITK_TEST_CONDITION(m_Service->GetPlanePosition(-1) == nullptr, "Trying to get non existing pos");
198 return EXIT_FAILURE;
199 }
200
201 return EXIT_SUCCESS;
202}
203
204int testRemovePlanePosition()
205{

Callers 1

Calls 15

MatrixEqualElementWiseFunction · 0.85
atMethod · 0.80
GetPlanePositionMethod · 0.80
GetWidthMethod · 0.80
GetOffsetMethod · 0.80
GetTransformMethod · 0.80
GetDirectionVectorMethod · 0.80
GetVnlMatrixMethod · 0.80
GetMatrixMethod · 0.80
EqualFunction · 0.50
sizeMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected