Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkSurfaceDepthSortingTest.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 mitkSurfaceDepthSortingTest(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("mitkRenderingDepthSortingTest")
34 
35  mitk::RenderingTestHelper renderingHelper(640, 480, argc, argv);
36 
37  renderingHelper.SetMapperIDToRender3D();
38 
39  mitk::DataNode *dataNode = renderingHelper.GetDataStorage()->GetNode(mitk::NodePredicateDataType::New("Surface"));
40 
41  if (dataNode)
42  {
43  dataNode->SetOpacity(0.8);
44  dataNode->SetBoolProperty("Depth Sorting", true);
45  dataNode->Update();
46  }
47 
48  //### Usage of CompareRenderWindowAgainstReference: See docu of mitkRrenderingTestHelper
49  MITK_TEST_CONDITION(renderingHelper.CompareRenderWindowAgainstReference(argc, argv) == true,
50  "CompareRenderWindowAgainstReference test result positive?");
51 
52  MITK_TEST_END();
53 }
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)
mitk::DataStorage::Pointer GetDataStorage()
Returns the datastorage, in order to modify the data inside a rendering test.
void SetBoolProperty(const char *propertyKey, bool boolValue, const mitk::BaseRenderer *renderer=nullptr)
Convenience method for setting boolean properties (instances of BoolProperty)
static Pointer New(const char *_arg)
int mitkSurfaceDepthSortingTest(int argc, char *argv[])
and MITK_TEST_END()
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66