| 291 | } |
| 292 | |
| 293 | int testGeometry3D(bool imageGeometry) |
| 294 | { |
| 295 | // Build up a new image Geometry |
| 296 | mitk::Geometry3D::Pointer geometry3d = mitk::Geometry3D::New(); |
| 297 | float bounds[] = {-10.0, 17.0, -12.0, 188.0, 13.0, 211.0}; |
| 298 | |
| 299 | MITK_TEST_OUTPUT(<< "Initializing"); |
| 300 | geometry3d->Initialize(); |
| 301 | |
| 302 | MITK_TEST_OUTPUT(<< "Setting ImageGeometry to " << imageGeometry); |
| 303 | geometry3d->SetImageGeometry(imageGeometry); |
| 304 | |
| 305 | MITK_TEST_OUTPUT(<< "Setting bounds by SetFloatBounds(): " << bounds); |
| 306 | geometry3d->SetFloatBounds(bounds); |
| 307 | |
| 308 | MITK_TEST_OUTPUT(<< "Testing AxisVectors"); |
| 309 | if (testGetAxisVectorVariants(geometry3d) == false) |
| 310 | return EXIT_FAILURE; |
| 311 | |
| 312 | if (testGetAxisVectorExtent(geometry3d) == false) |
| 313 | return EXIT_FAILURE; |
| 314 | |
| 315 | MITK_TEST_OUTPUT(<< "Creating an AffineTransform3D transform"); |
| 316 | mitk::AffineTransform3D::MatrixType matrix; |
| 317 | matrix.SetIdentity(); |
| 318 | matrix(1, 1) = 2; |
| 319 | mitk::AffineTransform3D::Pointer transform; |
| 320 | transform = mitk::AffineTransform3D::New(); |
| 321 | transform->SetMatrix(matrix); |
| 322 | |
| 323 | MITK_TEST_OUTPUT(<< "Testing a SetIndexToWorldTransform"); |
| 324 | geometry3d->SetIndexToWorldTransform(transform); |
| 325 | |
| 326 | MITK_TEST_OUTPUT(<< "Testing correctness of value returned by GetSpacing"); |
| 327 | const mitk::Vector3D &spacing1 = geometry3d->GetSpacing(); |
| 328 | mitk::Vector3D expectedSpacing; |
| 329 | expectedSpacing.Fill(1.0); |
| 330 | expectedSpacing[1] = 2; |
| 331 | if (mitk::Equal(spacing1, expectedSpacing) == false) |
| 332 | { |
| 333 | MITK_TEST_OUTPUT(<< " [FAILED]"); |
| 334 | return EXIT_FAILURE; |
| 335 | } |
| 336 | |
| 337 | MITK_TEST_OUTPUT(<< "Testing a Compose(transform)"); |
| 338 | geometry3d->Compose(transform); |
| 339 | |
| 340 | MITK_TEST_OUTPUT(<< "Testing correctness of value returned by GetSpacing"); |
| 341 | const mitk::Vector3D &spacing2 = geometry3d->GetSpacing(); |
| 342 | expectedSpacing[1] = 4; |
| 343 | if (mitk::Equal(spacing2, expectedSpacing) == false) |
| 344 | { |
| 345 | MITK_TEST_OUTPUT(<< " [FAILED]"); |
| 346 | return EXIT_FAILURE; |
| 347 | } |
| 348 | |
| 349 | MITK_TEST_OUTPUT(<< "Testing correctness of SetSpacing"); |
| 350 | mitk::Vector3D newspacing; |
no test coverage detected