Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
|
#include <mitkRenderingTestHelper.h>
Classes | |
class | ArgcHelperClass |
The ArgcHelperClass class is a convinience class to convert a vector of strings to the standard c++ argv and argc arguments. This is necessary for the vtkTesting::Test, since is requires the reference image (and other optional parameters) via command line. More... | |
Public Member Functions | |
RenderingTestHelper (int width, int height, int argc, char *argv[], mitk::BaseRenderer::RenderingMode::Type renderingMode=mitk::BaseRenderer::RenderingMode::Standard) | |
Generate a rendering test helper object including a render window of the size width * height (in pixel). More... | |
RenderingTestHelper (int width, int height, mitk::BaseRenderer::RenderingMode::Type renderingMode=mitk::BaseRenderer::RenderingMode::Standard) | |
Generate a rendering test helper object including a render window of the size width * height (in pixel). More... | |
~RenderingTestHelper () | |
vtkRenderer * | GetVtkRenderer () |
Getter for the vtkRenderer. More... | |
vtkRenderWindow * | GetVtkRenderWindow () |
Getter for the vtkRenderWindow which should be used to call vtkRegressionTestImage. More... | |
void | SaveAsPNG (std::string fileName) |
Method can be used to save a screenshot (e.g. reference screenshot as a .png file. More... | |
void | SetAutomaticallyCloseRenderWindow (bool automaticallyCloseRenderWindow) |
SetStopRenderWindow Convenience method to make the renderwindow hold after rendering. Usefull for debugging. More... | |
void | SetImageProperty (const char *propertyKey, mitk::BaseProperty *property) |
This method set the property of the member datastorage. More... | |
void | SetViewDirection (mitk::SliceNavigationController::ViewDirection viewDirection) |
Set the view direction of the renderwindow (e.g. sagittal, coronal, axial) More... | |
void | ReorientSlices (mitk::Point3D origin, mitk::Vector3D rotation) |
Reorient the slice (e.g. rotation and translation like the swivel mode). More... | |
void | Render () |
Render everything into an mitkRenderWindow. Call SetViewDirection() and SetProperty() before this method. More... | |
mitk::DataStorage::Pointer | GetDataStorage () |
Returns the datastorage, in order to modify the data inside a rendering test. More... | |
void | SetMapperID (mitk::BaseRenderer::StandardMapperSlot id) |
SetMapperID Change between Standard2D and 3D mappers. More... | |
void | AddNodeToStorage (mitk::DataNode::Pointer node) |
AddNodeToStorage Add a node to the datastorage and perform a reinit which is necessary for rendering. More... | |
void | SetMapperIDToRender3D () |
SetMapperIDToRender3D Convenience method to render in a 3D renderwindow. More... | |
void | SetMapperIDToRender2D () |
SetMapperIDToRender2D Convenience method to render in a 2D renderwindow. More... | |
void | SaveReferenceScreenShot (std::string fileName) |
SaveReferenceScreenShot Convenience method to save a reference screen shot. More... | |
bool | CompareRenderWindowAgainstReference (int argc, char *argv[], double threshold=10.0) |
CompareRenderWindowAgainstReference Convenience method to compare the image rendered in the internal renderwindow against a reference screen shot. More... | |
bool | IsAdvancedOpenGL () |
Returns true if the opengl context is compatible for advanced vtk effects. More... | |
Protected Member Functions | |
void | Initialize (int width, int height, mitk::BaseRenderer::RenderingMode::Type renderingMode=mitk::BaseRenderer::RenderingMode::Standard) |
Initialize Internal method to initialize the renderwindow and set the datastorage. More... | |
void | PrintGLInfo () |
Prints the opengl information, e.g. version, vendor and extensions, This function can only be called after an opengl context is active. It only prints the context after the vtkRenderwindow is fully initialized. More... | |
void | AddToStorage (const std::string &filename) |
This method tries to load the given file into a member datastorage, in order to render it. More... | |
void | SetInputFileNames (int argc, char *argv[]) |
This method tries to parse the given argv for files (e.g. images) and load them into a member datastorage, in order to render it. More... | |
Protected Attributes | |
mitk::RenderWindow::Pointer | m_RenderWindow |
mitk::DataStorage::Pointer | m_DataStorage |
bool | m_AutomaticallyCloseRenderWindow |
Definition at line 32 of file mitkRenderingTestHelper.h.
mitk::RenderingTestHelper::RenderingTestHelper | ( | int | width, |
int | height, | ||
int | argc, | ||
char * | argv[], | ||
mitk::BaseRenderer::RenderingMode::Type | renderingMode = mitk::BaseRenderer::RenderingMode::Standard |
||
) |
Generate a rendering test helper object including a render window of the size width * height (in pixel).
argc | Number of parameters. (here: Images) "Usage: [filename1 filenam2 -V referenceScreenshot (optional -T /directory/to/save/differenceImage)] |
argv | Given parameters. If no data is inserted via commandline, you can add data later via AddNodeToDataStorage(). |
renderingMode | Enable Standard, Multisample or DepthPeeling |
Definition at line 57 of file mitkRenderingTestHelper.cpp.
References Initialize(), and SetInputFileNames().
mitk::RenderingTestHelper::RenderingTestHelper | ( | int | width, |
int | height, | ||
mitk::BaseRenderer::RenderingMode::Type | renderingMode = mitk::BaseRenderer::RenderingMode::Standard |
||
) |
Generate a rendering test helper object including a render window of the size width * height (in pixel).
Definition at line 49 of file mitkRenderingTestHelper.cpp.
References Initialize().
mitk::RenderingTestHelper::~RenderingTestHelper | ( | ) |
Default destructor
Definition at line 124 of file mitkRenderingTestHelper.cpp.
void mitk::RenderingTestHelper::AddNodeToStorage | ( | mitk::DataNode::Pointer | node | ) |
AddNodeToStorage Add a node to the datastorage and perform a reinit which is necessary for rendering.
node | The data you want to add. |
Definition at line 302 of file mitkRenderingTestHelper.cpp.
References mitk::RenderingManager::GetInstance(), mitk::RenderingManager::InitializeViews(), and m_DataStorage.
Referenced by addPlaneToDataStorage(), and mitkSurfaceVtkMapper3DTexturedSphereTest().
|
protected |
This method tries to load the given file into a member datastorage, in order to render it.
fileName | The filename of the file to be loaded (including path). |
Definition at line 288 of file mitkRenderingTestHelper.cpp.
References mitk::RenderingManager::GetInstance(), mitk::RenderingManager::InitializeViews(), mitk::IOUtil::Load(), m_DataStorage, and MITK_ERROR.
bool mitk::RenderingTestHelper::CompareRenderWindowAgainstReference | ( | int | argc, |
char * | argv[], | ||
double | threshold = 10.0 |
||
) |
CompareRenderWindowAgainstReference Convenience method to compare the image rendered in the internal renderwindow against a reference screen shot.
Usage of vtkTesting::Test: vtkTesting::Test( argc, argv, vtkRenderWindow, threshold ) Set a vtkRenderWindow containing the desired scene. This is automatically rendered. vtkTesting::Test() automatically searches in argc and argv[] for a path a valid image with -V. If the test failed with the first image (foo.png) it checks if there are images of the form foo_N.png (where N=1,2,3...) and compare against them. This allows for multiple valid images.
argc | Number of arguments. |
argv | Arguments must(!) contain the term "-V Path/To/Valid/Image.png" |
threshold | Allowed difference between two images. Default = 10.0 and was taken from VTK. |
Definition at line 245 of file mitkRenderingTestHelper.cpp.
Referenced by mitkImageVtkMapper2DColorTest(), mitkImageVtkMapper2DLevelWindowTest(), mitkImageVtkMapper2DLookupTableTest(), mitkImageVtkMapper2DOpacityTest(), mitkImageVtkMapper2DOpacityTransferFunctionTest(), mitkImageVtkMapper2DResliceInterpolationPropertyTest(), mitkImageVtkMapper2DSwivelTest(), mitkImageVtkMapper2DTest(), mitkImageVtkMapper2DTransferFunctionTest(), mitkPlaneGeometryDataMapper2DTest(), mitkPointSetVtkMapper2DGlyphTypeTest(), mitkPointSetVtkMapper2DImageTest(), mitkPointSetVtkMapper2DTest(), mitkPointSetVtkMapper2DTransformedPointsTest(), mitkSceneIOCompatibilityTest(), mitkSurfaceDepthPeelingTest(), mitkSurfaceDepthSortingTest(), mitkSurfaceVtkMapper3DTest(), and mitkSurfaceVtkMapper3DTexturedSphereTest().
mitk::DataStorage::Pointer mitk::RenderingTestHelper::GetDataStorage | ( | ) |
Returns the datastorage, in order to modify the data inside a rendering test.
Definition at line 190 of file mitkRenderingTestHelper.cpp.
References m_DataStorage.
Referenced by mitkImageVtkMapper2DResliceInterpolationPropertyTest(), mitkImageVtkMapper2DSwivelTest(), mitkPlaneGeometryDataMapper2DTest(), mitkPointSetVtkMapper2DGlyphTypeTest(), mitkPointSetVtkMapper2DTransformedPointsTest(), mitkSurfaceDepthPeelingTest(), mitkSurfaceDepthSortingTest(), mitkSurfaceVtkMapper3DTest(), mitkSurfaceVtkMapper3DTexturedSphereTest(), and mitkViewportRenderingTest().
vtkRenderer * mitk::RenderingTestHelper::GetVtkRenderer | ( | ) |
Getter for the vtkRenderer.
Definition at line 230 of file mitkRenderingTestHelper.cpp.
Referenced by mitkSurfaceVtkMapper3DTest(), and mitkViewportRenderingTest().
vtkRenderWindow * mitk::RenderingTestHelper::GetVtkRenderWindow | ( | ) |
Getter for the vtkRenderWindow which should be used to call vtkRegressionTestImage.
Definition at line 240 of file mitkRenderingTestHelper.cpp.
Referenced by mitkPointSetVtkMapper2DGlyphTypeTest(), mitkPointSetVtkMapper2DImageTest(), mitkPointSetVtkMapper2DTest(), and mitkViewportRenderingTest().
|
protected |
Initialize Internal method to initialize the renderwindow and set the datastorage.
width | Height of renderwindow. |
height | Width of renderwindow. |
renderingMode | Enable Standard, Multisampling or Depthpeeling |
Definition at line 65 of file mitkRenderingTestHelper.cpp.
References m_DataStorage, MITK_INFO, mitk::RenderWindow::New(), and mitk::StandaloneDataStorage::New().
Referenced by RenderingTestHelper().
bool mitk::RenderingTestHelper::IsAdvancedOpenGL | ( | ) |
Returns true if the opengl context is compatible for advanced vtk effects.
Definition at line 128 of file mitkRenderingTestHelper.cpp.
Referenced by mitkSurfaceDepthPeelingTest().
|
protected |
Prints the opengl information, e.g. version, vendor and extensions, This function can only be called after an opengl context is active. It only prints the context after the vtkRenderwindow is fully initialized.
Definition at line 136 of file mitkRenderingTestHelper.cpp.
References MITK_INFO.
void mitk::RenderingTestHelper::Render | ( | ) |
Render everything into an mitkRenderWindow. Call SetViewDirection() and SetProperty() before this method.
Definition at line 168 of file mitkRenderingTestHelper.cpp.
References m_DataStorage, and MITK_ERROR.
Referenced by mitkImageVtkMapper2DResliceInterpolationPropertyTest(), and mitkViewportRenderingTest().
void mitk::RenderingTestHelper::ReorientSlices | ( | mitk::Point3D | origin, |
mitk::Vector3D | rotation | ||
) |
Reorient the slice (e.g. rotation and translation like the swivel mode).
Definition at line 223 of file mitkRenderingTestHelper.cpp.
References mitk::BaseRenderer::GetInstance().
Referenced by mitkImageVtkMapper2DResliceInterpolationPropertyTest(), and mitkImageVtkMapper2DSwivelTest().
void mitk::RenderingTestHelper::SaveAsPNG | ( | std::string | fileName | ) |
Method can be used to save a screenshot (e.g. reference screenshot as a .png file.
fileName | The filename of the new screenshot (including path). |
Definition at line 260 of file mitkRenderingTestHelper.cpp.
References mitk::New().
Referenced by mitkViewportRenderingTest().
void mitk::RenderingTestHelper::SaveReferenceScreenShot | ( | std::string | fileName | ) |
SaveReferenceScreenShot Convenience method to save a reference screen shot.
fileName | Path/to/save/the/png/file. |
Definition at line 283 of file mitkRenderingTestHelper.cpp.
Referenced by mitkImageVtkMapper2DColorTest(), mitkImageVtkMapper2DLevelWindowTest(), mitkImageVtkMapper2DLookupTableTest(), mitkImageVtkMapper2DOpacityTest(), mitkImageVtkMapper2DOpacityTransferFunctionTest(), mitkImageVtkMapper2DResliceInterpolationPropertyTest(), mitkImageVtkMapper2DSwivelTest(), mitkImageVtkMapper2DTest(), mitkImageVtkMapper2DTransferFunctionTest(), mitkPlaneGeometryDataMapper2DTest(), mitkPointSetVtkMapper2DGlyphTypeTest(), mitkPointSetVtkMapper2DImageTest(), mitkPointSetVtkMapper2DTest(), mitkPointSetVtkMapper2DTransformedPointsTest(), mitkSceneIOCompatibilityTest(), mitkSurfaceVtkMapper3DTest(), and mitkSurfaceVtkMapper3DTexturedSphereTest().
void mitk::RenderingTestHelper::SetAutomaticallyCloseRenderWindow | ( | bool | automaticallyCloseRenderWindow | ) |
SetStopRenderWindow Convenience method to make the renderwindow hold after rendering. Usefull for debugging.
flag | Flag indicating whether the renderwindow should automatically close (false, default) or stay open (true). Usefull for debugging. |
Definition at line 278 of file mitkRenderingTestHelper.cpp.
Referenced by mitkViewportRenderingTest().
void mitk::RenderingTestHelper::SetImageProperty | ( | const char * | propertyKey, |
mitk::BaseProperty * | property | ||
) |
This method set the property of the member datastorage.
property | Set a property for each image in the datastorage m_DataStorage. If you want to set the property for a single data node, use GetDataStorage() and set the property yourself for the destinct node. |
Definition at line 235 of file mitkRenderingTestHelper.cpp.
References m_DataStorage, and mitk::NodePredicateDataType::New().
Referenced by mitkImageVtkMapper2DColorTest(), mitkImageVtkMapper2DLevelWindowTest(), mitkImageVtkMapper2DLookupTableTest(), mitkImageVtkMapper2DOpacityTest(), mitkImageVtkMapper2DOpacityTransferFunctionTest(), mitkImageVtkMapper2DResliceInterpolationPropertyTest(), and mitkImageVtkMapper2DTransferFunctionTest().
|
protected |
This method tries to parse the given argv for files (e.g. images) and load them into a member datastorage, in order to render it.
argc | Number of parameters. |
argv | Given parameters. |
Definition at line 195 of file mitkRenderingTestHelper.cpp.
Referenced by RenderingTestHelper().
void mitk::RenderingTestHelper::SetMapperID | ( | mitk::BaseRenderer::StandardMapperSlot | id | ) |
SetMapperID Change between Standard2D and 3D mappers.
id | Enum mitk::BaseRenderer::StandardMapperSlot which defines the mapper. |
Definition at line 151 of file mitkRenderingTestHelper.cpp.
Referenced by mitkSurfaceVtkMapper3DTest(), and mitkSurfaceVtkMapper3DTexturedSphereTest().
void mitk::RenderingTestHelper::SetMapperIDToRender2D | ( | ) |
SetMapperIDToRender2D Convenience method to render in a 2D renderwindow.
Definition at line 163 of file mitkRenderingTestHelper.cpp.
References mitk::BaseRenderer::Standard2D.
void mitk::RenderingTestHelper::SetMapperIDToRender3D | ( | ) |
SetMapperIDToRender3D Convenience method to render in a 3D renderwindow.
Definition at line 156 of file mitkRenderingTestHelper.cpp.
References GetDataStorage(), mitk::RenderingManager::GetInstance(), mitk::RenderingManager::InitializeViews(), and mitk::BaseRenderer::Standard3D.
Referenced by mitkSurfaceDepthPeelingTest(), and mitkSurfaceDepthSortingTest().
void mitk::RenderingTestHelper::SetViewDirection | ( | mitk::SliceNavigationController::ViewDirection | viewDirection | ) |
Set the view direction of the renderwindow (e.g. sagittal, coronal, axial)
Definition at line 214 of file mitkRenderingTestHelper.cpp.
References mitk::BaseRenderer::GetInstance(), mitk::RenderingManager::GetInstance(), mitk::RenderingManager::InitializeViews(), and m_DataStorage.
Referenced by mitkImageVtkMapper2DColorTest(), mitkImageVtkMapper2DLevelWindowTest(), mitkImageVtkMapper2DOpacityTest(), mitkPointSetVtkMapper2DGlyphTypeTest(), mitkPointSetVtkMapper2DTest(), mitkPointSetVtkMapper2DTransformedPointsTest(), and mitkViewportRenderingTest().
|
protected |
Definition at line 221 of file mitkRenderingTestHelper.h.
|
protected |
Definition at line 219 of file mitkRenderingTestHelper.h.
|
protected |
Definition at line 218 of file mitkRenderingTestHelper.h.