MCPcopy Create free account
hub / github.com/MITK/MITK / Initialize

Method Initialize

Modules/Core/TestingHelper/src/mitkInteractionTestHelper.cpp:37–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37void mitk::InteractionTestHelper::Initialize(const std::string &interactionXmlFilePath)
38{
39 tinyxml2::XMLDocument document;
40 if (tinyxml2::XML_SUCCESS == document.LoadFile(interactionXmlFilePath.c_str()))
41 {
42 // create data storage
43 m_DataStorage = mitk::StandaloneDataStorage::New();
44
45 // for each renderer found create a render window and configure
46 for (auto *element = document.FirstChildElement(mitk::InteractionEventConst::xmlTagInteractions().c_str())
47 ->FirstChildElement(mitk::InteractionEventConst::xmlTagConfigRoot().c_str())
48 ->FirstChildElement(mitk::InteractionEventConst::xmlTagRenderer().c_str());
49 element != nullptr;
50 element = element->NextSiblingElement(mitk::InteractionEventConst::xmlTagRenderer().c_str()))
51 {
52 // get name of renderer
53 const char *rendererName =
54 element->Attribute(mitk::InteractionEventConst::xmlEventPropertyRendererName().c_str());
55
56 // get view direction
57 mitk::AnatomicalPlane viewDirection = mitk::AnatomicalPlane::Axial;
58 if (element->Attribute(mitk::InteractionEventConst::xmlEventPropertyViewDirection().c_str()) != nullptr)
59 {
60 int viewDirectionNum =
61 std::atoi(element->Attribute(mitk::InteractionEventConst::xmlEventPropertyViewDirection().c_str()));
62 viewDirection = static_cast<mitk::AnatomicalPlane>(viewDirectionNum);
63 }
64
65 // get mapper slot id
66 MapperSlotId mapperID = mitk::BaseRenderer::Standard2D;
67 if (element->Attribute(mitk::InteractionEventConst::xmlEventPropertyMapperID().c_str()) != nullptr)
68 {
69 int mapperIDNum =
70 std::atoi(element->Attribute(mitk::InteractionEventConst::xmlEventPropertyMapperID().c_str()));
71 mapperID = static_cast<MapperSlotId>(mapperIDNum);
72 }
73
74 // Get Size of Render Windows
75 int size[3];
76 size[0] = size[1] = size[2] = 0;
77 if (element->Attribute(mitk::InteractionEventConst::xmlRenderSizeX().c_str()) != nullptr)
78 {
79 size[0] = std::atoi(element->Attribute(mitk::InteractionEventConst::xmlRenderSizeX().c_str()));
80 }
81 if (element->Attribute(mitk::InteractionEventConst::xmlRenderSizeY().c_str()) != nullptr)
82 {
83 size[1] = std::atoi(element->Attribute(mitk::InteractionEventConst::xmlRenderSizeY().c_str()));
84 }
85 if (element->Attribute(mitk::InteractionEventConst::xmlRenderSizeZ().c_str()) != nullptr)
86 {
87 size[2] = std::atoi(element->Attribute(mitk::InteractionEventConst::xmlRenderSizeZ().c_str()));
88 }
89
90 // create renderWindow, renderer and dispatcher
91 auto rw = RenderWindow::New(nullptr, rendererName); // VtkRenderWindow is created within constructor if nullptr
92
93 if (size[0] != 0 && size[1] != 0)
94 {

Callers 1

InteractionTestHelperMethod · 0.95

Calls 13

PrepareRenderMethod · 0.80
NewFunction · 0.50
SetSizeMethod · 0.45
ResizeMethod · 0.45
GetRendererMethod · 0.45
SetDataStorageMethod · 0.45
SetMapperIDMethod · 0.45
GetVtkRendererMethod · 0.45
SetPositionMethod · 0.45
RenderMethod · 0.45

Tested by

no test coverage detected