Medical Imaging Interaction Toolkit
2023.12.00
Medical Imaging Interaction Toolkit
|
#include <mitkRenderingTestHelper.h>
Classes | |
class | ArgcHelperClass |
The ArgcHelperClass class is a convenience 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[], AntiAliasing antiAliasing=AntiAliasing::None) | |
Generate a rendering test helper object including a render window of the size width * height (in pixel). More... | |
RenderingTestHelper (int width, int height, AntiAliasing antiAliasing=AntiAliasing::None) | |
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. Useful for debugging. More... | |
void | SetImageProperty (const char *propertyKey, mitk::BaseProperty *property) |
This method set the property of the member datastorage. More... | |
void | SetViewDirection (mitk::AnatomicalPlane 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... | |
Protected Member Functions | |
void | Initialize (int width, int height, AntiAliasing antiAliasing=AntiAliasing::None) |
Initialize Internal method to initialize the renderwindow and set the datastorage. 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 28 of file mitkRenderingTestHelper.h.
mitk::RenderingTestHelper::RenderingTestHelper | ( | int | width, |
int | height, | ||
int | argc, | ||
char * | argv[], | ||
AntiAliasing | antiAliasing = AntiAliasing::None |
||
) |
Generate a rendering test helper object including a render window of the size width * height (in pixel).
width | |
height | |
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(). |
antiAliasing | The anti-aliasing mode. |
mitk::RenderingTestHelper::RenderingTestHelper | ( | int | width, |
int | height, | ||
AntiAliasing | antiAliasing = AntiAliasing::None |
||
) |
Generate a rendering test helper object including a render window of the size width * height (in pixel).
mitk::RenderingTestHelper::~RenderingTestHelper | ( | ) |
Default destructor
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. |
|
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). |
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. |
mitk::DataStorage::Pointer mitk::RenderingTestHelper::GetDataStorage | ( | ) |
Returns the datastorage, in order to modify the data inside a rendering test.
vtkRenderer* mitk::RenderingTestHelper::GetVtkRenderer | ( | ) |
Getter for the vtkRenderer.
vtkRenderWindow* mitk::RenderingTestHelper::GetVtkRenderWindow | ( | ) |
Getter for the vtkRenderWindow which should be used to call vtkRegressionTestImage.
|
protected |
Initialize Internal method to initialize the renderwindow and set the datastorage.
width | Height of renderwindow. |
height | Width of renderwindow. |
antiAliasing | The anti-aliasing mode. |
void mitk::RenderingTestHelper::Render | ( | ) |
Render everything into an mitkRenderWindow. Call SetViewDirection() and SetProperty() before this method.
void mitk::RenderingTestHelper::ReorientSlices | ( | mitk::Point3D | origin, |
mitk::Vector3D | rotation | ||
) |
Reorient the slice (e.g. rotation and translation like the swivel mode).
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). |
void mitk::RenderingTestHelper::SaveReferenceScreenShot | ( | std::string | fileName | ) |
SaveReferenceScreenShot Convenience method to save a reference screen shot.
fileName | Path/to/save/the/png/file. |
void mitk::RenderingTestHelper::SetAutomaticallyCloseRenderWindow | ( | bool | automaticallyCloseRenderWindow | ) |
SetStopRenderWindow Convenience method to make the renderwindow hold after rendering. Useful for debugging.
automaticallyCloseRenderWindow | Flag indicating whether the renderwindow should automatically close (false, default) or stay open (true). Useful for debugging. |
void mitk::RenderingTestHelper::SetImageProperty | ( | const char * | propertyKey, |
mitk::BaseProperty * | property | ||
) |
This method set the property of the member datastorage.
propertyKey | |
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. |
|
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. |
void mitk::RenderingTestHelper::SetMapperID | ( | mitk::BaseRenderer::StandardMapperSlot | id | ) |
SetMapperID Change between Standard2D and 3D mappers.
id | Enum mitk::BaseRenderer::StandardMapperSlot which defines the mapper. |
void mitk::RenderingTestHelper::SetMapperIDToRender2D | ( | ) |
SetMapperIDToRender2D Convenience method to render in a 2D renderwindow.
void mitk::RenderingTestHelper::SetMapperIDToRender3D | ( | ) |
SetMapperIDToRender3D Convenience method to render in a 3D renderwindow.
void mitk::RenderingTestHelper::SetViewDirection | ( | mitk::AnatomicalPlane | viewDirection | ) |
Set the view direction of the renderwindow (e.g. sagittal, coronal, axial)
|
protected |
Definition at line 211 of file mitkRenderingTestHelper.h.
|
protected |
Definition at line 209 of file mitkRenderingTestHelper.h.
|
protected |
Definition at line 208 of file mitkRenderingTestHelper.h.