Medical Imaging Interaction Toolkit  2018.4.99-4c24e3cb
Medical Imaging Interaction Toolkit
mitkPointSetVtkMapper2DGlyphTypeTest.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 #include <mitkBaseProperty.h>
19 #include <mitkPointSet.h>
20 
21 // VTK
22 #include <vtkRegressionTestImage.h>
23 
24 int mitkPointSetVtkMapper2DGlyphTypeTest(int argc, char *argv[])
25 {
26  try
27  {
28  mitk::RenderingTestHelper openGlTest(640, 480);
29  }
30  catch (const mitk::TestNotRunException &e)
31  {
32  MITK_WARN << "Test not run: " << e.GetDescription();
33  return 77;
34  }
35  // load all arguments into a datastorage, take last argument as reference rendering
36  // setup a renderwindow of fixed size X*Y
37  // render the datastorage
38  // compare rendering to reference image
39  MITK_TEST_BEGIN("mitkPointSetVtkMapper2DGlyphTypeTest")
40 
41  mitk::RenderingTestHelper renderingHelper(640, 480, argc, argv);
42 
44 
46  dynamic_cast<mitk::EnumerationProperty *>(renderingHelper.GetDataStorage()
47  ->GetNode(mitk::NodePredicateDataType::New("PointSet"))
48  ->GetProperty("Pointset.2D.shape"));
49  // render triangles instead of crosses
50  eP->SetValue(5);
51 
52  // disables anti-aliasing which is enabled on several graphics cards and
53  // causes problems when doing a pixel-wise comparison to a reference image
54  renderingHelper.GetVtkRenderWindow()->SetMultiSamples(0);
55 
56  //### Usage of CompareRenderWindowAgainstReference: See docu of mitkRrenderingTestHelper
57  MITK_TEST_CONDITION(renderingHelper.CompareRenderWindowAgainstReference(argc, argv) == true,
58  "CompareRenderWindowAgainstReference test result positive?");
59 
60  // use this to generate a reference screenshot or save the file:
61  if (false)
62  {
63  renderingHelper.SaveReferenceScreenShot("C:/development_ITK4/output.png");
64  }
65 
66  MITK_TEST_END();
67 }
virtual bool SetValue(const std::string &name)
void SetViewDirection(mitk::SliceNavigationController::ViewDirection viewDirection)
Set the view direction of the renderwindow (e.g. sagittal, coronal, axial)
vtkRenderWindow * GetVtkRenderWindow()
Getter for the vtkRenderWindow which should be used to call vtkRegressionTestImage.
int mitkPointSetVtkMapper2DGlyphTypeTest(int argc, char *argv[])
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)
Specialized mitk::Exception for skipped tests.
mitk::DataStorage::Pointer GetDataStorage()
Returns the datastorage, in order to modify the data inside a rendering test.
static Pointer New(const char *_arg)
and MITK_TEST_END()