Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 // MITK
19 #include "mitkTestingMacros.h"
20 #include <mitkBaseProperty.h>
23 #include <mitkPointSet.h>
24 
25 // VTK
26 #include <vtkRegressionTestImage.h>
27 
28 int mitkPointSetVtkMapper2DGlyphTypeTest(int argc, char *argv[])
29 {
30  // load all arguments into a datastorage, take last argument as reference rendering
31  // setup a renderwindow of fixed size X*Y
32  // render the datastorage
33  // compare rendering to reference image
34  MITK_TEST_BEGIN("mitkPointSetVtkMapper2DGlyphTypeTest")
35 
36  mitk::RenderingTestHelper renderingHelper(640, 480, argc, argv);
37 
39 
41  dynamic_cast<mitk::EnumerationProperty *>(renderingHelper.GetDataStorage()
42  ->GetNode(mitk::NodePredicateDataType::New("PointSet"))
43  ->GetProperty("Pointset.2D.shape"));
44  // render triangles instead of crosses
45  eP->SetValue(5);
46 
47  // disables anti-aliasing which is enabled on several graphics cards and
48  // causes problems when doing a pixel-wise comparison to a reference image
49  renderingHelper.GetVtkRenderWindow()->SetMultiSamples(0);
50 
51  //### Usage of CompareRenderWindowAgainstReference: See docu of mitkRrenderingTestHelper
52  MITK_TEST_CONDITION(renderingHelper.CompareRenderWindowAgainstReference(argc, argv) == true,
53  "CompareRenderWindowAgainstReference test result positive?");
54 
55  // use this to generate a reference screenshot or save the file:
56  if (false)
57  {
58  renderingHelper.SaveReferenceScreenShot("C:/development_ITK4/output.png");
59  }
60 
61  MITK_TEST_END();
62 }
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_TEST_CONDITION(COND, MSG)
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()