29 #include <itkVectorContainer.h>
32 #include <vtkDebugLeaks.h>
33 #include <vtkRegressionTestImage.h>
47 vtkDebugLeaks::SetExitError(0);
52 MITK_TEST_OUTPUT(<<
"Usage: " << std::string(*argv) <<
" [file1 file2 ...] outputfile")
53 MITK_TEST_OUTPUT(<<
"Will render a central axial slice of all given files into outputfile")
57 double renderWindowWidth = atof(argv[1]);
58 double renderWindowHeight = atof(argv[2]);
59 double left = atof(argv[3]);
60 double bottom = atof(argv[4]);
61 double right = atof(argv[5]);
62 double top = atof(argv[6]);
63 std::string referenceFilename = argv[8 + 6];
67 MITK_INFO <<
"Testing viewport " << right - left <<
"x" << top - bottom <<
" (" << left <<
", " << bottom <<
") to ("
68 << right <<
", " << top <<
") "
69 <<
"in render window of size " << renderWindowWidth <<
"x" << renderWindowHeight <<
"px";
81 for (ObjectsSet::const_iterator iterFigures = figures->begin(); iterFigures != figures->end(); ++iterFigures)
91 for (ObjectsSet::const_iterator iterSurfaces = surfaces->begin(); iterSurfaces != surfaces->end(); ++iterSurfaces)
98 for (ObjectsSet::const_iterator iterImages = images->begin(); iterImages != images->end(); ++iterImages)
101 int imageWidth =
dynamic_cast<mitk::Image *
>((*iterImages)->GetData())->GetDimension(0);
102 int imageHeight =
dynamic_cast<mitk::Image *
>((*iterImages)->GetData())->GetDimension(1);
103 MITK_INFO <<
"Image dimension " << imageWidth <<
"x" << imageHeight;
106 double vLeft = left / renderWindowWidth;
107 double vBottom = bottom / renderWindowHeight;
108 double vRight = right / renderWindowWidth;
109 double vTop = top / renderWindowHeight;
113 renderingHelper.
GetDataStorage()->ComputeBoundingGeometry3D(images));
115 renderingHelper.
GetVtkRenderer()->SetViewport(vLeft, vBottom, vRight, vTop);
119 bool generateReferenceScreenshot =
false;
120 if (generateReferenceScreenshot)
122 std::string tmpFilename = referenceFilename;
123 std::string::size_type slashpos = referenceFilename.find_last_of(
'/');
124 tmpFilename = referenceFilename.substr(slashpos + 1);
125 tmpFilename = std::string(
"/tmp/") + tmpFilename;
127 MITK_INFO <<
"*********************************";
129 MITK_INFO <<
"*********************************";
139 int retVal = vtkRegressionTestImageThreshold(renderingHelper.
GetVtkRenderWindow(), 20.0);
void SaveAsPNG(std::string fileName)
Method can be used to save a screenshot (e.g. reference screenshot as a .png file.
virtual bool InitializeViews(const BaseGeometry *geometry, RequestType type=REQUEST_UPDATE_ALL, bool preserveRoughOrientationInWorldSpace=false)
int mitkViewportRenderingTest(int argc, char *argv[])
void SetViewDirection(mitk::SliceNavigationController::ViewDirection viewDirection)
Set the view direction of the renderwindow (e.g. sagittal, coronal, axial)
itk::VectorContainer< unsigned int, mitk::DataNode::Pointer > SetOfObjects
A Container of objects that is used as a result set of GetSubset() query operations (Set of...
vtkRenderWindow * GetVtkRenderWindow()
Getter for the vtkRenderWindow which should be used to call vtkRegressionTestImage.
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
Tests for type compatibility (dynamic_cast).
itk::SmartPointer< const Self > ConstPointer
#define MITK_TEST_OUTPUT(x)
Output some text.
The LevelWindow class Class to store level/window values.
void Render()
Render everything into an mitkRenderWindow. Call SetViewDirection() and SetProperty() before this met...
#define MITK_TEST_CONDITION(COND, MSG)
static RenderingManager * GetInstance()
Image class for storing images.
mitk::DataStorage::Pointer GetDataStorage()
Returns the datastorage, in order to modify the data inside a rendering test.
vtkRenderer * GetVtkRenderer()
Getter for the vtkRenderer.
void SetAutomaticallyCloseRenderWindow(bool automaticallyCloseRenderWindow)
SetStopRenderWindow Convenience method to make the renderwindow hold after rendering. Usefull for debugging.
section MAP_FRAME_Mapper_Settings Mapper settings For the mapping of corrected images