26 #include <vtkDoubleArray.h>
27 #include <vtkPointData.h>
28 #include <vtkPolyData.h>
35 CPPUNIT_TEST_SUITE(mitkSurfaceVtkMapper2D3DTestSuite);
43 CPPUNIT_TEST_SUITE_END();
48 std::vector<std::string> m_CommandlineArgs;
49 std::string m_PathToBall;
57 mitkSurfaceVtkMapper2D3DTestSuite() : m_RenderingTestHelper(300, 300) {}
74 m_CommandlineArgs.push_back(
"-V");
83 CPPUNIT_ASSERT(surface);
85 vtkPolyData *polydata = surface->GetVtkPolyData();
86 CPPUNIT_ASSERT(polydata);
90 data_array->Initialize();
91 data_array->SetName(
"Funny LUT entries");
92 data_array->SetNumberOfComponents(1);
93 auto num_points = polydata->GetNumberOfPoints();
94 data_array->SetNumberOfTuples(num_points);
96 for (
unsigned int index = 0; index != num_points; ++index)
100 data_array->SetValue(index, (index / 250) % 5);
103 polydata->GetPointData()->SetScalars(data_array);
114 vtkSmartPointer<vtkLookupTable> vtk_lut = mitk_lut->GetVtkLookupTable();
115 if (vtk_lut ==
nullptr)
118 mitk_lut->SetVtkLookupTable(vtk_lut);
122 vtk_lut->SetTableRange(0, 3);
123 vtk_lut->SetNumberOfTableValues(4);
125 vtk_lut->SetTableValue(0, 1, 0, 0);
126 vtk_lut->SetTableValue(1, 0, 1, 0);
127 vtk_lut->SetTableValue(2, 0, 0, 1);
128 vtk_lut->SetTableValue(3, 1, 1, 0);
137 PrepareSurfaceRenderingWithLUT(*node);
141 m_CommandlineArgs.push_back(
GetTestDataFilePath(
"RenderingTestData/ReferenceScreenshots/ballLUT2D_300x300.png"));
152 PrepareSurfaceRenderingWithLUT(*node);
156 m_CommandlineArgs.push_back(
GetTestDataFilePath(
"RenderingTestData/ReferenceScreenshots/ballLUT3D_300x300.png"));
Class for storing surfaces (vtkPolyData).
void SetViewDirection(mitk::SliceNavigationController::ViewDirection viewDirection)
Set the view direction of the renderwindow (e.g. sagittal, coronal, axial)
MITK_TEST_SUITE_REGISTRATION(mitkImageToItk)
#define MITK_TEST(TESTMETHOD)
Adds a test to the current test suite.
void SetMapperIDToRender3D()
SetMapperIDToRender3D Convenience method to render in a 3D renderwindow.
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
static std::string GetTestDataFilePath(const std::string &testData)
Get the absolute path for test data.
bool CompareRenderWindowAgainstReference(int argc, char *argv[], double threshold=10.0)
CompareRenderWindowAgainstReference Convenience method to compare the image rendered in the internal ...
void SetFloatProperty(const char *propertyKey, float floatValue, const mitk::BaseRenderer *renderer=nullptr)
Convenience method for setting float properties (instances of FloatProperty)
Test fixture for parameterized tests.
void SetBoolProperty(const char *propertyKey, bool boolValue, const mitk::BaseRenderer *renderer=nullptr)
Convenience method for setting boolean properties (instances of BoolProperty)
The ArgcHelperClass class is a convinience class to convert a vector of strings to the standard c++ a...
static DataStorage::SetOfObjects::Pointer Load(const std::string &path, DataStorage &storage)
Load a file into the given DataStorage.
void SetProperty(const char *propertyKey, BaseProperty *property, const mitk::BaseRenderer *renderer=nullptr)
Set the property (instance of BaseProperty) with key propertyKey in the PropertyList of the renderer ...
void AddNodeToStorage(mitk::DataNode::Pointer node)
AddNodeToStorage Add a node to the datastorage and perform a reinit which is necessary for rendering...
Class for nodes of the DataTree.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.