Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkSurfaceDepthPeelingTest.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>
22 #include <mitkSurface.h>
23 
24 // VTK
25 #include <vtkRegressionTestImage.h>
26 
27 int mitkSurfaceDepthPeelingTest(int argc, char *argv[])
28 {
29  // load all arguments into a datastorage, take last argument as reference rendering
30  // setup a renderwindow of fixed size X*Y
31  // render the datastorage
32  // compare rendering to reference image
33  MITK_TEST_BEGIN("mitkRenderingDepthPeelingTest")
34 
36 
37  if (renderingHelper.IsAdvancedOpenGL())
38  {
39  renderingHelper.SetMapperIDToRender3D();
40 
41  mitk::DataNode *dataNode = renderingHelper.GetDataStorage()->GetNode(mitk::NodePredicateDataType::New("Surface"));
42 
43  if (dataNode)
44  {
45  dataNode->SetOpacity(0.8);
46  dataNode->Update();
47  }
48 
49  //### Usage of CompareRenderWindowAgainstReference: See docu of mitkRrenderingTestHelper
50  MITK_TEST_CONDITION(renderingHelper.CompareRenderWindowAgainstReference(argc, argv) == true,
51  "CompareRenderWindowAgainstReference test result positive?");
52  }
53 
54  MITK_TEST_END();
55 }
bool IsAdvancedOpenGL()
Returns true if the opengl context is compatible for advanced vtk effects.
void SetMapperIDToRender3D()
SetMapperIDToRender3D Convenience method to render in a 3D renderwindow.
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
bool CompareRenderWindowAgainstReference(int argc, char *argv[], double threshold=10.0)
CompareRenderWindowAgainstReference Convenience method to compare the image rendered in the internal ...
void SetOpacity(float opacity, const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="opacity")
Convenience method for setting opacity properties (instances of FloatProperty)
#define MITK_TEST_CONDITION(COND, MSG)
int mitkSurfaceDepthPeelingTest(int argc, char *argv[])
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()
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66