Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
mitkPointSetVtkMapper2DImageTest.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 mitkPointSetVtkMapper2DImageTest(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("mitkPointSetVtkMapper2DImageTest")
36 
37  mitk::RenderingTestHelper renderingHelper(640, 480, argc, argv);
38 
39  // disables anti-aliasing which is enabled on several graphics cards and
40  // causes problems when doing a pixel-wise comparison to a reference image
41  renderingHelper.GetVtkRenderWindow()->SetMultiSamples(0);
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  // use this to generate a reference screenshot or save the file:
48  if (false)
49  {
50  renderingHelper.SaveReferenceScreenShot("C:/development_ITK4/output.png");
51  }
52 
53  MITK_TEST_END();
54 }
vtkRenderWindow * GetVtkRenderWindow()
Getter for the vtkRenderWindow which should be used to call vtkRegressionTestImage.
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 ...
#define MITK_WARN
Definition: mitkLogMacros.h:19
#define MITK_TEST_CONDITION(COND, MSG)
int mitkPointSetVtkMapper2DImageTest(int argc, char *argv[])
Specialized mitk::Exception for skipped tests.
and MITK_TEST_END()