22 #include <vtkDoubleArray.h> 23 #include <vtkPointData.h> 24 #include <vtkPolyData.h> 31 CPPUNIT_TEST_SUITE(mitkSurfaceVtkMapper2D3DTestSuite);
34 CPPUNIT_TEST_SUITE_END();
39 std::vector<std::string> m_CommandlineArgs;
40 std::string m_PathToBall;
48 mitkSurfaceVtkMapper2D3DTestSuite() : m_RenderingTestHelper(300, 300) {}
65 m_CommandlineArgs.push_back(
"-V");
74 CPPUNIT_ASSERT(surface);
76 vtkPolyData *polydata = surface->GetVtkPolyData();
77 CPPUNIT_ASSERT(polydata);
80 vtkSmartPointer<vtkDoubleArray> data_array = vtkSmartPointer<vtkDoubleArray>::New();
81 data_array->Initialize();
82 data_array->SetName(
"Funny LUT entries");
83 data_array->SetNumberOfComponents(1);
84 auto num_points = polydata->GetNumberOfPoints();
85 data_array->SetNumberOfTuples(num_points);
87 for (
unsigned int index = 0; index != num_points; ++index)
91 data_array->SetValue(index, (index / 250) % 5);
94 polydata->GetPointData()->SetScalars(data_array);
105 vtkSmartPointer<vtkLookupTable> vtk_lut = mitk_lut->GetVtkLookupTable();
106 if (vtk_lut ==
nullptr)
108 vtk_lut = vtkSmartPointer<vtkLookupTable>::New();
109 mitk_lut->SetVtkLookupTable(vtk_lut);
113 vtk_lut->SetTableRange(0, 3);
114 vtk_lut->SetNumberOfTableValues(4);
116 vtk_lut->SetTableValue(0, 1, 0, 0);
117 vtk_lut->SetTableValue(1, 0, 1, 0);
118 vtk_lut->SetTableValue(2, 0, 0, 1);
119 vtk_lut->SetTableValue(3, 1, 1, 0);
128 PrepareSurfaceRenderingWithLUT(*node);
132 m_CommandlineArgs.push_back(
GetTestDataFilePath(
"RenderingTestData/ReferenceScreenshots/ballLUT2D_300x300.png"));
143 PrepareSurfaceRenderingWithLUT(*node);
147 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.
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 SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Add new or change existent property.
void SetFloatProperty(const char *propertyKey, float floatValue, const mitk::BaseRenderer *renderer=nullptr)
Convenience method for setting float properties (instances of FloatProperty)
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
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...
void AddNodeToStorage(mitk::DataNode::Pointer node)
AddNodeToStorage Add a node to the datastorage and perform a reinit which is necessary for rendering...
static DataStorage::SetOfObjects::Pointer Load(const std::string &path, DataStorage &storage, const ReaderOptionsFunctorBase *optionsCallback=nullptr)
Load a file into the given DataStorage.
Class for nodes of the DataTree.