Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkImageVtkMapper2DColorTest.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 // MITK
15 #include "mitkTestingMacros.h"
16 
17 // VTK
18 #include <vtkRegressionTestImage.h>
19 
20 int mitkImageVtkMapper2DColorTest(int argc, char *argv[])
21 {
22  try
23  {
24  mitk::RenderingTestHelper openGlTest(640, 480);
25  }
26  catch (const mitk::TestNotRunException &e)
27  {
28  MITK_WARN << "Test not run: " << e.GetDescription();
29  return 77;
30  }
31  // load all arguments into a datastorage, take last argument as reference rendering
32  // setup a renderwindow of fixed size X*Y
33  // render the datastorage
34  // compare rendering to reference image
35  MITK_TEST_BEGIN("mitkImageVtkMapper2DTest")
36 
37  mitk::RenderingTestHelper renderingHelper(640, 480, argc, argv);
38  // Set the opacity for all images
39  renderingHelper.SetImageProperty("color", mitk::ColorProperty::New(0.0f, 0.0f, 255.0f));
40  // for now this test renders in sagittal view direction
42 
43  //### Usage of CompareRenderWindowAgainstReference: See docu of mitkRrenderingTestHelper
44  MITK_TEST_CONDITION(renderingHelper.CompareRenderWindowAgainstReference(argc, argv) == true,
45  "CompareRenderWindowAgainstReference test result positive?");
46 
47  //####################
48  // Use this to generate a reference screenshot or save the file.
49  //(Only in your local version of the test!)
50  if (false)
51  {
52  renderingHelper.SaveReferenceScreenShot("/home/kilgus/Pictures/RenderingTestData/output.png");
53  }
54  //####################
55 
56  MITK_TEST_END();
57 }
void SetViewDirection(mitk::SliceNavigationController::ViewDirection viewDirection)
Set the view direction of the renderwindow (e.g. sagittal, coronal, axial)
int mitkImageVtkMapper2DColorTest(int argc, char *argv[])
static Pointer New()
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
void SaveReferenceScreenShot(std::string fileName)
SaveReferenceScreenShot Convenience method to save a reference screen shot.
bool CompareRenderWindowAgainstReference(int argc, char *argv[], double threshold=10.0)
CompareRenderWindowAgainstReference Convenience method to compare the image rendered in the internal ...
void SetImageProperty(const char *propertyKey, mitk::BaseProperty *property)
This method set the property of the member datastorage.
#define MITK_WARN
Definition: mitkLogMacros.h:19
#define MITK_TEST_CONDITION(COND, MSG)
Specialized mitk::Exception for skipped tests.
and MITK_TEST_END()