Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkPointSetVtkMapper2DTransformedPointsTest.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 
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("mitkPointSetVtkMapper2DTransformedPointsTest")
35 
36  mitk::RenderingTestHelper renderingHelper(640, 480, argc, argv);
37 
39 
40  mitk::DataNode *dataNode = renderingHelper.GetDataStorage()->GetNode(mitk::NodePredicateDataType::New("PointSet"));
41 
42  if (dataNode)
43  {
44  mitk::PointSet::Pointer pointSet = dynamic_cast<mitk::PointSet *>(dataNode->GetData());
45 
46  if (pointSet)
47  {
48  mitk::Point3D origin = pointSet->GetGeometry()->GetOrigin();
49 
50  origin[1] += 10;
51  origin[2] += 15;
52 
53  pointSet->GetGeometry()->SetOrigin(origin);
54  pointSet->Modified();
55  dataNode->Update();
56  }
57  }
58 
59  //### Usage of CompareRenderWindowAgainstReference: See docu of mitkRenderingTestHelper
60  MITK_TEST_CONDITION(renderingHelper.CompareRenderWindowAgainstReference(argc, argv) == true,
61  "CompareRenderWindowAgainstReference test result positive?");
62 
63  // use this to generate a reference screenshot or save the file:
64  if (false)
65  {
66  renderingHelper.SaveReferenceScreenShot("D:/test/output.png");
67  }
68 
69  MITK_TEST_END();
70 }
void SetViewDirection(mitk::SliceNavigationController::ViewDirection viewDirection)
Set the view direction of the renderwindow (e.g. sagittal, coronal, axial)
int mitkPointSetVtkMapper2DTransformedPointsTest(int argc, char *argv[])
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
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 ...
Data structure which stores a set of points. Superclass of mitk::Mesh.
Definition: mitkPointSet.h:79
#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()
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66