diff --git a/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/simpleexample/QmitkSimpleExampleView.cpp b/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/simpleexample/QmitkSimpleExampleView.cpp
index d4e166ce06..c5e378be43 100644
--- a/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/simpleexample/QmitkSimpleExampleView.cpp
+++ b/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/simpleexample/QmitkSimpleExampleView.cpp
@@ -1,418 +1,418 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 #include "QmitkSimpleExampleView.h"
 
 #include <vtkImageWriter.h>
 #include <vtkJPEGWriter.h>
 #include <vtkPNGWriter.h>
 #include <vtkRenderLargeImage.h>
 #include <vtkRenderWindow.h>
 #include <vtkOpenGL.h>
 
 #include "QmitkRenderWindow.h"
 #include "QmitkStepperAdapter.h"
 
 #include "QmitkFFmpegWriter.h"
 #include "mitkNodePredicateNot.h"
 #include "mitkNodePredicateProperty.h"
 #include "mitkProperties.h"
 
 #include <QDir>
 #include <QFileDialog>
 #include <QFileInfo>
 #include <QMessageBox>
 #include <berryPlatform.h>
 
 const std::string QmitkSimpleExampleView::VIEW_ID = "org.mitk.views.simpleexample";
 
 QmitkSimpleExampleView::QmitkSimpleExampleView()
   : m_Controls(nullptr), m_NavigatorsInitialized(false), m_Parent(nullptr)
 {
 }
 
 QmitkSimpleExampleView::~QmitkSimpleExampleView()
 {
 }
 
 void QmitkSimpleExampleView::CreateQtPartControl(QWidget *parent)
 {
   if (!m_Controls)
   {
     m_Parent = parent;
     // create GUI widgets
     m_Controls = new Ui::QmitkSimpleExampleViewControls;
     m_Controls->setupUi(parent);
     this->CreateConnections();
 
-    this->RenderWindowPartActivated(this->GetRenderWindowPart());
+    this->RenderWindowPartActivated(this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN));
   }
 }
 
 void QmitkSimpleExampleView::SetFocus()
 {
   m_Controls->renderWindowComboBox->setFocus();
 }
 
 void QmitkSimpleExampleView::RenderWindowPartActivated(mitk::IRenderWindowPart *renderWindowPart)
 {
   if (renderWindowPart == nullptr)
   {
     m_Parent->setEnabled(false);
     return;
   }
 
   QHashIterator<QString, QmitkRenderWindow *> renderIter(renderWindowPart->GetQmitkRenderWindows());
   while (renderIter.hasNext())
   {
     renderIter.next();
     m_Controls->renderWindowComboBox->addItem(renderIter.key());
   }
 
   RenderWindowSelected(m_Controls->renderWindowComboBox->currentText());
   m_TimeStepper.reset(new QmitkStepperAdapter(m_Controls->sliceNavigatorTime,
                                               renderWindowPart->GetTimeNavigationController()->GetTime(),
                                               "sliceNavigatorTimeFromSimpleExample"));
   m_MovieStepper.reset(new QmitkStepperAdapter(m_Controls->movieNavigatorTime,
                                                renderWindowPart->GetTimeNavigationController()->GetTime(),
                                                "movieNavigatorTimeFromSimpleExample"));
 
   m_Parent->setEnabled(true);
 }
 
 void QmitkSimpleExampleView::RenderWindowPartDeactivated(mitk::IRenderWindowPart * /*renderWindowPart*/)
 {
   m_Parent->setEnabled(false);
 
   m_SliceStepper.reset();
   m_TimeStepper.reset();
   m_MovieStepper.reset();
   m_Controls->renderWindowComboBox->clear();
 }
 
 void QmitkSimpleExampleView::CreateConnections()
 {
   if (m_Controls)
   {
     connect(m_Controls->renderWindowComboBox,
             SIGNAL(currentIndexChanged(QString)),
             this,
             SLOT(RenderWindowSelected(QString)));
     connect(m_Controls->stereoSelect, SIGNAL(activated(int)), this, SLOT(StereoSelectionChanged(int)));
     connect(m_Controls->reInitializeNavigatorsButton, SIGNAL(clicked()), this, SLOT(InitNavigators()));
     connect(m_Controls->genMovieButton, SIGNAL(clicked()), this, SLOT(GenerateMovie()));
     connect(m_Controls->m_TakeScreenshotBtn, SIGNAL(clicked()), this, SLOT(OnTakeScreenshot()));
     connect(m_Controls->m_TakeHighResScreenShotBtn, SIGNAL(clicked()), this, SLOT(OnTakeHighResolutionScreenshot()));
   }
 }
 
 void QmitkSimpleExampleView::InitNavigators()
 {
   /* get all nodes that have not set "includeInBoundingBox" to false */
   mitk::NodePredicateNot::Pointer pred = mitk::NodePredicateNot::New(
     mitk::NodePredicateProperty::New("includeInBoundingBox", mitk::BoolProperty::New(false)));
   mitk::DataStorage::SetOfObjects::ConstPointer rs = this->GetDataStorage()->GetSubset(pred);
   /* calculate bounding geometry of these nodes */
   auto bounds = this->GetDataStorage()->ComputeBoundingGeometry3D(rs);
   /* initialize the views to the bounding geometry */
   m_NavigatorsInitialized = mitk::RenderingManager::GetInstance()->InitializeViews(bounds);
 }
 
 /**
  * Returns path to the ffmpeg lib if configured in preferences.
  *
  * This implementation has been reused from MovieMaker view.
  *
  * @return The path to ffmpeg lib or empty string if not configured.
  */
 QString QmitkSimpleExampleView::GetFFmpegPath() const
 {
   berry::IPreferences::Pointer preferences =
     berry::Platform::GetPreferencesService()->GetSystemPreferences()->Node("/org.mitk.gui.qt.ext.externalprograms");
 
   return preferences.IsNotNull() ? preferences->Get("ffmpeg", "") : "";
 }
 
 /**
  * Reads pixels from specified render window.
  *
  * This implementation has been reused from MovieMaker view.
  *
  * @param renderWindow
  * @param x
  * @param y
  * @param width
  * @param height
  * @return
  */
 static unsigned char *ReadPixels(vtkRenderWindow *renderWindow, int x, int y, int width, int height)
 {
   if (renderWindow == nullptr)
     return nullptr;
 
   unsigned char *frame = new unsigned char[width * height * 3];
 
   renderWindow->MakeCurrent();
   glReadPixels(x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, frame);
 
   return frame;
 }
 
 /**
  * Records a movie from the selected render window with a default frame rate of 30 Hz.
  *
  * Parts of this implementation have been reused from MovieMaker view.
  */
 void QmitkSimpleExampleView::GenerateMovie()
 {
   QmitkRenderWindow *movieRenderWindow = GetSelectedRenderWindow();
 
   mitk::Stepper::Pointer stepper = movieRenderWindow->GetSliceNavigationController()->GetSlice();
 
   QmitkFFmpegWriter *movieWriter = new QmitkFFmpegWriter(m_Parent);
 
   const QString ffmpegPath = GetFFmpegPath();
 
   if (ffmpegPath.isEmpty())
   {
     QMessageBox::information(
       nullptr,
       "Movie Maker",
       "<p>Set path to FFmpeg<sup>1</sup> in preferences (Window -> Preferences... "
       "(Ctrl+P) -> External Programs) to be able to record your movies to video files.</p>"
       "<p>If you are using Linux, chances are good that FFmpeg is included in the official package "
       "repositories.</p>"
       "<p>[1] <a href=\"https://www.ffmpeg.org/download.html\">Download FFmpeg from ffmpeg.org</a></p>");
     return;
   }
 
   movieWriter->SetFFmpegPath(GetFFmpegPath());
 
   vtkRenderWindow *renderWindow = movieRenderWindow->renderWindow();
 
   if (renderWindow == nullptr)
     return;
 
   const int border = 3;
   const int x = border;
   const int y = border;
   int width = renderWindow->GetSize()[0] - border * 2;
   int height = renderWindow->GetSize()[1] - border * 2;
 
   if (width & 1)
     --width;
 
   if (height & 1)
     --height;
 
   if (width < 16 || height < 16)
     return;
 
   movieWriter->SetSize(width, height);
   movieWriter->SetFramerate(30);
 
   QString saveFileName = QFileDialog::getSaveFileName(nullptr, "Specify a filename", "", "Movie (*.mp4)");
 
   if (saveFileName.isEmpty())
     return;
 
   if (!saveFileName.endsWith(".mp4"))
     saveFileName += ".mp4";
 
   movieWriter->SetOutputPath(saveFileName);
 
   const unsigned int numberOfFrames = stepper->GetSteps() - stepper->GetPos();
 
   try
   {
     movieWriter->Start();
 
     for (unsigned int currentFrame = 0; currentFrame < numberOfFrames; ++currentFrame)
     {
       mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
 
       renderWindow->MakeCurrent();
       unsigned char *frame = ReadPixels(renderWindow, x, y, width, height);
       movieWriter->WriteFrame(frame);
       delete[] frame;
 
       stepper->Next();
     }
 
     movieWriter->Stop();
 
     mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
   }
   catch (const mitk::Exception &exception)
   {
     mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
 
     QMessageBox::critical(nullptr, "Generate Movie", exception.GetDescription());
   }
 }
 
 void QmitkSimpleExampleView::StereoSelectionChanged(int id)
 {
   /* From vtkRenderWindow.h tells us about stereo rendering:
   Set/Get what type of stereo rendering to use. CrystalEyes mode uses frame-sequential capabilities available in OpenGL
   to drive LCD shutter glasses and stereo projectors. RedBlue mode is a simple type of stereo for use with red-blue
   glasses. Anaglyph mode is a superset of RedBlue mode, but the color output channels can be configured using the
   AnaglyphColorMask and the color of the original image can be (somewhat maintained using AnaglyphColorSaturation; the
   default colors for Anaglyph mode is red-cyan. Interlaced stereo  mode produces a composite image where horizontal
   lines alternate between left and right views. StereoLeft and StereoRight modes choose one or the other stereo view.
   Dresden mode is yet another stereoscopic interleaving.
   */
 
-  mitk::IRenderWindowPart *renderWindowPart = this->GetRenderWindowPart();
+  auto *renderWindowPart = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN);
   vtkRenderWindow *vtkrenderwindow = renderWindowPart->GetQmitkRenderWindow("3d")->GetVtkRenderWindow();
 
   // note: foreground vtkRenderers (at least the department logo renderer) produce errors in stereoscopic visualization.
   // Therefore, we disable the logo visualization during stereo rendering.
   switch (id)
   {
     case 0:
       vtkrenderwindow->StereoRenderOff();
       break;
     case 1:
       vtkrenderwindow->SetStereoTypeToRedBlue();
       vtkrenderwindow->StereoRenderOn();
       renderWindowPart->EnableDecorations(false, QStringList(mitk::IRenderWindowPart::DECORATION_LOGO));
       break;
     case 2:
       vtkrenderwindow->SetStereoTypeToDresden();
       vtkrenderwindow->StereoRenderOn();
       renderWindowPart->EnableDecorations(false, QStringList(mitk::IRenderWindowPart::DECORATION_LOGO));
       break;
   }
 
   mitk::BaseRenderer::GetInstance(vtkrenderwindow)->SetMapperID(mitk::BaseRenderer::Standard3D);
   renderWindowPart->RequestUpdate();
 }
 
 QmitkRenderWindow *QmitkSimpleExampleView::GetSelectedRenderWindow() const
 {
   QString id = m_Controls->renderWindowComboBox->currentText();
   if (id.isEmpty())
   {
     return nullptr;
   }
   else
   {
-    return this->GetRenderWindowPart()->GetQmitkRenderWindow(id);
+    return this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetQmitkRenderWindow(id);
   }
 }
 
 void QmitkSimpleExampleView::OnTakeHighResolutionScreenshot()
 {
   QString filter;
   QString fileName = QFileDialog::getSaveFileName(
     nullptr, "Save screenshot to...", QDir::currentPath(), m_PNGExtension + ";;" + m_JPGExtension, &filter);
 
   vtkRenderer *renderer = this->GetSelectedRenderWindow()->GetRenderer()->GetVtkRenderer();
   if (renderer == nullptr)
     return;
   this->TakeScreenshot(renderer, 4, fileName, filter);
 }
 
 void QmitkSimpleExampleView::OnTakeScreenshot()
 {
   QString filter;
   QString fileName = QFileDialog::getSaveFileName(
     nullptr, "Save screenshot to...", QDir::currentPath(), m_PNGExtension + ";;" + m_JPGExtension, &filter);
 
   QmitkRenderWindow *renWin = this->GetSelectedRenderWindow();
   if (renWin == nullptr)
     return;
 
   vtkRenderer *renderer = renWin->GetRenderer()->GetVtkRenderer();
   if (renderer == nullptr)
     return;
   this->TakeScreenshot(renderer, 1, fileName, filter);
 }
 
 void QmitkSimpleExampleView::TakeScreenshot(vtkRenderer *renderer,
                                             unsigned int magnificationFactor,
                                             QString fileName,
                                             QString filter)
 {
   if ((renderer == nullptr) || (magnificationFactor < 1) || fileName.isEmpty())
     return;
 
   bool doubleBuffering(renderer->GetRenderWindow()->GetDoubleBuffer());
   renderer->GetRenderWindow()->DoubleBufferOff();
 
   vtkImageWriter *fileWriter = nullptr;
 
   QFileInfo fi(fileName);
   QString suffix = fi.suffix().toLower();
 
   if (suffix.isEmpty() || (suffix != "png" && suffix != "jpg" && suffix != "jpeg"))
   {
     if (filter == m_PNGExtension)
     {
       suffix = "png";
     }
     else if (filter == m_JPGExtension)
     {
       suffix = "jpg";
     }
     fileName += "." + suffix;
   }
 
   if (suffix.compare("jpg", Qt::CaseInsensitive) == 0 || suffix.compare("jpeg", Qt::CaseInsensitive) == 0)
   {
     vtkJPEGWriter *w = vtkJPEGWriter::New();
     w->SetQuality(100);
     w->ProgressiveOff();
     fileWriter = w;
   }
   else // default is png
   {
     fileWriter = vtkPNGWriter::New();
   }
 
   vtkRenderLargeImage *magnifier = vtkRenderLargeImage::New();
   magnifier->SetInput(renderer);
   magnifier->SetMagnification(magnificationFactor);
   fileWriter->SetInputConnection(magnifier->GetOutputPort());
   fileWriter->SetFileName(fileName.toLatin1());
 
   // vtkRenderLargeImage has problems with different layers, therefore we have to
   // temporarily deactivate all other layers.
   // we set the background to white, because it is nicer than black...
   double oldBackground[3];
   renderer->GetBackground(oldBackground);
   double white[] = {1.0, 1.0, 1.0};
   renderer->SetBackground(white);
-  mitk::IRenderWindowPart *renderWindowPart = this->GetRenderWindowPart();
+  mitk::IRenderWindowPart* renderWindowPart = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN);
   renderWindowPart->EnableDecorations(false);
 
   fileWriter->Write();
   fileWriter->Delete();
 
   renderWindowPart->EnableDecorations(true);
 
   renderer->SetBackground(oldBackground);
 
   renderer->GetRenderWindow()->SetDoubleBuffer(doubleBuffering);
 }
 
 void QmitkSimpleExampleView::RenderWindowSelected(const QString &id)
 {
   if (!id.isEmpty())
   {
     m_SliceStepper.reset(new QmitkStepperAdapter(
       m_Controls->sliceNavigator,
-      this->GetRenderWindowPart()->GetQmitkRenderWindow(id)->GetSliceNavigationController()->GetSlice(),
+      this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetQmitkRenderWindow(id)->GetSliceNavigationController()->GetSlice(),
       "sliceNavigatorFromSimpleExample"));
   }
 }
diff --git a/Plugins/org.mitk.gui.qt.cest/src/internal/QmitkCESTStatisticsView.cpp b/Plugins/org.mitk.gui.qt.cest/src/internal/QmitkCESTStatisticsView.cpp
index 904af7f0a7..8f4366b639 100644
--- a/Plugins/org.mitk.gui.qt.cest/src/internal/QmitkCESTStatisticsView.cpp
+++ b/Plugins/org.mitk.gui.qt.cest/src/internal/QmitkCESTStatisticsView.cpp
@@ -1,815 +1,816 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 // itk
 #include "itksys/SystemTools.hxx"
 #include <itkImageRegionConstIterator.h>
 #include <itkImageRegionIterator.h>
 
 // Blueberry
 #include <berryISelectionService.h>
 #include <berryIWorkbenchWindow.h>
 
 // Qmitk
 #include "QmitkCESTStatisticsView.h"
 
 // Qt
 #include <QMessageBox>
 #include <qclipboard.h>
 
 // qwt
 #include <qwt_scale_engine.h>
 
 // mitk
 #include <mitkCESTImageNormalizationFilter.h>
 #include <mitkCESTPropertyHelper.h>
 #include <mitkITKImageImport.h>
 #include <mitkImage.h>
 #include <mitkImageAccessByItk.h>
 #include <mitkImageCast.h>
 #include <mitkImageStatisticsContainerNodeHelper.h>
 #include <mitkLocaleSwitch.h>
 #include <mitkSliceNavigationController.h>
 #include <mitkStatisticsToImageRelationRule.h>
 #include <mitkStatisticsToMaskRelationRule.h>
 #include <mitkTemporoSpatialStringProperty.h>
 #include <mitkTimeGeometry.h>
 
 // boost
 #include <boost/algorithm/string.hpp>
 #include <boost/tokenizer.hpp>
 
 // stl
 #include <algorithm>
 #include <iostream>
 #include <iterator>
 #include <sstream>
 #include <string>
 #include <vector>
 
 namespace
 {
   template <typename T, typename Compare>
   void GetSortPermutation(std::vector<unsigned> &out,
                           const std::vector<T> &determiningVector,
                           Compare compare = std::less<T>())
   {
     out.resize(determiningVector.size());
     std::iota(out.begin(), out.end(), 0);
 
     std::sort(out.begin(), out.end(), [&](unsigned i, unsigned j) {
       return compare(determiningVector[i], determiningVector[j]);
     });
   }
 
   template <typename T>
   void ApplyPermutation(const std::vector<unsigned> &order, std::vector<T> &vectorToSort)
   {
     assert(order.size() == vectorToSort.size());
     std::vector<T> tempVector(vectorToSort.size());
     for (unsigned i = 0; i < vectorToSort.size(); i++)
     {
       tempVector[i] = vectorToSort[order[i]];
     }
     vectorToSort = tempVector;
   }
 
   template <typename T, typename... S>
   void ApplyPermutation(const std::vector<unsigned> &order,
                         std::vector<T> &currentVector,
                         std::vector<S> &... remainingVectors)
   {
     ApplyPermutation(order, currentVector);
     ApplyPermutation(order, remainingVectors...);
   }
 
   template <typename T, typename Compare, typename... SS>
   void SortVectors(const std::vector<T> &orderDeterminingVector,
                    Compare comparison,
                    std::vector<SS> &... vectorsToBeSorted)
   {
     std::vector<unsigned> order;
     GetSortPermutation(order, orderDeterminingVector, comparison);
     ApplyPermutation(order, vectorsToBeSorted...);
   }
 } // namespace
 
 const std::string QmitkCESTStatisticsView::VIEW_ID = "org.mitk.views.cest.statistics";
 
 QmitkCESTStatisticsView::QmitkCESTStatisticsView(QObject * /*parent*/, const char * /*name*/)
 {
   this->m_CalculatorJob = new QmitkImageStatisticsCalculationJob();
 
   m_currentSelectedPosition.Fill(0.0);
   m_currentSelectedTimePoint = 0.;
   m_CrosshairPointSet = mitk::PointSet::New();
 }
 
 QmitkCESTStatisticsView::~QmitkCESTStatisticsView()
 {
   while (this->m_CalculatorJob->isRunning()) // wait until thread has finished
   {
     itksys::SystemTools::Delay(100);
   }
   delete this->m_CalculatorJob;
 }
 
 void QmitkCESTStatisticsView::SetFocus()
 {
   m_Controls.threeDimToFourDimPushButton->setFocus();
 }
 
 void QmitkCESTStatisticsView::CreateQtPartControl(QWidget *parent)
 {
   // create GUI widgets from the Qt Designer's .ui file
   m_Controls.setupUi(parent);
   connect(
     m_Controls.threeDimToFourDimPushButton, SIGNAL(clicked()), this, SLOT(OnThreeDimToFourDimPushButtonClicked()));
   connect((QObject *)this->m_CalculatorJob,
           SIGNAL(finished()),
           this,
           SLOT(OnThreadedStatisticsCalculationEnds()),
           Qt::QueuedConnection);
   connect((QObject *)(this->m_Controls.fixedRangeCheckBox),
           SIGNAL(toggled(bool)),
           (QObject *)this,
           SLOT(OnFixedRangeCheckBoxToggled(bool)));
   connect((QObject *)(this->m_Controls.fixedRangeLowerDoubleSpinBox),
           SIGNAL(editingFinished()),
           (QObject *)this,
           SLOT(OnFixedRangeDoubleSpinBoxChanged()));
   connect((QObject *)(this->m_Controls.fixedRangeUpperDoubleSpinBox),
           SIGNAL(editingFinished()),
           (QObject *)this,
           SLOT(OnFixedRangeDoubleSpinBoxChanged()));
 
   m_Controls.threeDimToFourDimPushButton->setEnabled(false);
 
   m_Controls.widget_statistics->SetDataStorage(this->GetDataStorage());
 
   this->m_SliceChangeListener.RenderWindowPartActivated(this->GetRenderWindowPart());
   connect(&m_SliceChangeListener, SIGNAL(SliceChanged()), this, SLOT(OnSliceChanged()));
 }
 
 void QmitkCESTStatisticsView::RenderWindowPartActivated(mitk::IRenderWindowPart *renderWindowPart)
 {
   this->m_SliceChangeListener.RenderWindowPartActivated(renderWindowPart);
 }
 
 void QmitkCESTStatisticsView::RenderWindowPartDeactivated(mitk::IRenderWindowPart *renderWindowPart)
 {
   this->m_SliceChangeListener.RenderWindowPartDeactivated(renderWindowPart);
 }
 
 void QmitkCESTStatisticsView::OnSelectionChanged(berry::IWorkbenchPart::Pointer /*source*/,
                                                  const QList<mitk::DataNode::Pointer> &nodes)
 {
   if (nodes.empty())
   {
     std::stringstream message;
     message << "<font color='red'>Please select an image.</font>";
     m_Controls.labelWarning->setText(message.str().c_str());
     m_Controls.labelWarning->show();
 
     this->Clear();
     return;
   }
 
   // iterate all selected objects
   bool atLeastOneWasCESTImage = false;
   foreach (mitk::DataNode::Pointer node, nodes)
   {
     if (node.IsNull())
     {
       continue;
     }
 
     if (dynamic_cast<mitk::Image *>(node->GetData()) != nullptr)
     {
       m_Controls.labelWarning->setVisible(false);
 
       bool zSpectrumSet = SetZSpectrum(dynamic_cast<mitk::StringProperty *>(
         node->GetData()->GetProperty(mitk::CEST_PROPERTY_NAME_OFFSETS().c_str()).GetPointer()));
 
       atLeastOneWasCESTImage = atLeastOneWasCESTImage || zSpectrumSet;
 
       if (zSpectrumSet)
       {
         m_ZImage = dynamic_cast<mitk::Image *>(node->GetData());
         m_Controls.widget_statistics->SetImageNodes({node.GetPointer()});
       }
       else
       {
         m_MaskImage = dynamic_cast<mitk::Image *>(node->GetData());
         m_Controls.widget_statistics->SetMaskNodes({node.GetPointer()});
       }
     }
 
     if (dynamic_cast<mitk::PlanarFigure *>(node->GetData()) != nullptr)
     {
       m_MaskPlanarFigure = dynamic_cast<mitk::PlanarFigure *>(node->GetData());
       m_Controls.widget_statistics->SetMaskNodes({node.GetPointer()});
     }
 
     if (dynamic_cast<mitk::PointSet *>(node->GetData()) != nullptr)
     {
       m_PointSet = dynamic_cast<mitk::PointSet *>(node->GetData());
     }
   }
 
   // We only want to offer normalization or timestep copying if one object is selected
   if (nodes.size() == 1)
   {
     if (dynamic_cast<mitk::Image *>(nodes.front()->GetData()))
     {
       m_Controls.threeDimToFourDimPushButton->setDisabled(atLeastOneWasCESTImage);
     }
     else
     {
       m_Controls.threeDimToFourDimPushButton->setEnabled(false);
 
       std::stringstream message;
       message << "<font color='red'>The selected node is not an image.</font>";
       m_Controls.labelWarning->setText(message.str().c_str());
       m_Controls.labelWarning->show();
     }
     this->Clear();
     return;
   }
 
   // we always need a mask, either image or planar figure as well as an image for further processing
   if (nodes.size() != 2)
   {
     this->Clear();
     return;
   }
 
   m_Controls.threeDimToFourDimPushButton->setEnabled(false);
 
   if (!atLeastOneWasCESTImage)
   {
     std::stringstream message;
     message << "<font color='red'>None of the selected data nodes contains required CEST meta information</font>";
     m_Controls.labelWarning->setText(message.str().c_str());
     m_Controls.labelWarning->show();
     this->Clear();
     return;
   }
 
   bool bothAreImages = (m_ZImage.GetPointer() != nullptr) && (m_MaskImage.GetPointer() != nullptr);
 
   if (bothAreImages)
   {
     bool geometriesMatch =
       mitk::Equal(*(m_ZImage->GetTimeGeometry()), *(m_MaskImage->GetTimeGeometry()), mitk::eps, false);
 
     if (!geometriesMatch)
     {
       std::stringstream message;
       message << "<font color='red'>The selected images have different geometries.</font>";
       m_Controls.labelWarning->setText(message.str().c_str());
       m_Controls.labelWarning->show();
       this->Clear();
       return;
     }
   }
 
   if (!this->DataSanityCheck())
   {
     this->Clear();
     return;
   }
 
   if (m_PointSet.IsNull())
   {
     // initialize thread and trigger it
     this->m_CalculatorJob->SetIgnoreZeroValueVoxel(false);
     this->m_CalculatorJob->Initialize(m_ZImage.GetPointer(), m_MaskImage.GetPointer(), m_MaskPlanarFigure.GetPointer());
     std::stringstream message;
     message << "<font color='red'>Calculating statistics...</font>";
     m_Controls.labelWarning->setText(message.str().c_str());
     m_Controls.labelWarning->show();
 
     try
     {
       // Compute statistics
       this->m_CalculatorJob->start();
     }
     catch (const mitk::Exception &e)
     {
       std::stringstream message;
       message << "<font color='red'>" << e.GetDescription() << "</font>";
       m_Controls.labelWarning->setText(message.str().c_str());
       m_Controls.labelWarning->show();
     }
     catch (const std::runtime_error &e)
     {
       // In case of exception, print error message on GUI
       std::stringstream message;
       message << "<font color='red'>" << e.what() << "</font>";
       m_Controls.labelWarning->setText(message.str().c_str());
       m_Controls.labelWarning->show();
     }
     catch (const std::exception &e)
     {
       MITK_ERROR << "Caught exception: " << e.what();
       // In case of exception, print error message on GUI
       std::stringstream message;
       message << "<font color='red'>Error! Unequal Dimensions of Image and Segmentation. No recompute possible </font>";
       m_Controls.labelWarning->setText(message.str().c_str());
       m_Controls.labelWarning->show();
     }
 
     while (this->m_CalculatorJob->isRunning()) // wait until thread has finished
     {
       itksys::SystemTools::Delay(100);
     }
   }
 
   if (m_PointSet.IsNotNull())
   {
     if (m_ZImage->GetDimension() == 4)
     {
       AccessFixedDimensionByItk(m_ZImage, PlotPointSet, 4);
     }
     else
     {
       MITK_WARN << "Expecting a 4D image.";
     }
   }
 }
 
 void QmitkCESTStatisticsView::OnThreadedStatisticsCalculationEnds()
 {
   this->m_Controls.m_DataViewWidget->SetAxisTitle(QwtPlot::Axis::xBottom, "delta w");
   this->m_Controls.m_DataViewWidget->SetAxisTitle(QwtPlot::Axis::yLeft, "z");
 
   if (this->m_CalculatorJob->GetStatisticsUpdateSuccessFlag())
   {
     auto statistics = this->m_CalculatorJob->GetStatisticsData();
 
     std::string statisticsNodeName = "CEST_statistics";
     auto statisticsNode = mitk::CreateImageStatisticsNode(statistics, statisticsNodeName);
     auto imageRule = mitk::StatisticsToImageRelationRule::New();
     imageRule->Connect(statistics, m_CalculatorJob->GetStatisticsImage());
 
     if (m_CalculatorJob->GetMaskImage())
     {
       auto maskRule = mitk::StatisticsToMaskRelationRule::New();
       maskRule->Connect(statistics, m_CalculatorJob->GetMaskImage());
     }
     else if (m_CalculatorJob->GetPlanarFigure())
     {
       auto planarFigureRule = mitk::StatisticsToMaskRelationRule::New();
       planarFigureRule->Connect(statistics, m_CalculatorJob->GetPlanarFigure());
     }
 
     this->GetDataStorage()->Add(statisticsNode);
 
     QmitkPlotWidget::DataVector::size_type numberOfSpectra = this->m_zSpectrum.size();
 
     QmitkPlotWidget::DataVector means(numberOfSpectra);
     QmitkPlotWidget::DataVector stdevs(numberOfSpectra);
 
     for (unsigned int index = 0; index < numberOfSpectra; ++index)
     {
       means[index] =
         statistics->GetStatisticsForTimeStep(index).GetValueConverted<mitk::ImageStatisticsContainer::RealType>(
           mitk::ImageStatisticsConstants::MEAN());
       stdevs[index] =
         statistics->GetStatisticsForTimeStep(index).GetValueConverted<mitk::ImageStatisticsContainer::RealType>(
           mitk::ImageStatisticsConstants::STANDARDDEVIATION());
     }
 
     QmitkPlotWidget::DataVector xValues = this->m_zSpectrum;
 
     RemoveMZeros(xValues, means, stdevs);
     ::SortVectors(xValues, std::less<qreal>(), xValues, means, stdevs);
 
     unsigned int curveId = this->m_Controls.m_DataViewWidget->InsertCurve("Spectrum");
     this->m_Controls.m_DataViewWidget->SetCurveData(curveId, xValues, means, stdevs, stdevs);
     this->m_Controls.m_DataViewWidget->SetErrorPen(curveId, QPen(Qt::blue));
     QwtSymbol *blueSymbol = new QwtSymbol(QwtSymbol::Rect, QColor(Qt::blue), QColor(Qt::blue), QSize(8, 8));
     this->m_Controls.m_DataViewWidget->SetCurveSymbol(curveId, blueSymbol);
     this->m_Controls.m_DataViewWidget->SetLegendAttribute(curveId, QwtPlotCurve::LegendShowSymbol);
 
     QwtLegend *legend = new QwtLegend();
     legend->setFrameShape(QFrame::Box);
     legend->setFrameShadow(QFrame::Sunken);
     legend->setLineWidth(1);
     this->m_Controls.m_DataViewWidget->SetLegend(legend, QwtPlot::BottomLegend);
 
     m_Controls.m_DataViewWidget->GetPlot()
       ->axisScaleEngine(QwtPlot::Axis::xBottom)
       ->setAttributes(QwtScaleEngine::Inverted);
 
     this->m_Controls.m_DataViewWidget->Replot();
     m_Controls.labelWarning->setVisible(false);
 
     m_Controls.m_StatisticsGroupBox->setEnabled(true);
     m_Controls.m_StatisticsGroupBox->setEnabled(true);
 
     if (this->m_Controls.fixedRangeCheckBox->isChecked())
     {
       this->m_Controls.m_DataViewWidget->GetPlot()->setAxisAutoScale(2, false);
       this->m_Controls.m_DataViewWidget->GetPlot()->setAxisScale(
         2,
         this->m_Controls.fixedRangeLowerDoubleSpinBox->value(),
         this->m_Controls.fixedRangeUpperDoubleSpinBox->value());
     }
     else
     {
       this->m_Controls.m_DataViewWidget->GetPlot()->setAxisAutoScale(2, true);
     }
   }
   else
   {
     m_Controls.labelWarning->setText(m_CalculatorJob->GetLastErrorMessage().c_str());
     m_Controls.labelWarning->setVisible(true);
     this->Clear();
   }
 }
 
 void QmitkCESTStatisticsView::OnFixedRangeDoubleSpinBoxChanged()
 {
   if (this->m_Controls.fixedRangeCheckBox->isChecked())
   {
     this->m_Controls.m_DataViewWidget->GetPlot()->setAxisAutoScale(2, false);
     this->m_Controls.m_DataViewWidget->GetPlot()->setAxisScale(2,
                                                                this->m_Controls.fixedRangeLowerDoubleSpinBox->value(),
                                                                this->m_Controls.fixedRangeUpperDoubleSpinBox->value());
   }
 
   this->m_Controls.m_DataViewWidget->Replot();
 }
 
 template <typename TPixel, unsigned int VImageDimension>
 void QmitkCESTStatisticsView::PlotPointSet(itk::Image<TPixel, VImageDimension> *image)
 {
   this->m_Controls.m_DataViewWidget->SetAxisTitle(QwtPlot::Axis::xBottom, "delta w");
   this->m_Controls.m_DataViewWidget->SetAxisTitle(QwtPlot::Axis::yLeft, "z");
 
   QmitkPlotWidget::DataVector::size_type numberOfSpectra = this->m_zSpectrum.size();
   mitk::PointSet::Pointer internalPointset;
 
   if (m_PointSet.IsNotNull())
   {
     internalPointset = m_PointSet;
   }
   else
   {
     internalPointset = m_CrosshairPointSet;
   }
 
   if (internalPointset.IsNull())
   {
     return;
   }
 
   if (!this->DataSanityCheck())
   {
     m_Controls.labelWarning->setText("Data can not be plotted, internally inconsistent.");
     m_Controls.labelWarning->show();
     return;
   }
 
   auto maxIndex = internalPointset->GetMaxId().Index();
 
   for (std::size_t number = 0; number < maxIndex + 1; ++number)
   {
     mitk::PointSet::PointType point;
     if (!internalPointset->GetPointIfExists(number, &point))
     {
       continue;
     }
 
     if (!this->m_ZImage->GetGeometry()->IsInside(point))
     {
       continue;
     }
 
     itk::Index<3> itkIndex;
 
     this->m_ZImage->GetGeometry()->WorldToIndex(point, itkIndex);
 
     itk::Index<VImageDimension> itkIndexTime;
     itkIndexTime[0] = itkIndex[0];
     itkIndexTime[1] = itkIndex[1];
     itkIndexTime[2] = itkIndex[2];
 
     QmitkPlotWidget::DataVector values(numberOfSpectra);
 
     for (std::size_t step = 0; step < numberOfSpectra; ++step)
     {
       if (VImageDimension == 4)
       {
         itkIndexTime[3] = step;
       }
 
       values[step] = image->GetPixel(itkIndexTime);
     }
 
     std::stringstream name;
     name << "Point " << number;
 
     // Qcolor enums go from 0 to 19, but 19 is transparent and 0,1 are for bitmaps
     // 3 is white and thus not visible
     QColor color(static_cast<Qt::GlobalColor>(number % 17 + 4));
 
     QmitkPlotWidget::DataVector xValues = this->m_zSpectrum;
 
     RemoveMZeros(xValues, values);
     ::SortVectors(xValues, std::less<qreal>(), xValues, values);
 
     unsigned int curveId = this->m_Controls.m_DataViewWidget->InsertCurve(name.str().c_str());
     this->m_Controls.m_DataViewWidget->SetCurveData(curveId, xValues, values);
     this->m_Controls.m_DataViewWidget->SetCurvePen(curveId, QPen(color));
     QwtSymbol *symbol = new QwtSymbol(QwtSymbol::Rect, color, color, QSize(8, 8));
     this->m_Controls.m_DataViewWidget->SetCurveSymbol(curveId, symbol);
     this->m_Controls.m_DataViewWidget->SetLegendAttribute(curveId, QwtPlotCurve::LegendShowSymbol);
   }
 
   if (this->m_Controls.fixedRangeCheckBox->isChecked())
   {
     this->m_Controls.m_DataViewWidget->GetPlot()->setAxisAutoScale(2, false);
     this->m_Controls.m_DataViewWidget->GetPlot()->setAxisScale(2,
                                                                this->m_Controls.fixedRangeLowerDoubleSpinBox->value(),
                                                                this->m_Controls.fixedRangeUpperDoubleSpinBox->value());
   }
   else
   {
     this->m_Controls.m_DataViewWidget->GetPlot()->setAxisAutoScale(2, true);
   }
 
   QwtLegend *legend = new QwtLegend();
   legend->setFrameShape(QFrame::Box);
   legend->setFrameShadow(QFrame::Sunken);
   legend->setLineWidth(1);
   this->m_Controls.m_DataViewWidget->SetLegend(legend, QwtPlot::BottomLegend);
 
   m_Controls.m_DataViewWidget->GetPlot()
     ->axisScaleEngine(QwtPlot::Axis::xBottom)
     ->setAttributes(QwtScaleEngine::Inverted);
 
   this->m_Controls.m_DataViewWidget->Replot();
   m_Controls.labelWarning->setVisible(false);
 }
 
 void QmitkCESTStatisticsView::OnFixedRangeCheckBoxToggled(bool state)
 {
   this->m_Controls.fixedRangeLowerDoubleSpinBox->setEnabled(state);
   this->m_Controls.fixedRangeUpperDoubleSpinBox->setEnabled(state);
 }
 
 void QmitkCESTStatisticsView::RemoveMZeros(QmitkPlotWidget::DataVector &xValues, QmitkPlotWidget::DataVector &yValues)
 {
   QmitkPlotWidget::DataVector tempX;
   QmitkPlotWidget::DataVector tempY;
   for (std::size_t index = 0; index < xValues.size(); ++index)
   {
     if ((xValues.at(index) < -299) || (xValues.at(index)) > 299)
     {
       // do not include
     }
     else
     {
       tempX.push_back(xValues.at(index));
       tempY.push_back(yValues.at(index));
     }
   }
 
   xValues = tempX;
   yValues = tempY;
 }
 
 void QmitkCESTStatisticsView::RemoveMZeros(QmitkPlotWidget::DataVector &xValues,
                                            QmitkPlotWidget::DataVector &yValues,
                                            QmitkPlotWidget::DataVector &stdDevs)
 {
   QmitkPlotWidget::DataVector tempX;
   QmitkPlotWidget::DataVector tempY;
   QmitkPlotWidget::DataVector tempDevs;
   for (std::size_t index = 0; index < xValues.size(); ++index)
   {
     if ((xValues.at(index) < -299) || (xValues.at(index)) > 299)
     {
       // do not include
     }
     else
     {
       tempX.push_back(xValues.at(index));
       tempY.push_back(yValues.at(index));
       tempDevs.push_back(stdDevs.at(index));
     }
   }
 
   xValues = tempX;
   yValues = tempY;
   stdDevs = tempDevs;
 }
 
 void QmitkCESTStatisticsView::OnThreeDimToFourDimPushButtonClicked()
 {
   QList<mitk::DataNode::Pointer> nodes = this->GetDataManagerSelection();
   if (nodes.empty())
     return;
 
   mitk::DataNode *node = nodes.front();
 
   if (!node)
   {
     // Nothing selected. Inform the user and return
     QMessageBox::information(nullptr, "CEST View", "Please load and select an image before starting image processing.");
     return;
   }
 
   // here we have a valid mitk::DataNode
 
   // a node itself is not very useful, we need its data item (the image)
   mitk::BaseData *data = node->GetData();
   if (data)
   {
     // test if this data item is an image or not (could also be a surface or something totally different)
     mitk::Image *image = dynamic_cast<mitk::Image *>(data);
     if (image)
     {
       if (image->GetDimension() == 4)
       {
         AccessFixedDimensionByItk(image, CopyTimesteps, 4);
       }
 
       this->Clear();
     }
   }
 }
 
 template <typename TPixel, unsigned int VImageDimension>
 void QmitkCESTStatisticsView::CopyTimesteps(itk::Image<TPixel, VImageDimension> *image)
 {
   typedef itk::Image<TPixel, VImageDimension> ImageType;
   // typedef itk::PasteImageFilter<ImageType, ImageType>    PasteImageFilterType;
 
   unsigned int numberOfTimesteps = image->GetLargestPossibleRegion().GetSize(3);
 
   typename ImageType::RegionType sourceRegion = image->GetLargestPossibleRegion();
   sourceRegion.SetSize(3, 1);
   typename ImageType::RegionType targetRegion = image->GetLargestPossibleRegion();
   targetRegion.SetSize(3, 1);
 
   for (unsigned int timestep = 1; timestep < numberOfTimesteps; ++timestep)
   {
     targetRegion.SetIndex(3, timestep);
     itk::ImageRegionConstIterator<ImageType> sourceIterator(image, sourceRegion);
     itk::ImageRegionIterator<ImageType> targetIterator(image, targetRegion);
     while (!sourceIterator.IsAtEnd())
     {
       targetIterator.Set(sourceIterator.Get());
 
       ++sourceIterator;
       ++targetIterator;
     }
   }
 }
 
 bool QmitkCESTStatisticsView::SetZSpectrum(mitk::StringProperty *zSpectrumProperty)
 {
   if (zSpectrumProperty == nullptr)
   {
     return false;
   }
   mitk::LocaleSwitch localeSwitch("C");
 
   std::string zSpectrumString = zSpectrumProperty->GetValueAsString();
   std::istringstream iss(zSpectrumString);
   std::vector<std::string> zSpectra;
   std::copy(
     std::istream_iterator<std::string>(iss), std::istream_iterator<std::string>(), std::back_inserter(zSpectra));
 
   m_zSpectrum.clear();
   m_zSpectrum.resize(0);
 
   for (auto const &spectrumString : zSpectra)
   {
     m_zSpectrum.push_back(std::stod(spectrumString));
   }
 
   return (m_zSpectrum.size() > 0);
 }
 
 bool QmitkCESTStatisticsView::DataSanityCheck()
 {
   QmitkPlotWidget::DataVector::size_type numberOfSpectra = m_zSpectrum.size();
 
   // if we do not have a spectrum, the data can not be processed
   if (numberOfSpectra == 0)
   {
     return false;
   }
 
   // if we do not have CEST image data, the data can not be processed
   if (m_ZImage.IsNull())
   {
     return false;
   }
 
   // if the CEST image data and the meta information do not match, the data can not be processed
   if (numberOfSpectra != m_ZImage->GetTimeSteps())
   {
     MITK_INFO << "CEST meta information and number of volumes does not match.";
     return false;
   }
 
   // if we have neither a mask image, a point set nor a mask planar figure, we can not do statistics
   // statistics on the whole image would not make sense
   if (m_MaskImage.IsNull() && m_MaskPlanarFigure.IsNull() && m_PointSet.IsNull() && m_CrosshairPointSet->IsEmpty())
   {
     return false;
   }
 
   // if we have a mask image and a mask planar figure, we can not do statistics
   // we do not know which one to use
   if (m_MaskImage.IsNotNull() && m_MaskPlanarFigure.IsNotNull())
   {
     return false;
   }
 
   return true;
 }
 
 void QmitkCESTStatisticsView::Clear()
 {
   this->m_zSpectrum.clear();
   this->m_zSpectrum.resize(0);
   this->m_ZImage = nullptr;
   this->m_MaskImage = nullptr;
   this->m_MaskPlanarFigure = nullptr;
   this->m_PointSet = nullptr;
   this->m_Controls.m_DataViewWidget->Clear();
   this->m_Controls.m_StatisticsGroupBox->setEnabled(false);
   this->m_Controls.widget_statistics->SetImageNodes({});
   this->m_Controls.widget_statistics->SetMaskNodes({});
 }
 
 void QmitkCESTStatisticsView::OnSliceChanged()
 {
-  mitk::Point3D currentSelectedPosition = this->GetRenderWindowPart()->GetSelectedPosition(nullptr);
-  mitk::TimePointType currentSelectedTimePoint = this->GetRenderWindowPart()->GetSelectedTimePoint();
+  auto* renderWindowPart = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN);
+  auto currentSelectedPosition = renderWindowPart->GetSelectedPosition(nullptr);
+  auto currentSelectedTimePoint = renderWindowPart->GetSelectedTimePoint();
 
   if (m_currentSelectedPosition != currentSelectedPosition || m_currentSelectedTimePoint != currentSelectedTimePoint)
   //|| m_selectedNodeTime > m_currentPositionTime)
   {
     // the current position has been changed or the selected node has been changed since the last position validation ->
     // check position
     m_currentSelectedPosition = currentSelectedPosition;
     m_currentSelectedTimePoint = currentSelectedTimePoint;
     m_currentPositionTime.Modified();
 
     m_CrosshairPointSet->Clear();
 
     m_CrosshairPointSet->SetPoint(0, m_currentSelectedPosition);
 
     QList<mitk::DataNode::Pointer> nodes = this->GetDataManagerSelection();
     if (nodes.empty() || nodes.size() > 1)
       return;
 
     mitk::DataNode *node = nodes.front();
 
     if (!node)
     {
       return;
     }
 
     if (dynamic_cast<mitk::Image *>(node->GetData()) != nullptr)
     {
       m_Controls.labelWarning->setVisible(false);
       bool zSpectrumSet = SetZSpectrum(dynamic_cast<mitk::StringProperty *>(
         node->GetData()->GetProperty(mitk::CEST_PROPERTY_NAME_OFFSETS().c_str()).GetPointer()));
 
       if (zSpectrumSet)
       {
         m_ZImage = dynamic_cast<mitk::Image *>(node->GetData());
       }
       else
       {
         return;
       }
     }
     else
     {
       return;
     }
 
     this->m_Controls.m_DataViewWidget->Clear();
 
     AccessFixedDimensionByItk(m_ZImage, PlotPointSet, 4);
   }
 }
diff --git a/Plugins/org.mitk.gui.qt.dicominspector/src/internal/QmitkDicomInspectorView.cpp b/Plugins/org.mitk.gui.qt.dicominspector/src/internal/QmitkDicomInspectorView.cpp
index 531f020f2b..5b601b2f03 100644
--- a/Plugins/org.mitk.gui.qt.dicominspector/src/internal/QmitkDicomInspectorView.cpp
+++ b/Plugins/org.mitk.gui.qt.dicominspector/src/internal/QmitkDicomInspectorView.cpp
@@ -1,376 +1,377 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 // Blueberry
 #include <berryISelectionService.h>
 #include <berryIWorkbenchWindow.h>
 #include <berryIWorkbenchPage.h>
 
 // mitk
 #include <QmitkRenderWindow.h>
 #include <mitkImagePixelReadAccessor.h>
 #include <mitkPixelTypeMultiplex.h>
 
 // Qt
 #include <QMessageBox>
 #include <QMessageBox>
 #include <QFileDialog>
 #include <qwt_plot_marker.h>
 
 #include "QmitkDicomInspectorView.h"
 
 const std::string QmitkDicomInspectorView::VIEW_ID = "org.mitk.views.dicominspector";
 
 QmitkDicomInspectorView::ObserverInfo::ObserverInfo(mitk::SliceNavigationController* controller,
   int observerTag, const std::string& renderWindowName, mitk::IRenderWindowPart* part) : controller(controller), observerTag(observerTag),
   renderWindowName(renderWindowName), renderWindowPart(part)
 {
 }
 
 QmitkDicomInspectorView::QmitkDicomInspectorView()
   : m_RenderWindowPart(nullptr)
   , m_PendingSliceChangedEvent(false)
   , m_SelectedNode(nullptr)
   , m_SelectedTimePoint(0.)
   , m_CurrentSelectedZSlice(0)
 {
   m_SelectedPosition.Fill(0.0);
 }
 
 QmitkDicomInspectorView::~QmitkDicomInspectorView()
 {
   this->RemoveAllObservers();
 }
 
 void QmitkDicomInspectorView::RenderWindowPartActivated(mitk::IRenderWindowPart* renderWindowPart)
 {
   if (m_RenderWindowPart != renderWindowPart)
   {
     m_RenderWindowPart = renderWindowPart;
 
     if (!InitObservers())
     {
       QMessageBox::information(nullptr, "Error", "Unable to set up the event observers. The " \
         "plot will not be triggered on changing the crosshair, " \
         "position or time step.");
     }
   }
 }
 
 void QmitkDicomInspectorView::RenderWindowPartDeactivated(mitk::IRenderWindowPart* renderWindowPart)
 {
   m_RenderWindowPart = nullptr;
   this->RemoveAllObservers(renderWindowPart);
 }
 
 void QmitkDicomInspectorView::CreateQtPartControl(QWidget* parent)
 {
   // create GUI widgets from the Qt Designer's .ui file
   m_Controls.setupUi(parent);
 
   m_Controls.singleSlot->SetDataStorage(GetDataStorage());
   m_Controls.singleSlot->SetSelectionIsOptional(true);
   m_Controls.singleSlot->SetEmptyInfo(QString("Please select a data node"));
   m_Controls.singleSlot->SetPopUpTitel(QString("Select data node"));
 
   m_SelectionServiceConnector = std::make_unique<QmitkSelectionServiceConnector>();
   SetAsSelectionListener(true);
 
   m_Controls.timePointValueLabel->setText(QString(""));
   m_Controls.sliceNumberValueLabel->setText(QString(""));
 
   connect(m_Controls.singleSlot, &QmitkSingleNodeSelectionWidget::CurrentSelectionChanged,
     this, &QmitkDicomInspectorView::OnCurrentSelectionChanged);
 
   mitk::IRenderWindowPart* renderWindowPart = GetRenderWindowPart();
   RenderWindowPartActivated(renderWindowPart);
 }
 
 bool QmitkDicomInspectorView::InitObservers()
 {
   bool result = true;
 
   typedef QHash<QString, QmitkRenderWindow*> WindowMapType;
   WindowMapType windowMap = m_RenderWindowPart->GetQmitkRenderWindows();
 
   auto i = windowMap.begin();
 
   while (i != windowMap.end())
   {
     mitk::SliceNavigationController* sliceNavController =
       i.value()->GetSliceNavigationController();
 
     if (sliceNavController)
     {
       auto cmdSliceEvent = itk::SimpleMemberCommand<QmitkDicomInspectorView>::New();
       cmdSliceEvent->SetCallbackFunction(this, &QmitkDicomInspectorView::OnSliceChanged);
       int tag = sliceNavController->AddObserver(
         mitk::SliceNavigationController::GeometrySliceEvent(nullptr, 0), cmdSliceEvent);
 
       m_ObserverMap.insert(std::make_pair(sliceNavController, ObserverInfo(sliceNavController, tag,
         i.key().toStdString(), m_RenderWindowPart)));
 
       auto cmdTimeEvent = itk::SimpleMemberCommand<QmitkDicomInspectorView>::New();
       cmdTimeEvent->SetCallbackFunction(this, &QmitkDicomInspectorView::OnSliceChanged);
       tag = sliceNavController->AddObserver(
         mitk::SliceNavigationController::GeometryTimeEvent(nullptr, 0), cmdTimeEvent);
 
       m_ObserverMap.insert(std::make_pair(sliceNavController, ObserverInfo(sliceNavController, tag,
         i.key().toStdString(), m_RenderWindowPart)));
 
       auto cmdDelEvent = itk::MemberCommand<QmitkDicomInspectorView>::New();
       cmdDelEvent->SetCallbackFunction(this, &QmitkDicomInspectorView::OnSliceNavigationControllerDeleted);
       tag = sliceNavController->AddObserver(itk::DeleteEvent(), cmdDelEvent);
 
       m_ObserverMap.insert(std::make_pair(sliceNavController, ObserverInfo(sliceNavController, tag,
         i.key().toStdString(), m_RenderWindowPart)));
     }
 
     ++i;
 
     result = result && sliceNavController;
   }
 
   return result;
 }
 
 void QmitkDicomInspectorView::RemoveObservers(const mitk::SliceNavigationController* deletedSlicer)
 {
   std::pair<ObserverMapType::const_iterator, ObserverMapType::const_iterator> obsRange =
     m_ObserverMap.equal_range(deletedSlicer);
 
   for (ObserverMapType::const_iterator pos = obsRange.first; pos != obsRange.second; ++pos)
   {
     pos->second.controller->RemoveObserver(pos->second.observerTag);
   }
 
   m_ObserverMap.erase(deletedSlicer);
 }
 
 void QmitkDicomInspectorView::RemoveAllObservers(mitk::IRenderWindowPart* deletedPart)
 {
   for (ObserverMapType::const_iterator pos = m_ObserverMap.begin(); pos != m_ObserverMap.end();)
   {
     ObserverMapType::const_iterator delPos = pos++;
 
     if (nullptr == deletedPart || deletedPart == delPos->second.renderWindowPart)
     {
       delPos->second.controller->RemoveObserver(delPos->second.observerTag);
       m_ObserverMap.erase(delPos);
     }
   }
 }
 
 void QmitkDicomInspectorView::OnCurrentSelectionChanged(QList<mitk::DataNode::Pointer> nodes)
 {
   if (nodes.empty() || nodes.front().IsNull())
   {
     m_SelectedNode = nullptr;
     m_SelectedData = nullptr;
     UpdateData();
     return;
   }
 
   if (nodes.front() != this->m_SelectedNode)
   {
     // node is selected, create DICOM tag table
     m_SelectedNode = nodes.front();
     m_SelectedData = this->m_SelectedNode->GetData();
 
     m_SelectedNodeTime.Modified();
     UpdateData();
     OnSliceChangedDelayed();
   }
 }
 
 void QmitkDicomInspectorView::OnSliceChanged()
 {
   // Taken from QmitkStdMultiWidget::HandleCrosshairPositionEvent().
   // Since there are always 3 events arriving (one for each render window) every time the slice
   // or time changes, the slot OnSliceChangedDelayed is triggered - and only if it hasn't been
   // triggered yet - so it is only executed once for every slice/time change.
   if (!m_PendingSliceChangedEvent)
   {
     m_PendingSliceChangedEvent = true;
 
     QTimer::singleShot(0, this, SLOT(OnSliceChangedDelayed()));
   }
 }
 
 void QmitkDicomInspectorView::OnSliceNavigationControllerDeleted(const itk::Object* sender, const itk::EventObject& /*e*/)
 {
   auto sendingSlicer = dynamic_cast<const mitk::SliceNavigationController*>(sender);
 
   this->RemoveObservers(sendingSlicer);
 }
 
 void QmitkDicomInspectorView::ValidateAndSetCurrentPosition()
 {
-  mitk::Point3D currentSelectedPosition = GetRenderWindowPart()->GetSelectedPosition(nullptr);
-  const auto currentSelectedTimePoint = GetRenderWindowPart()->GetSelectedTimePoint();
+  auto* renderWindowPart = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN);
+  auto currentSelectedPosition = renderWindowPart->GetSelectedPosition(nullptr);
+  const auto currentSelectedTimePoint = renderWindowPart->GetSelectedTimePoint();
 
   if (m_SelectedPosition != currentSelectedPosition
     || m_SelectedTimePoint != currentSelectedTimePoint
     || m_SelectedNodeTime > m_CurrentPositionTime)
   {
     // the current position has been changed, the selected node has been changed since
     // the last position validation or the current time position has been changed -> check position
     m_SelectedPosition = currentSelectedPosition;
     m_SelectedTimePoint = currentSelectedTimePoint;
     m_CurrentPositionTime.Modified();
     m_ValidSelectedPosition = false;
 
     if (m_SelectedData.IsNull())
     {
       return;
     }
 
     mitk::BaseGeometry::Pointer geometry = m_SelectedData->GetTimeGeometry()->GetGeometryForTimePoint(m_SelectedTimePoint);
 
     // check for invalid time step
     if (geometry.IsNull())
     {
       geometry = m_SelectedData->GetTimeGeometry()->GetGeometryForTimeStep(0);
     }
 
     if (geometry.IsNull())
     {
       return;
     }
 
     m_ValidSelectedPosition = geometry->IsInside(m_SelectedPosition);
     itk::Index<3> index;
     geometry->WorldToIndex(m_SelectedPosition, index);
 
     m_CurrentSelectedZSlice = index[2];
   }
 }
 
 void QmitkDicomInspectorView::OnSliceChangedDelayed()
 {
   m_PendingSliceChangedEvent = false;
 
   ValidateAndSetCurrentPosition();
 
   m_Controls.tableTags->setEnabled(m_ValidSelectedPosition);
 
   if (m_SelectedNode.IsNotNull())
   {
     RenderTable();
   }
 }
 
 void QmitkDicomInspectorView::RenderTable()
 {
   assert(nullptr != m_RenderWindowPart);
 
   const auto timeStep = (m_SelectedData.IsNull()) ? 0 : m_SelectedData->GetTimeGeometry()->TimePointToTimeStep(m_SelectedTimePoint);
 
   unsigned int rowIndex = 0;
   for (const auto& element : m_Tags)
   {
     QTableWidgetItem* newItem = new QTableWidgetItem(QString::fromStdString(
       element.second.prop->GetValue(timeStep, m_CurrentSelectedZSlice, true, true)));
     m_Controls.tableTags->setItem(rowIndex, 3, newItem);
     ++rowIndex;
   }
 
   UpdateLabels();
 }
 
 void QmitkDicomInspectorView::UpdateData()
 {
   QStringList headers;
 
   m_Controls.tableTags->horizontalHeader()->resizeSections(QHeaderView::ResizeToContents);
 
   m_Tags.clear();
 
   if (m_SelectedData.IsNotNull())
   {
     for (const auto& element : *(m_SelectedData->GetPropertyList()->GetMap()))
     {
       if (element.first.find("DICOM") == 0)
       {
         std::istringstream stream(element.first);
         std::string token;
         std::getline(stream, token, '.'); //drop the DICOM suffix
         std::getline(stream, token, '.'); //group id
         unsigned long dcmgroup = std::stoul(token, nullptr, 16);
         std::getline(stream, token, '.'); //element id
         unsigned long dcmelement = std::stoul(token, nullptr, 16);
 
         TagInfo info(mitk::DICOMTag(dcmgroup, dcmelement), dynamic_cast<const mitk::DICOMProperty*>(element.second.GetPointer()));
 
         m_Tags.insert(std::make_pair(element.first, info));
       }
     }
   }
 
   m_Controls.tableTags->setRowCount(m_Tags.size());
 
   unsigned int rowIndex = 0;
   for (const auto& element : m_Tags)
   {
     QTableWidgetItem* newItem = new QTableWidgetItem(QString::number(element.second.tag.GetGroup(), 16));
     m_Controls.tableTags->setItem(rowIndex, 0, newItem);
     newItem = new QTableWidgetItem(QString::number(element.second.tag.GetElement(), 16));
     m_Controls.tableTags->setItem(rowIndex, 1, newItem);
     newItem = new QTableWidgetItem(QString::fromStdString(element.second.tag.GetName()));
     m_Controls.tableTags->setItem(rowIndex, 2, newItem);
     newItem = new QTableWidgetItem(QString::fromStdString(element.second.prop->GetValue()));
     m_Controls.tableTags->setItem(rowIndex, 3, newItem);
     ++rowIndex;
   }
 
   UpdateLabels();
 }
 
 void QmitkDicomInspectorView::UpdateLabels()
 {
   if (m_SelectedData.IsNull())
   {
     m_Controls.timePointValueLabel->setText(QString(""));
     m_Controls.sliceNumberValueLabel->setText(QString(""));
   }
   else
   {
     const auto timeStep = m_SelectedData->GetTimeGeometry()->TimePointToTimeStep(m_SelectedTimePoint);
 
     if (m_ValidSelectedPosition)
     {
       m_Controls.timePointValueLabel->setText(QString::number(timeStep) + QStringLiteral("(")+ QString::number(m_SelectedTimePoint/1000.) + QStringLiteral(" [s])"));
       m_Controls.sliceNumberValueLabel->setText(QString::number(m_CurrentSelectedZSlice));
     }
     else
     {
       m_Controls.timePointValueLabel->setText(QString("outside data geometry"));
       m_Controls.sliceNumberValueLabel->setText(QString("outside data geometry"));
     }
   }
 }
 
 void QmitkDicomInspectorView::SetAsSelectionListener(bool checked)
 {
   if (checked)
   {
     m_SelectionServiceConnector->AddPostSelectionListener(GetSite()->GetWorkbenchWindow()->GetSelectionService());
     connect(m_SelectionServiceConnector.get(), &QmitkSelectionServiceConnector::ServiceSelectionChanged,
       m_Controls.singleSlot, &QmitkSingleNodeSelectionWidget::SetCurrentSelection);
   }
   else
   {
     m_SelectionServiceConnector->RemovePostSelectionListener();
     disconnect(m_SelectionServiceConnector.get(), &QmitkSelectionServiceConnector::ServiceSelectionChanged,
       m_Controls.singleSlot, &QmitkSingleNodeSelectionWidget::SetCurrentSelection);
   }
 }
diff --git a/Plugins/org.mitk.gui.qt.eventrecorder/src/internal/InteractionEventRecorder.cpp b/Plugins/org.mitk.gui.qt.eventrecorder/src/internal/InteractionEventRecorder.cpp
index f77850a43d..99584a9962 100644
--- a/Plugins/org.mitk.gui.qt.eventrecorder/src/internal/InteractionEventRecorder.cpp
+++ b/Plugins/org.mitk.gui.qt.eventrecorder/src/internal/InteractionEventRecorder.cpp
@@ -1,156 +1,156 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 
 // Blueberry
 #include <berryISelectionService.h>
 #include <berryIWorkbenchWindow.h>
 
 // Qmitk
 #include "InteractionEventRecorder.h"
 
 // Qt
 #include <QMessageBox>
 #include <QFileDialog>
 // us
 #include "usGetModuleContext.h"
 #include "usModuleContext.h"
 #include "usModuleResource.h"
 
 #include <usModuleInitialization.h>
 #include <mitkXML2EventParser.h>
 #include <vtkSmartPointer.h>
 #include "QmitkRenderWindow.h"
 
 
 US_INITIALIZE_MODULE
 
 
 const std::string InteractionEventRecorder::VIEW_ID = "org.mitk.views.interactioneventrecorder";
 
 void InteractionEventRecorder::SetFocus()
 {
   m_Controls.textFileName->setFocus();
 }
 
 void InteractionEventRecorder::StartRecording()
 {
 
   MITK_INFO << "Start Recording";
   MITK_INFO << "Performing Reinit";
   mitk::RenderingManager::GetInstance()->InitializeViewsByBoundingObjects(this->GetDataStorage());
 
   m_CurrentObserver->SetOutputFile(m_Controls.textFileName->text().toStdString());
   m_CurrentObserver->StartRecording();
 }
 
 void InteractionEventRecorder::StopRecording()
 {
   MITK_INFO << "Stop Recording";
   m_CurrentObserver->StopRecording();
 }
 
 void InteractionEventRecorder::Play()
 {
   std::ifstream xmlStream(m_Controls.textFileName->text().toStdString().c_str());
   mitk::XML2EventParser parser(xmlStream);
   mitk::XML2EventParser::EventContainerType events = parser.GetInteractions();
 
   MITK_INFO << "parsed events";
+
   for (std::size_t i=0; i < events.size(); ++i)
-  {
-    //this->GetRenderWindowPart()->GetQmitkRenderWindow("axial")->GetRenderer()->GetDispatcher()->ProcessEvent(events.at(i));
     events.at(i)->GetSender()->GetDispatcher()->ProcessEvent(events.at(i));
-  }
-  MITK_INFO << "DONE";
 
+  MITK_INFO << "DONE";
 }
 
 void InteractionEventRecorder::OpenFile()
 {
   QString fn = QFileDialog::getOpenFileName(nullptr, "Open File...",
                                             QString(), "All Files (*)");
   if (!fn.isEmpty())
     this->m_Controls.textFileName->setText(fn);
 }
 
 void InteractionEventRecorder::RotatePlanes()
 {
   mitk::Point3D center;
   center.Fill(0);
   mitk::Vector3D firstVec;
   mitk::Vector3D secondVec;
 
   firstVec[0] = 1.0;
   firstVec[1] = .5;
   firstVec[2] = .25;
 
   secondVec[0] = 1;
   secondVec[1] = .25;
   secondVec[2] = 1;
 
   // Rotate Planes to a predefined state which can later be used again in tests
-  this->GetRenderWindowPart()->GetQmitkRenderWindow("axial")->GetSliceNavigationController()->ReorientSlices( center, firstVec,secondVec );
-  this->GetRenderWindowPart()->GetQmitkRenderWindow("axial")->GetRenderer()->RequestUpdate();
+  auto* axialRenderWindow = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetQmitkRenderWindow("axial");
+  axialRenderWindow->GetSliceNavigationController()->ReorientSlices( center, firstVec,secondVec );
+  axialRenderWindow->GetRenderer()->RequestUpdate();
 
 }
 
 void InteractionEventRecorder::RotateView()
 {
   // Rotate the view in 3D to a predefined state which can later be used again in tests
   // this simulates a prior VTK Interaction
 
   vtkRenderWindow* renderWindow = mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget3");
 
   if (renderWindow == nullptr)
     return;
 
   mitk::Stepper* stepper = mitk::BaseRenderer::GetInstance(renderWindow)->GetCameraRotationController()->GetSlice();
 
   if (stepper == nullptr)
     return;
 
   unsigned int newPos = 17;
 
 
   stepper->SetPos(newPos);
 
-  this->GetRenderWindowPart()->GetQmitkRenderWindow("axial")->GetRenderer()->RequestUpdate();
+  auto* axialRenderWindow = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetQmitkRenderWindow("axial");
+  axialRenderWindow->GetRenderer()->RequestUpdate();
 }
 
 void InteractionEventRecorder::CreateQtPartControl( QWidget *parent )
 {
   // create GUI widgets from the Qt Designer's .ui file
   m_Controls.setupUi( parent );
   connect( m_Controls.btnStopRecording, SIGNAL(clicked()), this, SLOT(StopRecording()) );
   connect( m_Controls.btnStartRecording, SIGNAL(clicked()), this, SLOT(StartRecording()) );
   connect( m_Controls.btnPlay, SIGNAL(clicked()), this, SLOT(Play()) );
   connect( m_Controls.btnOpenFile, SIGNAL(clicked()), this, SLOT(OpenFile()) );
   connect( m_Controls.rotatePlanes, SIGNAL(clicked()), this, SLOT(RotatePlanes()) );
   connect( m_Controls.rotate3D, SIGNAL(clicked()), this, SLOT(RotateView()) );
 
   m_CurrentObserver = new mitk::EventRecorder();
   // Register as listener via micro services
   us::ServiceProperties props;
 
   props["name"] = std::string("EventRecorder");
   m_ServiceRegistration = us::GetModuleContext()->RegisterService<mitk::InteractionEventObserver>(m_CurrentObserver,props);
 
 
   /*
 
 delete m_CurrentObserverDEBUG;
   m_ServiceRegistrationDEBUG.Unregister();
   */
 }
 
 
diff --git a/Plugins/org.mitk.gui.qt.fit.inspector/src/internal/ModelFitInspectorView.cpp b/Plugins/org.mitk.gui.qt.fit.inspector/src/internal/ModelFitInspectorView.cpp
index 89d950ed79..2a44448ab0 100644
--- a/Plugins/org.mitk.gui.qt.fit.inspector/src/internal/ModelFitInspectorView.cpp
+++ b/Plugins/org.mitk.gui.qt.fit.inspector/src/internal/ModelFitInspectorView.cpp
@@ -1,920 +1,920 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 
 // Blueberry
 #include <berryISelectionService.h>
 #include <berryIWorkbenchWindow.h>
 #include <berryIWorkbenchPage.h>
 
 // mitk
 #include <QmitkRenderWindow.h>
 
 // Qt
 #include <QMessageBox>
 #include <QFileDialog>
 #include <QTableWidget>
 #include <qwt_plot_marker.h>
 #include "QmitkPlotWidget.h"
 
 #include "mitkNodePredicateFunction.h"
 #include "mitkScalarListLookupTableProperty.h"
 #include "mitkModelFitConstants.h"
 #include "mitkExtractTimeGrid.h"
 #include "mitkModelGenerator.h"
 #include "mitkModelFitException.h"
 #include "mitkModelFitParameterValueExtraction.h"
 #include "mitkTimeGridHelper.h"
 #include "mitkModelFitResultRelationRule.h"
 
 #include "mitkModelFitPlotDataHelper.h"
 
 #include "ModelFitInspectorView.h"
 
 const std::string ModelFitInspectorView::VIEW_ID = "org.mitk.views.fit.inspector";
 const unsigned int ModelFitInspectorView::INTERPOLATION_STEPS = 10;
 const std::string DEFAULT_X_AXIS = "Time [s]";
 
 ModelFitInspectorView::ModelFitInspectorView() :
   m_renderWindowPart(nullptr),
   m_internalUpdateFlag(false),
   m_currentFit(nullptr),
   m_currentModelParameterizer(nullptr),
   m_currentModelProviderService(nullptr),
   m_currentSelectedTimeStep(0),
   m_currentSelectedNode(nullptr)
 
 {
   m_currentSelectedPosition.Fill(0.0);
   m_modelfitList.clear();
 }
 
 ModelFitInspectorView::~ModelFitInspectorView()
 {
 }
 
 void ModelFitInspectorView::RenderWindowPartActivated(mitk::IRenderWindowPart* renderWindowPart)
 {
   if (m_renderWindowPart != renderWindowPart)
   {
     m_renderWindowPart = renderWindowPart;
   }
 
   this->m_SliceChangeListener.RenderWindowPartActivated(renderWindowPart);
 }
 
 void ModelFitInspectorView::RenderWindowPartDeactivated(
   mitk::IRenderWindowPart* renderWindowPart)
 {
   m_renderWindowPart = nullptr;
   this->m_SliceChangeListener.RenderWindowPartDeactivated(renderWindowPart);
 }
 
 void ModelFitInspectorView::CreateQtPartControl(QWidget* parent)
 {
   m_Controls.setupUi(parent);
 
   m_SelectionServiceConnector = std::make_unique<QmitkSelectionServiceConnector>();
   m_SelectionServiceConnector->AddPostSelectionListener(this->GetSite()->GetWorkbenchWindow()->GetSelectionService());
 
   m_Controls.inputNodeSelector->SetDataStorage(GetDataStorage());
   m_Controls.inputNodeSelector->SetEmptyInfo(QString("Please select input data to be viewed."));
   m_Controls.inputNodeSelector->SetInvalidInfo(QString("<b><font color=\"red\">No input data is selected</font></b>"));
   m_Controls.inputNodeSelector->SetPopUpTitel(QString("Choose 3D+t input data that should be viewed!"));
   m_Controls.inputNodeSelector->SetSelectionIsOptional(false);
   m_Controls.inputNodeSelector->SetSelectOnlyVisibleNodes(true);
 
   auto predicate = mitk::NodePredicateFunction::New([](const mitk::DataNode *node) {
     bool isModelFitNode = node->GetData() && node->GetData()->GetProperty(mitk::ModelFitConstants::FIT_UID_PROPERTY_NAME().c_str()).IsNotNull();
     return isModelFitNode || (node && node->GetData() && node->GetData()->GetTimeSteps() > 1);
   });
 
   m_Controls.inputNodeSelector->SetNodePredicate(predicate);
 
   connect(m_SelectionServiceConnector.get(), &QmitkSelectionServiceConnector::ServiceSelectionChanged, m_Controls.inputNodeSelector, &QmitkSingleNodeSelectionWidget::SetCurrentSelection);
   connect(m_Controls.inputNodeSelector, &QmitkAbstractNodeSelectionWidget::CurrentSelectionChanged, this, &ModelFitInspectorView::OnInputChanged);
 
   this->m_SliceChangeListener.RenderWindowPartActivated(this->GetRenderWindowPart());
   connect(&m_SliceChangeListener, SIGNAL(SliceChanged()), this, SLOT(OnSliceChanged()));
 
   connect(m_Controls.cmbFit, SIGNAL(currentIndexChanged(int)), this,
           SLOT(OnFitSelectionChanged(int)));
 
   connect(m_Controls.radioScaleFixed, SIGNAL(toggled(bool)), m_Controls.sbFixMin,
           SLOT(setEnabled(bool)));
   connect(m_Controls.radioScaleFixed, SIGNAL(toggled(bool)), m_Controls.sbFixMax,
           SLOT(setEnabled(bool)));
   connect(m_Controls.radioScaleFixed, SIGNAL(toggled(bool)), m_Controls.labelFixMin,
           SLOT(setEnabled(bool)));
   connect(m_Controls.radioScaleFixed, SIGNAL(toggled(bool)), m_Controls.labelFixMax,
           SLOT(setEnabled(bool)));
   connect(m_Controls.radioScaleFixed, SIGNAL(toggled(bool)), m_Controls.btnScaleToData,
           SLOT(setEnabled(bool)));
 
   connect(m_Controls.radioScaleFixed, SIGNAL(toggled(bool)), this, SLOT(OnScaleFixedYChecked(bool)));
 
   connect(m_Controls.btnScaleToData, SIGNAL(clicked()), this, SLOT(OnScaleToDataYClicked()));
   connect(m_Controls.sbFixMax, SIGNAL(valueChanged(double)), this,
           SLOT(OnFixedScalingYChanged(double)));
   connect(m_Controls.sbFixMin, SIGNAL(valueChanged(double)), this,
           SLOT(OnFixedScalingYChanged(double)));
 
   connect(m_Controls.radioScaleFixed_x, SIGNAL(toggled(bool)), m_Controls.sbFixMin_x,
     SLOT(setEnabled(bool)));
   connect(m_Controls.radioScaleFixed_x, SIGNAL(toggled(bool)), m_Controls.sbFixMax_x,
     SLOT(setEnabled(bool)));
   connect(m_Controls.radioScaleFixed_x, SIGNAL(toggled(bool)), m_Controls.labelFixMin_x,
     SLOT(setEnabled(bool)));
   connect(m_Controls.radioScaleFixed_x, SIGNAL(toggled(bool)), m_Controls.labelFixMax_x,
     SLOT(setEnabled(bool)));
   connect(m_Controls.radioScaleFixed_x, SIGNAL(toggled(bool)), m_Controls.btnScaleToData_x,
     SLOT(setEnabled(bool)));
 
   connect(m_Controls.radioScaleFixed_x, SIGNAL(toggled(bool)), this, SLOT(OnScaleFixedXChecked(bool)));
 
   connect(m_Controls.btnScaleToData_x, SIGNAL(clicked()), this, SLOT(OnScaleToDataXClicked()));
   connect(m_Controls.sbFixMax_x, SIGNAL(valueChanged(double)), this,
     SLOT(OnFixedScalingXChanged(double)));
   connect(m_Controls.sbFixMin_x, SIGNAL(valueChanged(double)), this,
     SLOT(OnFixedScalingXChanged(double)));
 
   connect(m_Controls.btnFullPlot, SIGNAL(clicked(bool)), this, SLOT(OnFullPlotClicked(bool)));
 
   this->EnsureBookmarkPointSet();
   m_Controls.inspectionPositionWidget->SetPositionBookmarkNode(m_PositionBookmarksNode.Lock());
 
   connect(m_Controls.inspectionPositionWidget, SIGNAL(PositionBookmarksChanged()), this, SLOT(OnPositionBookmarksChanged()));
 
   // For some reason this needs to be called to set the plot widget's minimum width to an
   // acceptable level (since Qwt 6).
   // Otherwise it tries to keep both axes equal in length, resulting in a minimum width of
   // 400-500px which is way too much.
   m_Controls.widgetPlot->GetPlot()->updateAxes();
 
   m_Controls.cmbFit->clear();
 
   mitk::IRenderWindowPart* renderWindowPart = GetRenderWindowPart();
   RenderWindowPartActivated(renderWindowPart);
 }
 
 void ModelFitInspectorView::SetFocus()
 {
 }
 
 void ModelFitInspectorView::NodeRemoved(const mitk::DataNode* node)
 {
   if (node == this->m_currentSelectedNode)
   {
     QmitkSingleNodeSelectionWidget::NodeList emptylist;
     this->m_Controls.inputNodeSelector->SetCurrentSelection(emptylist);
   }
 }
 
 void ModelFitInspectorView::OnScaleFixedYChecked(bool checked)
 {
   m_Controls.widgetPlot->GetPlot()->setAxisAutoScale(QwtPlot::yLeft, !checked);
 
   if (checked)
   {
     OnScaleToDataYClicked();
   }
 
   m_Controls.widgetPlot->GetPlot()->replot();
 };
 
 void ModelFitInspectorView::OnScaleFixedXChecked(bool checked)
 {
   m_Controls.widgetPlot->GetPlot()->setAxisAutoScale(QwtPlot::xBottom, !checked);
 
   if (checked)
   {
     OnScaleToDataXClicked();
   }
 
   m_Controls.widgetPlot->GetPlot()->replot();
 };
 
 void ModelFitInspectorView::OnScaleToDataYClicked()
 {
   auto minmax = this->m_PlotCurves.GetYMinMax();
 
   auto min = minmax.first - std::abs(minmax.first) * 0.01;
   auto max = minmax.second + std::abs(minmax.second) * 0.01;
 
   m_Controls.sbFixMin->setValue(min);
   m_Controls.sbFixMax->setValue(max);
 };
 
 void ModelFitInspectorView::OnScaleToDataXClicked()
 {
   auto minmax = this->m_PlotCurves.GetXMinMax();
 
   auto min = minmax.first - std::abs(minmax.first) * 0.01;
   auto max = minmax.second + std::abs(minmax.second) * 0.01;
 
   m_Controls.sbFixMin_x->setValue(min);
   m_Controls.sbFixMax_x->setValue(max);
 };
 
 void ModelFitInspectorView::OnFixedScalingYChanged(double /*value*/)
 {
   m_Controls.widgetPlot->GetPlot()->setAxisScale(QwtPlot::yLeft, m_Controls.sbFixMin->value(),
       m_Controls.sbFixMax->value());
   m_Controls.widgetPlot->GetPlot()->replot();
 };
 
 void ModelFitInspectorView::OnFixedScalingXChanged(double /*value*/)
 {
   m_Controls.widgetPlot->GetPlot()->setAxisScale(QwtPlot::xBottom, m_Controls.sbFixMin_x->value(),
     m_Controls.sbFixMax_x->value());
   m_Controls.widgetPlot->GetPlot()->replot();
 };
 
 void ModelFitInspectorView::OnFullPlotClicked(bool checked)
 {
   m_Controls.tabWidget->setVisible(!checked);
 };
 
 int ModelFitInspectorView::ActualizeFitSelectionWidget()
 {
   mitk::modelFit::ModelFitInfo::UIDType selectedFitUD = "";
   bool isModelFitNode = false;
   if (this->m_Controls.inputNodeSelector->GetSelectedNode().IsNotNull())
   {
     isModelFitNode = this->m_Controls.inputNodeSelector->GetSelectedNode()->GetData()->GetPropertyList()->GetStringProperty(
       mitk::ModelFitConstants::FIT_UID_PROPERTY_NAME().c_str(), selectedFitUD);
   }
 
   mitk::DataStorage::Pointer storage = this->GetDataStorage();
 
   mitk::modelFit::NodeUIDSetType fitUIDs = mitk::modelFit::GetFitUIDsOfNode(
     this->m_currentSelectedNode, storage);
 
   this->m_modelfitList.clear();
   this->m_Controls.cmbFit->clear();
 
   for (const auto & fitUID : fitUIDs)
   {
     mitk::modelFit::ModelFitInfo::ConstPointer info = mitk::modelFit::CreateFitInfoFromNode(fitUID,
       storage).GetPointer();
 
     if (info.IsNotNull())
     {
       this->m_modelfitList.insert(std::make_pair(info->uid, info));
       std::ostringstream nameStrm;
       if (info->fitName.empty())
       {
         nameStrm << info->uid;
       }
       else
       {
         nameStrm << info->fitName;
       }
       nameStrm << " (" << info->modelName << ")";
       QVariant data(info->uid.c_str());
       m_Controls.cmbFit->addItem(QString::fromStdString(nameStrm.str()), data);
     }
     else
     {
       MITK_ERROR <<
         "Was not able to extract model fit information from storage. Node properties in storage may be invalid. Failed fit UID:"
         << fitUID;
     }
   }
 
   int cmbIndex = 0;
 
   if (m_modelfitList.empty())
   {
     cmbIndex = -1;
   };
 
   if (isModelFitNode)
   {
     //model was selected, thus select this one in combobox
     QVariant data(selectedFitUD.c_str());
     cmbIndex = m_Controls.cmbFit->findData(data);
 
     if (cmbIndex == -1)
     {
       MITK_WARN <<
         "Model fit Inspector in invalid state. Selected fit seems to be not avaible in plugin selection. Failed fit UID:"
         << selectedFitUD;
     }
   };
 
   m_Controls.cmbFit->setCurrentIndex(cmbIndex);
 
   return cmbIndex;
 }
 
 void ModelFitInspectorView::OnInputChanged(const QList<mitk::DataNode::Pointer>& nodes)
 {
   if (nodes.size() > 0)
   {
     if (nodes.front() != this->m_currentSelectedNode)
     {
 
       m_internalUpdateFlag = true;
 
       this->m_currentSelectedNode = nodes.front();
 
       mitk::modelFit::ModelFitInfo::UIDType selectedFitUD = "";
       bool isModelFitNode = this->m_currentSelectedNode->GetData()->GetPropertyList()->GetStringProperty(
                               mitk::ModelFitConstants::FIT_UID_PROPERTY_NAME().c_str(), selectedFitUD);
 
       if (isModelFitNode)
       {
         this->m_currentSelectedNode = this->GetInputNode(this->m_currentSelectedNode);
         if (this->m_currentSelectedNode.IsNull())
         {
           MITK_WARN <<
             "Model fit Inspector in invalid state. Input image for selected fit cannot be found in data storage. Failed fit UID:"
             << selectedFitUD;
         }
       }
 
       auto cmbIndex = ActualizeFitSelectionWidget();
 
       m_internalUpdateFlag = false;
 
       m_selectedNodeTime.Modified();
 
       if (cmbIndex == -1)
       {
         //only raw 4D data selected. Just update plots for current position
         m_currentFit = nullptr;
         m_currentFitTime.Modified();
         OnSliceChanged();
         m_Controls.plotDataWidget->SetXName(DEFAULT_X_AXIS);
       }
       else
       {
         //refresh fit selection (and implicitly update plots)
         OnFitSelectionChanged(cmbIndex);
       }
     }
   }
   else
   {
     if (this->m_currentSelectedNode.IsNotNull())
     {
       m_internalUpdateFlag = true;
       this->m_currentSelectedNode = nullptr;
       this->m_currentFit = nullptr;
       this->m_modelfitList.clear();
       this->m_Controls.cmbFit->clear();
       m_internalUpdateFlag = false;
 
       m_selectedNodeTime.Modified();
       OnFitSelectionChanged(0);
       RefreshPlotData();
       m_Controls.plotDataWidget->SetPlotData(&(this->m_PlotCurves));
       m_Controls.fitParametersWidget->setFits(QmitkFitParameterModel::FitVectorType());
       RenderPlot();
     }
   }
 
 }
 
 mitk::DataNode::ConstPointer
 ModelFitInspectorView::GetInputNode(mitk::DataNode::ConstPointer node)
 {
   if (node.IsNotNull())
   {
     std::string selectedFitUD = "";
 
     auto rule = mitk::ModelFitResultRelationRule::New();
     auto predicate = rule->GetDestinationsDetector(node);
     mitk::DataStorage::SetOfObjects::ConstPointer parentNodeList =
       GetDataStorage()->GetSubset(predicate);
 
     if (parentNodeList->size() > 0)
     {
       return parentNodeList->front().GetPointer();
     }
   }
 
   return mitk::DataNode::ConstPointer();
 }
 
 
 void ModelFitInspectorView::ValidateAndSetCurrentPosition()
 {
-  mitk::Point3D currentSelectedPosition = GetRenderWindowPart()->GetSelectedPosition(nullptr);
+  mitk::Point3D currentSelectedPosition = GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetSelectedPosition(nullptr);
   unsigned int currentSelectedTimestep = m_renderWindowPart->GetTimeNavigationController()->GetTime()->
     GetPos();
 
   if (m_currentSelectedPosition != currentSelectedPosition
       || m_currentSelectedTimeStep != currentSelectedTimestep
       || m_selectedNodeTime > m_currentPositionTime)
   {
     //the current position has been changed or the selected node has been changed since the last position validation -> check position
     m_currentSelectedPosition = currentSelectedPosition;
     m_currentSelectedTimeStep = currentSelectedTimestep;
     m_currentPositionTime.Modified();
     m_validSelectedPosition = false;
 
     auto inputImage = this->GetCurrentInputImage();
 
     if (inputImage.IsNull())
     {
       return;
     }
 
     mitk::BaseGeometry::ConstPointer geometry = inputImage->GetTimeGeometry()->GetGeometryForTimeStep(
       m_currentSelectedTimeStep).GetPointer();
 
     // check for invalid time step
     if (geometry.IsNull())
     {
       geometry = inputImage->GetTimeGeometry()->GetGeometryForTimeStep(0);
     }
 
     if (geometry.IsNull())
     {
       return;
     }
 
     m_validSelectedPosition = geometry->IsInside(m_currentSelectedPosition);
 
   }
 }
 
 mitk::Image::ConstPointer  ModelFitInspectorView::GetCurrentInputImage() const
 {
   mitk::Image::ConstPointer result = nullptr;
 
   if (this->m_currentFit.IsNotNull())
   {
     result = m_currentFit->inputImage;
   }
   else if (this->m_currentSelectedNode.IsNotNull())
   {
     result = dynamic_cast<mitk::Image*>(this->m_currentSelectedNode->GetData());
 
     if (result.IsNotNull() && result->GetTimeSteps() <= 1)
     {
       //if the image is not dynamic, we can't use it.
       result = nullptr;
     }
   }
 
   return result;
 };
 
 const mitk::ModelBase::TimeGridType ModelFitInspectorView::GetCurrentTimeGrid() const
 {
   if (m_currentModelProviderService && m_currentFit.IsNotNull())
   {
     return m_currentModelProviderService->GetVariableGrid(m_currentFit);
   }
   else
   { //fall back if there is no model provider we assume to use the normal time grid.
     return ExtractTimeGrid(GetCurrentInputImage());
   }
 };
 
 void ModelFitInspectorView::OnSliceChanged()
 {
   ValidateAndSetCurrentPosition();
 
   m_Controls.widgetPlot->setEnabled(m_validSelectedPosition);
 
   if (m_currentSelectedNode.IsNotNull())
   {
     m_Controls.inspectionPositionWidget->SetCurrentPosition(m_currentSelectedPosition);
 
     if (RefreshPlotData())
     {
       RenderPlot();
       m_Controls.plotDataWidget->SetPlotData(&m_PlotCurves);
       RenderFitInfo();
     }
   }
 }
 
 void ModelFitInspectorView::OnPositionBookmarksChanged()
 {
     if (RefreshPlotData())
     {
       RenderPlot();
       m_Controls.plotDataWidget->SetPlotData(&m_PlotCurves);
       RenderFitInfo();
     }
 }
 
 void ModelFitInspectorView::OnFitSelectionChanged(int index)
 {
   if (!m_internalUpdateFlag)
   {
     MITK_DEBUG << "selected fit index: " << index;
 
     std::string uid = "";
 
 
     if (m_Controls.cmbFit->count() > index)
     {
       uid = m_Controls.cmbFit->itemData(index).toString().toStdString();
     }
 
     mitk::modelFit::ModelFitInfo::ConstPointer newFit = nullptr;
 
     ModelFitInfoListType::iterator finding = m_modelfitList.find(uid);
 
     if (finding != m_modelfitList.end())
     {
       newFit = finding->second;
     }
 
     if (m_currentFit != newFit)
     {
       m_currentModelParameterizer = nullptr;
       m_currentModelProviderService = nullptr;
 
       if (newFit.IsNotNull())
       {
         m_currentModelParameterizer = mitk::ModelGenerator::GenerateModelParameterizer(*newFit);
         m_currentModelProviderService = mitk::ModelGenerator::GetProviderService(newFit->functionClassID);
       }
 
       m_currentFit = newFit;
 
       m_currentFitTime.Modified();
 
       auto name = m_currentFit->xAxisName;
       if (!m_currentFit->xAxisUnit.empty())
       {
         name += " [" + m_currentFit->xAxisUnit + "]";
       }
       m_Controls.plotDataWidget->SetXName(name);
 
       OnSliceChanged();
     }
   }
 }
 
 mitk::PlotDataCurveCollection::Pointer ModelFitInspectorView::RefreshPlotDataCurveCollection(const mitk::Point3D& position,
   const mitk::Image* input, const mitk::modelFit::ModelFitInfo* fitInfo,
   const mitk::ModelBase::TimeGridType& timeGrid, mitk::ModelParameterizerBase* parameterizer)
 {
   mitk::PlotDataCurveCollection::Pointer result = mitk::PlotDataCurveCollection::New();
 
   //sample curve
   if (input)
   {
     result->InsertElement(mitk::MODEL_FIT_PLOT_SAMPLE_NAME(), GenerateImageSamplePlotData(position, input, timeGrid));
   }
 
   //model signal curve
   if (fitInfo)
   {
     // Interpolate time grid (x values) so the curve looks smooth
     const mitk::ModelBase::TimeGridType interpolatedTimeGrid = mitk::GenerateSupersampledTimeGrid(timeGrid, INTERPOLATION_STEPS);
     auto hires_curve = mitk::GenerateModelSignalPlotData(position, fitInfo, interpolatedTimeGrid, parameterizer);
     result->InsertElement(mitk::MODEL_FIT_PLOT_INTERPOLATED_SIGNAL_NAME(), hires_curve);
     auto curve = mitk::GenerateModelSignalPlotData(position, fitInfo, timeGrid, parameterizer);
     result->InsertElement(mitk::MODEL_FIT_PLOT_SIGNAL_NAME(), curve);
   }
 
   return result;
 };
 
 bool ModelFitInspectorView::RefreshPlotData()
 {
   bool changed = false;
 
   if (m_currentSelectedNode.IsNull())
   {
     this->m_PlotCurves = mitk::ModelFitPlotData();
 
     changed = m_selectedNodeTime > m_lastRefreshTime;
     m_lastRefreshTime.Modified();
   }
   else
   {
     assert(GetRenderWindowPart() != NULL);
 
     const mitk::Image* input = GetCurrentInputImage();
     const mitk::ModelBase::TimeGridType timeGrid = GetCurrentTimeGrid();
 
     if (m_currentFitTime > m_lastRefreshTime || m_currentPositionTime > m_lastRefreshTime)
     {
       if (m_validSelectedPosition)
       {
         m_PlotCurves.currentPositionPlots = RefreshPlotDataCurveCollection(m_currentSelectedPosition,input,m_currentFit, timeGrid, m_currentModelParameterizer);
       }
       else
       {
         m_PlotCurves.currentPositionPlots = mitk::PlotDataCurveCollection::New();
       }
 
       changed = true;
     }
 
     auto bookmarks = m_PositionBookmarks.Lock();
     if (bookmarks.IsNotNull())
     {
       if (m_currentFitTime > m_lastRefreshTime || bookmarks->GetMTime() > m_lastRefreshTime)
       {
         m_PlotCurves.positionalPlots.clear();
 
         auto endIter = bookmarks->End();
         for (auto iter = bookmarks->Begin(); iter != endIter; iter++)
         {
           auto collection = RefreshPlotDataCurveCollection(iter.Value(), input, m_currentFit, timeGrid, m_currentModelParameterizer);
           m_PlotCurves.positionalPlots.emplace(iter.Index(), std::make_pair(iter.Value(), collection));
         }
 
         changed = true;
       }
     }
     else
     {
       m_PlotCurves.positionalPlots.clear();
     }
 
     // input data curve
     if (m_currentFitTime > m_lastRefreshTime)
     {
       m_PlotCurves.staticPlots->clear();
 
       if (m_currentFit.IsNotNull())
       {
         m_PlotCurves.staticPlots = GenerateAdditionalModelFitPlotData(m_currentSelectedPosition, m_currentFit, timeGrid);
       }
 
       changed = true;
     }
 
     m_lastRefreshTime.Modified();
   }
 
   return changed;
 }
 
 void ModelFitInspectorView::RenderFitInfo()
 {
     assert(m_renderWindowPart != nullptr);
 
     // configure fit information
 
     if (m_currentFit.IsNull())
     {
         m_Controls.lFitType->setText("");
         m_Controls.lFitUID->setText("");
         m_Controls.lModelName->setText("");
         m_Controls.lModelType->setText("");
     }
     else
     {
         m_Controls.lFitType->setText(QString::fromStdString(m_currentFit->fitType));
         m_Controls.lFitUID->setText(QString::fromStdString(m_currentFit->uid));
         m_Controls.lModelName->setText(QString::fromStdString(m_currentFit->modelName));
         m_Controls.lModelType->setText(QString::fromStdString(m_currentFit->modelType));
     }
 
     // print results
     std::stringstream infoOutput;
 
   m_Controls.fitParametersWidget->setVisible(false);
     m_Controls.groupSettings->setVisible(false);
 
     if (m_currentFit.IsNull())
     {
         infoOutput << "No fit selected. Only raw image data is plotted.";
     }
     else if (!m_validSelectedPosition)
     {
         infoOutput <<
                "Current position is outside of the input image of the selected fit.\nInspector is deactivated.";
     }
     else
     {
         m_Controls.fitParametersWidget->setVisible(true);
     m_Controls.fitParametersWidget->setFits({ m_currentFit });
 
     m_Controls.fitParametersWidget->setPositionBookmarks(m_PositionBookmarks.Lock());
     m_Controls.fitParametersWidget->setCurrentPosition(m_currentSelectedPosition);
     }
 
     // configure data table
     m_Controls.tableInputData->clearContents();
 
     if (m_currentFit.IsNull())
     {
         infoOutput << "No fit selected. Only raw image data is plotted.";
     }
     else
     {
         m_Controls.groupSettings->setVisible(true);
         m_Controls.tableInputData->setRowCount(m_PlotCurves.staticPlots->size());
 
         unsigned int rowIndex = 0;
 
     for (mitk::PlotDataCurveCollection::const_iterator pos = m_PlotCurves.staticPlots->begin();
             pos != m_PlotCurves.staticPlots->end(); ++pos, ++rowIndex)
         {
             QColor dataColor;
 
             if (pos->first == "ROI")
             {
                 dataColor = QColor(0, 190, 0);
             }
             else
             {
                 //Use HSV schema of QColor to calculate a different color depending on the
                 //number of already existing free iso lines.
                 dataColor.setHsv(((rowIndex + 1) * 85) % 360, 255, 255);
             }
 
             QTableWidgetItem* newItem = new QTableWidgetItem(QString::fromStdString(pos->first));
             m_Controls.tableInputData->setItem(rowIndex, 0, newItem);
             newItem = new QTableWidgetItem();
             newItem->setBackgroundColor(dataColor);
             m_Controls.tableInputData->setItem(rowIndex, 1, newItem);
         }
     }
 
     m_Controls.lInfo->setText(QString::fromStdString(infoOutput.str()));
 }
 
 void ModelFitInspectorView::RenderPlotCurve(const mitk::PlotDataCurveCollection* curveCollection, const QColor& sampleColor, const QColor& signalColor, const std::string& posString)
 {
   auto sampleCurve = mitk::ModelFitPlotData::GetSamplePlot(curveCollection);
   if (sampleCurve)
   {
     std::string name = mitk::MODEL_FIT_PLOT_SAMPLE_NAME() + posString;
     unsigned int curveId = m_Controls.widgetPlot->InsertCurve(name.c_str());
     m_Controls.widgetPlot->SetCurveData(curveId, sampleCurve->GetValues());
     m_Controls.widgetPlot->SetCurvePen(curveId, QPen(Qt::NoPen));
 
     // QwtSymbol needs to passed as a real pointer from MITK v2013.09.0 on
     // (QwtPlotCurve deletes it on destruction and assignment).
     QwtSymbol* dataSymbol = new QwtSymbol(QwtSymbol::Diamond, sampleColor, sampleColor, QSize(8, 8));
     m_Controls.widgetPlot->SetCurveSymbol(curveId, dataSymbol);
 
     // Again, there is no way to set a curve's legend attributes via QmitkPlotWidget so this
     // gets unnecessarily complicated.
     QwtPlotCurve* measurementCurve = dynamic_cast<QwtPlotCurve*>(m_Controls.widgetPlot->
       GetPlot()->itemList(QwtPlotItem::Rtti_PlotCurve).back());
     measurementCurve->setLegendAttribute(QwtPlotCurve::LegendShowSymbol);
     measurementCurve->setLegendIconSize(QSize(8, 8));
   }
 
   //draw model curve
   auto signalCurve = mitk::ModelFitPlotData::GetInterpolatedSignalPlot(curveCollection);
   if (signalCurve)
   {
     std::string name = mitk::MODEL_FIT_PLOT_SIGNAL_NAME() + posString;
     QPen pen;
     pen.setColor(signalColor);
     pen.setWidth(2);
     unsigned int curveId = m_Controls.widgetPlot->InsertCurve(name.c_str());
     m_Controls.widgetPlot->SetCurveData(curveId, signalCurve->GetValues());
     m_Controls.widgetPlot->SetCurvePen(curveId, pen);
 
     // Manually set the legend attribute to use the symbol as the legend icon and alter its
     // size. Otherwise it would revert to default which is drawing a square which is the color
     // of the curve's pen, so in this case none which defaults to black.
     // Unfortunately, QmitkPlotWidget offers no way to set the legend attribute and icon size so
     // this looks a bit hacky.
     QwtPlotCurve* fitCurve = dynamic_cast<QwtPlotCurve*>(m_Controls.widgetPlot->GetPlot()->
       itemList(QwtPlotItem::Rtti_PlotCurve).back());
     fitCurve->setLegendAttribute(QwtPlotCurve::LegendShowLine);
   }
 
 }
 
 void ModelFitInspectorView::RenderPlot()
 {
   m_Controls.widgetPlot->Clear();
 
   std::string xAxis = DEFAULT_X_AXIS;
   std::string yAxis = "Intensity";
   std::string plotTitle = "Raw data plot: no data";
 
   if (m_currentSelectedNode.IsNotNull())
   {
     plotTitle = "Raw data plot: " + m_currentSelectedNode->GetName();
   }
 
   if (m_currentFit.IsNotNull())
   {
     plotTitle = m_currentFit->modelName.c_str();
     xAxis = m_currentFit->xAxisName;
 
     if (!m_currentFit->xAxisUnit.empty())
     {
       xAxis += " [" + m_currentFit->xAxisUnit + "]";
     }
 
     yAxis = m_currentFit->yAxisName;
 
     if (!m_currentFit->yAxisUnit.empty())
     {
       yAxis += " [" + m_currentFit->yAxisUnit + "]";
     }
   }
 
   m_Controls.widgetPlot->SetAxisTitle(QwtPlot::xBottom, xAxis.c_str());
   m_Controls.widgetPlot->SetAxisTitle(QwtPlot::yLeft, yAxis.c_str());
   m_Controls.widgetPlot->SetPlotTitle(plotTitle.c_str());
 
   // Draw static curves
   unsigned int colorIndex = 0;
 
   for (mitk::PlotDataCurveCollection::const_iterator pos = m_PlotCurves.staticPlots->begin();
        pos != m_PlotCurves.staticPlots->end(); ++pos)
   {
     QColor dataColor;
 
     unsigned int curveId = m_Controls.widgetPlot->InsertCurve(pos->first.c_str());
     m_Controls.widgetPlot->SetCurveData(curveId, pos->second->GetValues());
 
     if (pos->first == "ROI")
     {
       dataColor = QColor(0, 190, 0);
       QPen pen;
       pen.setColor(dataColor);
       pen.setStyle(Qt::SolidLine);
       m_Controls.widgetPlot->SetCurvePen(curveId, pen);
     }
     else
     {
       //Use HSV schema of QColor to calculate a different color depending on the
       //number of already existing curves.
       dataColor.setHsv((++colorIndex * 85) % 360, 255, 150);
       m_Controls.widgetPlot->SetCurvePen(curveId, QPen(Qt::NoPen));
     }
 
     // QwtSymbol needs to passed as a real pointer from MITK v2013.09.0 on
     // (QwtPlotCurve deletes it on destruction and assignment).
     QwtSymbol* dataSymbol = new QwtSymbol(QwtSymbol::Triangle, dataColor, dataColor,
                                           QSize(8, 8));
     m_Controls.widgetPlot->SetCurveSymbol(curveId, dataSymbol);
 
     // Again, there is no way to set a curve's legend attributes via QmitkPlotWidget so this
     // gets unnecessarily complicated.
     QwtPlotCurve* measurementCurve = dynamic_cast<QwtPlotCurve*>(m_Controls.widgetPlot->
                                      GetPlot()->itemList(QwtPlotItem::Rtti_PlotCurve).back());
     measurementCurve->setLegendAttribute(QwtPlotCurve::LegendShowSymbol);
     measurementCurve->setLegendIconSize(QSize(8, 8));
   }
 
   // Draw positional curves
   for (const auto& posIter : this->m_PlotCurves.positionalPlots)
   {
     QColor dataColor;
     dataColor.setHsv((++colorIndex * 85) % 360, 255, 150);
 
     this->RenderPlotCurve(posIter.second.second, dataColor, dataColor, " @ "+mitk::ModelFitPlotData::GetPositionalCollectionName(posIter));
   }
 
   // Draw current pos curve
   this->RenderPlotCurve(m_PlotCurves.currentPositionPlots, QColor(Qt::red), QColor(Qt::black), "");
 
   QwtLegend* legend = new QwtLegend();
   legend->setFrameShape(QFrame::Box);
   legend->setFrameShadow(QFrame::Sunken);
   legend->setLineWidth(1);
   m_Controls.widgetPlot->SetLegend(legend, QwtPlot::BottomLegend);
 
   m_Controls.widgetPlot->Replot();
 }
 
 void ModelFitInspectorView::EnsureBookmarkPointSet()
 {
   if (m_PositionBookmarks.IsExpired() || m_PositionBookmarksNode.IsExpired())
   {
     const char* nodeName = "org.mitk.gui.qt.fit.inspector.positions";
     mitk::DataNode::Pointer node = this->GetDataStorage()->GetNamedNode(nodeName);
 
     if (!node)
     {
       node = mitk::DataNode::New();
       node->SetName(nodeName);
       node->SetBoolProperty("helper object", true);
       this->GetDataStorage()->Add(node);
     }
     m_PositionBookmarksNode = node;
 
     mitk::PointSet::Pointer pointSet = dynamic_cast<mitk::PointSet*>(node->GetData());
     if (pointSet.IsNull())
     {
       pointSet = mitk::PointSet::New();
       node->SetData(pointSet);
     }
 
     m_PositionBookmarks = pointSet;
   }
 }
diff --git a/Plugins/org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation/src/internal/QmitkUSNavigationMarkerPlacement.cpp b/Plugins/org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation/src/internal/QmitkUSNavigationMarkerPlacement.cpp
index 55c077e88e..2fa229ab9c 100644
--- a/Plugins/org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation/src/internal/QmitkUSNavigationMarkerPlacement.cpp
+++ b/Plugins/org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation/src/internal/QmitkUSNavigationMarkerPlacement.cpp
@@ -1,802 +1,802 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 #include "QmitkUSNavigationMarkerPlacement.h"
 #include "ui_QmitkUSNavigationMarkerPlacement.h"
 
 #include "NavigationStepWidgets/QmitkUSNavigationStepCombinedModality.h"
 #include "NavigationStepWidgets/QmitkUSNavigationStepMarkerIntervention.h"
 #include "NavigationStepWidgets/QmitkUSNavigationStepPlacementPlanning.h"
 #include "NavigationStepWidgets/QmitkUSNavigationStepPunctuationIntervention.h"
 #include "NavigationStepWidgets/QmitkUSNavigationStepTumourSelection.h"
 #include "NavigationStepWidgets/QmitkUSNavigationStepZoneMarking.h"
 
 #include "SettingsWidgets/QmitkUSNavigationCombinedSettingsWidget.h"
 
 #include "mitkAbstractUltrasoundTrackerDevice.h"
 #include "mitkIRenderingManager.h"
 #include "mitkNodeDisplacementFilter.h"
 #include "mitkTrackedUltrasound.h"
 #include <mitkIOUtil.h>
 
 #include "IO/mitkUSNavigationStepTimer.h"
 
 #include <QDateTime>
 #include <QDir>
 #include <QInputDialog>
 #include <QMessageBox>
 #include <QSignalMapper>
 #include <QTimer>
 
 #include "QmitkRenderWindow.h"
 #include "QmitkStdMultiWidget.h"
 #include "QmitkStdMultiWidgetEditor.h"
 #include "mitkCameraController.h"
 #include "mitkLayoutAnnotationRenderer.h"
 #include <vtkSmartPointer.h>
 
 // scene serialization
 #include <mitkConvert2Dto3DImageFilter.h>
 #include <mitkNodePredicateNot.h>
 #include <mitkNodePredicateProperty.h>
 #include <mitkSceneIO.h>
 #include <mitkSurface.h>
 
 const std::string QmitkUSNavigationMarkerPlacement::VIEW_ID = "org.mitk.views.usmarkerplacement";
 
 const char *QmitkUSNavigationMarkerPlacement::DATANAME_TUMOUR = "Tumour";
 const char *QmitkUSNavigationMarkerPlacement::DATANAME_TARGETSURFACE = "Target Surface";
 const char *QmitkUSNavigationMarkerPlacement::DATANAME_ZONES = "Zones";
 const char *QmitkUSNavigationMarkerPlacement::DATANAME_TARGETS = "Targets";
 const char *QmitkUSNavigationMarkerPlacement::DATANAME_TARGETS_PATHS = "Target Paths";
 const char *QmitkUSNavigationMarkerPlacement::DATANAME_REACHED_TARGETS = "Reached Targets";
 
 QmitkUSNavigationMarkerPlacement::QmitkUSNavigationMarkerPlacement()
   : m_Parent(nullptr),
     m_UpdateTimer(new QTimer(this)),
     m_ImageAndNavigationDataLoggingTimer(new QTimer(this)),
     m_StdMultiWidget(nullptr),
     m_CombinedModality(nullptr),
     m_ReinitAlreadyDone(false),
     m_IsExperimentRunning(false),
     m_CurrentApplicationName(),
     m_NavigationStepTimer(mitk::USNavigationStepTimer::New()),
     m_IconRunning(QPixmap(":/USNavigation/record.png")),
     m_IconNotRunning(QPixmap(":/USNavigation/record-gray.png")),
     m_ResultsDirectory(),
     m_ExperimentName(),
     m_ExperimentResultsSubDirectory(),
     m_NavigationStepNames(),
     m_LoggingBackend(),
     m_USImageLoggingFilter(mitk::USImageLoggingFilter::New()),
     m_NavigationDataRecorder(mitk::NavigationDataRecorder::New()),
     m_TargetNodeDisplacementFilter(nullptr),
     m_AblationZonesDisplacementFilter(mitk::NodeDisplacementFilter::New()),
     m_ToolVisualizationFilter(nullptr),
     m_AblationZonesVector(),
     m_NeedleIndex(0),
     m_MarkerIndex(1),
     m_SceneNumber(1),
     m_WarnOverlay(mitk::TextAnnotation2D::New()),
     m_NavigationDataSource(nullptr),
     m_CurrentStorage(nullptr),
     m_ImageStreamNode(nullptr),
     ui(new Ui::QmitkUSNavigationMarkerPlacement)
 {
   connect(m_UpdateTimer, SIGNAL(timeout()), this, SLOT(OnTimeout()));
   connect(
     m_ImageAndNavigationDataLoggingTimer, SIGNAL(timeout()), this, SLOT(OnImageAndNavigationDataLoggingTimeout()));
 
   // scale running (and not running) icon the specific height
   m_IconRunning = m_IconRunning.scaledToHeight(20, Qt::SmoothTransformation);
   m_IconNotRunning = m_IconNotRunning.scaledToHeight(20, Qt::SmoothTransformation);
 
 
 }
 
 QmitkUSNavigationMarkerPlacement::~QmitkUSNavigationMarkerPlacement()
 {
   this->GetDataStorage()->Remove(m_InstrumentNode);
   delete ui;
 }
 
 void QmitkUSNavigationMarkerPlacement::OnChangeAblationZone(int id, int newSize)
 {
   if ((static_cast<int>(m_AblationZonesVector.size()) < id) || (id < 0))
   {
     return;
   }
 
   MITK_INFO << "Ablation Zone " << id << " changed, new size: " << newSize;
 
   // create a vtk sphere with given radius
   vtkSmartPointer<vtkSphereSource> vtkSphere = vtkSmartPointer<vtkSphereSource>::New();
   vtkSphere->SetRadius(newSize / 2);
   vtkSphere->SetCenter(0, 0, 0);
   vtkSphere->SetPhiResolution(20);
   vtkSphere->SetThetaResolution(20);
   vtkSphere->Update();
 
   mitk::Surface::Pointer zoneSurface = dynamic_cast<mitk::Surface *>(m_AblationZonesVector.at(id)->GetData());
   zoneSurface->SetVtkPolyData(vtkSphere->GetOutput());
 }
 
 void QmitkUSNavigationMarkerPlacement::OnAddAblationZone(int size)
 {
   m_AblationZonesDisplacementFilter->SetInitialReferencePose(
     m_CombinedModality->GetNavigationDataSource()->GetOutput(m_MarkerIndex));
   mitk::DataNode::Pointer NewAblationZone = mitk::DataNode::New();
 
   mitk::Point3D origin = m_CombinedModality->GetNavigationDataSource()->GetOutput(m_NeedleIndex)->GetPosition();
 
   MITK_INFO("USNavigationLogging") << "Ablation Zone Added, initial size: " << size << ", origin: " << origin;
 
   mitk::Surface::Pointer zone = mitk::Surface::New();
 
   // create a vtk sphere with given radius
   vtkSmartPointer<vtkSphereSource> vtkSphere = vtkSmartPointer<vtkSphereSource>::New();
   vtkSphere->SetRadius(size / 2);
   vtkSphere->SetCenter(0, 0, 0);
   vtkSphere->SetPhiResolution(20);
   vtkSphere->SetThetaResolution(20);
   vtkSphere->Update();
   zone->SetVtkPolyData(vtkSphere->GetOutput());
 
   // set vtk sphere and origin to data node (origin must be set
   // again, because of the new sphere set as data)
   NewAblationZone->SetData(zone);
   NewAblationZone->GetData()->GetGeometry()->SetOrigin(origin);
   mitk::Color SphereColor = mitk::Color();
   // default color
   SphereColor[0] = 102;
   SphereColor[1] = 0;
   SphereColor[2] = 204;
   NewAblationZone->SetColor(SphereColor);
   NewAblationZone->SetOpacity(0.3);
 
   // set name of zone
   std::stringstream name;
   name << "Ablation Zone" << m_AblationZonesVector.size();
   NewAblationZone->SetName(name.str());
 
   // add zone to filter
   m_AblationZonesDisplacementFilter->AddNode(NewAblationZone);
   m_AblationZonesVector.push_back(NewAblationZone);
   this->GetDataStorage()->Add(NewAblationZone);
 }
 
 void QmitkUSNavigationMarkerPlacement::CreateQtPartControl(QWidget *parent)
 {
   m_Parent = parent;
   ui->setupUi(parent);
 
   connect(ui->startExperimentButton, SIGNAL(clicked()), this, SLOT(OnStartExperiment()));
   connect(ui->finishExperimentButton, SIGNAL(clicked()), this, SLOT(OnFinishExperiment()));
   connect(ui->m_enableNavigationLayout, SIGNAL(clicked()), this, SLOT(OnChangeLayoutClicked()));
   connect(ui->m_RenderWindowSelection, SIGNAL(valueChanged(int)), this, SLOT(OnRenderWindowSelection()));
   connect(ui->m_RefreshView, SIGNAL(clicked()), this, SLOT(OnRefreshView()));
 
   m_BaseNode = this->GetDataStorage()->GetNamedNode(QmitkUSAbstractNavigationStep::DATANAME_BASENODE);
   if (m_BaseNode.IsNull())
   {
     m_BaseNode = mitk::DataNode::New();
     m_BaseNode->SetName(QmitkUSAbstractNavigationStep::DATANAME_BASENODE);
     this->GetDataStorage()->Add(m_BaseNode);
   }
 
   connect(ui->m_CtToUsRegistrationWidget, SIGNAL(GetCursorPosition()), this, SLOT(OnGetCursorPosition()));
   connect(ui->m_CtToUsRegistrationWidget, SIGNAL(ActualizeCtToUsRegistrationWidget()), this, SLOT(OnActualizeCtToUsRegistrationWidget()));
   connect(ui->m_initializeCtToUsRegistration, SIGNAL(clicked()), this, SLOT(OnInitializeCtToUsRegistration()));
   connect(ui->m_initializeTargetMarking, SIGNAL(clicked()), this, SLOT(OnInitializeTargetMarking()));
   connect(ui->m_initializeCritStructureMarking, SIGNAL(clicked()), this, SLOT(OnInitializeCriticalStructureMarking()));
   connect(ui->m_initializeNavigation, SIGNAL(clicked()), this, SLOT(OnInitializeNavigation()));
 
   // indicate that no experiment is running at start
   ui->runningLabel->setPixmap(m_IconNotRunning);
 
   connect(ui->m_settingsWidget, SIGNAL(SettingsChanged(itk::SmartPointer<mitk::DataNode>)),
           this, SLOT(OnSettingsChanged(itk::SmartPointer<mitk::DataNode>)));
 }
 
 void QmitkUSNavigationMarkerPlacement::ReInitializeSettingsNodesAndImageStream()
 {
   //If update timer is not stopped (signals stopped), setting the m_CombinedModality
   // will cause a crash of the workbench in some times.
   m_UpdateTimer->blockSignals(true);
   m_UpdateTimer->stop();
   m_SettingsNode = mitk::DataNode::New();
   ui->m_settingsWidget->OnSetSettingsNode(m_SettingsNode, true);
   InitImageStream();
   m_CombinedModality = ui->m_CombinedModalityCreationWidget->GetSelectedCombinedModality();
   // Having set the m_CombinedModality reactivate the update timer again
   m_UpdateTimer->start(50); // every 50 Milliseconds = 20 Frames/Second
   m_UpdateTimer->blockSignals(false);
 }
 
 void QmitkUSNavigationMarkerPlacement::OnGetCursorPosition()
 {
-  mitk::Point3D centroid = this->GetRenderWindowPart()->GetSelectedPosition();
+  auto centroid = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetSelectedPosition();
   ui->m_CtToUsRegistrationWidget->OnCalculateTRE(centroid);
 }
 
 void QmitkUSNavigationMarkerPlacement::OnActualizeCtToUsRegistrationWidget()
 {
   m_SettingsNode = mitk::DataNode::New();
   ui->m_settingsWidget->OnSetSettingsNode(m_SettingsNode, true);
   this->InitImageStream();
 
   if (ui->m_CombinedModalityCreationWidget->GetSelectedCombinedModality().IsNull())
   {
     return;
   }
   ui->m_CtToUsRegistrationWidget->SetCombinedModality(
     ui->m_CombinedModalityCreationWidget->GetSelectedCombinedModality());
 
   m_CombinedModality = ui->m_CombinedModalityCreationWidget->GetSelectedCombinedModality();
 
   if (!m_StdMultiWidget)
   {
     // try to get the standard multi widget if it couldn't be got before
     mitk::IRenderWindowPart *renderWindowPart = this->GetRenderWindowPart();
 
     QmitkStdMultiWidgetEditor *multiWidgetEditor = dynamic_cast<QmitkStdMultiWidgetEditor *>(renderWindowPart);
 
     // if there is a standard multi widget now, disable the level window and
     // change the layout to 2D up and 3d down
     if (multiWidgetEditor)
     {
       m_StdMultiWidget = dynamic_cast<QmitkStdMultiWidget *>(multiWidgetEditor->GetMultiWidget());
       multiWidgetEditor->ShowLevelWindowWidget(false);
       SetTwoWindowView();
     }
   }
   else
   {
     this->OnRefreshView();
   }
   m_UpdateTimer->start(50); // every 50 Milliseconds = 20 Frames/Second
 }
 
 void QmitkUSNavigationMarkerPlacement::OnInitializeCtToUsRegistration()
 {
   ui->m_CtToUsRegistrationWidget->SetDataStorage(this->GetDataStorage());
   ui->m_CtToUsRegistrationWidget->OnSettingsChanged(m_SettingsNode);
   ui->m_CtToUsRegistrationWidget->OnActivateStep();
   ui->m_CtToUsRegistrationWidget->OnStartStep();
   ui->m_CtToUsRegistrationWidget->Update();
 }
 
 void QmitkUSNavigationMarkerPlacement::OnInitializeTargetMarking()
 {
   ReInitializeSettingsNodesAndImageStream();
   ui->m_TargetMarkingWidget->SetCombinedModality(m_CombinedModality);
   ui->m_TargetMarkingWidget->SetDataStorage(this->GetDataStorage());
   ui->m_TargetMarkingWidget->OnSettingsChanged(m_SettingsNode);
   ui->m_TargetMarkingWidget->OnActivateStep();
   ui->m_TargetMarkingWidget->OnStartStep();
   ui->m_TargetMarkingWidget->Update();
 }
 
 void QmitkUSNavigationMarkerPlacement::OnInitializeCriticalStructureMarking()
 {
   ReInitializeSettingsNodesAndImageStream();
   ui->m_CriticalStructuresWidget->SetCombinedModality(m_CombinedModality);
   ui->m_CriticalStructuresWidget->SetDataStorage(this->GetDataStorage());
   ui->m_CriticalStructuresWidget->OnSettingsChanged(m_SettingsNode);
   ui->m_CriticalStructuresWidget->OnActivateStep();
   ui->m_CriticalStructuresWidget->OnStartStep();
   ui->m_CriticalStructuresWidget->Update();
 }
 
 void QmitkUSNavigationMarkerPlacement::OnInitializeNavigation()
 {
   ReInitializeSettingsNodesAndImageStream();
   ui->m_NavigationWidget->SetCombinedModality(m_CombinedModality);
   ui->m_NavigationWidget->SetDataStorage(this->GetDataStorage());
   ui->m_NavigationWidget->OnSettingsChanged(m_SettingsNode);
   ui->m_NavigationWidget->OnActivateStep();
   ui->m_NavigationWidget->OnStartStep();
   ui->m_NavigationWidget->Update();
 
   // test if it is tracked US, if yes add visualization filter
   if (m_CombinedModality->GetIsTrackedUltrasoundActive())
   {
     m_InstrumentNode = mitk::DataNode::New();
     m_InstrumentNode->SetName("Tracked US Instrument");
     m_InstrumentNode->SetData(
       m_CombinedModality->GetNavigationDataSource()->GetToolMetaData(0)->GetToolSurface()->Clone());
     this->GetDataStorage()->Add(m_InstrumentNode);
     m_ToolVisualizationFilter = mitk::NavigationDataObjectVisualizationFilter::New();
     m_ToolVisualizationFilter->ConnectTo(m_CombinedModality->GetNavigationDataSource());
     m_ToolVisualizationFilter->SetRepresentationObject(0, m_InstrumentNode->GetData()); //caution: currently hard coded that instrument has id 0
     //set dummy objects to avoid spamming of console
     mitk::Surface::Pointer dummyObject = mitk::Surface::New();
     m_ToolVisualizationFilter->SetRepresentationObject(1, dummyObject.GetPointer());
     m_ToolVisualizationFilter->SetRepresentationObject(2, dummyObject.GetPointer());
   }
 }
 
 void QmitkUSNavigationMarkerPlacement::InitImageStream()
 {
   if (m_ImageStreamNode.IsNull())
   {
     m_ImageStreamNode = mitk::DataNode::New();
     m_ImageStreamNode->SetName("US Navigation Viewing Stream");
     this->GetDataStorage()->Add(m_ImageStreamNode);
   }
 }
 
 void QmitkUSNavigationMarkerPlacement::OnCombinedModalityPropertyChanged(const std::string &key, const std::string &)
 {
   if (key == mitk::USDevice::GetPropertyKeys().US_PROPKEY_BMODE_DEPTH)
   {
     m_ReinitAlreadyDone = false;
     this->ReinitOnImage();
 
     if (m_CombinedModality.IsNotNull() && !m_CombinedModality->GetIsCalibratedForCurrentStatus())
     {
       mitk::LayoutAnnotationRenderer::AddAnnotation(
         m_WarnOverlay.GetPointer(), "stdmulti.widget0", mitk::LayoutAnnotationRenderer::TopLeft);
       MITK_WARN << "No calibration available for the selected ultrasound image depth.";
     }
   }
 }
 
 void QmitkUSNavigationMarkerPlacement::SetFocus()
 {
   this->ReinitOnImage();
 }
 
 void QmitkUSNavigationMarkerPlacement::OnTimeout()
 {
   if (m_CombinedModality.IsNull())
     return;
   m_CombinedModality->Modified(); // shouldn't be nessecary ... fix in abstract ultrasound tracker device!
   m_CombinedModality->Update();
   if (m_ToolVisualizationFilter.IsNotNull())
   {
     m_ToolVisualizationFilter->Update();
   }
 
   ui->m_CtToUsRegistrationWidget->Update();
   ui->m_TargetMarkingWidget->Update();
   ui->m_CriticalStructuresWidget->Update();
   ui->m_NavigationWidget->Update();
 
   mitk::Image::Pointer image = m_CombinedModality->GetOutput();
   // make sure that always the current image is set to the data node
   if (image.IsNotNull() && m_ImageStreamNode->GetData() != image.GetPointer() && image->IsInitialized())
   {
     m_ImageStreamNode->SetData(image);
   }
 
   if (!m_StdMultiWidget)
   {
     // try to get the standard multi widget if it couldn't be got before
     mitk::IRenderWindowPart *renderWindowPart = this->GetRenderWindowPart();
 
     QmitkStdMultiWidgetEditor *multiWidgetEditor = dynamic_cast<QmitkStdMultiWidgetEditor*>(renderWindowPart);
 
     // if there is a standard multi widget now, disable the level window and
     // change the layout to 2D up and 3d down
     if (multiWidgetEditor)
     {
       m_StdMultiWidget = dynamic_cast<QmitkStdMultiWidget*>(multiWidgetEditor->GetMultiWidget());
       multiWidgetEditor->ShowLevelWindowWidget(false);
       SetTwoWindowView();
     }
 
     this->CreateOverlays();
   }
 
   if (m_CombinedModality.IsNotNull() && !this->m_CombinedModality->GetIsFreezed()) // if the combined modality is freezed: do nothing
   {
     m_AblationZonesDisplacementFilter->Update();
 
     // update the 3D window only every fourth time to speed up the rendering (at least in 2D)
     this->RequestRenderWindowUpdate(mitk::RenderingManager::REQUEST_UPDATE_2DWINDOWS);
 
     // make sure that a reinit was performed on the image
     this->ReinitOnImage();
   }
 }
 
 void QmitkUSNavigationMarkerPlacement::OnEnableNavigationLayout()
 {
   MITK_INFO << "Navigation Layout";
   // try to get the standard multi widget if it couldn't be got before
   mitk::IRenderWindowPart *renderWindowPart = this->GetRenderWindowPart();
 
   QmitkStdMultiWidgetEditor *multiWidgetEditor = dynamic_cast<QmitkStdMultiWidgetEditor*>(renderWindowPart);
 
   // if there is a standard multi widget now, disable the level window and
   // change the layout to 2D up and 3d down
   if (multiWidgetEditor)
   {
     m_StdMultiWidget = dynamic_cast<QmitkStdMultiWidget*>(multiWidgetEditor->GetMultiWidget());
     multiWidgetEditor->ShowLevelWindowWidget(false);
     SetTwoWindowView();
   }
 }
 
 void QmitkUSNavigationMarkerPlacement::OnRenderWindowSelection()
 {
   SetTwoWindowView();
 }
 
 void QmitkUSNavigationMarkerPlacement::OnRefreshView()
 {
   if (!ui->m_enableNavigationLayout->isChecked())
     OnResetStandardLayout();
   else
   {
     // Reinit the US Image Stream (this might be broken if there was a global reinit somewhere...)
     try
     {
       mitk::RenderingManager::GetInstance()->InitializeViews( // Reinit
         this
           ->GetDataStorage() // GetDataStorage
           ->GetNamedNode("US Viewing Stream - Image 0")
           ->GetData()
           ->GetTimeGeometry()); // GetNode
     }
     catch (...)
     {
       MITK_DEBUG << "No reinit possible";
     }
     SetTwoWindowView();
   }
 }
 
 void QmitkUSNavigationMarkerPlacement::SetTwoWindowView()
 {
   if (m_StdMultiWidget)
   {
     int i, j, k;
     switch (this->ui->m_RenderWindowSelection->value())
     {
       case 1:
         mitk::BaseRenderer::GetInstance(mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget3"))->GetCameraController()->SetViewToCaudal();
         i = 1;
         j = 2; // other windows
         k = 0;
         break;
       case 2:
         mitk::BaseRenderer::GetInstance(mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget3"))->GetCameraController()->SetViewToSinister();
         i = 0;
         j = 2;
         k = 1;
         break;
       case 3:
         mitk::BaseRenderer::GetInstance(mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget3"))->GetCameraController()->SetViewToAnterior();
         i = 1;
         j = 0;
         k = 2;
         break;
       default:
         return;
     }
 
     // get the render window which is defined by index "k" and set it as "current render window widget"
     // chose the layout that will set the current 2D window as top render window and the 3D windows as bottom render window
     auto renderWindowWidget = m_StdMultiWidget->GetRenderWindowWidget(m_StdMultiWidget->GetNameFromIndex(k));
     m_StdMultiWidget->GetMultiWidgetLayoutManager()->SetCurrentRenderWindowWidget(renderWindowWidget.get());
     m_StdMultiWidget->GetMultiWidgetLayoutManager()->SetOneTop3DBottomLayout();
 
     ////Crosshair invisible in 3D view
     this->GetDataStorage()->GetNamedNode("stdmulti.widget" + std::to_string(i) + ".plane")
       ->SetBoolProperty("visible", false, mitk::BaseRenderer::GetInstance(mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget4")));
     this->GetDataStorage()->GetNamedNode("stdmulti.widget" + std::to_string(j) + ".plane")
       ->SetBoolProperty("visible", false, mitk::BaseRenderer::GetInstance(mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget4")));
     this->GetDataStorage()->GetNamedNode("stdmulti.widget" + std::to_string(k) + ".plane")
       ->SetBoolProperty("visible", true, mitk::BaseRenderer::GetInstance(mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget4")));
     this->GetDataStorage()->GetNamedNode("stdmulti.widget" + std::to_string(i) + ".plane")
       ->SetIntProperty("Crosshair.Gap Size", 0);
     this->GetDataStorage()->GetNamedNode("stdmulti.widget" + std::to_string(j) + ".plane")
       ->SetIntProperty("Crosshair.Gap Size", 0);
   }
 }
 
 void QmitkUSNavigationMarkerPlacement::OnResetStandardLayout()
 {
   if (m_StdMultiWidget)
   {
     //reset render windows
     m_StdMultiWidget->SetCrosshairVisibility(true);
     m_StdMultiWidget->GetMultiWidgetLayoutManager()->SetDefaultLayout();
   }
 }
 
 void QmitkUSNavigationMarkerPlacement::OnChangeLayoutClicked()
 {
   if (ui->m_enableNavigationLayout->isChecked())
     OnEnableNavigationLayout();
   else
     OnResetStandardLayout();
 }
 
 void QmitkUSNavigationMarkerPlacement::OnImageAndNavigationDataLoggingTimeout()
 {
   // update filter for logging navigation data and ultrasound images
   if (m_CombinedModality.IsNotNull())
   {
     m_NavigationDataRecorder->Update();
     // get last messages for logging filer and store them
     std::vector<std::string> messages = m_LoggingBackend.GetNavigationMessages();
     std::string composedMessage = "";
     for (std::size_t i = 0; i < messages.size(); i++)
     {
       composedMessage += messages.at(i);
     }
     m_USImageLoggingFilter->AddMessageToCurrentImage(composedMessage);
     m_LoggingBackend.ClearNavigationMessages();
     // update logging filter
     m_USImageLoggingFilter->Update();
   }
 }
 
 void QmitkUSNavigationMarkerPlacement::OnStartExperiment()
 {
   // get name for the experiment by a QInputDialog
   bool ok;
   if (m_ExperimentName.isEmpty())
   { // default: current date
     m_ExperimentName = QString::number(QDateTime::currentDateTime().date().year()) + "_" +
                        QString::number(QDateTime::currentDateTime().date().month()) + "_" +
                        QString::number(QDateTime::currentDateTime().date().day()) + "_experiment_" +
                        QString::number(QDateTime::currentDateTime().time().hour()) + "." +
                        QString::number(QDateTime::currentDateTime().time().minute());
   }
   m_ExperimentName = QInputDialog::getText(
     m_Parent, QString("Experiment Name"), QString("Name of the Experiment"), QLineEdit::Normal, m_ExperimentName, &ok);
   MITK_INFO("USNavigationLogging") << "Experiment started: " << m_ExperimentName.toStdString();
   if (ok && !m_ExperimentName.isEmpty())
   {
     // display error message and call the function recursively if a directory
     // with the given name already exists
     QDir experimentResultsDir(m_ResultsDirectory + QDir::separator() + m_ExperimentName);
     if (experimentResultsDir.exists())
     {
       QMessageBox::critical(
         m_Parent, "Results Directory Exists", "The result directory already exists.\nPlease choose an other name.");
       this->OnStartExperiment();
     }
     else
     {
       QDir(m_ResultsDirectory).mkdir(m_ExperimentName);
       m_ExperimentResultsSubDirectory = m_ResultsDirectory + QDir::separator() + m_ExperimentName;
 
       // experiment is running now
       ui->runningLabel->setPixmap(m_IconRunning);
 
       // (re)start timer for navigation step durations
       m_NavigationStepTimer->Reset();
       m_NavigationStepTimer->SetOutputFileName(
         QString(m_ExperimentResultsSubDirectory + QDir::separator() + QString("durations.cvs")).toStdString());
       m_NavigationStepTimer->SetActiveIndex(0, "Initialization");
 
       ui->finishExperimentButton->setEnabled(true);
       ui->startExperimentButton->setDisabled(true);
 
       // initialize and register logging backend
       QString loggingFilename = m_ExperimentResultsSubDirectory + QDir::separator() + "logging.txt";
       m_LoggingBackend.SetOutputFileName(loggingFilename.toStdString());
       mbilog::RegisterBackend(&m_LoggingBackend);
 
       // initialize and start navigation data recorder form xml recording
       m_NavigationDataRecorder->StartRecording();
 
       m_IsExperimentRunning = true;
 
       m_ImageAndNavigationDataLoggingTimer->start(1000);
     }
   }
 }
 
 void QmitkUSNavigationMarkerPlacement::OnFinishExperiment()
 {
   this->WaitCursorOn();
 
   MITK_INFO("USNavigationLogging") << "Experiment finished!";
   MITK_INFO("USNavigationLogging") << "Position/Orientation of needle tip: "
                                    << (dynamic_cast<mitk::NavigationData *>(
                                          m_CombinedModality->GetTrackingDeviceDataSource()->GetOutput(0)))
                                         ->GetPosition();
   MITK_INFO("USNavigationLogging")
     << "Position of target: " << m_TargetNodeDisplacementFilter->GetRawDisplacementNavigationData(0)->GetPosition();
   MITK_INFO("USNavigationLogging") << "Total duration: " << m_NavigationStepTimer->GetTotalDuration();
 
   m_ImageAndNavigationDataLoggingTimer->stop();
 
   ui->runningLabel->setPixmap(m_IconNotRunning);
 
   m_NavigationStepTimer->Stop();
 
   ui->finishExperimentButton->setDisabled(true);
   ui->startExperimentButton->setEnabled(true);
 
   MITK_INFO("USNavigationLogging") << "Writing logging data to " << m_ExperimentResultsSubDirectory.toStdString();
   //  save ultrasound images to the file system
   QDir(m_ExperimentResultsSubDirectory).mkdir("ImageStream");
   m_USImageLoggingFilter->Update();
   m_USImageLoggingFilter->SetImageFilesExtension(".jpg");
   m_USImageLoggingFilter->SaveImages(
     QString(m_ExperimentResultsSubDirectory + QDir::separator() + "ImageStream" + QDir::separator()).toStdString());
   m_USImageLoggingFilter = mitk::USImageLoggingFilter::New();
 
   m_NavigationDataRecorder->StopRecording();
 
   // Write data to csv and xml file
   mitk::IOUtil::Save(
     m_NavigationDataRecorder->GetNavigationDataSet(),
     (QString(m_ExperimentResultsSubDirectory + QDir::separator() + "navigation-data.xml").toStdString().c_str()));
   mitk::IOUtil::Save(
     m_NavigationDataRecorder->GetNavigationDataSet(),
     (QString(m_ExperimentResultsSubDirectory + QDir::separator() + "navigation-data.csv").toStdString().c_str()));
 
   // write logged navigation data messages to separate file
   std::stringstream csvNavigationMessagesFilename;
   csvNavigationMessagesFilename << m_ExperimentResultsSubDirectory.toStdString() << QDir::separator().toLatin1()
                                 << "CSVNavigationMessagesLogFile.csv";
   MITK_INFO("USNavigationLogging") << "Writing logged navigation messages to separate csv file: "
                                    << csvNavigationMessagesFilename.str();
   m_LoggingBackend.WriteCSVFileWithNavigationMessages(csvNavigationMessagesFilename.str());
 
   mbilog::UnregisterBackend(&m_LoggingBackend);
 
   m_IsExperimentRunning = false;
 
   m_ImageAndNavigationDataLoggingTimer->stop();
   m_CombinedModality = nullptr;
 
   // reset scene number for next experiment
   m_SceneNumber = 1;
 
   this->WaitCursorOff();
   MITK_INFO("USNavigationLogging") << "Finished!";
 }
 
 void QmitkUSNavigationMarkerPlacement::OnSettingsChanged(itk::SmartPointer<mitk::DataNode> settings)
 {
   // initialize gui according to the experiment mode setting
   bool experimentMode = false;
   settings->GetBoolProperty("settings.experiment-mode", experimentMode);
   ui->startExperimentButton->setVisible(experimentMode);
   ui->finishExperimentButton->setVisible(experimentMode);
   ui->runningLabel->setVisible(experimentMode);
   if (experimentMode && !m_IsExperimentRunning)
   {
     ui->runningLabel->setPixmap(m_IconNotRunning);
   }
   else if (!experimentMode)
   {
     if (m_IsExperimentRunning)
     {
       this->OnFinishExperiment();
     }
   }
 
   // get the results directory from the settings and use home directory if
   // there is no results directory configured
   std::string resultsDirectory;
   if (settings->GetStringProperty("settings.experiment-results-directory", resultsDirectory))
   {
     m_ResultsDirectory = QString::fromStdString(resultsDirectory);
   }
   else
   {
     m_ResultsDirectory = QDir::homePath();
   }
 
   // make sure that the results directory exists
   QDir resultsDirectoryQDir = QDir(m_ResultsDirectory);
   if (!resultsDirectoryQDir.exists())
   {
     resultsDirectoryQDir.mkpath(m_ResultsDirectory);
   }
 
   MITK_INFO("USNavigation") << "Results Directory: " << m_ResultsDirectory.toStdString();
 }
 
 void QmitkUSNavigationMarkerPlacement::ReinitOnImage()
 {
   if (!m_ReinitAlreadyDone && m_CombinedModality.IsNotNull())
   {
     // make sure that the output is already calibrated correctly
     // (if the zoom level was changed recently)
     m_CombinedModality->Modified();
     m_CombinedModality->Update();
 
     mitk::Image::Pointer image = m_CombinedModality->GetOutput();
     if (image.IsNotNull() && image->IsInitialized())
     {
       // make a reinit on the ultrasound image
       mitk::IRenderWindowPart *renderWindowPart = this->GetRenderWindowPart();
       if (renderWindowPart != nullptr && image->GetTimeGeometry()->IsValid())
       {
         renderWindowPart->GetRenderingManager()->InitializeViews(
           image->GetTimeGeometry(), mitk::RenderingManager::REQUEST_UPDATE_ALL, true);
         renderWindowPart->GetRenderingManager()->RequestUpdateAll();
       }
 
       this->RequestRenderWindowUpdate();
 
       m_ReinitAlreadyDone = true;
     }
   }
 }
 
 void QmitkUSNavigationMarkerPlacement::Convert2DImagesTo3D(mitk::DataStorage::SetOfObjects::ConstPointer nodes)
 {
   for (mitk::DataStorage::SetOfObjects::ConstIterator it = nodes->Begin(); it != nodes->End(); ++it)
   {
     if (it->Value()->GetData() && strcmp(it->Value()->GetData()->GetNameOfClass(), "Image") == 0)
     {
       // convert image to 3d image if it is 2d at the moment
       mitk::Image::Pointer image = dynamic_cast<mitk::Image *>(it->Value()->GetData());
       if (image.IsNotNull() && image->GetDimension() == 2 && !image->GetGeometry()->Is2DConvertable())
       {
         mitk::Convert2Dto3DImageFilter::Pointer convert2DTo3DImageFilter = mitk::Convert2Dto3DImageFilter::New();
         convert2DTo3DImageFilter->SetInput(image);
         convert2DTo3DImageFilter->Update();
         it->Value()->SetData(convert2DTo3DImageFilter->GetOutput());
       }
     }
   }
 }
 
 void QmitkUSNavigationMarkerPlacement::CreateOverlays()
 {
   // initialize warning overlay (and do not display it, yet)
   m_WarnOverlay->SetText("Warning: No calibration available for current depth.");
 
   // set position and font size for the text overlay
   // (nonesense postition as a layouter is used, but it ignored
   // the overlay without setting a position here)
   mitk::Point2D overlayPosition;
   overlayPosition.SetElement(0, -50.0f);
   overlayPosition.SetElement(1, -50.0f);
   m_WarnOverlay->SetPosition2D(overlayPosition);
   m_WarnOverlay->SetFontSize(22);
   m_WarnOverlay->SetColor(1, 0, 0); // overlay should be red
 }
 
 void QmitkUSNavigationMarkerPlacement::UpdateToolStorage()
 {
   if (m_NavigationDataSource.IsNull())
   {
     m_NavigationDataSource = m_CombinedModality->GetNavigationDataSource();
   }
   if (m_NavigationDataSource.IsNull())
   {
     MITK_WARN << "Found an invalid navigation data source object!";
   }
   us::ModuleContext *context = us::GetModuleContext();
   std::string id = m_NavigationDataSource->US_PROPKEY_ID;
   std::string filter = "(" + mitk::NavigationToolStorage::US_PROPKEY_SOURCE_ID + "=" + id + ")";
   // Get Storage
   std::vector<us::ServiceReference<mitk::NavigationToolStorage>> refs =
     context->GetServiceReferences<mitk::NavigationToolStorage>();
   m_CurrentStorage = context->GetService(refs.front());
 
   if (m_CurrentStorage.IsNull())
   {
     MITK_WARN << "Found an invalid storage object!";
   }
   else if (m_CurrentStorage->GetToolCount() !=
            m_NavigationDataSource->GetNumberOfOutputs()) // there is something wrong with the storage
   {
     MITK_WARN << "Found a tool storage, but it has not the same number of tools like the NavigationDataSource. This "
                  "storage won't be used because it isn't the right one.";
     m_CurrentStorage = nullptr;
   }
 }
diff --git a/Plugins/org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation/src/internal/QmitkUltrasoundCalibration.cpp b/Plugins/org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation/src/internal/QmitkUltrasoundCalibration.cpp
index c8502054a3..3134d15837 100644
--- a/Plugins/org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation/src/internal/QmitkUltrasoundCalibration.cpp
+++ b/Plugins/org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation/src/internal/QmitkUltrasoundCalibration.cpp
@@ -1,1398 +1,1398 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 // Blueberry
 #include <berryISelectionService.h>
 #include <berryIWorkbenchWindow.h>
 
 // Qmitk
 #include "QmitkUltrasoundCalibration.h"
 #include <QTimer>
 
 // Qt
 #include <QFileDialog>
 #include <QMessageBox>
 #include <QTextStream>
 #include <QmitkServiceListWidget.h>
 
 // MITK
 #include <mitkVector.h>
 #include "mitkIOUtil.h"
 #include "mitkIRenderingManager.h"
 #include <mitkBaseData.h>
 #include <mitkImageGenerator.h>
 #include <mitkNodePredicateDataType.h>
 #include <mitkNodePredicateNot.h>
 #include <mitkNodePredicateProperty.h>
 #include <mitkPointSet.h>
 #include <mitkPointSetDataInteractor.h>
 #include <mitkPointSetShapeProperty.h>
 #include <mitkSceneIO.h>
 
 // us
 #include <usServiceReference.h>
 
 // VTK
 #include <vtkLandmarkTransform.h>
 #include <vtkMatrix4x4.h>
 #include <vtkPlane.h>
 #include <vtkPoints.h>
 #include <vtkSphereSource.h>
 #include <vtkTransform.h>
 
 #include <vtkVertexGlyphFilter.h>
 
 #include "internal/org_mbi_gui_qt_usnavigation_Activator.h"
 
 // sleep headers
 #include <chrono>
 #include <thread>
 
 const std::string QmitkUltrasoundCalibration::VIEW_ID = "org.mitk.views.ultrasoundcalibration";
 
 QmitkUltrasoundCalibration::QmitkUltrasoundCalibration()
   : m_PhantomConfigurationPointSet(nullptr),
     m_USDeviceChanged(this, &QmitkUltrasoundCalibration::OnUSDepthChanged)
 {
   ctkPluginContext *pluginContext = mitk::PluginActivator::GetContext();
 
   if (pluginContext)
   {
     // to be notified about service event of an USDevice
     pluginContext->connectServiceListener(this,
                                           "OnDeviceServiceEvent",
                                           QString::fromStdString("(" + us::ServiceConstants::OBJECTCLASS() + "=" +
                                                                  us_service_interface_iid<mitk::USDevice>() + ")"));
   }
 }
 
 QmitkUltrasoundCalibration::~QmitkUltrasoundCalibration()
 {
   m_Controls.m_CombinedModalityManagerWidget->blockSignals(true);
   mitk::AbstractUltrasoundTrackerDevice::Pointer combinedModality;
   combinedModality = m_Controls.m_CombinedModalityManagerWidget->GetSelectedCombinedModality();
   if (combinedModality.IsNotNull())
   {
     combinedModality->GetUltrasoundDevice()->RemovePropertyChangedListener(m_USDeviceChanged);
   }
   m_Timer->stop();
 
   this->OnStopCalibrationProcess();
 
   this->OnStopPlusCalibration();
 
   mitk::DataNode::Pointer node = this->GetDataStorage()->GetNamedNode("Needle Path");
   if (node.IsNotNull())
     this->GetDataStorage()->Remove(node);
 
   this->GetDataStorage()->Remove(m_VerificationReferencePointsDataNode);
 
   delete m_Timer;
 
   // remove observer for phantom-based point adding
   m_CalibPointsImage->RemoveAllObservers();
 }
 
 void QmitkUltrasoundCalibration::SetFocus()
 {
   m_Controls.m_ToolBox->setFocus();
 }
 
 void QmitkUltrasoundCalibration::CreateQtPartControl(QWidget *parent)
 {
   // create GUI widgets from the Qt Designer's .ui file
   m_Controls.setupUi(parent);
 
   m_Controls.m_CombinedModalityManagerWidget->SetCalibrationLoadedNecessary(false);
 
   m_Timer = new QTimer(this);
   m_StreamingTimer = new QTimer(this);
 
   m_Controls.m_SpacingBtnFreeze->setEnabled(true);
   m_Controls.m_SpacingAddPoint->setEnabled(false);
   m_Controls.m_CalculateSpacing->setEnabled(false);
 
   m_SpacingPointsCount = 0;
   m_SpacingPoints = mitk::PointSet::New();
   m_SpacingNode = mitk::DataNode::New();
   m_SpacingNode->SetName("Spacing Points");
   m_SpacingNode->SetData(this->m_SpacingPoints);
   this->GetDataStorage()->Add(m_SpacingNode);
 
   // Pointset for Calibration Points
   m_CalibPointsTool = mitk::PointSet::New();
 
   // Pointset for Worldpoints
   m_CalibPointsImage = mitk::PointSet::New();
 
   m_CalibPointsCount = 0;
 
   // Evaluation Pointsets (Non-Visualized)
   m_EvalPointsImage = mitk::PointSet::New();
   m_EvalPointsTool = mitk::PointSet::New();
   m_EvalPointsProjected = mitk::PointSet::New();
 
   // Neelde Projection Filter
   m_NeedleProjectionFilter = mitk::NeedleProjectionFilter::New();
 
   // Tracking Status Widgets
   m_Controls.m_CalibTrackingStatus->ShowStatusLabels();
   m_Controls.m_EvalTrackingStatus->ShowStatusLabels();
 
   // General & Device Selection
   connect(m_Timer, SIGNAL(timeout()), this, SLOT(Update()));
 
   // Calibration
   connect(m_Controls.m_CalibBtnFreeze, SIGNAL(clicked()), this, SLOT(SwitchFreeze())); // Freeze
   connect(m_Controls.m_CalibBtnAddPoint,
           SIGNAL(clicked()),
           this,
           SLOT(OnAddCalibPoint())); // Tracking & Image Points (Calibration)
   connect(m_Controls.m_CalibBtnCalibrate, SIGNAL(clicked()), this, SLOT(OnCalibration())); // Perform Calibration
   // Phantom-based calibration
   connect(m_Controls.m_CalibBtnLoadPhantomConfiguration,
           SIGNAL(clicked()),
           this,
           SLOT(OnLoadPhantomConfiguration())); // Phantom configuration
   connect(m_Controls.m_CalibBtnMatchAnnotationToPhantomConfiguration,
           SIGNAL(clicked()),
           this,
           SLOT(OnMatchAnnotationToPhantomConfiguration()));
   connect(m_Controls.m_CalibBtnMoveUp, SIGNAL(clicked()), this, SLOT(OnMovePhantomAnnotationsUp()));
   connect(m_Controls.m_CalibBtnMoveDown, SIGNAL(clicked()), this, SLOT(OnMovePhantomAnnotationsDown()));
   connect(m_Controls.m_CalibBtnMoveLeft, SIGNAL(clicked()), this, SLOT(OnMovePhantomAnnotationsLeft()));
   connect(m_Controls.m_CalibBtnMoveRight, SIGNAL(clicked()), this, SLOT(OnMovePhantomAnnotationsRight()));
   connect(m_Controls.m_CalibBtnRotateRight, SIGNAL(clicked()), this, SLOT(OnRotatePhantomAnnotationsRight()));
   connect(m_Controls.m_CalibBtnRotateLeft, SIGNAL(clicked()), this, SLOT(OnRotatePhantomAnnotationsLeft()));
 
   connect(m_Controls.m_CalibBtnPerformPhantomCalibration,
           SIGNAL(clicked()),
           this,
           SLOT(OnPhantomBasedCalibration())); // Perform phantom-based calibration
   connect(m_Controls.m_CalibBtnSavePhantomCalibration,
           SIGNAL(clicked()),
           this,
           SLOT(OnSaveCalibration())); // Save phantom-based calibration
 
   // Evaluation
   connect(m_Controls.m_EvalBtnStep1, SIGNAL(clicked()), this, SLOT(OnAddEvalProjectedPoint())); // Needle Projection
   connect(m_Controls.m_EvalBtnStep2, SIGNAL(clicked()), this, SLOT(SwitchFreeze()));            // Freeze
   connect(m_Controls.m_EvalBtnStep3,
           SIGNAL(clicked()),
           this,
           SLOT(OnAddEvalTargetPoint())); // Tracking & Image Points (Evaluation)
   connect(m_Controls.m_EvalBtnSave, SIGNAL(clicked()), this, SLOT(OnSaveEvaluation())); // Save Evaluation Results
   connect(m_Controls.m_CalibBtnSaveCalibration,
           SIGNAL(clicked()),
           this,
           SLOT(OnSaveCalibration()));                                       // Save Evaluation Results
   connect(m_Controls.m_BtnReset, SIGNAL(clicked()), this, SLOT(OnReset())); // Reset Pointsets
 
   // PLUS Calibration
   connect(m_Controls.m_GetCalibrationFromPLUS, SIGNAL(clicked()), this, SLOT(OnGetPlusCalibration()));
   connect(m_Controls.m_StartStreaming, SIGNAL(clicked()), this, SLOT(OnStartStreaming()));
   connect(m_StreamingTimer, SIGNAL(timeout()), this, SLOT(OnStreamingTimerTimeout()));
   connect(m_Controls.m_StopPlusCalibration, SIGNAL(clicked()), this, SLOT(OnStopPlusCalibration()));
   connect(m_Controls.m_SavePlusCalibration, SIGNAL(clicked()), this, SLOT(OnSaveCalibration()));
   connect(this, SIGNAL(NewConnectionSignal()), this, SLOT(OnNewConnection()));
 
   // Determine Spacing for Calibration of USVideoDevice
   connect(m_Controls.m_SpacingBtnFreeze, SIGNAL(clicked()), this, SLOT(OnFreezeClicked()));
   connect(m_Controls.m_SpacingAddPoint, SIGNAL(clicked()), this, SLOT(OnAddSpacingPoint()));
   connect(m_Controls.m_CalculateSpacing, SIGNAL(clicked()), this, SLOT(OnCalculateSpacing()));
 
   connect(m_Controls.m_CombinedModalityManagerWidget, SIGNAL(SignalReadyForNextStep()), this, SLOT(OnDeviceSelected()));
   connect(m_Controls.m_CombinedModalityManagerWidget,
           SIGNAL(SignalNoLongerReadyForNextStep()),
           this,
           SLOT(OnDeviceDeselected()));
   connect(m_Controls.m_StartCalibrationButton, SIGNAL(clicked()), this, SLOT(OnStartCalibrationProcess()));
   connect(m_Controls.m_StartPlusCalibrationButton, SIGNAL(clicked()), this, SLOT(OnStartPlusCalibration()));
   connect(m_Controls.m_CalibBtnRestartCalibration, SIGNAL(clicked()), this, SLOT(OnReset()));
   connect(m_Controls.m_CalibBtnStopCalibration, SIGNAL(clicked()), this, SLOT(OnStopCalibrationProcess()));
 
   connect(m_Controls.m_AddReferencePoints, SIGNAL(clicked()), this, SLOT(OnAddCurrentTipPositionToReferencePoints()));
   connect(m_Controls.m_AddCurrentPointerTipForVerification,
           SIGNAL(clicked()),
           this,
           SLOT(OnAddCurrentTipPositionForVerification()));
   connect(m_Controls.m_StartVerification, SIGNAL(clicked()), this, SLOT(OnStartVerification()));
 
   // initialize data storage combo box
   m_Controls.m_ReferencePointsComboBox->SetDataStorage(this->GetDataStorage());
   m_Controls.m_ReferencePointsComboBox->SetAutoSelectNewItems(true);
   m_Controls.m_ReferencePointsComboBox->SetPredicate(mitk::NodePredicateDataType::New("PointSet"));
 
   // initialize point list widget
   if (m_VerificationReferencePoints.IsNull())
   {
     m_VerificationReferencePoints = mitk::PointSet::New();
   }
   if (m_VerificationReferencePointsDataNode.IsNull())
   {
     m_VerificationReferencePointsDataNode = mitk::DataNode::New();
     m_VerificationReferencePointsDataNode->SetName("US Verification Reference Points");
     m_VerificationReferencePointsDataNode->SetData(m_VerificationReferencePoints);
     this->GetDataStorage()->Add(m_VerificationReferencePointsDataNode);
   }
   m_Controls.m_ReferencePointsPointListWidget->SetPointSetNode(m_VerificationReferencePointsDataNode);
 
   m_Controls.m_ToolBox->setCurrentIndex(0);
 }
 
 void QmitkUltrasoundCalibration::OnSelectionChanged(berry::IWorkbenchPart::Pointer /*source*/,
                                                     const QList<mitk::DataNode::Pointer> & /*nodes*/)
 {
 }
 
 void QmitkUltrasoundCalibration::OnTabSwitch(int index)
 {
   switch (index)
   {
     case 0:
       if (m_Controls.m_ToolBox->isItemEnabled(1) || m_Controls.m_ToolBox->isItemEnabled(2))
       {
         this->OnStopCalibrationProcess();
       }
       break;
     default:;
   }
 }
 
 void QmitkUltrasoundCalibration::OnDeviceSelected()
 {
   mitk::AbstractUltrasoundTrackerDevice::Pointer combinedModality;
   combinedModality = m_Controls.m_CombinedModalityManagerWidget->GetSelectedCombinedModality();
   if (combinedModality.IsNotNull())
   {
     combinedModality->GetUltrasoundDevice()->AddPropertyChangedListener(m_USDeviceChanged);
 
     m_Controls.m_StartCalibrationButton->setEnabled(true);
     m_Controls.m_StartPlusCalibrationButton->setEnabled(true);
     m_Controls.m_ToolBox->setItemEnabled(1, true);
     m_Controls.m_ToolBox->setItemEnabled(2, true);
   }
 }
 
 void QmitkUltrasoundCalibration::OnDeviceDeselected()
 {
   mitk::AbstractUltrasoundTrackerDevice::Pointer combinedModality;
   combinedModality = m_Controls.m_CombinedModalityManagerWidget->GetSelectedCombinedModality();
   if (combinedModality.IsNotNull())
   {
     combinedModality->GetUltrasoundDevice()->RemovePropertyChangedListener(m_USDeviceChanged);
   }
   m_Controls.m_StartCalibrationButton->setEnabled(false);
   m_Controls.m_StartPlusCalibrationButton->setEnabled(false);
   m_Controls.m_ToolBox->setCurrentIndex(0);
   m_Controls.m_ToolBox->setItemEnabled(1, false);
   m_Controls.m_ToolBox->setItemEnabled(2, false);
 }
 
 void QmitkUltrasoundCalibration::OnAddCurrentTipPositionToReferencePoints()
 {
   if (m_Controls.m_VerificationPointerChoser->GetSelectedNavigationDataSource().IsNull() ||
       (m_Controls.m_VerificationPointerChoser->GetSelectedToolID() == -1))
   {
     MITK_WARN << "No tool selected, aborting";
     return;
   }
   mitk::NavigationData::Pointer currentPointerData =
     m_Controls.m_VerificationPointerChoser->GetSelectedNavigationDataSource()->GetOutput(
       m_Controls.m_VerificationPointerChoser->GetSelectedToolID());
   mitk::Point3D currentTipPosition = currentPointerData->GetPosition();
   m_VerificationReferencePoints->InsertPoint(m_VerificationReferencePoints->GetSize(), currentTipPosition);
 }
 
 void QmitkUltrasoundCalibration::OnStartVerification()
 {
   m_currentPoint = 0;
   mitk::PointSet::Pointer selectedPointSet =
     dynamic_cast<mitk::PointSet *>(m_Controls.m_ReferencePointsComboBox->GetSelectedNode()->GetData());
   m_Controls.m_CurrentPointLabel->setText("Point " + QString::number(m_currentPoint) + " of " +
                                           QString::number(selectedPointSet->GetSize()));
   m_allErrors = std::vector<double>();
   m_allReferencePoints = std::vector<mitk::Point3D>();
   for (int i = 0; i < selectedPointSet->GetSize(); i++)
   {
     m_allReferencePoints.push_back(selectedPointSet->GetPoint(i));
   }
 }
 
 void QmitkUltrasoundCalibration::OnAddCurrentTipPositionForVerification()
 {
   if (m_currentPoint == -1)
   {
     MITK_WARN << "Cannot add point";
     return;
   }
   if (m_Controls.m_VerificationPointerChoser->GetSelectedNavigationDataSource().IsNull() ||
       (m_Controls.m_VerificationPointerChoser->GetSelectedToolID() == -1))
   {
     MITK_WARN << "No tool selected, aborting";
     return;
   }
   mitk::NavigationData::Pointer currentPointerData =
     m_Controls.m_VerificationPointerChoser->GetSelectedNavigationDataSource()->GetOutput(
       m_Controls.m_VerificationPointerChoser->GetSelectedToolID());
   mitk::Point3D currentTipPosition = currentPointerData->GetPosition();
 
   double currentError = m_allReferencePoints.at(m_currentPoint).EuclideanDistanceTo(currentTipPosition);
   MITK_INFO << "Current Error: " << currentError << " mm";
   m_allErrors.push_back(currentError);
 
   if (++m_currentPoint < static_cast<int>(m_allReferencePoints.size()))
   {
     m_Controls.m_CurrentPointLabel->setText("Point " + QString::number(m_currentPoint) + " of " +
                                             QString::number(m_allReferencePoints.size()));
   }
   else
   {
     m_currentPoint = -1;
     double meanError = 0;
     for (std::size_t i = 0; i < m_allErrors.size(); ++i)
     {
       meanError += m_allErrors[i];
     }
     meanError /= m_allErrors.size();
 
     QString result = "Finished verification! \n Verification of " + QString::number(m_allErrors.size()) +
                      " points, mean error: " + QString::number(meanError) + " mm";
     m_Controls.m_ResultsTextEdit->setText(result);
     MITK_INFO << result.toStdString();
   }
 }
 
 void QmitkUltrasoundCalibration::OnStartCalibrationProcess()
 {
   // US Image Stream
   m_Node = dynamic_cast<mitk::DataNode*>(this->GetDataStorage()->GetNamedNode("US Viewing Stream - Image 0")->CreateAnother().GetPointer());
   m_Node->SetName("US Calibration Viewing Stream");
   this->GetDataStorage()->Add(m_Node);
 
   // data node for calibration point set
   m_CalibNode = mitk::DataNode::New();
   m_CalibNode->SetName("Tool Calibration Points");
   m_CalibNode->SetData(this->m_CalibPointsTool);
   this->GetDataStorage()->Add(m_CalibNode);
 
   // data node for world point set
   m_WorldNode = mitk::DataNode::New();
   m_WorldNode->SetName("Image Calibration Points");
   m_WorldNode->SetData(this->m_CalibPointsImage);
   this->GetDataStorage()->Add(m_WorldNode);
 
   m_CombinedModality = m_Controls.m_CombinedModalityManagerWidget->GetSelectedCombinedModality();
   m_CombinedModality->SetCalibration(mitk::AffineTransform3D::New()); // dummy calibration because without a calibration
                                                                       // the comined modality was laggy (maybe a bug?)
   if (m_CombinedModality.IsNull())
   {
     return;
   }
 
   m_Tracker = m_CombinedModality->GetNavigationDataSource();
 
   // Construct Pipeline
   this->m_NeedleProjectionFilter->SetInput(0, m_Tracker->GetOutput(0));
 
   QApplication::setOverrideCursor(Qt::WaitCursor);
   // make sure that the combined modality is in connected state before using it
   if (m_CombinedModality->GetUltrasoundDevice()->GetDeviceState() < mitk::USDevice::State_Connected)
   {
     m_CombinedModality->GetUltrasoundDevice()->Connect();
   }
   if (m_CombinedModality->GetUltrasoundDevice()->GetDeviceState() < mitk::USDevice::State_Activated)
   {
     m_CombinedModality->GetUltrasoundDevice()->Activate();
   }
   QApplication::restoreOverrideCursor();
 
   this->SwitchFreeze();
 
   // Trigger the ProbeChanged method for initializing/updating the spacing of the ultrasound image correctly
   std::string probeName = m_CombinedModality->GetUltrasoundDevice()->GetCurrentProbe()->GetName();
   m_CombinedModality->GetUltrasoundDevice()->ProbeChanged(probeName);
 
   mitk::DataNode::Pointer usNode = this->GetDataStorage()->GetNamedNode("US Viewing Stream - Image 0");
   if (usNode.IsNotNull())
   {
     this->GetDataStorage()->Remove(usNode);
   }
 
   // Todo: Maybe display this elsewhere
   this->ShowNeedlePath();
 
   // Switch active tab to Calibration page
   m_Controls.m_ToolBox->setItemEnabled(1, true);
   m_Controls.m_ToolBox->setCurrentIndex(1);
 }
 
 void QmitkUltrasoundCalibration::OnStartPlusCalibration()
 {
   if (m_CombinedModality.IsNull())
   {
     m_CombinedModality = m_Controls.m_CombinedModalityManagerWidget->GetSelectedCombinedModality();
     if (m_CombinedModality.IsNull())
     {
       return;
     } // something went wrong, there is no combined modality
   }
 
   // setup server to send UltrasoundImages to PLUS
   mitk::IGTLServer::Pointer m_USServer = mitk::IGTLServer::New(true);
   m_USServer->SetName("EchoTrack Image Source");
   m_USServer->SetHostname("127.0.0.1");
   m_USServer->SetPortNumber(18944);
 
   m_USMessageProvider = mitk::IGTLMessageProvider::New();
   m_USMessageProvider->SetIGTLDevice(m_USServer);
   m_USMessageProvider->SetFPS(5);
 
   m_USImageToIGTLMessageFilter = mitk::ImageToIGTLMessageFilter::New();
   m_USImageToIGTLMessageFilter->ConnectTo(m_CombinedModality->GetUltrasoundDevice());
   m_USImageToIGTLMessageFilter->SetName("USImage Filter");
 
   // setup server to send TrackingData to PLUS
   m_TrackingServer = mitk::IGTLServer::New(true);
   m_TrackingServer->SetName("EchoTrack Tracking Source");
   m_TrackingServer->SetHostname("127.0.0.1");
   m_TrackingServer->SetPortNumber(18945);
 
   m_TrackingMessageProvider = mitk::IGTLMessageProvider::New();
   m_TrackingMessageProvider->SetIGTLDevice(m_TrackingServer);
   m_TrackingMessageProvider->SetFPS(5);
 
   m_TrackingToIGTLMessageFilter = mitk::NavigationDataToIGTLMessageFilter::New();
   m_TrackingToIGTLMessageFilter->ConnectTo(m_CombinedModality->GetTrackingDeviceDataSource());
   m_TrackingToIGTLMessageFilter->SetName("Tracker Filter");
 
   typedef itk::SimpleMemberCommand<QmitkUltrasoundCalibration> CurCommandType;
 
   CurCommandType::Pointer newConnectionCommand = CurCommandType::New();
   newConnectionCommand->SetCallbackFunction(this, &QmitkUltrasoundCalibration::OnPlusConnected);
   this->m_NewConnectionObserverTag =
     this->m_TrackingServer->AddObserver(mitk::NewClientConnectionEvent(), newConnectionCommand);
 
   // Open connections of both servers
   if (m_USServer->OpenConnection())
   {
     MITK_INFO << "US Server opened its connection successfully";
     m_USServer->StartCommunication();
   }
   else
   {
     MITK_INFO << "US Server could not open its connection";
   }
   if (m_TrackingServer->OpenConnection())
   {
     MITK_INFO << "Tracking Server opened its connection successfully";
     m_TrackingServer->StartCommunication();
   }
   else
   {
     MITK_INFO << "Tracking Server could not open its connection";
   }
   if (m_USMessageProvider->IsCommunicating() && m_TrackingMessageProvider->IsCommunicating())
   {
     m_Controls.m_StartPlusCalibrationButton->setEnabled(false);
     m_Controls.m_GetCalibrationFromPLUS->setEnabled(true);
     m_Controls.m_StartStreaming->setEnabled(false);
     m_Controls.m_SavePlusCalibration->setEnabled(false);
     m_Controls.m_SetupStatus->setStyleSheet("QLabel { color : green; }");
     m_Controls.m_SetupStatus->setText("Setup successfull you can now connect PLUS");
   }
   else
   {
     m_Controls.m_SetupStatus->setStyleSheet("QLabel { color : red; }");
     m_Controls.m_SetupStatus->setText("Something went wrong. Please try again");
   }
 }
 
 void QmitkUltrasoundCalibration::OnStopPlusCalibration()
 {
   // closing all server and clients when PlusCalibration is finished
   if (m_USMessageProvider.IsNotNull())
   {
     if (m_USMessageProvider->IsStreaming())
     {
       m_USMessageProvider->StopStreamingOfSource(m_USImageToIGTLMessageFilter);
     }
   }
   if (m_TrackingMessageProvider.IsNotNull())
   {
     if (m_TrackingMessageProvider->IsStreaming())
     {
       m_TrackingMessageProvider->StopStreamingOfSource(m_TrackingToIGTLMessageFilter);
     }
   }
   if (m_USServer.IsNotNull())
   {
     m_USServer->CloseConnection();
   }
   if (m_TrackingServer.IsNotNull())
   {
     m_TrackingServer->CloseConnection();
   }
   if (m_TransformClient.IsNotNull())
   {
     m_TransformClient->CloseConnection();
   }
   m_Controls.m_GotCalibrationLabel->setText("");
   m_Controls.m_ConnectionStatus->setText("");
   m_Controls.m_SetupStatus->setText("");
   m_Controls.m_StartPlusCalibrationButton->setEnabled(true);
   m_StreamingTimer->stop();
   delete m_StreamingTimer;
 }
 
 void QmitkUltrasoundCalibration::OnPlusConnected()
 {
   emit NewConnectionSignal();
 }
 
 void QmitkUltrasoundCalibration::OnNewConnection()
 {
   m_Controls.m_StartStreaming->setEnabled(true);
   m_Controls.m_ConnectionStatus->setStyleSheet("QLabel { color : green; }");
   m_Controls.m_ConnectionStatus->setText("Connection successfull you can now start streaming");
 }
 
 void QmitkUltrasoundCalibration::OnStreamingTimerTimeout()
 {
   m_USMessageProvider->Update();
   m_TrackingMessageProvider->Update();
 }
 
 void QmitkUltrasoundCalibration::OnStartStreaming()
 {
   m_USMessageProvider->StartStreamingOfSource(m_USImageToIGTLMessageFilter, 5);
   m_TrackingMessageProvider->StartStreamingOfSource(m_TrackingToIGTLMessageFilter, 5);
   m_Controls.m_StartStreaming->setEnabled(false);
   m_Controls.m_ConnectionStatus->setText("");
   m_StreamingTimer->start((1.0 / 5.0 * 1000.0));
 }
 
 void QmitkUltrasoundCalibration::OnGetPlusCalibration()
 {
   m_TransformClient = mitk::IGTLClient::New(true);
   m_TransformClient->SetHostname("127.0.0.1");
   m_TransformClient->SetPortNumber(18946);
   m_TransformDeviceSource = mitk::IGTLDeviceSource::New();
   m_TransformDeviceSource->SetIGTLDevice(m_TransformClient);
   m_TransformDeviceSource->Connect();
   if (m_TransformDeviceSource->IsConnected())
   {
     MITK_INFO << "successfully connected";
     m_TransformDeviceSource->StartCommunication();
     if (m_TransformDeviceSource->IsCommunicating())
     {
       MITK_INFO << "communication started";
       mitk::IGTLMessage::Pointer receivedMessage;
       bool condition = false;
       igtl::Matrix4x4 transformPLUS;
       while (!(receivedMessage.IsNotNull() && receivedMessage->IsDataValid()))
       {
         std::this_thread::sleep_for(std::chrono::milliseconds(50));
         m_TransformDeviceSource->Update();
         receivedMessage = m_TransformDeviceSource->GetOutput();
         igtl::TransformMessage::Pointer msg =
           dynamic_cast<igtl::TransformMessage *>(m_TransformDeviceSource->GetOutput()->GetMessage().GetPointer());
         if (msg == nullptr || msg.IsNull())
         {
           MITK_INFO << "Received message could not be casted to TransformMessage. Skipping...";
           continue;
         }
         else
         {
           if (std::strcmp(msg->GetDeviceName(), "ImageToTracker") != 0)
           {
             MITK_INFO << "Was not Image to Tracker Transform. Skipping...";
             continue;
           }
           else
           {
             msg->GetMatrix(transformPLUS);
             condition = true;
             break;
           }
         }
       }
       if (condition)
       {
         this->ProcessPlusCalibration(transformPLUS);
       }
       else
       {
         m_Controls.m_GotCalibrationLabel->setStyleSheet("QLabel { color : red; }");
         m_Controls.m_GotCalibrationLabel->setText("Something went wrong. Please try again");
       }
     }
     else
     {
       MITK_INFO << " no connection";
       m_Controls.m_GotCalibrationLabel->setStyleSheet("QLabel { color : red; }");
       m_Controls.m_GotCalibrationLabel->setText("Something went wrong. Please try again");
     }
   }
   else
   {
     m_Controls.m_GotCalibrationLabel->setStyleSheet("QLabel { color : red; }");
     m_Controls.m_GotCalibrationLabel->setText("Something went wrong. Please try again");
   }
 }
 
 void QmitkUltrasoundCalibration::ProcessPlusCalibration(igtl::Matrix4x4 &imageToTracker)
 {
   mitk::AffineTransform3D::Pointer imageToTrackerTransform = mitk::AffineTransform3D::New();
   itk::Matrix<mitk::ScalarType, 3, 3> rotationFloat = itk::Matrix<mitk::ScalarType, 3, 3>();
   itk::Vector<mitk::ScalarType, 3> translationFloat = itk::Vector<mitk::ScalarType, 3>();
 
   rotationFloat[0][0] = imageToTracker[0][0];
   rotationFloat[0][1] = imageToTracker[0][1];
   rotationFloat[0][2] = imageToTracker[0][2];
   rotationFloat[1][0] = imageToTracker[1][0];
   rotationFloat[1][1] = imageToTracker[1][1];
   rotationFloat[1][2] = imageToTracker[1][2];
   rotationFloat[2][0] = imageToTracker[2][0];
   rotationFloat[2][1] = imageToTracker[2][1];
   rotationFloat[2][2] = imageToTracker[2][2];
   translationFloat[0] = imageToTracker[0][3];
   translationFloat[1] = imageToTracker[1][3];
   translationFloat[2] = imageToTracker[2][3];
 
   imageToTrackerTransform->SetTranslation(translationFloat);
   imageToTrackerTransform->SetMatrix(rotationFloat);
 
   m_CombinedModality->SetCalibration(imageToTrackerTransform);
   m_Controls.m_ToolBox->setItemEnabled(2, true);
   m_Controls.m_SavePlusCalibration->setEnabled(true);
   m_Controls.m_GotCalibrationLabel->setStyleSheet("QLabel { color : green; }");
   m_Controls.m_GotCalibrationLabel->setText("Recieved Calibration from PLUS you can now save it");
 }
 
 void QmitkUltrasoundCalibration::OnStopCalibrationProcess()
 {
   this->ClearTemporaryMembers();
 
   m_Timer->stop();
 
   this->GetDataStorage()->Remove(m_Node);
   m_Node = nullptr;
 
   this->GetDataStorage()->Remove(m_CalibNode);
   m_CalibNode = nullptr;
 
   this->GetDataStorage()->Remove(m_WorldNode);
   m_WorldNode = nullptr;
 
   m_Controls.m_ToolBox->setCurrentIndex(0);
 }
 
 void QmitkUltrasoundCalibration::OnDeviceServiceEvent(const ctkServiceEvent event)
 {
   if (m_CombinedModality.IsNull() || event.getType() != ctkServiceEvent::MODIFIED)
   {
     return;
   }
 
   ctkServiceReference service = event.getServiceReference();
 
   QString curDepth =
     service.getProperty(QString::fromStdString(mitk::USDevice::GetPropertyKeys().US_PROPKEY_BMODE_DEPTH)).toString();
   if (m_CurrentDepth != curDepth)
   {
     m_CurrentDepth = curDepth;
     this->OnReset();
   }
 }
 
 void QmitkUltrasoundCalibration::OnAddCalibPoint()
 {
-  mitk::Point3D world = this->GetRenderWindowPart()->GetSelectedPosition();
+  auto world = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetSelectedPosition();
 
   this->m_CalibPointsImage->InsertPoint(m_CalibPointsCount, world);
   this->m_CalibPointsTool->InsertPoint(m_CalibPointsCount, this->m_FreezePoint);
 
   QString text = text.number(m_CalibPointsCount + 1);
   text = "Point " + text;
   this->m_Controls.m_CalibPointList->addItem(text);
 
   m_CalibPointsCount++;
   SwitchFreeze();
 }
 
 void QmitkUltrasoundCalibration::OnCalibration()
 {
   if (m_CombinedModality.IsNull())
   {
     return;
   }
 
   // Compute transformation
   vtkSmartPointer<vtkLandmarkTransform> transform = vtkSmartPointer<vtkLandmarkTransform>::New();
 
   transform->SetSourceLandmarks(this->ConvertPointSetToVtkPolyData(m_CalibPointsImage)->GetPoints());
   transform->SetTargetLandmarks(this->ConvertPointSetToVtkPolyData(m_CalibPointsTool)->GetPoints());
 
   if (!m_CombinedModality->GetIsTrackedUltrasoundActive())
   {
     if (m_Controls.m_ScaleTransform->isChecked())
     {
       transform->SetModeToSimilarity();
     } // use affine transform
     else
     {
       transform->SetModeToRigidBody();
     } // use similarity transform: scaling is not touched
     MITK_INFO << "TEST";
   }
   else
   {
     transform->SetModeToRigidBody(); // use similarity transform: scaling is not touched
   }
 
   transform->Modified();
   transform->Update();
 
   // Convert from vtk to itk data types
   itk::Matrix<mitk::ScalarType, 3, 3> rotationFloat = itk::Matrix<mitk::ScalarType, 3, 3>();
   itk::Vector<mitk::ScalarType, 3> translationFloat = itk::Vector<mitk::ScalarType, 3>();
   vtkSmartPointer<vtkMatrix4x4> m = transform->GetMatrix();
   rotationFloat[0][0] = m->GetElement(0, 0);
   rotationFloat[0][1] = m->GetElement(0, 1);
   rotationFloat[0][2] = m->GetElement(0, 2);
   rotationFloat[1][0] = m->GetElement(1, 0);
   rotationFloat[1][1] = m->GetElement(1, 1);
   rotationFloat[1][2] = m->GetElement(1, 2);
   rotationFloat[2][0] = m->GetElement(2, 0);
   rotationFloat[2][1] = m->GetElement(2, 1);
   rotationFloat[2][2] = m->GetElement(2, 2);
   translationFloat[0] = m->GetElement(0, 3);
   translationFloat[1] = m->GetElement(1, 3);
   translationFloat[2] = m->GetElement(2, 3);
 
   mitk::PointSet::Pointer ImagePointsTransformed = m_CalibPointsImage->Clone();
   this->ApplyTransformToPointSet(ImagePointsTransformed, transform);
   mitk::DataNode::Pointer CalibPointsImageTransformed =
     this->GetDataStorage()->GetNamedNode("Calibration Points Image (Transformed)");
   if (CalibPointsImageTransformed.IsNull())
   {
     CalibPointsImageTransformed = mitk::DataNode::New();
     CalibPointsImageTransformed->SetName("Calibration Points Image (Transformed)");
     this->GetDataStorage()->Add(CalibPointsImageTransformed);
   }
   CalibPointsImageTransformed->SetData(ImagePointsTransformed);
 
   // Set new calibration transform
   m_Transformation = mitk::AffineTransform3D::New();
   m_Transformation->SetTranslation(translationFloat);
   m_Transformation->SetMatrix(rotationFloat);
   MITK_INFO << "New Calibration transform: " << m_Transformation;
 
   mitk::SlicedGeometry3D::Pointer sliced3d = dynamic_cast<mitk::SlicedGeometry3D *>(m_Node->GetData()->GetGeometry());
 
   mitk::PlaneGeometry::Pointer plane = const_cast<mitk::PlaneGeometry *>(sliced3d->GetPlaneGeometry(0));
 
   plane->SetIndexToWorldTransform(m_Transformation);
 
   // Save to US-Device
   m_CombinedModality->SetCalibration(m_Transformation);
   m_Controls.m_ToolBox->setItemEnabled(2, true);
 
   // Save to NeedleProjectionFilter
   m_NeedleProjectionFilter->SetTargetPlane(m_Transformation);
 
   // Update Calibration FRE
   m_CalibrationStatistics = mitk::PointSetDifferenceStatisticsCalculator::New();
   mitk::PointSet::Pointer p1 =
     this->m_CalibPointsTool->Clone(); // We use clones to calculate statistics to avoid concurrency Problems
 
   // Create point set with transformed image calibration points for
   // calculating the difference of image calibration and tool
   // calibration points in one geometry space
   mitk::PointSet::Pointer p2 = mitk::PointSet::New();
   int n = 0;
   for (mitk::PointSet::PointsConstIterator it = m_CalibPointsImage->Begin(); it != m_CalibPointsImage->End(); ++it, ++n)
   {
     p2->InsertPoint(n, m_Transformation->TransformPoint(it->Value()));
   }
 
   m_CalibrationStatistics->SetPointSets(p1, p2);
   // QString text = text.number(m_CalibrationStatistics->GetRMS());
   QString text = QString::number(ComputeFRE(m_CalibPointsImage, m_CalibPointsTool, transform));
   MITK_INFO << "Calibration FRE: " << text.toStdString().c_str();
   m_Controls.m_EvalLblCalibrationFRE->setText(text);
 
   m_Node->SetStringProperty("Calibration FRE", text.toStdString().c_str());
   // Enable Button to save Calibration
   m_Controls.m_CalibBtnSaveCalibration->setEnabled(true);
 }
 
 void QmitkUltrasoundCalibration::OnLoadPhantomConfiguration()
 {
   // clear all data
   ClearTemporaryMembers();
   // reset UI
   m_Controls.m_CalibBtnMatchAnnotationToPhantomConfiguration->setEnabled(false);
   m_Controls.m_RefinePhantomAnnotationsGroupBox->setEnabled(false);
   m_Controls.m_CalibBtnPerformPhantomCalibration->setEnabled(false);
   m_Controls.m_CalibBtnSavePhantomCalibration->setEnabled(false);
 
   // open phantom configuration
   QString fileName = QFileDialog::getOpenFileName(nullptr, "Load phantom configuration", "", "*.mps");
 
   // dialog closed or selection canceled
   if (fileName.isNull())
   {
     return;
   }
 
   m_PhantomConfigurationPointSet = dynamic_cast<mitk::PointSet *>(mitk::IOUtil::Load(fileName.toStdString()).at(0).GetPointer());
 
   // transform phantom fiducials to tracking space
   mitk::NavigationData::Pointer currentSensorData = this->m_Tracker->GetOutput(0)->Clone();
 
   for (int i = 0; i < m_PhantomConfigurationPointSet->GetSize(); i++)
   {
     mitk::Point3D phantomPoint = m_PhantomConfigurationPointSet->GetPoint(i);
     mitk::Point3D transformedPoint = currentSensorData->TransformPoint(phantomPoint);
     this->m_CalibPointsTool->InsertPoint(i, transformedPoint);
   }
 
   // add point set interactor for image calibration points
   mitk::PointSetDataInteractor::Pointer imageCalibrationPointSetInteractor = mitk::PointSetDataInteractor::New();
   imageCalibrationPointSetInteractor->LoadStateMachine("PointSet.xml");
   imageCalibrationPointSetInteractor->SetEventConfig("PointSetConfig.xml");
   imageCalibrationPointSetInteractor->SetDataNode(m_WorldNode);
   imageCalibrationPointSetInteractor->SetMaxPoints(m_PhantomConfigurationPointSet->GetSize());
   // Call On AddCalibPointPhantomBased() when point was added
   itk::SimpleMemberCommand<QmitkUltrasoundCalibration>::Pointer pointAddedCommand =
     itk::SimpleMemberCommand<QmitkUltrasoundCalibration>::New();
   pointAddedCommand->SetCallbackFunction(this, &QmitkUltrasoundCalibration::OnPhantomCalibPointsChanged);
   m_CalibPointsImage->AddObserver(mitk::PointSetAddEvent(), pointAddedCommand);
   m_CalibPointsImage->AddObserver(mitk::PointSetMoveEvent(), pointAddedCommand);
   // Set size of image points points
   m_WorldNode->ReplaceProperty("point 2D size", mitk::FloatProperty::New(10.0));
 }
 
 void QmitkUltrasoundCalibration::OnPhantomCalibPointsChanged()
 {
   int currentIndex = m_CalibPointsImage->SearchSelectedPoint();
   mitk::Point3D currentImagePoint = m_CalibPointsImage->GetPoint(currentIndex);
   UpdatePhantomAnnotationPointVisualization(currentIndex);
   // create sphere to show radius in which next point has to be placed
    this->GetDataStorage()->Remove(this->GetDataStorage()->GetNamedNode("NextPointIndicator"));
    if (currentIndex < m_CalibPointsTool->GetSize() - 1)
   {
     float distanceToNextPoint =
       m_CalibPointsTool->GetPoint(currentIndex).EuclideanDistanceTo(m_CalibPointsTool->GetPoint(currentIndex + 1));
     vtkSmartPointer<vtkSphereSource> vtkHelperSphere = vtkSmartPointer<vtkSphereSource>::New();
     vtkHelperSphere->SetCenter(currentImagePoint[0], currentImagePoint[1], currentImagePoint[2]);
     vtkHelperSphere->SetRadius(distanceToNextPoint);
     vtkHelperSphere->SetPhiResolution(40);
     vtkHelperSphere->SetThetaResolution(40);
     vtkHelperSphere->Update();
     mitk::Surface::Pointer helperSphere = mitk::Surface::New();
     helperSphere->SetVtkPolyData(vtkHelperSphere->GetOutput());
     mitk::DataNode::Pointer helperSphereNode = mitk::DataNode::New();
     helperSphereNode->SetName("NextPointIndicator");
     helperSphereNode->SetData(helperSphere);
     helperSphereNode->SetColor(0.0, 1.0, 0.0);
     this->GetDataStorage()->Add(helperSphereNode);
   }
   if (m_CalibPointsTool->GetSize() == m_CalibPointsImage->GetSize())
   {
     m_Controls.m_CalibBtnMatchAnnotationToPhantomConfiguration->setEnabled(true);
   }
 }
 
 void QmitkUltrasoundCalibration::UpdatePhantomAnnotationPointVisualization(int index)
 {
   mitk::Point3D currentImagePoint = m_CalibPointsImage->GetPoint(index);
   // create sphere to show current fiducial
   std::stringstream pointName;
   pointName << "Point";
   pointName << index;
   this->GetDataStorage()->Remove(this->GetDataStorage()->GetNamedNode(pointName.str()));
   vtkSmartPointer<vtkSphereSource> vtkPointSphere = vtkSmartPointer<vtkSphereSource>::New();
   vtkPointSphere->SetCenter(currentImagePoint[0], currentImagePoint[1], currentImagePoint[2]);
   vtkPointSphere->SetRadius(5.0);
   vtkPointSphere->SetPhiResolution(40);
   vtkPointSphere->SetThetaResolution(40);
   vtkPointSphere->Update();
   mitk::Surface::Pointer pointSphere = mitk::Surface::New();
   pointSphere->SetVtkPolyData(vtkPointSphere->GetOutput());
   mitk::DataNode::Pointer sphereNode = mitk::DataNode::New();
   sphereNode->SetName(pointName.str());
   sphereNode->SetData(pointSphere);
   sphereNode->SetColor(1.0, 1.0, 0.0);
   this->GetDataStorage()->Add(sphereNode);
 }
 
 void QmitkUltrasoundCalibration::OnMatchAnnotationToPhantomConfiguration()
 {
   // Transform pointset of phantom configuration to currently annotated image points
   vtkSmartPointer<vtkLandmarkTransform> transform = vtkSmartPointer<vtkLandmarkTransform>::New();
   transform->SetModeToRigidBody();
   vtkSmartPointer<vtkPoints> toolLandmarks = this->ConvertPointSetToVtkPolyData(m_CalibPointsTool)->GetPoints();
   transform->SetSourceLandmarks(toolLandmarks);
   transform->SetTargetLandmarks(this->ConvertPointSetToVtkPolyData(m_CalibPointsImage)->GetPoints());
   transform->Update();
   // update image annotation with matched phantom configuration
   vtkSmartPointer<vtkPoints> transformedToolLandmarks = vtkSmartPointer<vtkPoints>::New();
   transform->TransformPoints(toolLandmarks, transformedToolLandmarks);
   for (int i = 0; i < transformedToolLandmarks->GetNumberOfPoints(); i++)
   {
     m_CalibPointsImage->InsertPoint(i, transformedToolLandmarks->GetPoint(i));
     UpdatePhantomAnnotationPointVisualization(i);
   }
   m_Controls.m_RefinePhantomAnnotationsGroupBox->setEnabled(true);
   m_Controls.m_CalibBtnPerformPhantomCalibration->setEnabled(true);
 }
 
 void QmitkUltrasoundCalibration::TranslatePhantomAnnotations(double tx, double ty, double tz)
 {
   vtkSmartPointer<vtkTransform> transform = vtkSmartPointer<vtkTransform>::New();
   transform->Translate(tx, ty, tz);
   vtkSmartPointer<vtkPoints> currentPoints = this->ConvertPointSetToVtkPolyData(m_CalibPointsImage)->GetPoints();
   vtkSmartPointer<vtkPoints> transformedPoints = vtkSmartPointer<vtkPoints>::New();
   transform->TransformPoints(currentPoints, transformedPoints);
   for (int i = 0; i < transformedPoints->GetNumberOfPoints(); i++)
   {
     m_CalibPointsImage->InsertPoint(i, transformedPoints->GetPoint(i));
     UpdatePhantomAnnotationPointVisualization(i);
   }
 }
 
 void QmitkUltrasoundCalibration::RotatePhantomAnnotations(double angle)
 {
   vtkSmartPointer<vtkTransform> transform = vtkSmartPointer<vtkTransform>::New();
   transform->RotateZ(angle);
   vtkSmartPointer<vtkPoints> currentPoints = this->ConvertPointSetToVtkPolyData(m_CalibPointsImage)->GetPoints();
   vtkSmartPointer<vtkPoints> transformedPoints = vtkSmartPointer<vtkPoints>::New();
   transform->TransformPoints(currentPoints, transformedPoints);
   for (int i = 0; i < transformedPoints->GetNumberOfPoints(); i++)
   {
     m_CalibPointsImage->InsertPoint(i, transformedPoints->GetPoint(i));
     UpdatePhantomAnnotationPointVisualization(i);
   }
 }
 
 void QmitkUltrasoundCalibration::OnMovePhantomAnnotationsUp()
 {
   this->TranslatePhantomAnnotations(0, -m_Image->GetGeometry()->GetSpacing()[1], 0);
 }
 
 void QmitkUltrasoundCalibration::OnMovePhantomAnnotationsDown()
 {
   this->TranslatePhantomAnnotations(0, m_Image->GetGeometry()->GetSpacing()[1], 0);
 }
 
 void QmitkUltrasoundCalibration::OnMovePhantomAnnotationsLeft()
 {
   this->TranslatePhantomAnnotations(-m_Image->GetGeometry()->GetSpacing()[0], 0, 0);
 }
 
 void QmitkUltrasoundCalibration::OnMovePhantomAnnotationsRight()
 {
   this->TranslatePhantomAnnotations(m_Image->GetGeometry()->GetSpacing()[0], 0, 0);
 }
 
 void QmitkUltrasoundCalibration::OnRotatePhantomAnnotationsRight()
 {
   mitk::BoundingBox::PointType centerOfPointSet = m_CalibPointsImage->GetGeometry()->GetBoundingBox()->GetCenter();
   this->TranslatePhantomAnnotations(-centerOfPointSet[0], -centerOfPointSet[1], -centerOfPointSet[2]);
   this->RotatePhantomAnnotations(0.5);
   this->TranslatePhantomAnnotations(centerOfPointSet[0], centerOfPointSet[1], centerOfPointSet[2]);
 }
 
 void QmitkUltrasoundCalibration::OnRotatePhantomAnnotationsLeft()
 {
   mitk::BoundingBox::PointType centerOfPointSet = m_CalibPointsImage->GetGeometry()->GetBoundingBox()->GetCenter();
   this->TranslatePhantomAnnotations(-centerOfPointSet[0], -centerOfPointSet[1], -centerOfPointSet[2]);
   this->RotatePhantomAnnotations(-0.5);
   this->TranslatePhantomAnnotations(centerOfPointSet[0], centerOfPointSet[1], centerOfPointSet[2]);
 }
 
 void QmitkUltrasoundCalibration::OnPhantomBasedCalibration()
 {
   // perform calibration
   OnCalibration();
   m_Controls.m_CalibBtnSavePhantomCalibration->setEnabled(true);
 }
 
 void QmitkUltrasoundCalibration::OnAddEvalTargetPoint()
 {
-  mitk::Point3D world = this->GetRenderWindowPart()->GetSelectedPosition();
+  auto world = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetSelectedPosition();
 
   this->m_EvalPointsImage->InsertPoint(m_EvalPointsImage->GetSize(), world);
   this->m_EvalPointsTool->InsertPoint(m_EvalPointsTool->GetSize(), this->m_FreezePoint);
 
   QString text = text.number(this->m_EvalPointsTool->GetSize());
   this->m_Controls.m_EvalLblNumTargetPoints->setText(text);
 
   // Update FREs
   // Update Evaluation FRE, but only if it contains more than one point (will crash otherwise)
   if ((m_EvalPointsProjected->GetSize() > 1) && (m_EvalPointsTool->GetSize() > 1))
   {
     m_EvaluationStatistics = mitk::PointSetDifferenceStatisticsCalculator::New();
     m_ProjectionStatistics = mitk::PointSetDifferenceStatisticsCalculator::New();
     mitk::PointSet::Pointer p1 =
       this->m_EvalPointsTool->Clone(); // We use clones to calculate statistics to avoid concurrency Problems
     mitk::PointSet::Pointer p2 = this->m_EvalPointsImage->Clone();
     mitk::PointSet::Pointer p3 = this->m_EvalPointsProjected->Clone();
     m_EvaluationStatistics->SetPointSets(p1, p2);
     m_ProjectionStatistics->SetPointSets(p1, p3);
     QString evalText = evalText.number(m_EvaluationStatistics->GetRMS());
     QString projText = projText.number(m_ProjectionStatistics->GetRMS());
     m_Controls.m_EvalLblEvaluationFRE->setText(evalText);
     m_Controls.m_EvalLblProjectionFRE->setText(projText);
   }
   SwitchFreeze();
 }
 
 void QmitkUltrasoundCalibration::OnAddEvalProjectedPoint()
 {
   MITK_WARN << "Projection Evaluation may currently be inaccurate.";
   // TODO: Verify correct Evaluation. Is the Point that is added really current?
   mitk::Point3D projection = this->m_NeedleProjectionFilter->GetProjection()->GetPoint(1);
   m_EvalPointsProjected->InsertPoint(m_EvalPointsProjected->GetSize(), projection);
   QString text = text.number(this->m_EvalPointsProjected->GetSize());
   this->m_Controls.m_EvalLblNumProjectionPoints->setText(text);
 }
 
 void QmitkUltrasoundCalibration::OnSaveEvaluation()
 {
   // Filename without suffix
   QString filename = m_Controls.m_EvalFilePath->text() + "//" + m_Controls.m_EvalFilePrefix->text();
 
   MITK_WARN << "CANNOT SAVE, ABORTING!";
   /* not working any more TODO!
   mitk::PointSetWriter::Pointer psWriter = mitk::PointSetWriter::New();
   psWriter->SetInput(0, m_CalibPointsImage);
   psWriter->SetInput(1, m_CalibPointsTool);
   psWriter->SetInput(2, m_EvalPointsImage);
   psWriter->SetInput(3, m_EvalPointsTool);
   psWriter->SetInput(4, m_EvalPointsProjected);
   psWriter->SetFileName(filename.toStdString() + ".xml");
   psWriter->Write();
   */
 
   // TODO: New writer for transformations must be implemented.
   /*
   mitk::TransformationFileWriter::Pointer tWriter = mitk::TransformationFileWriter::New();
   tWriter->SetInput(0, m_CalibPointsImage);
   tWriter->SetInput(1, m_CalibPointsTool);
   tWriter->SetInput(2, m_EvalPointsImage);
   tWriter->SetInput(3, m_EvalPointsTool);
   tWriter->SetInput(4, m_EvalPointsProjected);
   tWriter->SetOutputFilename(filename.toStdString() + ".txt");
   tWriter->DoWrite(this->m_Transformation);
   */
 }
 
 void QmitkUltrasoundCalibration::OnSaveCalibration()
 {
   m_Controls.m_GotCalibrationLabel->setText("");
   QString filename =
     QFileDialog::getSaveFileName(QApplication::activeWindow(), "Save Calibration", "", "Calibration files *.cal");
 
   QFile file(filename);
   if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate))
   {
     MITK_WARN << "Cannot open file '" << filename.toStdString() << "' for writing.";
     return;
   }
 
   std::string calibrationSerialization = m_CombinedModality->SerializeCalibration();
 
   QTextStream outStream(&file);
   outStream << QString::fromStdString(calibrationSerialization);
 
   // save additional information
   if (m_Controls.m_saveAdditionalCalibrationLog->isChecked())
   {
     mitk::SceneIO::Pointer mySceneIO = mitk::SceneIO::New();
     QString filenameScene = filename + "_mitkScene.mitk";
     mitk::NodePredicateNot::Pointer isNotHelperObject =
       mitk::NodePredicateNot::New(mitk::NodePredicateProperty::New("helper object", mitk::BoolProperty::New(true)));
     mitk::DataStorage::SetOfObjects::ConstPointer nodesToBeSaved = this->GetDataStorage()->GetSubset(isNotHelperObject);
     mySceneIO->SaveScene(nodesToBeSaved, this->GetDataStorage(), filenameScene.toStdString().c_str());
   }
 }
 
 void QmitkUltrasoundCalibration::OnReset()
 {
   this->ClearTemporaryMembers();
 
   if (m_Transformation.IsNull())
   {
     m_Transformation = mitk::AffineTransform3D::New();
   }
   m_Transformation->SetIdentity();
 
   if (m_Node.IsNotNull() && (m_Node->GetData() != nullptr) && (m_Node->GetData()->GetGeometry() != nullptr))
   {
     mitk::SlicedGeometry3D::Pointer sliced3d = dynamic_cast<mitk::SlicedGeometry3D *>(m_Node->GetData()->GetGeometry());
     mitk::PlaneGeometry::Pointer plane = const_cast<mitk::PlaneGeometry *>(sliced3d->GetPlaneGeometry(0));
     plane->SetIndexToWorldTransform(m_Transformation);
   }
 
   QString text1 = text1.number(this->m_EvalPointsTool->GetSize());
   this->m_Controls.m_EvalLblNumTargetPoints->setText(text1);
   QString text2 = text2.number(this->m_EvalPointsProjected->GetSize());
   this->m_Controls.m_EvalLblNumProjectionPoints->setText(text2);
 }
 
 void QmitkUltrasoundCalibration::Update()
 {
   // Update Tracking Data
   std::vector<mitk::NavigationData::Pointer> *datas = new std::vector<mitk::NavigationData::Pointer>();
   datas->push_back(m_Tracker->GetOutput());
   m_Controls.m_CalibTrackingStatus->SetNavigationDatas(datas);
   m_Controls.m_CalibTrackingStatus->Refresh();
   m_Controls.m_EvalTrackingStatus->SetNavigationDatas(datas);
   m_Controls.m_EvalTrackingStatus->Refresh();
 
   m_CombinedModality->Modified();
   m_CombinedModality->Update();
 
   // Update US Image
   mitk::Image::Pointer image = m_CombinedModality->GetOutput();
   // make sure that always the current image is set to the data node
   if (image.IsNotNull() && m_Node->GetData() != image.GetPointer() && image->IsInitialized())
   {
     m_Node->SetData(image);
   }
 
   // Update Needle Projection
   m_NeedleProjectionFilter->Update();
 
   // only update 2d window because it is faster
   this->RequestRenderWindowUpdate(mitk::RenderingManager::REQUEST_UPDATE_2DWINDOWS);
 }
 
 void QmitkUltrasoundCalibration::SwitchFreeze()
 {
   m_Controls.m_CalibBtnAddPoint->setEnabled(false); // generally deactivate
   // We use the activity state of the timer to determine whether we are currently viewing images
   if (!m_Timer->isActive()) // Activate Imaging
   {
     // if (m_Node) m_Node->ReleaseData();
     if (m_CombinedModality.IsNull())
     {
       m_Timer->stop();
       return;
     }
 
     m_CombinedModality->Update();
     m_Image = m_CombinedModality->GetOutput();
     if (m_Image.IsNotNull() && m_Image->IsInitialized())
     {
       m_Node->SetData(m_Image);
     }
 
     std::vector<mitk::NavigationData::Pointer> datas;
     datas.push_back(m_Tracker->GetOutput());
     m_Controls.m_CalibTrackingStatus->SetNavigationDatas(&datas);
     m_Controls.m_CalibTrackingStatus->ShowStatusLabels();
     m_Controls.m_CalibTrackingStatus->Refresh();
 
     m_Controls.m_EvalTrackingStatus->SetNavigationDatas(&datas);
     m_Controls.m_EvalTrackingStatus->ShowStatusLabels();
     m_Controls.m_EvalTrackingStatus->Refresh();
 
     int interval = 40;
     m_Timer->setInterval(interval);
     m_Timer->start();
 
     m_CombinedModality->SetIsFreezed(false);
   }
   else if (this->m_Tracker->GetOutput(0)->IsDataValid())
   {
     // deactivate Imaging
     m_Timer->stop();
     // Remember last tracking coordinates
     m_FreezePoint = this->m_Tracker->GetOutput(0)->GetPosition();
     m_Controls.m_CalibBtnAddPoint->setEnabled(true); // activate only, if valid point is set
 
     m_CombinedModality->SetIsFreezed(true);
   }
 }
 
 void QmitkUltrasoundCalibration::ShowNeedlePath()
 {
   // Init Filter
   this->m_NeedleProjectionFilter->SelectInput(0);
 
   // Create Node for Pointset
   mitk::DataNode::Pointer node = this->GetDataStorage()->GetNamedNode("Needle Path");
   if (node.IsNull())
   {
     node = mitk::DataNode::New();
     node->SetName("Needle Path");
     node->SetData(m_NeedleProjectionFilter->GetProjection());
     node->SetBoolProperty("show contour", true);
     this->GetDataStorage()->Add(node);
   }
 }
 
 void QmitkUltrasoundCalibration::ClearTemporaryMembers()
 {
   m_CalibPointsTool->Clear();
   m_CalibPointsImage->Clear();
   m_CalibPointsCount = 0;
 
   m_EvalPointsImage->Clear();
   m_EvalPointsTool->Clear();
   m_EvalPointsProjected->Clear();
 
   this->m_Controls.m_CalibPointList->clear();
 
   m_SpacingPoints->Clear();
   m_Controls.m_SpacingPointsList->clear();
   m_SpacingPointsCount = 0;
 }
 
 vtkSmartPointer<vtkPolyData> QmitkUltrasoundCalibration::ConvertPointSetToVtkPolyData(mitk::PointSet::Pointer PointSet)
 {
   vtkSmartPointer<vtkPolyData> returnValue = vtkSmartPointer<vtkPolyData>::New();
   vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
   for (int i = 0; i < PointSet->GetSize(); i++)
   {
     double point[3] = {PointSet->GetPoint(i)[0], PointSet->GetPoint(i)[1], PointSet->GetPoint(i)[2]};
     points->InsertNextPoint(point);
   }
   vtkSmartPointer<vtkPolyData> temp = vtkSmartPointer<vtkPolyData>::New();
   temp->SetPoints(points);
 
   vtkSmartPointer<vtkVertexGlyphFilter> vertexFilter = vtkSmartPointer<vtkVertexGlyphFilter>::New();
   vertexFilter->SetInputData(temp);
   vertexFilter->Update();
 
   returnValue->ShallowCopy(vertexFilter->GetOutput());
 
   return returnValue;
 }
 
 double QmitkUltrasoundCalibration::ComputeFRE(mitk::PointSet::Pointer imageFiducials,
                                               mitk::PointSet::Pointer realWorldFiducials,
                                               vtkSmartPointer<vtkLandmarkTransform> transform)
 {
   if (imageFiducials->GetSize() != realWorldFiducials->GetSize())
     return -1;
   double FRE = 0;
   for (int i = 0; i < imageFiducials->GetSize(); ++i)
   {
     itk::Point<double> current_image_fiducial_point = imageFiducials->GetPoint(i);
     if (transform != nullptr)
     {
       current_image_fiducial_point = transform->TransformPoint(
         imageFiducials->GetPoint(i)[0], imageFiducials->GetPoint(i)[1], imageFiducials->GetPoint(i)[2]);
     }
     double cur_error_squared = current_image_fiducial_point.SquaredEuclideanDistanceTo(realWorldFiducials->GetPoint(i));
     FRE += cur_error_squared;
   }
 
   FRE = sqrt(FRE / (double)imageFiducials->GetSize());
 
   return FRE;
 }
 
 void QmitkUltrasoundCalibration::ApplyTransformToPointSet(mitk::PointSet::Pointer pointSet,
                                                           vtkSmartPointer<vtkAbstractTransform> transform)
 {
   for (int i = 0; i < pointSet->GetSize(); ++i)
   {
     itk::Point<double> current_point_transformed = itk::Point<double>();
     current_point_transformed =
       transform->TransformPoint(pointSet->GetPoint(i)[0], pointSet->GetPoint(i)[1], pointSet->GetPoint(i)[2]);
     pointSet->SetPoint(i, current_point_transformed);
   }
 }
 
 void QmitkUltrasoundCalibration::OnFreezeClicked()
 {
   if (m_CombinedModality.IsNull())
   {
     return;
   }
 
   if (m_CombinedModality->GetIsFreezed())
   {
     // device was already frozen so we need to delete all spacing points because they need to be collected all at once
     // no need to check if all four points are already collected, because if that's the case you can no longer click the
     // Freeze button
     m_SpacingPoints->Clear();
     m_Controls.m_SpacingPointsList->clear();
     m_SpacingPointsCount = 0;
     m_Controls.m_SpacingAddPoint->setEnabled(false);
   }
   else
   {
     m_Controls.m_SpacingAddPoint->setEnabled(true);
   }
   SwitchFreeze();
 }
 
 void QmitkUltrasoundCalibration::OnAddSpacingPoint()
 {
-  mitk::Point3D point = this->GetRenderWindowPart()->GetSelectedPosition();
+  auto point = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetSelectedPosition();
 
   this->m_SpacingPoints->InsertPoint(m_SpacingPointsCount, point);
 
   QString text = text.number(m_SpacingPointsCount + 1);
   text = "Point " + text;
 
   this->m_Controls.m_SpacingPointsList->addItem(text);
 
   m_SpacingPointsCount++;
 
   if (m_SpacingPointsCount == 4) // now we have all 4 points needed
   {
     m_Controls.m_SpacingAddPoint->setEnabled(false);
     m_Controls.m_CalculateSpacing->setEnabled(true);
     m_Controls.m_SpacingBtnFreeze->setEnabled(false);
   }
 }
 
 void QmitkUltrasoundCalibration::OnCalculateSpacing()
 {
   mitk::Point3D horizontalOne = m_SpacingPoints->GetPoint(0);
   mitk::Point3D horizontalTwo = m_SpacingPoints->GetPoint(1);
   mitk::Point3D verticalOne = m_SpacingPoints->GetPoint(2);
   mitk::Point3D verticalTwo = m_SpacingPoints->GetPoint(3);
 
   // Get the distances between the points in the image
   double xDistance = horizontalOne.EuclideanDistanceTo(horizontalTwo);
   double yDistance = verticalOne.EuclideanDistanceTo(verticalTwo);
 
   // Calculate the spacing of the image and fill a vector with it
   double xSpacing = 30 / xDistance;
   double ySpacing = 20 / yDistance;
 
   m_CombinedModality->GetUltrasoundDevice()->SetSpacing(xSpacing, ySpacing);
 
   // Now that the spacing is set clear all stuff and return to Calibration
   m_SpacingPoints->Clear();
   m_Controls.m_SpacingPointsList->clear();
   m_SpacingPointsCount = 0;
   m_CombinedModality->SetIsFreezed(false);
 }
 
 void QmitkUltrasoundCalibration::OnUSDepthChanged(const std::string &key, const std::string &)
 {
   // whenever depth of USImage is changed the spacing should no longer be overwritten
   if (key == mitk::USDevice::GetPropertyKeys().US_PROPKEY_BMODE_DEPTH)
   {
   }
 }
diff --git a/Plugins/org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation/src/internal/USNavigation.cpp b/Plugins/org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation/src/internal/USNavigation.cpp
index 328db2bab1..7709db6833 100644
--- a/Plugins/org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation/src/internal/USNavigation.cpp
+++ b/Plugins/org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation/src/internal/USNavigation.cpp
@@ -1,409 +1,404 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 // Blueberry
 #include <berryISelectionService.h>
 #include <berryIWorkbenchWindow.h>
 
 // Qmitk
 #include "USNavigation.h"
 #include <QFileDialog>
 
 //MITK
 #include <mitkBaseRenderer.h>
 #include <mitkIRenderingManager.h>
 #include <QmitkRenderWindow.h>
 #include <mitkDataStorage.h>
 
 // VTK
 #include <vtkSphereSource.h>
 
 // Qt
 #include <QMessageBox>
 #include <QBoxLayout>
 #include <QShortcut>
 
 const std::string USNavigation::VIEW_ID = "org.mitk.views.usnavigation";
 
 void USNavigation::SetFocus()
 {
   //  m_Controls.buttonPerformImageProcessing->setFocus();
 }
 
 USNavigation::USNavigation()
 : m_ImageAlreadySetToNode(false)
 {
 }
 
 void USNavigation::CreateQtPartControl( QWidget *parent )
 {
   m_Timer = new QTimer(this);
   m_RangeMeterTimer = new QTimer(this);
   // create GUI widgets from the Qt Designer's .ui file
   m_Controls.setupUi( parent );
 
   m_Controls.m_ZonesWidget->SetDataStorage(this->GetDataStorage());
 
   // Timer
   connect( m_Timer, SIGNAL(timeout()), this, SLOT(Update()));
   connect( m_RangeMeterTimer, SIGNAL(timeout()), this, SLOT(UpdateMeters()));
 
   connect( m_Controls.m_BtnSelectDevices, SIGNAL(clicked()), this, SLOT(OnSelectDevices()) );
   connect( m_Controls.m_CombinedModalitySelectionWidget, SIGNAL(SignalReadyForNextStep()),
            this, SLOT(OnDeviceSelected()) );
   connect( m_Controls.m_CombinedModalitySelectionWidget, SIGNAL(SignalNoLongerReadyForNextStep()),
            this, SLOT(OnDeviceDeselected()) );
 
   connect( m_Controls.m_TabWidget, SIGNAL(currentChanged ( int )), this, SLOT(OnTabSwitch( int )) );
 
   // Zones
   connect( m_Controls.m_BtnFreeze, SIGNAL(clicked()), this, SLOT(OnFreeze()) );
   connect( m_Controls.m_ZonesWidget, SIGNAL(ZoneAdded()), this, SLOT(OnZoneAdded()) );
   // Navigation
   connect( m_Controls.m_BtnStartIntervention, SIGNAL(clicked ()), this, SLOT(OnStartIntervention()) );
   connect( m_Controls.m_BtnReset, SIGNAL(clicked ()), this, SLOT(OnReset()) );
   connect( m_Controls.m_BtnNeedleView, SIGNAL(clicked ()), this, SLOT(OnNeedleViewToogle()) );
 
   m_Freeze = false;
   m_IsNeedleViewActive = false;
 
   m_Controls.m_TabWidget->setTabEnabled(1, false);
   m_Controls.m_TabWidget->setTabEnabled(2, false);
   m_ZoneFilter = mitk::NodeDisplacementFilter::New();
   m_NeedleProjectionFilter = mitk::NeedleProjectionFilter::New();
   m_SmoothingFilter = mitk::NavigationDataSmoothingFilter::New();
   m_CameraVis = mitk::CameraVisualization::New();
   m_RangeMeterStyle = "QProgressBar:horizontal {\nborder: 1px solid gray;\nborder-radius: 3px;\nbackground: white;\npadding: 1px;\ntext-align: center;\n}\nQProgressBar::chunk:horizontal {\nbackground: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 #StartColor#, stop: 0.8 #StartColor#, stop: 1 #StopColor#);\n}";
   QBoxLayout * layout = new QBoxLayout(QBoxLayout::Down, m_Controls.m_RangeBox);
   // Pedal Support for Needle View
   QShortcut *shortcut = new QShortcut(QKeySequence(Qt::Key_PageDown), parent);
   QObject::connect(shortcut, SIGNAL(activated()), m_Controls.m_BtnNeedleView, SLOT(animateClick()) );
 
   m_Controls.m_CombinedModalitySelectionWidget->OnActivateStep();
 }
 
 void USNavigation::OnDeviceSelected()
 {
   m_Controls.m_BtnSelectDevices->setEnabled(true);
 }
 
 void USNavigation::OnDeviceDeselected()
 {
   m_Controls.m_BtnSelectDevices->setEnabled(false);
   m_Controls.m_TabWidget->setCurrentIndex(0);
   m_Controls.m_TabWidget->setTabEnabled(1, false);
   m_Controls.m_TabWidget->setTabEnabled(2, false);
 }
 
 void USNavigation::OnSelectDevices(){
   m_USDevice = m_Controls.m_CombinedModalitySelectionWidget->GetSelectedCombinedModality();
   if (m_USDevice.IsNull())
   {
     MITK_WARN << "No device selected.";
     return;
   }
 
   QApplication::setOverrideCursor(Qt::WaitCursor);
   // make sure that the combined modality is in connected state before using it
   if ( m_USDevice->GetDeviceState() < mitk::USDevice::State_Connected ) { m_USDevice->Connect(); }
   if ( m_USDevice->GetDeviceState() < mitk::USDevice::State_Activated ) { m_USDevice->Activate(); }
   QApplication::restoreOverrideCursor();
 
   m_Tracker = m_USDevice->GetNavigationDataSource();
 
   // Build Pipeline
   m_ZoneFilter->SetInput(0, m_Tracker->GetOutput(0));
   m_ZoneFilter->SetInput(1, m_Tracker->GetOutput(1));
   m_ZoneFilter->SelectInput(1);
   m_NeedleProjectionFilter->SetInput(0, m_ZoneFilter->GetOutput(0));
   m_NeedleProjectionFilter->SetInput(1, m_ZoneFilter->GetOutput(1));
   m_NeedleProjectionFilter->SelectInput(0);
   m_NeedleProjectionFilter->SetTargetPlane(m_USDevice->GetCalibration());
 
   // Setting up the Camera Visualization Filter
 
-  /* Second 3D Renderwindow currently not functional, see Bug 13465
-  mitk::BaseRenderer* renderer = mitk::BaseRenderer::GetInstance(this->GetRenderWindowPart()->GetQmitkRenderWindow("sagittal")->GetRenderWindow());
-  renderer->SetMapperID(mitk::BaseRenderer::Standard3D);
-  */
-
-  mitk::BaseRenderer* renderer = mitk::BaseRenderer::GetInstance(this->GetRenderWindowPart()->GetQmitkRenderWindow("3d")->GetRenderWindow());
+  mitk::BaseRenderer* renderer = mitk::BaseRenderer::GetInstance(this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetQmitkRenderWindow("3d")->GetRenderWindow());
 
   m_CameraVis->SetInput(0, m_NeedleProjectionFilter->GetOutput(0));
   m_CameraVis->SetRenderer( renderer );
   m_CameraVis->SetFocalLength(40);
 
   mitk::Vector3D direction;
   direction[0] = 0;
   direction[1] = 0;
   direction[2] = 1;
   m_CameraVis->SetDirectionOfProjectionInToolCoordinates(direction);
   direction[0] = -1;
   direction[1] = 0;
   direction[2] = 0;
   m_CameraVis->SetViewUpInToolCoordinates(direction);
 
   // Create Node for Needle Projection
   mitk::DataNode::Pointer node = this->GetDataStorage()->GetNamedNode("Needle Path");
   if ( node.IsNull() )
   {
     node = mitk::DataNode::New();
     node->SetName("Needle Path");
     node->SetData(m_NeedleProjectionFilter->GetProjection());
     node->SetBoolProperty("show contour", true);
     this->GetDataStorage()->Add(node);
     node->SetFloatProperty("opacity", 0.80f );
   }
 
   m_Timer->start(15);
 
   // Create Node for US Stream
   m_USStream = mitk::DataNode::New();
   m_USStream->SetName("US Image Stream");
   m_USStream->SetFloatProperty("opacity", 0.80f );
   this->GetDataStorage()->Add(m_USStream);
 
   // Switch active tab to next page
   m_Controls.m_TabWidget->setTabEnabled(1, true);
   m_Controls.m_TabWidget->setTabEnabled(2, true);
   m_Controls.m_TabWidget->setCurrentIndex(1);
 }
 
 void USNavigation::Update()
 {
   if (m_Freeze) return;
 
   // Update NeedleVisFilter only if the view is desired
   if (! m_IsNeedleViewActive)
     m_NeedleProjectionFilter->Update();
   else
     m_CameraVis->Update();
   //only Update USImage every other time
   m_UpdateImage ++;
   if (m_UpdateImage)
   {
     m_USDevice->Modified();
     m_USDevice->Update();
     mitk::Image::Pointer image = m_USDevice->GetOutput();
     if ( ! m_ImageAlreadySetToNode && image.IsNotNull() && image->IsInitialized() )
     {
       m_USStream->SetData(image);
       m_ImageAlreadySetToNode = true;
 
       // make a reinit on the ultrasound image
       mitk::IRenderWindowPart* renderWindow = this->GetRenderWindowPart();
       if ( renderWindow != nullptr && image->GetTimeGeometry()->IsValid() )
       {
         renderWindow->GetRenderingManager()->InitializeViews(
           image->GetTimeGeometry(), mitk::RenderingManager::REQUEST_UPDATE_ALL, true );
         renderWindow->GetRenderingManager()->RequestUpdateAll();
       }
     }
     this->RequestRenderWindowUpdate();
   }
 }
 
 ///////////////////// Range Meter ////////////////
 
 void USNavigation::SetupProximityView()
 {
   // make sure that the data nodes in m_Zones are exactly the same as
   // the zone nodes of the zone node widget
   m_Zones.clear();
   mitk::DataStorage::SetOfObjects::ConstPointer zoneNodes = m_Controls.m_ZonesWidget->GetZoneNodes();
   for (mitk::DataStorage::SetOfObjects::ConstIterator it = zoneNodes->Begin();
        it != zoneNodes->End(); ++it)
   {
     m_Zones.push_back(it->Value());
   }
 
   QLayout * layout = m_Controls.m_RangeBox->layout();
   for (int i = 0; i < m_Zones.size(); i++)
   {
     QProgressBar * meter = CreateRangeMeter(i);
     layout->addWidget(meter);
     m_RangeMeters.push_back(meter);
   }
   m_RangeMeterTimer->start(100);
 }
 
 QProgressBar* USNavigation::CreateRangeMeter(int i)
 {
   mitk::DataNode::Pointer zone = m_Zones.at(i);
 
   float zoneColor[3];
   bool success = m_Zones.at(i)->GetColor(zoneColor);
   QString zoneColorString = "#555555";
   if (success)
   {
     QString zoneColorString = QString("#%1%2%3").arg(static_cast<unsigned int>(zoneColor[0]*255), 2, 16, QChar('0'))
       .arg(static_cast<unsigned int>(zoneColor[1]*255), 2, 16, QChar('0')).arg(static_cast<unsigned int>(zoneColor[2]*255), 2, 16, QChar('0'));
   }
 
   QProgressBar* meter = new QProgressBar();
   meter->setMinimum(0);
   meter->setMaximum(100);
   meter->setValue(0);
   QString zoneName = zone->GetName().c_str();
   meter->setFormat(zoneName + ": No Data");
   QString style = m_RangeMeterStyle;
   style = style.replace("#StartColor#", zoneColorString);
   style = style.replace("#StopColor#", zoneColorString);
   meter->setStyleSheet(style);
   meter->setVisible(true);
   return meter;
 }
 
 void USNavigation::UpdateMeters()
 {
   // Get NeedlePosition
   mitk::NavigationData::Pointer needle = this->m_Tracker->GetOutput(0);
   if (! needle->IsDataValid()) return;
   mitk::Point3D needlePosition = needle->GetPosition();
   // Update each meter
   for (int i = 0; i < m_Zones.size(); i++)
   {
     mitk::Point3D zoneOrigin = m_Zones.at(i)->GetData()->GetGeometry()->GetOrigin();
     // calculate absolute distance
     mitk::ScalarType distance = sqrt( pow(zoneOrigin[0] - needlePosition[0], 2) + pow(zoneOrigin[1] - needlePosition[1], 2) + pow(zoneOrigin[2] - needlePosition[2], 2) );
     // Subtract zone size
     float zoneSize;
     m_Zones.at(i)->GetFloatProperty("zone.size", zoneSize);
     distance = distance - zoneSize;
 
     // Prepare new Style
     float zoneColor[3];
     m_Zones.at(i)->GetColor(zoneColor);
     QString zoneColorString = QString("#%1%2%3").arg(static_cast<unsigned int>(zoneColor[0]*255), 2, 16, QChar('0'))
       .arg(static_cast<unsigned int>(zoneColor[1]*255), 2, 16, QChar('0')).arg(static_cast<unsigned int>(zoneColor[2]*255), 2, 16, QChar('0'));
     QString style = m_RangeMeterStyle;
     QString text =  m_Zones.at(i)->GetName().c_str();
     int value = 0;
     // There Are now four possible Outcomes
     // 1) Needle is inside zone (bad news)
     if (distance < 0)
     {
       style = style.replace("#StartColor#", "red");
       style = style.replace("#StopColor#", "red");
       text  = text + ": VIOLATED";
       value = 100;
     } // 2) Needle is close to Zone
     else if (distance < WARNRANGE)
     {
       style = style.replace("#StartColor#", zoneColorString);
       style = style.replace("#StopColor#", "red");
       text  = text + ": " + QString::number(distance) + " mm";
       value = 100 -  100 * ((float) distance / (float )MAXRANGE);
     } // 3) Needle is away from zone
     else if (distance < MAXRANGE)
     {
       style = style.replace("#StartColor#", zoneColorString);
       style = style.replace("#StopColor#", zoneColorString);
       text  = text + ": " + QString::number(distance) + " mm";
       value = 100 -  100 * ((float) distance / (float )MAXRANGE);
     } // 4) Needle is far away from zone
     else
     {
       style = style.replace("#StartColor#", zoneColorString);
       style = style.replace("#StopColor#", zoneColorString);
       text  = text + ": " + QString::number(distance) + " mm";
       value = 0;
     }
 
     QProgressBar * meter = this->m_RangeMeters.at(i);
     meter->setStyleSheet(style);
     meter->setFormat(text);
     meter->setValue(value);
   }
 }
 
 /////////////////// Intervention ///////////////////////
 
 void USNavigation::OnStartIntervention()
 {
   this->ResetRangeMeters();
 
   m_Controls.m_TabWidget->setCurrentIndex(2);
   this->SetupProximityView();
 }
 
 void USNavigation::OnFreeze()
 {
   // Swap Freeze State
   m_Freeze = ! m_Freeze;
 
   if ( m_Freeze )
   {
     m_Controls.m_ZonesWidget->OnStartAddingZone();
   }
   else
   {
     m_Controls.m_ZonesWidget->OnAbortAddingZone();
   }
 }
 
 void USNavigation::OnReset()
 {
   // Reset Zones
   m_ZoneFilter->ResetNodes();
   m_Zones.clear();
   m_Controls.m_ZonesWidget->OnResetZones();
 
   this->ResetRangeMeters();
 
   m_RangeMeters.clear();
   m_RangeMeterTimer->stop();
 }
 
 void USNavigation::OnNeedleViewToggle()
 {
   m_IsNeedleViewActive = m_Controls.m_BtnNeedleView->isChecked();
 
   mitk::DataNode::Pointer node = this->GetDataStorage()->GetNamedNode("Needle Path");
   if ( node.IsNotNull() )
     node->SetVisibility( ! m_IsNeedleViewActive );
 }
 
 void USNavigation::OnZoneAdded()
 {
   if ( m_Freeze )
   {
     m_Controls.m_BtnFreeze->setChecked(false);
     m_Freeze = false;
   }
 
   mitk::DataStorage::SetOfObjects::ConstPointer zoneNodes = m_Controls.m_ZonesWidget->GetZoneNodes();
   for (mitk::DataStorage::SetOfObjects::ConstIterator it = zoneNodes->Begin();
        it != zoneNodes->End(); ++it)
   {
     // add all zones to zone filter which aren't added until now
     if ( find(m_Zones.begin(), m_Zones.end(), it->Value()) == m_Zones.end() )
     {
       m_Zones.push_back(it->Value());
       m_ZoneFilter->AddNode(it->Value());
     }
   }
 }
 
 void USNavigation::ResetRangeMeters()
 {
   m_RangeMeters.clear();
 
   QLayout* layout = m_Controls.m_RangeBox->layout();
   QLayoutItem *item;
   while((item = layout->takeAt(0))) {
     if (item->widget()) {
       delete item->widget();
     }
     delete item;
   }
 }
diff --git a/Plugins/org.mitk.gui.qt.igtexamples/src/internal/QmitkIGTTrackingLabView.cpp b/Plugins/org.mitk.gui.qt.igtexamples/src/internal/QmitkIGTTrackingLabView.cpp
index 21edcad84d..f108526e35 100644
--- a/Plugins/org.mitk.gui.qt.igtexamples/src/internal/QmitkIGTTrackingLabView.cpp
+++ b/Plugins/org.mitk.gui.qt.igtexamples/src/internal/QmitkIGTTrackingLabView.cpp
@@ -1,728 +1,728 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 
 // Blueberry
 #include <berryISelectionService.h>
 #include <berryIWorkbenchWindow.h>
 
 // Qmitk
 #include "QmitkIGTTrackingLabView.h"
 
 #include <QmitkRenderWindow.h>
 #include <QmitkNDIConfigurationWidget.h>
 #include <QmitkFiducialRegistrationWidget.h>
 #include <QmitkUpdateTimerWidget.h>
 #include <QmitkToolSelectionWidget.h>
 #include <QmitkToolTrackingStatusWidget.h>
 #include <mitkStaticIGTHelperFunctions.h>
 
 #include <mitkIGTException.h>
 #include <mitkNodePredicateNot.h>
 #include <mitkNodePredicateProperty.h>
 #include <mitkNodePredicateDataType.h>
 #include <itkVector.h>
 
 #include <vtkTransform.h>
 #include <vtkTransformPolyDataFilter.h>
 #include <vtkAppendPolyData.h>
 #include <vtkPoints.h>
 
 // Qt
 #include <QMessageBox>
 #include <QIcon>
 #include <QPushButton>
 
 // vtk
 #include <mitkVtkResliceInterpolationProperty.h>
 
 
 const std::string QmitkIGTTrackingLabView::VIEW_ID = "org.mitk.views.igttrackinglab";
 
 QmitkIGTTrackingLabView::QmitkIGTTrackingLabView()
 : QmitkAbstractView()
 ,m_Source(nullptr)
 ,m_PermanentRegistrationFilter(nullptr)
 ,m_Visualizer(nullptr)
 ,m_VirtualView(nullptr)
 ,m_PSRecordingPointSet(nullptr)
 ,m_PointSetRecording(false)
 ,m_PermanentRegistration(false)
 ,m_CameraView(false)
 ,m_ImageFiducialsDataNode(nullptr)
 ,m_TrackerFiducialsDataNode(nullptr)
 ,m_PermanentRegistrationSourcePoints(nullptr)
 {
 }
 
 //###############################################################################################
 //###############################################################################################
 //############################## Timer method for IGT pipeline updating #########################
 //###############################################################################################
 //###############################################################################################
 
 void QmitkIGTTrackingLabView::UpdateTimer()
 {
   if (m_PermanentRegistration && m_PermanentRegistrationFilter.IsNotNull())
   {
     if(IsTransformDifferenceHigh(m_ObjectmarkerNavigationData, m_ObjectmarkerNavigationDataLastUpdate))
     {
       m_ObjectmarkerNavigationDataLastUpdate->Graft(m_ObjectmarkerNavigationData);
       m_PermanentRegistrationFilter->Update();
     }
   }
 
   if (m_CameraView && m_VirtualView.IsNotNull()) {m_VirtualView->Update();}
 
   if(m_PointSetRecording && m_PSRecordingPointSet.IsNotNull())
     {
       int size = m_PSRecordingPointSet->GetSize();
       mitk::NavigationData::Pointer nd = m_PointSetRecordingNavigationData;
 
       if(size > 0)
       {
         mitk::Point3D p = m_PSRecordingPointSet->GetPoint(size-1);
         if(p.EuclideanDistanceTo(nd->GetPosition()) > (double) m_Controls.m_PSRecordingSpinBox->value())
           m_PSRecordingPointSet->InsertPoint(size, nd->GetPosition());
       }
       else
         m_PSRecordingPointSet->InsertPoint(size, nd->GetPosition());
     }
   }
 
 //###############################################################################################
 //###############################################################################################
 //############################## Slots of CONFIGURATION step ####################################
 //###############################################################################################
 //###############################################################################################
 
 void QmitkIGTTrackingLabView::OnSetupNavigation()
 {
   if(m_Source.IsNotNull())
     if(m_Source->IsTracking())
       return;
 
   mitk::DataStorage* ds = this->GetDataStorage();
 
   if(ds == nullptr)
   {
     MITK_WARN << "IGTSurfaceTracker: Error. Cannot access DataStorage. Navigation not possible";
     return;
   }
 
   //Building up the filter pipeline
   try
   {
     this->InitializeRegistration();
   }
   catch(mitk::IGTException& e)
   {
     MITK_WARN << "Error while building the IGT-Pipeline: " << e.GetDescription();
     this->DestroyIGTPipeline(); // destroy the pipeline if building is incomplete
     return;
   }
   catch(...)
   {
     MITK_WARN << "Unexpected error while building the IGT-Pipeline";
     this->DestroyIGTPipeline();
     return;
   }
 }
 
 void QmitkIGTTrackingLabView::OnInstrumentSelected()
 {
   if (m_Controls.m_TrackingDeviceSelectionWidget->GetSelectedNavigationDataSource().IsNotNull())
     {
     m_InstrumentNavigationData = m_Controls.m_TrackingDeviceSelectionWidget->GetSelectedNavigationDataSource()->GetOutput(m_Controls.m_TrackingDeviceSelectionWidget->GetSelectedToolID());
     }
   else
     {
     m_Controls.m_PointerNameLabel->setText("<not available>");
     return;
     }
 
   if (m_InstrumentNavigationData.IsNotNull())
     {
     m_Controls.m_PointerNameLabel->setText(m_InstrumentNavigationData->GetName());
     }
   else
     {
     m_Controls.m_PointerNameLabel->setText("<not available>");
     }
 }
 
 void QmitkIGTTrackingLabView::OnObjectmarkerSelected()
 {
   if (m_Controls.m_TrackingDeviceSelectionWidget->GetSelectedNavigationDataSource().IsNotNull())
     {
     m_ObjectmarkerNavigationData = m_Controls.m_TrackingDeviceSelectionWidget->GetSelectedNavigationDataSource()->GetOutput(m_Controls.m_TrackingDeviceSelectionWidget->GetSelectedToolID());
     MITK_INFO << "Objectmarker rotation: " << m_ObjectmarkerNavigationData->GetOrientation();
     }
   else
     {
     m_Controls.m_ObjectmarkerNameLabel->setText("<not available>");
     return;
     }
 
   if (m_ObjectmarkerNavigationData.IsNotNull())
     {
     m_Controls.m_ObjectmarkerNameLabel->setText(m_ObjectmarkerNavigationData->GetName());
     }
   else
     {
     m_Controls.m_ObjectmarkerNameLabel->setText("<not available>");
     }
 }
 
 //###############################################################################################
 //###############################################################################################
 //####################### Slots of INITIAL REGISTRATION step ####################################
 //###############################################################################################
 //###############################################################################################
 
 void QmitkIGTTrackingLabView::OnInitialRegistration()
 {
   //Check for initialization
   if (!CheckRegistrationInitialization()) return;
 
   mitk::PointSet::Pointer imageFiducials = dynamic_cast<mitk::PointSet*>(m_ImageFiducialsDataNode->GetData());
   mitk::PointSet::Pointer trackerFiducials = dynamic_cast<mitk::PointSet*>(m_TrackerFiducialsDataNode->GetData());
 
   //############### conversion to vtk data types (we will use the vtk landmark based transform) ##########################
   //convert point sets to vtk poly data
   vtkSmartPointer<vtkPoints> sourcePoints = vtkSmartPointer<vtkPoints>::New();
   vtkSmartPointer<vtkPoints> targetPoints = vtkSmartPointer<vtkPoints>::New();
   for (int i=0; i<imageFiducials->GetSize(); i++)
     {
     double point[3] = {imageFiducials->GetPoint(i)[0],imageFiducials->GetPoint(i)[1],imageFiducials->GetPoint(i)[2]};
     sourcePoints->InsertNextPoint(point);
     double point_targets[3] = {trackerFiducials->GetPoint(i)[0],trackerFiducials->GetPoint(i)[1],trackerFiducials->GetPoint(i)[2]};
     targetPoints->InsertNextPoint(point_targets);
     }
 
   //########################### here, the actual transform is computed ##########################
   //compute transform
   vtkSmartPointer<vtkLandmarkTransform> transform = vtkSmartPointer<vtkLandmarkTransform>::New();
   transform->SetSourceLandmarks(sourcePoints);
   transform->SetTargetLandmarks(targetPoints);
   transform->SetModeToRigidBody();
   transform->Modified();
   transform->Update();
   //compute FRE of transform
   double FRE = mitk::StaticIGTHelperFunctions::ComputeFRE(imageFiducials, trackerFiducials, transform);
   m_Controls.m_RegistrationWidget->SetQualityDisplayText("FRE: " + QString::number(FRE) + " mm");
   //#############################################################################################
 
   //############### conversion back to itk/mitk data types ##########################
   //convert from vtk to itk data types
   itk::Matrix<float,3,3> rotationFloat = itk::Matrix<float,3,3>();
   itk::Vector<float,3> translationFloat = itk::Vector<float,3>();
   itk::Matrix<double,3,3> rotationDouble = itk::Matrix<double,3,3>();
   itk::Vector<double,3> translationDouble = itk::Vector<double,3>();
 
   vtkSmartPointer<vtkMatrix4x4> m = transform->GetMatrix();
   for(int k=0; k<3; k++) for(int l=0; l<3; l++)
   {
     rotationFloat[k][l] = m->GetElement(k,l);
     rotationDouble[k][l] = m->GetElement(k,l);
 
   }
   for(int k=0; k<3; k++)
   {
     translationFloat[k] = m->GetElement(k,3);
     translationDouble[k] = m->GetElement(k,3);
   }
   //create affine transform 3D surface
   mitk::AffineTransform3D::Pointer mitkTransform = mitk::AffineTransform3D::New();
   mitkTransform->SetMatrix(rotationDouble);
   mitkTransform->SetOffset(translationDouble);
   //#############################################################################################
 
   //############### object is transformed ##########################
   //save transform
   m_T_ObjectReg = mitk::NavigationData::New(mitkTransform); // this is stored in a member because it is needed for permanent registration later on
 
   //transform surface
   if(m_Controls.m_SurfaceActive->isChecked() && m_Controls.m_ObjectComboBox->GetSelectedNode().IsNotNull())
   {
     m_Controls.m_ObjectComboBox->GetSelectedNode()->GetData()->GetGeometry()->SetIndexToWorldTransform(mitkTransform);
   }
   //################################################################
 
   //############### if activated: ct image is also transformed ##########################
   //transform ct image
   //todo: Explain that AffineTransform3D is used, because NavigationData does not support spacing!
   if(m_Controls.m_ImageActive->isChecked() && m_Controls.m_ImageComboBox->GetSelectedNode().IsNotNull())
   {
     //first we have to store the original ct image transform to compose it with the new transform later
     mitk::AffineTransform3D::Pointer imageTransform = m_Controls.m_ImageComboBox->GetSelectedNode()->GetData()->GetGeometry()->GetIndexToWorldTransform();
     m_T_ImageGeo = mitk::AffineTransform3D::New(); // this is also stored in a member because it is needed for permanent registration later on
     //now the new transform of the ct image is computed
     m_T_ImageGeo->Compose(imageTransform);
     imageTransform->Compose(mitkTransform);
     mitk::AffineTransform3D::Pointer newImageTransform = mitk::AffineTransform3D::New(); //create new image transform... setting the composed directly leads to an error
     itk::Matrix<mitk::ScalarType,3,3> rotationFloatNew = imageTransform->GetMatrix();
     itk::Vector<mitk::ScalarType,3> translationFloatNew = imageTransform->GetOffset();
     newImageTransform->SetMatrix(rotationFloatNew);
     newImageTransform->SetOffset(translationFloatNew);
     m_Controls.m_ImageComboBox->GetSelectedNode()->GetData()->GetGeometry()->SetIndexToWorldTransform(newImageTransform);
     m_T_ImageReg = m_Controls.m_ImageComboBox->GetSelectedNode()->GetData()->GetGeometry()->GetIndexToWorldTransform();
   }
   //################################################################
 
 }
 
 
 void QmitkIGTTrackingLabView::OnAddRegistrationTrackingFiducial()
 {
   mitk::NavigationData::Pointer nd = m_InstrumentNavigationData;
 
   if( nd.IsNull() || !nd->IsDataValid())
   {
     QMessageBox::warning( nullptr, "Invalid tracking data", "Navigation data is not available or invalid!", QMessageBox::Ok );
     return;
   }
 
   if(m_TrackerFiducialsDataNode.IsNotNull() && m_TrackerFiducialsDataNode->GetData() != nullptr)
   {
     mitk::PointSet::Pointer ps = dynamic_cast<mitk::PointSet*>(m_TrackerFiducialsDataNode->GetData());
     ps->InsertPoint(ps->GetSize(), nd->GetPosition());
   }
   else
     QMessageBox::warning(nullptr, "IGTSurfaceTracker: Error", "Can not access Tracker Fiducials. Adding fiducial not possible!");
 }
 
 
 void QmitkIGTTrackingLabView::InitializeRegistration()
 {
   mitk::DataStorage* ds = this->GetDataStorage();
   if( ds == nullptr )
     return;
 
   // let the registration widget know about the slice navigation controllers
   // in the active render window part (crosshair updates)
-  foreach(QmitkRenderWindow* renderWindow, this->GetRenderWindowPart()->GetQmitkRenderWindows().values())
+  foreach(QmitkRenderWindow* renderWindow, this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetQmitkRenderWindows().values())
   {
     m_Controls.m_RegistrationWidget->AddSliceNavigationController(renderWindow->GetSliceNavigationController());
   }
 
   if(m_ImageFiducialsDataNode.IsNull())
   {
     m_ImageFiducialsDataNode = mitk::DataNode::New();
     mitk::PointSet::Pointer ifPS = mitk::PointSet::New();
 
     m_ImageFiducialsDataNode->SetData(ifPS);
 
     mitk::Color color;
     color.Set(1.0f, 0.0f, 0.0f);
     m_ImageFiducialsDataNode->SetName("Image Fiducials");
     m_ImageFiducialsDataNode->SetColor(color);
     m_ImageFiducialsDataNode->SetBoolProperty( "updateDataOnRender", false );
 
     ds->Add(m_ImageFiducialsDataNode);
   }
   m_Controls.m_RegistrationWidget->SetImageFiducialsNode(m_ImageFiducialsDataNode);
 
   if(m_TrackerFiducialsDataNode.IsNull())
   {
     m_TrackerFiducialsDataNode = mitk::DataNode::New();
     mitk::PointSet::Pointer tfPS = mitk::PointSet::New();
     m_TrackerFiducialsDataNode->SetData(tfPS);
 
     mitk::Color color;
     color.Set(0.0f, 1.0f, 0.0f);
     m_TrackerFiducialsDataNode->SetName("Tracking Fiducials");
     m_TrackerFiducialsDataNode->SetColor(color);
     m_TrackerFiducialsDataNode->SetBoolProperty( "updateDataOnRender", false );
 
     ds->Add(m_TrackerFiducialsDataNode);
   }
 
   m_Controls.m_RegistrationWidget->SetTrackerFiducialsNode(m_TrackerFiducialsDataNode);
 }
 
 //###############################################################################################
 //###############################################################################################
 //####################### Slots of PERMANENT REGISTRATION step ##################################
 //###############################################################################################
 //###############################################################################################
 
 void QmitkIGTTrackingLabView::OnPermanentRegistration(bool on)
 {
   if(on)
     {
     //######################################################################
     //######################## inititalization #############################
     //######################################################################
 
     //some initial checks
     if(!CheckRegistrationInitialization())
     {
       m_Controls.m_UsePermanentRegistrationToggle->setChecked(false);
       return;
     }
 
     //remember initial object transform to calculate the object to marker transform later on and convert it to navigation data
     mitk::AffineTransform3D::Pointer transform = this->m_Controls.m_ObjectComboBox->GetSelectedNode()->GetData()->GetGeometry()->GetIndexToWorldTransform();
     mitk::NavigationData::Pointer T_Object = mitk::NavigationData::New(transform,false); //TODO: catch exception during conversion?
 
     //then reset the transform because we will now start to calculate the permanent registration
     this->m_Controls.m_ObjectComboBox->GetSelectedNode()->GetData()->GetGeometry()->SetIdentity();
     if(m_Controls.m_ImageActive->isChecked()) {this->m_Controls.m_ImageComboBox->GetSelectedNode()->GetData()->GetGeometry()->SetIndexToWorldTransform(m_T_ImageGeo);}
 
     //create the permanent registration filter
     m_PermanentRegistrationFilter = mitk::NavigationDataObjectVisualizationFilter::New();
 
     //######################################################################
     //first: initialize permanent registration of surface (always activated)
     //######################################################################
 
     //connect filter to source
     m_PermanentRegistrationFilter->SetInput(0,this->m_ObjectmarkerNavigationData);
 
     //set representation object
     m_PermanentRegistrationFilter->SetRepresentationObject(0,this->m_Controls.m_ObjectComboBox->GetSelectedNode()->GetData());
 
     //get the marker transform out of the navigation data
     mitk::NavigationData::Pointer T_Marker = m_ObjectmarkerNavigationData;
 
     //compute transform from object to marker (T_MarkerRel = T_Object * T_Marker^-1)
     mitk::NavigationData::Pointer T_MarkerRel = mitk::NavigationData::New();
     T_MarkerRel->Compose(T_Object);
     T_MarkerRel->Compose(T_Marker->GetInverse());
     m_T_MarkerRel = T_MarkerRel;
     m_PermanentRegistrationFilter->SetOffset(0,m_T_MarkerRel->GetAffineTransform3D());
 
     //######################################################################
     //second: initialize permanent registration of image (if activated)
     //######################################################################
     if (m_Controls.m_ImageActive->isChecked() && (m_Controls.m_ImageComboBox->GetSelectedNode().IsNotNull()))
       {
       mitk::DataNode::Pointer imageNode = this->m_Controls.m_ImageComboBox->GetSelectedNode();
       imageNode->AddProperty( "reslice interpolation", mitk::VtkResliceInterpolationProperty::New(VTK_RESLICE_LINEAR) );
       m_PermanentRegistrationFilter->SetInput(1,this->m_ObjectmarkerNavigationData);
       m_PermanentRegistrationFilter->SetRepresentationObject(1,imageNode->GetData());
 
       //for the image we can't use NavigationData objects as transforms because an image needs additional geometry information, e.g., spacing
       //thus we use mitk::AffineTransform3D objects
 
       //computer transform from image to marker (T_ImageRel = T_ImageGeo * T_MarkerRel)
       mitk::AffineTransform3D::Pointer T_ImageRel = mitk::AffineTransform3D::New();
       T_ImageRel->SetIdentity();
       T_ImageRel->Compose(m_T_ImageGeo);
       T_ImageRel->Compose(m_T_MarkerRel->GetAffineTransform3D());
       m_PermanentRegistrationFilter->SetOffset(1,T_ImageRel);
       }
 
     //some general stuff
     m_PermanentRegistration = true;
     m_ObjectmarkerNavigationDataLastUpdate = mitk::NavigationData::New();
     }
   else //if off = disable the permanent registration
     {
     //stop permanent registration
     m_PermanentRegistration = false;
 
     //restore old registration
     if(m_T_ObjectReg.IsNotNull()) {this->m_Controls.m_ObjectComboBox->GetSelectedNode()->GetData()->GetGeometry()->SetIndexToWorldTransform(m_T_ObjectReg->GetAffineTransform3D());}
     if(m_T_ImageReg.IsNotNull()) {this->m_Controls.m_ImageComboBox->GetSelectedNode()->GetData()->GetGeometry()->SetIndexToWorldTransform(m_T_ImageReg);}
 
     //delete filter
     m_PermanentRegistrationFilter = nullptr;
     }
 }
 
 //###############################################################################################
 //###############################################################################################
 //####################### Slots of POINT SET RECORDING step #####################################
 //###############################################################################################
 //###############################################################################################
 
 void QmitkIGTTrackingLabView::OnPointSetRecording(bool record)
 {
   mitk::DataStorage* ds = this->GetDataStorage();
 
   if(record)
   {
     if (m_Controls.m_PointSetRecordingToolSelectionWidget->GetSelectedToolID() == -1)
       {
       QMessageBox::warning(nullptr, "Error", "No tool selected for point set recording!");
       m_Controls.m_PointSetRecordCheckBox->setChecked(false);
       return;
       }
     m_PointSetRecordingNavigationData = m_Controls.m_PointSetRecordingToolSelectionWidget->GetSelectedNavigationDataSource()->GetOutput(m_Controls.m_PointSetRecordingToolSelectionWidget->GetSelectedToolID());
 
     //initialize point set
     mitk::DataNode::Pointer psRecND = ds->GetNamedNode("Recorded Points");
     if(m_PSRecordingPointSet.IsNull() || psRecND.IsNull())
     {
       m_PSRecordingPointSet = nullptr;
       m_PSRecordingPointSet = mitk::PointSet::New();
       mitk::DataNode::Pointer dn = mitk::DataNode::New();
       dn->SetName("Recorded Points");
       dn->SetColor(0.,1.,0.);
       dn->SetData(m_PSRecordingPointSet);
       ds->Add(dn);
     }
     else
     {
       m_PSRecordingPointSet->Clear();
     }
     m_PointSetRecording = true;
   }
 
   else
   {
     m_PointSetRecording = false;
   }
 }
 
 //###############################################################################################
 //###############################################################################################
 //####################### Slots of VIRTUAL CAMERA VIEW step #####################################
 //###############################################################################################
 //###############################################################################################
 
 void QmitkIGTTrackingLabView::OnVirtualCamera(bool on)
 {
 if (m_Controls.m_CameraViewSelection->GetSelectedToolID() == -1)
     {
     m_Controls.m_ActivateNeedleView->setChecked(false);
     QMessageBox::warning(nullptr, "Error", "No tool selected for camera view!");
     return;
     }
 
 if(on)
   {
   m_VirtualView = mitk::CameraVisualization::New();
   m_VirtualView->SetInput(m_Controls.m_CameraViewSelection->GetSelectedNavigationDataSource()->GetOutput(m_Controls.m_CameraViewSelection->GetSelectedToolID()));
 
   mitk::Vector3D viewDirection;
   viewDirection[0] = (int)(m_Controls.m_NeedleViewX->isChecked());
   viewDirection[1] = (int)(m_Controls.m_NeedleViewY->isChecked());
   viewDirection[2] = (int)(m_Controls.m_NeedleViewZ->isChecked());
   if (m_Controls.m_NeedleViewInvert->isChecked()) viewDirection *= -1;
   m_VirtualView->SetDirectionOfProjectionInToolCoordinates(viewDirection);
 
   mitk::Vector3D viewUpVector;
   viewUpVector[0] = (int)(m_Controls.m_NeedleUpX->isChecked());
   viewUpVector[1] = (int)(m_Controls.m_NeedleUpY->isChecked());
   viewUpVector[2] = (int)(m_Controls.m_NeedleUpZ->isChecked());
   if (m_Controls.m_NeedleUpInvert->isChecked()) viewUpVector *= -1;
   m_VirtualView->SetViewUpInToolCoordinates(viewUpVector);
 
-  m_VirtualView->SetRenderer(this->GetRenderWindowPart()->GetQmitkRenderWindow("3d")->GetRenderer());
+  m_VirtualView->SetRenderer(this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetQmitkRenderWindow("3d")->GetRenderer());
   //next line: better code when this plugin is migrated to mitk::abstractview
-  //m_VirtualView->SetRenderer(mitk::BaseRenderer::GetInstance(this->GetRenderWindowPart()->GetRenderWindow("3d")->GetRenderWindow()));
+  //m_VirtualView->SetRenderer(mitk::BaseRenderer::GetInstance(this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetRenderWindow("3d")->GetRenderWindow()));
   m_CameraView = true;
 
   //make pointer itself invisible
   m_Controls.m_CameraViewSelection->GetSelectedNavigationTool()->GetDataNode()->SetBoolProperty("visible",false);
 
   //disable UI elements
   m_Controls.m_ViewDirectionBox->setEnabled(false);
   m_Controls.m_ViewUpBox->setEnabled(false);
   }
 else
   {
   m_VirtualView = nullptr;
   m_CameraView = false;
   m_Controls.m_CameraViewSelection->GetSelectedNavigationTool()->GetDataNode()->SetBoolProperty("visible",true);
 
   m_Controls.m_ViewDirectionBox->setEnabled(true);
   m_Controls.m_ViewUpBox->setEnabled(true);
   }
 
 }
 
 //###############################################################################################
 //###############################################################################################
 //############################## some general UI methods, always needed #########################
 //###############################################################################################
 //###############################################################################################
 
 QmitkIGTTrackingLabView::~QmitkIGTTrackingLabView()
 {
   if (m_Timer->isActive()) m_Timer->stop();
 }
 
 void QmitkIGTTrackingLabView::CreateQtPartControl( QWidget *parent )
 {
   // create GUI widgets from the Qt Designer's .ui file
   m_Controls.setupUi( parent );
   this->CreateBundleWidgets();
   this->CreateConnections();
 }
 
 
 void QmitkIGTTrackingLabView::CreateBundleWidgets()
 {
   //initialize registration widget
   m_Controls.m_RegistrationWidget->HideStaticRegistrationRadioButton(true);
   m_Controls.m_RegistrationWidget->HideContinousRegistrationRadioButton(true);
   m_Controls.m_RegistrationWidget->HideUseICPRegistrationCheckbox(true);
 }
 
 
 void QmitkIGTTrackingLabView::CreateConnections()
 {
   //initialize timer
   m_Timer = new QTimer(this);
 
   //create connections
   connect(m_Timer, SIGNAL(timeout()), this, SLOT(UpdateTimer()));
   connect( m_Controls.m_UsePermanentRegistrationToggle, SIGNAL(toggled(bool)), this, SLOT(OnPermanentRegistration(bool)) );
   connect( m_Controls.m_TrackingDeviceSelectionWidget, SIGNAL(NavigationDataSourceSelected(mitk::NavigationDataSource::Pointer)), this, SLOT(OnSetupNavigation()) );
   connect( m_Controls.m_UseAsPointerButton, SIGNAL(clicked()), this, SLOT(OnInstrumentSelected()) );
   connect( m_Controls.m_UseAsObjectmarkerButton, SIGNAL(clicked()), this, SLOT(OnObjectmarkerSelected()) );
   connect( m_Controls.m_RegistrationWidget, SIGNAL(AddedTrackingFiducial()), this, SLOT(OnAddRegistrationTrackingFiducial()) );
   connect( m_Controls.m_RegistrationWidget, SIGNAL(PerformFiducialRegistration()), this, SLOT(OnInitialRegistration()) );
   connect( m_Controls.m_PointSetRecordCheckBox, SIGNAL(toggled(bool)), this, SLOT(OnPointSetRecording(bool)) );
   connect( m_Controls.m_ActivateNeedleView, SIGNAL(toggled(bool)), this, SLOT(OnVirtualCamera(bool)) );
 
   //start timer
   m_Timer->start(30);
 
   //initialize Combo Boxes
   m_Controls.m_ObjectComboBox->SetDataStorage(this->GetDataStorage());
   m_Controls.m_ObjectComboBox->SetAutoSelectNewItems(false);
   m_Controls.m_ObjectComboBox->SetPredicate(mitk::NodePredicateDataType::New("Surface"));
 
   m_Controls.m_ImageComboBox->SetDataStorage(this->GetDataStorage());
   m_Controls.m_ImageComboBox->SetAutoSelectNewItems(false);
   m_Controls.m_ImageComboBox->SetPredicate(mitk::NodePredicateDataType::New("Image"));
 }
 
 void QmitkIGTTrackingLabView::SetFocus()
 {
   m_Controls.m_UseAsPointerButton->setFocus();
 }
 
 //###############################################################################################
 //###############################################################################################
 //####################### some additional slots and help methods ################################
 //####################### for cleaner code - not that important  ################################
 //####################### to understand the basic functions      ################################
 //###############################################################################################
 //###############################################################################################
 
 void QmitkIGTTrackingLabView::DestroyIGTPipeline()
 {
   if(m_Source.IsNotNull())
   {
     m_Source->StopTracking();
     m_Source->Disconnect();
     m_Source = nullptr;
   }
   m_PermanentRegistrationFilter = nullptr;
   m_Visualizer = nullptr;
   m_VirtualView = nullptr;
 }
 
 bool QmitkIGTTrackingLabView::CheckRegistrationInitialization()
 {
   // a couple of variables which we need in this method
   std::string warningMessage = "";
   bool initializationErrorDetected = false;
   mitk::PointSet::Pointer imageFiducials,trackerFiducials;
 
   // check some initialization stuff
   if (m_ImageFiducialsDataNode.IsNull() || m_TrackerFiducialsDataNode.IsNull())
   {
     warningMessage = "Initialization not finished!";
     MITK_WARN << warningMessage;
     QMessageBox::warning(nullptr, "Registration not possible", warningMessage.c_str());
     return false;
   }
   else
   {
     imageFiducials = dynamic_cast<mitk::PointSet*>(m_ImageFiducialsDataNode->GetData());
     trackerFiducials = dynamic_cast<mitk::PointSet*>(m_TrackerFiducialsDataNode->GetData());
   }
 
   // now, do a lot of other checks...
   if (m_Controls.m_SurfaceActive->isChecked() && m_Controls.m_ObjectComboBox->GetSelectedNode().IsNull())
   {
     warningMessage = "No surface selected for registration.\nRegistration is not possible";
     initializationErrorDetected = true;
   }
   else if (m_Controls.m_ImageActive->isChecked() && m_Controls.m_ImageComboBox->GetSelectedNode().IsNull())
   {
     warningMessage = "No image selected for registration.\nRegistration is not possible";
     initializationErrorDetected = true;
   }
   else if (imageFiducials.IsNull() || trackerFiducials.IsNull())
   {
    warningMessage = "Fiducial data objects not found. \n"
       "Please set 3 or more fiducials in the image and with the tracking system.\n\n"
       "Registration is not possible";
     initializationErrorDetected = true;
   }
   else if ((imageFiducials->GetSize() < 3) || (trackerFiducials->GetSize() < 3) || (imageFiducials->GetSize() != trackerFiducials->GetSize()))
   {
     warningMessage = "Not enough fiducial pairs found. At least 3 fiducial must exist for the image and the tracking system respectively.";
     initializationErrorDetected = true;
   }
 
   // finaly: if an err was detected, give a warning and an error popup, then return false
   if(initializationErrorDetected)
   {
     MITK_WARN << warningMessage;
     QMessageBox::warning(nullptr, "Registration not possible", warningMessage.c_str());
     return false;
   }
   //if no error was detected simply return true
   else {return true;}
 
 }
 
 bool QmitkIGTTrackingLabView::IsTransformDifferenceHigh(mitk::NavigationData::Pointer transformA, mitk::NavigationData::Pointer transformB, double euclideanDistanceThreshold, double angularDifferenceThreshold)
 {
   if(transformA.IsNull() || transformA.IsNull())
     {return false;}
   mitk::Point3D posA,posB;
   posA = transformA->GetPosition();
   posB = transformB->GetPosition();
 
 
   if(posA.EuclideanDistanceTo(posB) > euclideanDistanceThreshold)
     {return true;}
 
   double returnValue;
   mitk::Quaternion rotA,rotB;
   rotA = transformA->GetOrientation();
   rotB = transformB->GetOrientation();
 
   itk::Vector<double,3> point; //caution 5D-Tools: Vector must lie in the YZ-plane for a correct result.
   point[0] = 0.0;
   point[1] = 0.0;
   point[2] = 100000.0;
 
   rotA.normalize();
   rotB.normalize();
 
   itk::Matrix<double,3,3> rotMatrixA;
   for(int i=0; i<3; i++) for(int j=0; j<3; j++) rotMatrixA[i][j] = rotA.rotation_matrix_transpose().transpose()[i][j];
 
   itk::Matrix<double,3,3> rotMatrixB;
   for(int i=0; i<3; i++) for(int j=0; j<3; j++) rotMatrixB[i][j] = rotB.rotation_matrix_transpose().transpose()[i][j];
 
   itk::Vector<double,3> pt1 = rotMatrixA * point;
   itk::Vector<double,3> pt2 = rotMatrixB * point;
 
   returnValue = (pt1[0]*pt2[0]+pt1[1]*pt2[1]+pt1[2]*pt2[2]) / ( sqrt(pow(pt1[0],2.0)+pow(pt1[1],2.0)+pow(pt1[2],2.0)) * sqrt(pow(pt2[0],2.0)+pow(pt2[1],2.0)+pow(pt2[2],2.0)));
   returnValue = acos(returnValue);
 
   if(returnValue*57.3 > angularDifferenceThreshold){return true;}
 
   return false;
 }
diff --git a/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkIGTFiducialRegistration.cpp b/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkIGTFiducialRegistration.cpp
index 62b4393f97..246b89b50a 100644
--- a/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkIGTFiducialRegistration.cpp
+++ b/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkIGTFiducialRegistration.cpp
@@ -1,101 +1,101 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 // Blueberry
 #include <berryISelectionService.h>
 #include <berryIWorkbenchWindow.h>
 
 //Mitk
 #include <mitkDataNode.h>
 #include <mitkNodePredicateNot.h>
 #include <mitkNodePredicateProperty.h>
 #include <mitkNodePredicateOr.h>
 #include <mitkNodePredicateDataType.h>
 #include <mitkIRenderingManager.h>
 #include <mitkImageGenerator.h>
 
 // Qmitk
 #include "QmitkIGTFiducialRegistration.h"
 #include <QmitkRenderWindow.h>
 
 // Qt
 #include <QMessageBox>
 #include <QSettings>
 #include <QTimer>
 
 // MicroServices
 #include <usModuleContext.h>
 #include <usGetModuleContext.h>
 #include "usServiceReference.h"
 
 const std::string QmitkIGTFiducialRegistration::VIEW_ID = "org.mitk.views.IGTFiducialRegistration";
 
 void QmitkIGTFiducialRegistration::SetFocus()
 {
 }
 
 void QmitkIGTFiducialRegistration::CreateQtPartControl( QWidget *parent )
 {
 
   // create GUI widgets from the Qt Designer's .ui file
   m_Controls.setupUi( parent );
 
   //Connect signals and slots
   connect(m_Controls.m_ChooseSelectedPointer, SIGNAL(clicked()), this, SLOT(PointerSelectionChanged()));
   connect(m_Controls.m_ChooseSelectedImage, SIGNAL(clicked()), this, SLOT(ImageSelectionChanged()));
 
   //Initialize Combobox
   m_Controls.m_DataStorageComboBox->SetDataStorage(this->GetDataStorage());
   m_Controls.m_DataStorageComboBox->SetAutoSelectNewItems(false);
   m_Controls.m_DataStorageComboBox->SetPredicate(mitk::NodePredicateOr::New(mitk::NodePredicateDataType::New("Surface"), mitk::NodePredicateDataType::New("Image")));
 
   //Initialize Fiducial Registration Widget
   m_Controls.m_FiducialRegistrationWidget->setDataStorage(this->GetDataStorage());
   m_Controls.m_FiducialRegistrationWidget->HideStaticRegistrationRadioButton(true);
   m_Controls.m_FiducialRegistrationWidget->HideContinousRegistrationRadioButton(true);
   m_Controls.m_FiducialRegistrationWidget->HideUseICPRegistrationCheckbox(true);
 
 }
 
 void QmitkIGTFiducialRegistration::InitializeRegistration()
 {
-  foreach(QmitkRenderWindow* renderWindow, this->GetRenderWindowPart()->GetQmitkRenderWindows().values())
+  foreach(QmitkRenderWindow* renderWindow, this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetQmitkRenderWindows().values())
   {
     this->m_Controls.m_FiducialRegistrationWidget->AddSliceNavigationController(renderWindow->GetSliceNavigationController());
   }
 }
 
 void QmitkIGTFiducialRegistration::PointerSelectionChanged()
 {
   InitializeRegistration();
   int toolID = m_Controls.m_TrackingDeviceSelectionWidget->GetSelectedToolID();
   m_TrackingPointer = m_Controls.m_TrackingDeviceSelectionWidget->GetSelectedNavigationDataSource()->GetOutput(toolID);
   m_Controls.m_FiducialRegistrationWidget->setTrackerNavigationData(m_TrackingPointer);
   m_Controls.m_PointerLabel->setText(m_Controls.m_TrackingDeviceSelectionWidget->GetSelectedNavigationTool()->GetToolName().c_str());
 }
 
 void QmitkIGTFiducialRegistration::ImageSelectionChanged()
 {
   InitializeRegistration();
   m_Controls.m_ImageLabel->setText(m_Controls.m_DataStorageComboBox->GetSelectedNode()->GetName().c_str());
   m_Controls.m_FiducialRegistrationWidget->setImageNode(m_Controls.m_DataStorageComboBox->GetSelectedNode());
 }
 
 QmitkIGTFiducialRegistration::QmitkIGTFiducialRegistration()
 {
 
 }
 
 QmitkIGTFiducialRegistration::~QmitkIGTFiducialRegistration()
 {
 
 }
diff --git a/Plugins/org.mitk.gui.qt.matchpoint.algorithm.control/src/internal/QmitkMatchPoint.cpp b/Plugins/org.mitk.gui.qt.matchpoint.algorithm.control/src/internal/QmitkMatchPoint.cpp
index 431cd29901..6c3a9535a4 100644
--- a/Plugins/org.mitk.gui.qt.matchpoint.algorithm.control/src/internal/QmitkMatchPoint.cpp
+++ b/Plugins/org.mitk.gui.qt.matchpoint.algorithm.control/src/internal/QmitkMatchPoint.cpp
@@ -1,871 +1,878 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 #include "org_mitk_gui_qt_matchpoint_algorithmcontrol_Activator.h"
 
 // Blueberry
 #include <berryISelectionService.h>
 #include <berryIWorkbenchWindow.h>
 #include <berryISelectionProvider.h>
 #include <berryQModelIndexObject.h>
 
 // Mitk
 #include <mitkStatusBar.h>
 #include <mitkPointSet.h>
 #include <mitkImageTimeSelector.h>
 #include <mitkMAPAlgorithmInfoSelection.h>
 #include <mitkRegistrationHelper.h>
 #include <mitkMAPAlgorithmHelper.h>
 #include <mitkResultNodeGenerationHelper.h>
 #include <mitkNodePredicateDataType.h>
 #include <mitkNodePredicateOr.h>
 #include <mitkNodePredicateAnd.h>
 #include <mitkNodePredicateProperty.h>
 #include <mitkNodePredicateDimension.h>
 
 // Qmitk
 #include "QmitkMatchPoint.h"
 #include <QmitkRegistrationJob.h>
 #include <QmitkMappingJob.h>
 
 // Qt
 #include <QMessageBox>
 #include <QFileDialog>
 #include <QErrorMessage>
 #include <QThreadPool>
 #include <QDateTime>
 
 // MatchPoint
 #include <mapImageRegistrationAlgorithmInterface.h>
 #include <mapPointSetRegistrationAlgorithmInterface.h>
 #include <mapRegistrationAlgorithmInterface.h>
 #include <mapMaskedRegistrationAlgorithmInterface.h>
 #include <mapAlgorithmEvents.h>
 #include <mapAlgorithmWrapperEvent.h>
 #include <mapExceptionObjectMacros.h>
 #include <mapConvert.h>
 #include <mapDeploymentDLLAccess.h>
 
 const std::string QmitkMatchPoint::VIEW_ID = "org.mitk.views.matchpoint.algorithm.control";
 
 QmitkMatchPoint::QmitkMatchPoint()
   : m_Parent(nullptr), m_LoadedDLLHandle(nullptr), m_LoadedAlgorithm(nullptr)
 {
   m_CanLoadAlgorithm = false;
   m_ValidInputs = false;
   m_Working = false;
   m_spSelectedTargetData = nullptr;
   m_spSelectedMovingData = nullptr;
   m_spSelectedTargetMaskData = nullptr;
   m_spSelectedMovingMaskData = nullptr;
 }
 
 QmitkMatchPoint::~QmitkMatchPoint()
 {
   // remove selection service
   berry::ISelectionService* s = this->GetSite()->GetWorkbenchWindow()->GetSelectionService();
 
   if (s)
   {
     s->RemoveSelectionListener(m_AlgorithmSelectionListener.data());
   }
 }
 
 void QmitkMatchPoint::SetFocus()
 {
 }
 
 void QmitkMatchPoint::CreateConnections()
 {
   connect(m_Controls.targetNodeSelector, &QmitkAbstractNodeSelectionWidget::CurrentSelectionChanged, this, &QmitkMatchPoint::OnNodeSelectionChanged);
   connect(m_Controls.movingNodeSelector, &QmitkAbstractNodeSelectionWidget::CurrentSelectionChanged, this, &QmitkMatchPoint::OnNodeSelectionChanged);
   connect(m_Controls.targetMaskNodeSelector, &QmitkAbstractNodeSelectionWidget::CurrentSelectionChanged, this, &QmitkMatchPoint::OnNodeSelectionChanged);
   connect(m_Controls.movingMaskNodeSelector, &QmitkAbstractNodeSelectionWidget::CurrentSelectionChanged, this, &QmitkMatchPoint::OnNodeSelectionChanged);
 
   // ------
   // Tab 1 - Shared library loading interface
   // ------
 
   connect(m_Controls.m_pbLoadSelected, SIGNAL(clicked()), this, SLOT(OnLoadAlgorithmButtonPushed()));
 
   // -----
   // Tab 2 - Execution
   // -----
   connect(m_Controls.m_pbStartReg, SIGNAL(clicked()), this, SLOT(OnStartRegBtnPushed()));
   connect(m_Controls.m_pbStopReg, SIGNAL(clicked()), this, SLOT(OnStopRegBtnPushed()));
   connect(m_Controls.m_pbSaveLog, SIGNAL(clicked()), this, SLOT(OnSaveLogBtnPushed()));
 }
 
 const map::deployment::DLLInfo* QmitkMatchPoint::GetSelectedAlgorithmDLL() const
 {
   return m_SelectedAlgorithmInfo;
 }
 
 void QmitkMatchPoint::OnSelectedAlgorithmChanged()
 {
   std::stringstream descriptionString;
 
   ::map::deployment::DLLInfo::ConstPointer currentItemInfo = GetSelectedAlgorithmDLL();
 
   if (!currentItemInfo)
   {
     Error(QStringLiteral("No valid algorithm is selected. ABORTING."));
     return;
   }
 
   m_Controls.m_teAlgorithmDetails->updateInfo(currentItemInfo);
 
   m_Controls.m_lbSelectedAlgorithm->setText(QString::fromStdString(
         currentItemInfo->getAlgorithmUID().getName()));
 
   // enable loading
   m_CanLoadAlgorithm = true;
   this->AdaptFolderGUIElements();
 }
 
 void QmitkMatchPoint::OnLoadAlgorithmButtonPushed()
 {
   map::deployment::DLLInfo::ConstPointer dllInfo = GetSelectedAlgorithmDLL();
 
   if (!dllInfo)
   {
     Error(QStringLiteral("No valid algorithm is selected. Cannot load algorithm. ABORTING."));
     return;
   }
 
   ::map::deployment::DLLHandle::Pointer tempDLLHandle = ::map::deployment::openDeploymentDLL(
         dllInfo->getLibraryFilePath());
   ::map::algorithm::RegistrationAlgorithmBase::Pointer tempAlgorithm
     = ::map::deployment::getRegistrationAlgorithm(tempDLLHandle);
 
   if (tempAlgorithm.IsNull())
   {
     Error(QStringLiteral("Error. Cannot load selected algorithm."));
     return;
   }
 
   this->m_LoadedAlgorithm = tempAlgorithm;
   this->m_LoadedDLLHandle = tempDLLHandle;
 
   this->m_Controls.m_AlgoConfigurator->setAlgorithm(m_LoadedAlgorithm);
 
   typedef ::map::algorithm::facet::MaskedRegistrationAlgorithmInterface<3, 3> MaskRegInterface;
   const MaskRegInterface* pMaskReg = dynamic_cast<const MaskRegInterface*>
     (m_LoadedAlgorithm.GetPointer());
 
   if (!pMaskReg)
   {
     m_spSelectedTargetMaskData = nullptr;
     m_spSelectedTargetMaskNode = nullptr;
     m_spSelectedMovingMaskData = nullptr;
     m_spSelectedMovingMaskNode = nullptr;
     m_Controls.targetMaskNodeSelector->SetCurrentSelection(QmitkAbstractNodeSelectionWidget::NodeList());
     m_Controls.movingMaskNodeSelector->SetCurrentSelection(QmitkAbstractNodeSelectionWidget::NodeList());
   }
 
 
   this->AdaptFolderGUIElements();
   this->ConfigureNodeSelectors();
   this->CheckInputs();
   this->ConfigureRegistrationControls();
   this->ConfigureProgressInfos();
   this->m_Controls.m_tabs->setCurrentIndex(1);
   this->m_Controls.m_teLog->clear();
 }
 
 void QmitkMatchPoint::Error(QString msg)
 {
   mitk::StatusBar::GetInstance()->DisplayErrorText(msg.toLatin1());
   MITK_ERROR << msg.toStdString().c_str();
 
   m_Controls.m_teLog->append(QStringLiteral("<font color='red'><b>") + msg + QStringLiteral("</b></font>"));
 }
 
 void QmitkMatchPoint::AdaptFolderGUIElements()
 {
   m_Controls.m_pbLoadSelected->setEnabled(m_CanLoadAlgorithm);
 }
 
 void QmitkMatchPoint::CreateQtPartControl(QWidget* parent)
 {
 
   // create GUI widgets from the Qt Designer's .ui file
   m_Controls.setupUi(parent);
   m_Parent = parent;
 
   m_Controls.m_tabs->setCurrentIndex(0);
 
   m_Controls.movingNodeSelector->SetDataStorage(this->GetDataStorage());
   m_Controls.movingNodeSelector->SetSelectionIsOptional(false);
   m_Controls.targetNodeSelector->SetDataStorage(this->GetDataStorage());
   m_Controls.targetNodeSelector->SetSelectionIsOptional(false);
   m_Controls.movingMaskNodeSelector->SetDataStorage(this->GetDataStorage());
   m_Controls.movingMaskNodeSelector->SetSelectionIsOptional(true);
   m_Controls.targetMaskNodeSelector->SetDataStorage(this->GetDataStorage());
   m_Controls.targetMaskNodeSelector->SetSelectionIsOptional(true);
 
   m_AlgorithmSelectionListener.reset(new berry::SelectionChangedAdapter<QmitkMatchPoint>(this,
                                      &QmitkMatchPoint::OnAlgorithmSelectionChanged));
 
   // register selection listener
   GetSite()->GetWorkbenchWindow()->GetSelectionService()->AddSelectionListener(
     m_AlgorithmSelectionListener.data());
 
   this->CreateConnections();
   this->AdaptFolderGUIElements();
   this->CheckInputs();
   this->ConfigureProgressInfos();
   this->ConfigureRegistrationControls();
   this->ConfigureNodeSelectors();
 
   berry::ISelection::ConstPointer selection =
     GetSite()->GetWorkbenchWindow()->GetSelectionService()->GetSelection("org.mitk.views.matchpoint.algorithm.browser");
 
   this->UpdateAlgorithmSelection(selection);
 }
 
 mitk::Image::Pointer ExtractFirstFrame(const mitk::Image* dynamicImage)
 {
   mitk::ImageTimeSelector::Pointer imageTimeSelector = mitk::ImageTimeSelector::New();
   imageTimeSelector->SetInput(dynamicImage);
   imageTimeSelector->SetTimeNr(0);
   imageTimeSelector->UpdateLargestPossibleRegion();
 
   return imageTimeSelector->GetOutput();
 }
 
 bool QmitkMatchPoint::CheckInputs()
 {
   if (m_LoadedAlgorithm.IsNull())
   {
     m_spSelectedMovingNode = nullptr;
     m_spSelectedMovingData = nullptr;
     m_spSelectedTargetNode = nullptr;
     m_spSelectedTargetData = nullptr;
 
     m_spSelectedMovingMaskNode = nullptr;
     m_spSelectedMovingMaskData = nullptr;
     m_spSelectedTargetMaskNode = nullptr;
     m_spSelectedTargetMaskData = nullptr;
   }
   else
   {
     if (m_Controls.movingNodeSelector->GetSelectedNode().IsNull())
     {
       m_spSelectedMovingNode = nullptr;
       m_spSelectedMovingData = nullptr;
     }
     else
     {
       m_spSelectedMovingNode = m_Controls.movingNodeSelector->GetSelectedNode();
       m_spSelectedMovingData = m_spSelectedMovingNode->GetData();
       auto movingImage = dynamic_cast<mitk::Image*>(m_spSelectedMovingNode->GetData());
 
       if (movingImage && movingImage->GetDimension() - 1 == m_LoadedAlgorithm->getMovingDimensions()
             && movingImage->GetTimeSteps() > 1)
       {
         m_spSelectedMovingData = ExtractFirstFrame(movingImage).GetPointer();
         m_Controls.m_teLog->append(
           QStringLiteral("<font color='gray'><i>Selected moving image has multiple time steps. First time step is used as moving image.</i></font>"));
       }
     }
 
     if (m_Controls.targetNodeSelector->GetSelectedNode().IsNull())
     {
       m_spSelectedTargetNode = nullptr;
       m_spSelectedTargetData = nullptr;
     }
     else
     {
       m_spSelectedTargetNode = m_Controls.targetNodeSelector->GetSelectedNode();
       m_spSelectedTargetData = m_spSelectedTargetNode->GetData();
       auto targetImage = dynamic_cast<mitk::Image*>(m_spSelectedTargetNode->GetData());
 
       if (targetImage && targetImage->GetDimension() - 1 == m_LoadedAlgorithm->getTargetDimensions()
         && targetImage->GetTimeSteps() > 1)
       {
         m_spSelectedTargetData = ExtractFirstFrame(targetImage).GetPointer();
         m_Controls.m_teLog->append(
           QStringLiteral("<font color='gray'><i>Selected target image has multiple time steps. First time step is used as target image.</i></font>"));
       }
     }
 
     if (m_Controls.movingMaskNodeSelector->GetSelectedNode().IsNull())
     {
       m_spSelectedMovingMaskNode = nullptr;
       m_spSelectedMovingMaskData = nullptr;
     }
     else
     {
       m_spSelectedMovingMaskNode = m_Controls.movingMaskNodeSelector->GetSelectedNode();
       m_spSelectedMovingMaskData = dynamic_cast<mitk::Image*>(m_spSelectedMovingMaskNode->GetData());
 
       if (m_spSelectedMovingMaskData->GetDimension() - 1 == m_LoadedAlgorithm->getMovingDimensions()
           && m_spSelectedMovingMaskData->GetTimeSteps() > 1)
       {
         m_spSelectedMovingMaskData = ExtractFirstFrame(m_spSelectedMovingMaskData).GetPointer();
         m_Controls.m_teLog->append(
           QStringLiteral("<font color='gray'><i>Selected moving mask has multiple time steps. First time step is used as moving mask.</i></font>"));
       }
     }
 
     if (m_Controls.targetMaskNodeSelector->GetSelectedNode().IsNull())
     {
       m_spSelectedTargetMaskNode = nullptr;
       m_spSelectedTargetMaskData = nullptr;
     }
     else
     {
       m_spSelectedTargetMaskNode = m_Controls.targetMaskNodeSelector->GetSelectedNode();
       m_spSelectedTargetMaskData = dynamic_cast<mitk::Image*>(m_spSelectedTargetMaskNode->GetData());
 
       if (m_spSelectedTargetMaskData->GetDimension() - 1 == m_LoadedAlgorithm->getTargetDimensions()
           && m_spSelectedTargetMaskData->GetTimeSteps() > 1)
       {
         m_spSelectedTargetMaskData = ExtractFirstFrame(m_spSelectedTargetMaskData).GetPointer();
         m_Controls.m_teLog->append(
           QStringLiteral("<font color='gray'><i>Selected target mask has multiple time steps. First time step is used as target mask.</i></font>"));
       }
     }
 
   }
 
   m_ValidInputs = m_spSelectedMovingData.IsNotNull() && m_spSelectedTargetData.IsNotNull();
   return m_ValidInputs;
 }
 
 std::string QmitkMatchPoint::GetInputNodeDisplayName(const mitk::DataNode* node) const
 {
   std::string result = "UNDEFINED/nullptr";
 
   if (node)
   {
     result = node->GetName();
 
     const mitk::PointSet* pointSet = dynamic_cast<const mitk::PointSet*>(node->GetData());
 
     if (pointSet)
     {
       mitk::DataStorage::SetOfObjects::ConstPointer sources = this->GetDataStorage()->GetSources(node);
 
       if (sources.IsNotNull() && sources->Size() > 0)
       {
         result = result + " (" + sources->GetElement(0)->GetName() + ")";
       }
 
     }
   }
 
   return result;
 }
 
 mitk::DataStorage::SetOfObjects::Pointer QmitkMatchPoint::GetRegNodes() const
 {
 
   mitk::DataStorage::SetOfObjects::ConstPointer nodes = this->GetDataStorage()->GetAll();
   mitk::DataStorage::SetOfObjects::Pointer result = mitk::DataStorage::SetOfObjects::New();
 
   for (mitk::DataStorage::SetOfObjects::const_iterator pos = nodes->begin(); pos != nodes->end();
        ++pos)
   {
     if (mitk::MITKRegistrationHelper::IsRegNode(*pos))
     {
       result->push_back(*pos);
     }
   }
 
   return result;
 }
 
 std::string QmitkMatchPoint::GetDefaultRegJobName() const
 {
 
   mitk::DataStorage::SetOfObjects::ConstPointer nodes = this->GetRegNodes().GetPointer();
   mitk::DataStorage::SetOfObjects::ElementIdentifier estimatedIndex = nodes->Size();
 
   bool isUnique = false;
   std::string result = "Unnamed Reg";
 
   while (!isUnique)
   {
     ++estimatedIndex;
     result = "Reg #" +::map::core::convert::toStr(estimatedIndex);
     isUnique =  this->GetDataStorage()->GetNamedNode(result) == nullptr;
   }
 
   return result;
 }
 
 void QmitkMatchPoint::ConfigureRegistrationControls()
 {
   m_Controls.m_tabSelection->setEnabled(!m_Working);
   m_Controls.m_leRegJobName->setEnabled(!m_Working);
   m_Controls.groupMasks->setEnabled(!m_Working);
 
   m_Controls.m_pbStartReg->setEnabled(false);
   m_Controls.m_pbStopReg->setEnabled(false);
   m_Controls.m_pbStopReg->setVisible(false);
 
   if (m_LoadedAlgorithm.IsNotNull())
   {
     m_Controls.m_tabSettings->setEnabled(!m_Working);
     m_Controls.m_tabExecution->setEnabled(true);
     m_Controls.m_pbStartReg->setEnabled(m_ValidInputs && !m_Working);
     m_Controls.m_leRegJobName->setEnabled(!m_Working);
     m_Controls.m_checkMapEntity->setEnabled(!m_Working);
     m_Controls.targetNodeSelector->setEnabled(!m_Working);
     m_Controls.movingNodeSelector->setEnabled(!m_Working);
     m_Controls.targetMaskNodeSelector->setEnabled(!m_Working);
     m_Controls.movingMaskNodeSelector->setEnabled(!m_Working);
 
     const IStoppableAlgorithm* pIterativ = dynamic_cast<const IStoppableAlgorithm*>
                                            (m_LoadedAlgorithm.GetPointer());
 
     if (pIterativ)
     {
       m_Controls.m_pbStopReg->setVisible(pIterativ->isStoppable());
     }
 
     typedef ::map::algorithm::facet::MaskedRegistrationAlgorithmInterface<3, 3> MaskRegInterface;
     const MaskRegInterface* pMaskReg = dynamic_cast<const MaskRegInterface*>
                                        (m_LoadedAlgorithm.GetPointer());
 
     m_Controls.groupMasks->setVisible(pMaskReg != nullptr);
 
     //if the stop button is set to visible and the algorithm is working ->
     //then the algorithm is stoppable, thus enable the button.
     m_Controls.m_pbStopReg->setEnabled(m_Controls.m_pbStopReg->isVisible() && m_Working);
 
     this->m_Controls.m_lbLoadedAlgorithmName->setText(
       QString::fromStdString(m_LoadedAlgorithm->getUID()->toStr()));
   }
   else
   {
     m_Controls.m_tabSettings->setEnabled(false);
     m_Controls.m_tabExecution->setEnabled(false);
     this->m_Controls.m_lbLoadedAlgorithmName->setText(
       QStringLiteral("<font color='red'>no algorithm loaded!</font>"));
     m_Controls.groupMasks->setVisible(false);
   }
 
   if (!m_Working)
   {
     this->m_Controls.m_leRegJobName->setText(QString::fromStdString(this->GetDefaultRegJobName()));
   }
 }
 
 void QmitkMatchPoint::ConfigureNodeSelectors()
 {
   auto isImage = mitk::MITKRegistrationHelper::ImageNodePredicate();
   auto isPointSet = mitk::MITKRegistrationHelper::PointSetNodePredicate();
   auto isMask = mitk::MITKRegistrationHelper::MaskNodePredicate();
   mitk::NodePredicateBase::Pointer dimensionPredicate = mitk::NodePredicateOr::New(mitk::NodePredicateDimension::New(3), mitk::NodePredicateDimension::New(4)).GetPointer();
 
 
   m_Controls.movingNodeSelector->setEnabled(m_LoadedAlgorithm.IsNotNull());
   m_Controls.targetNodeSelector->setEnabled(m_LoadedAlgorithm.IsNotNull());
   m_Controls.movingMaskNodeSelector->setEnabled(m_LoadedAlgorithm.IsNotNull());
   m_Controls.targetMaskNodeSelector->setEnabled(m_LoadedAlgorithm.IsNotNull());
 
   if (m_LoadedAlgorithm.IsNotNull())
   {
     mitk::NodePredicateBase::ConstPointer dataPredicate;
 
     if (m_LoadedAlgorithm->getMovingDimensions() == 2)
     {
       dimensionPredicate = mitk::NodePredicateDimension::New(2);
     }
 
     if (mitk::MAPAlgorithmHelper::HasImageAlgorithmInterface(m_LoadedAlgorithm))
     {
       dataPredicate = mitk::NodePredicateAnd::New(isImage, dimensionPredicate);
 
       m_Controls.movingNodeSelector->SetInvalidInfo("Select valid moving image.");
       m_Controls.movingNodeSelector->SetPopUpTitel("Select moving image.");
       m_Controls.movingNodeSelector->SetPopUpHint("Select the moving image that should be registered onto the target image.");
       m_Controls.targetNodeSelector->SetInvalidInfo("Select valid target image.");
       m_Controls.targetNodeSelector->SetPopUpTitel("Select target image.");
       m_Controls.targetNodeSelector->SetPopUpHint("Select the target image that should be used as reference for the registration.");
     }
 
     if (mitk::MAPAlgorithmHelper::HasPointSetAlgorithmInterface(m_LoadedAlgorithm))
     {
       if (dataPredicate.IsNull())
       {
         dataPredicate = isPointSet;
         m_Controls.movingNodeSelector->SetInvalidInfo("Select valid moving point set.");
         m_Controls.movingNodeSelector->SetPopUpTitel("Select moving point set.");
         m_Controls.movingNodeSelector->SetPopUpHint("Select the moving point set that should be registered onto the target point set.");
         m_Controls.targetNodeSelector->SetInvalidInfo("Select valid target point set.");
         m_Controls.targetNodeSelector->SetPopUpTitel("Select target point set.");
         m_Controls.targetNodeSelector->SetPopUpHint("Select the target point set that should be used as reference for the registration.");
       }
       else
       {
         dataPredicate = mitk::NodePredicateOr::New(dataPredicate, isPointSet);
         m_Controls.movingNodeSelector->SetInvalidInfo("Select valid moving data.");
         m_Controls.movingNodeSelector->SetPopUpTitel("Select moving data.");
         m_Controls.movingNodeSelector->SetPopUpHint("Select the moving data that should be registered onto the target data. The algorithm supports images as well as point sets.");
         m_Controls.targetNodeSelector->SetInvalidInfo("Select valid target data.");
         m_Controls.targetNodeSelector->SetPopUpTitel("Select target data.");
         m_Controls.targetNodeSelector->SetPopUpHint("Select the target data that should be used as reference for the registration. The algorithm supports images as well as point sets.");
       }
     }
     mitk::NodePredicateBase::ConstPointer nodePredicate = dataPredicate;
 
     m_Controls.movingNodeSelector->SetNodePredicate(nodePredicate);
     m_Controls.targetNodeSelector->SetNodePredicate(nodePredicate);
 
     nodePredicate = mitk::NodePredicateAnd::New(isMask, dimensionPredicate);
 
     m_Controls.movingMaskNodeSelector->SetEmptyInfo("Select moving mask. (optional)");
     m_Controls.movingMaskNodeSelector->SetPopUpTitel("Select moving mask");
     m_Controls.movingMaskNodeSelector->SetPopUpHint("Select a segmentation that serves as moving mask for the registration.");
     m_Controls.targetMaskNodeSelector->SetEmptyInfo("Select target mask. (optional)");
     m_Controls.targetMaskNodeSelector->SetPopUpTitel("Select target mask");
     m_Controls.targetMaskNodeSelector->SetPopUpHint("Select a segmentation that serves as target mask for the registration.");
 
     m_Controls.movingMaskNodeSelector->SetNodePredicate(nodePredicate);
     m_Controls.targetMaskNodeSelector->SetNodePredicate(nodePredicate);
   }
 
 }
 
 void QmitkMatchPoint::ConfigureProgressInfos()
 {
   const IIterativeAlgorithm* pIterative = dynamic_cast<const IIterativeAlgorithm*>
                                           (m_LoadedAlgorithm.GetPointer());
   const IMultiResAlgorithm* pMultiRes = dynamic_cast<const IMultiResAlgorithm*>
                                         (m_LoadedAlgorithm.GetPointer());
 
   m_Controls.m_progBarIteration->setVisible(pIterative);
   m_Controls.m_lbProgBarIteration->setVisible(pIterative);
 
 
   if (pIterative)
   {
     QString format = "%p% (%v/%m)";
 
     if (!pIterative->hasMaxIterationCount())
     {
       format = "%v";
       m_Controls.m_progBarIteration->setMaximum(0);
     }
     else
     {
       m_Controls.m_progBarIteration->setMaximum(pIterative->getMaxIterations());
     }
 
     m_Controls.m_progBarIteration->setFormat(format);
   }
 
   m_Controls.m_progBarLevel->setVisible(pMultiRes);
   m_Controls.m_lbProgBarLevel->setVisible(pMultiRes);
 
   if (pMultiRes)
   {
     m_Controls.m_progBarLevel->setMaximum(pMultiRes->getResolutionLevels());
 
   }
   else
   {
     m_Controls.m_progBarLevel->setMaximum(1);
   }
 
   m_Controls.m_progBarIteration->reset();
   m_Controls.m_progBarLevel->reset();
 }
 
 void QmitkMatchPoint::OnNodeSelectionChanged(QList<mitk::DataNode::Pointer> /*nodes*/)
 {
   if (!m_Working)
   {
     CheckInputs();
     ConfigureRegistrationControls();
   }
 }
 
 void QmitkMatchPoint::OnStartRegBtnPushed()
 {
   this->m_Working = true;
 
   ////////////////////////////////
   //configure GUI
   this->ConfigureProgressInfos();
 
   m_Controls.m_progBarIteration->reset();
   m_Controls.m_progBarLevel->reset();
 
   this->ConfigureRegistrationControls();
 
   if (m_Controls.m_checkClearLog->checkState() == Qt::Checked)
   {
     this->m_Controls.m_teLog->clear();
   }
 
 
   /////////////////////////
   //create job and put it into the thread pool
   QmitkRegistrationJob* pJob = new QmitkRegistrationJob(m_LoadedAlgorithm);
   pJob->setAutoDelete(true);
 
   pJob->m_spTargetData = m_spSelectedTargetData;
   pJob->m_spMovingData = m_spSelectedMovingData;
   pJob->m_TargetDataUID = mitk::EnsureUID(this->m_spSelectedTargetNode->GetData());
   pJob->m_MovingDataUID = mitk::EnsureUID(this->m_spSelectedMovingNode->GetData());
 
   if (m_spSelectedTargetMaskData.IsNotNull())
   {
     pJob->m_spTargetMask = m_spSelectedTargetMaskData;
     pJob->m_TargetMaskDataUID = mitk::EnsureUID(this->m_spSelectedTargetMaskNode->GetData());
   }
 
   if (m_spSelectedMovingMaskData.IsNotNull())
   {
     pJob->m_spMovingMask = m_spSelectedMovingMaskData;
     pJob->m_MovingMaskDataUID = mitk::EnsureUID(this->m_spSelectedMovingMaskNode->GetData());
   }
 
   pJob->m_JobName = m_Controls.m_leRegJobName->text().toStdString();
 
   pJob->m_StoreReg = true;
 
   connect(pJob, SIGNAL(Error(QString)), this, SLOT(OnRegJobError(QString)));
   connect(pJob, SIGNAL(Finished()), this, SLOT(OnRegJobFinished()));
   connect(pJob, SIGNAL(RegResultIsAvailable(mitk::MAPRegistrationWrapper::Pointer,
                        const QmitkRegistrationJob*)), this,
           SLOT(OnRegResultIsAvailable(mitk::MAPRegistrationWrapper::Pointer, const QmitkRegistrationJob*)),
           Qt::BlockingQueuedConnection);
 
   connect(pJob, SIGNAL(AlgorithmInfo(QString)), this, SLOT(OnAlgorithmInfo(QString)));
   connect(pJob, SIGNAL(AlgorithmStatusChanged(QString)), this,
           SLOT(OnAlgorithmStatusChanged(QString)));
   connect(pJob, SIGNAL(AlgorithmIterated(QString, bool, unsigned long)), this,
           SLOT(OnAlgorithmIterated(QString, bool, unsigned long)));
   connect(pJob, SIGNAL(LevelChanged(QString, bool, unsigned long)), this, SLOT(OnLevelChanged(QString,
           bool, unsigned long)));
 
   QThreadPool* threadPool = QThreadPool::globalInstance();
   threadPool->start(pJob);
 }
 
 void QmitkMatchPoint::OnStopRegBtnPushed()
 {
   if (m_LoadedAlgorithm.IsNotNull())
   {
     IStoppableAlgorithm* pIterativ = dynamic_cast<IStoppableAlgorithm*>(m_LoadedAlgorithm.GetPointer());
 
     if (pIterativ && pIterativ->isStoppable())
     {
       if (pIterativ->stopAlgorithm())
       {
 
       }
       else
       {
 
       }
 
       m_Controls.m_pbStopReg->setEnabled(false);
     }
     else
     {
     }
   }
 }
 
 void QmitkMatchPoint::OnSaveLogBtnPushed()
 {
   QDateTime currentTime = QDateTime::currentDateTime();
   QString fileName = tr("registration_log_") + currentTime.toString(tr("yyyy-MM-dd_hh-mm-ss")) +
                      tr(".txt");
   fileName = QFileDialog::getSaveFileName(nullptr, tr("Save registration log"), fileName,
                                           tr("Text files (*.txt)"));
 
   if (fileName.isEmpty())
   {
     QMessageBox::critical(nullptr, tr("No file selected!"),
                           tr("Cannot save registration log file. Please selected a file."));
   }
   else
   {
     std::ofstream file;
 
     std::ios_base::openmode iOpenFlag = std::ios_base::out | std::ios_base::trunc;
     file.open(fileName.toStdString().c_str(), iOpenFlag);
 
     if (!file.is_open())
     {
       mitkThrow() << "Cannot open or create specified file to save. File path: "
                   << fileName.toStdString();
     }
 
     file << this->m_Controls.m_teLog->toPlainText().toStdString() << std::endl;
 
     file.close();
   }
 
 }
 
 void QmitkMatchPoint::OnRegJobError(QString err)
 {
   Error(err);
 }
 
 void QmitkMatchPoint::OnRegJobFinished()
 {
   this->m_Working = false;
 
-  this->GetRenderWindowPart()->RequestUpdate();
+  auto* renderWindowPart = this->GetRenderWindowPart();
+
+  if (nullptr != renderWindowPart)
+    renderWindowPart->RequestUpdate();
 
   this->CheckInputs();
   this->ConfigureRegistrationControls();
   this->ConfigureProgressInfos();
 }
 
 
 void QmitkMatchPoint::OnRegResultIsAvailable(mitk::MAPRegistrationWrapper::Pointer
     spResultRegistration, const QmitkRegistrationJob* pRegJob)
 {
   mitk::DataNode::Pointer spResultRegistrationNode = mitk::generateRegistrationResultNode(
         pRegJob->m_JobName, spResultRegistration, pRegJob->GetLoadedAlgorithm()->getUID()->toStr(),
         pRegJob->m_MovingDataUID, pRegJob->m_TargetDataUID);
 
   if (pRegJob->m_StoreReg)
   {
     m_Controls.m_teLog->append(
       QStringLiteral("<b><font color='blue'> Storing registration object in data manager ... </font></b>"));
 
     this->GetDataStorage()->Add(spResultRegistrationNode);
-    this->GetRenderWindowPart()->RequestUpdate();
+
+    auto* renderWindowPart = this->GetRenderWindowPart();
+
+    if (nullptr != renderWindowPart)
+      renderWindowPart->RequestUpdate();
   }
 
   if (m_Controls.m_checkMapEntity->checkState() == Qt::Checked)
   {
     QmitkMappingJob* pMapJob = new QmitkMappingJob();
     pMapJob->setAutoDelete(true);
 
     pMapJob->m_spInputData = pRegJob->m_spMovingData;
     pMapJob->m_InputDataUID = pRegJob->m_MovingDataUID;
     pMapJob->m_spRegNode = spResultRegistrationNode;
     pMapJob->m_doGeometryRefinement = false;
     pMapJob->m_spRefGeometry = pRegJob->m_spTargetData->GetGeometry()->Clone().GetPointer();
 
     pMapJob->m_MappedName = pRegJob->m_JobName + std::string(" mapped moving data");
     pMapJob->m_allowUndefPixels = true;
     pMapJob->m_paddingValue = 100;
     pMapJob->m_allowUnregPixels = true;
     pMapJob->m_errorValue = 200;
     pMapJob->m_InterpolatorLabel = "Linear Interpolation";
     pMapJob->m_InterpolatorType = mitk::ImageMappingInterpolator::Linear;
 
     connect(pMapJob, SIGNAL(Error(QString)), this, SLOT(OnMapJobError(QString)));
     connect(pMapJob, SIGNAL(MapResultIsAvailable(mitk::BaseData::Pointer, const QmitkMappingJob*)),
             this, SLOT(OnMapResultIsAvailable(mitk::BaseData::Pointer, const QmitkMappingJob*)),
             Qt::BlockingQueuedConnection);
     connect(pMapJob, SIGNAL(AlgorithmInfo(QString)), this, SLOT(OnAlgorithmInfo(QString)));
 
     m_Controls.m_teLog->append(
       QStringLiteral("<b><font color='blue'>Started mapping input data...</font></b>"));
 
     QThreadPool* threadPool = QThreadPool::globalInstance();
     threadPool->start(pMapJob);
   }
 }
 
 void QmitkMatchPoint::OnMapJobError(QString err)
 {
   Error(err);
 }
 
 void QmitkMatchPoint::OnMapResultIsAvailable(mitk::BaseData::Pointer spMappedData,
     const QmitkMappingJob* job)
 {
   m_Controls.m_teLog->append(QStringLiteral("<b><font color='blue'>Mapped entity stored. Name: ") +
                              QString::fromStdString(job->m_MappedName) + QStringLiteral("</font></b>"));
 
   mitk::DataNode::Pointer spMappedNode = mitk::generateMappedResultNode(job->m_MappedName,
                                          spMappedData, job->GetRegistration()->getRegistrationUID(), job->m_InputDataUID,
                                          job->m_doGeometryRefinement, job->m_InterpolatorLabel);
   this->GetDataStorage()->Add(spMappedNode);
 
-  if (nullptr != this->GetRenderWindowPart())
-  {
-    this->GetRenderWindowPart()->RequestUpdate();
-  }
+  auto* renderWindowPart = this->GetRenderWindowPart();
+
+  if (nullptr != renderWindowPart)
+    renderWindowPart->RequestUpdate();
 }
 
 void QmitkMatchPoint::OnAlgorithmIterated(QString info, bool hasIterationCount,
     unsigned long currentIteration)
 {
   if (hasIterationCount)
   {
     m_Controls.m_progBarIteration->setValue(currentIteration);
   }
 
   m_Controls.m_teLog->append(info);
 }
 
 void QmitkMatchPoint::OnLevelChanged(QString info, bool hasLevelCount, unsigned long currentLevel)
 {
   if (hasLevelCount)
   {
     m_Controls.m_progBarLevel->setValue(currentLevel);
   }
 
   m_Controls.m_teLog->append(QStringLiteral("<b><font color='green'>") + info + QStringLiteral("</font></b>"));
 }
 
 void QmitkMatchPoint::OnAlgorithmStatusChanged(QString info)
 {
   m_Controls.m_teLog->append(QStringLiteral("<b><font color='blue'>") + info + QStringLiteral(" </font></b>"));
 }
 
 void QmitkMatchPoint::OnAlgorithmInfo(QString info)
 {
   m_Controls.m_teLog->append(QStringLiteral("<font color='gray'><i>") + info + QStringLiteral("</i></font>"));
 }
 
 void QmitkMatchPoint::OnAlgorithmSelectionChanged(const berry::IWorkbenchPart::Pointer& sourcepart,
     const berry::ISelection::ConstPointer& selection)
 {
   // check for null selection
   if (selection.IsNull())
   {
     return;
   }
 
   if (sourcepart != this)
   {
     UpdateAlgorithmSelection(selection);
   }
 }
 
 void QmitkMatchPoint::UpdateAlgorithmSelection(berry::ISelection::ConstPointer selection)
 {
   mitk::MAPAlgorithmInfoSelection::ConstPointer currentSelection =
     selection.Cast<const mitk::MAPAlgorithmInfoSelection>();
 
   if (currentSelection)
   {
     mitk::MAPAlgorithmInfoSelection::AlgorithmInfoVectorType infoVector =
       currentSelection->GetSelectedAlgorithmInfo();
 
     if (!infoVector.empty())
     {
       // only the first selection is of interest, the rest will be skipped.
       this->m_SelectedAlgorithmInfo = infoVector[0];
     }
   }
 
   this->OnSelectedAlgorithmChanged();
 }
diff --git a/Plugins/org.mitk.gui.qt.matchpoint.evaluator/src/internal/QmitkMatchPointRegistrationEvaluator.cpp b/Plugins/org.mitk.gui.qt.matchpoint.evaluator/src/internal/QmitkMatchPointRegistrationEvaluator.cpp
index 46c3272a68..ba833d3f10 100644
--- a/Plugins/org.mitk.gui.qt.matchpoint.evaluator/src/internal/QmitkMatchPointRegistrationEvaluator.cpp
+++ b/Plugins/org.mitk.gui.qt.matchpoint.evaluator/src/internal/QmitkMatchPointRegistrationEvaluator.cpp
@@ -1,310 +1,317 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 // Blueberry
 #include <berryISelectionService.h>
 #include <berryIWorkbenchWindow.h>
 
 // Mitk
 #include <mitkStatusBar.h>
 #include <mitkNodePredicateDataProperty.h>
 #include <mitkMAPRegistrationWrapper.h>
 #include "mitkRegVisPropertyTags.h"
 #include "mitkMatchPointPropertyTags.h"
 #include "mitkRegEvaluationObject.h"
 #include "mitkRegistrationHelper.h"
 #include "mitkRegEvaluationMapper2D.h"
 #include <mitkMAPAlgorithmHelper.h>
 #include "mitkProperties.h"
 
 // Qmitk
 #include "QmitkRenderWindow.h"
 #include "QmitkMatchPointRegistrationEvaluator.h"
 
 // Qt
 #include <QMessageBox>
 #include <QErrorMessage>
 #include <QTimer>
 
 
 const std::string QmitkMatchPointRegistrationEvaluator::VIEW_ID =
     "org.mitk.views.matchpoint.registration.evaluator";
 
 const std::string QmitkMatchPointRegistrationEvaluator::HelperNodeName =
     "RegistrationEvaluationHelper";
 
 QmitkMatchPointRegistrationEvaluator::QmitkMatchPointRegistrationEvaluator()
   : m_Parent(nullptr), m_activeEvaluation(false), m_currentSelectedTimePoint(0.)
 {
   m_currentSelectedPosition.Fill(0.0);
 }
 
 QmitkMatchPointRegistrationEvaluator::~QmitkMatchPointRegistrationEvaluator()
 {
   if (this->m_selectedEvalNode.IsNotNull() && this->GetDataStorage().IsNotNull())
   {
     this->GetDataStorage()->Remove(this->m_selectedEvalNode);
   }
 }
 
 void QmitkMatchPointRegistrationEvaluator::SetFocus()
 {
 
 }
 
 void QmitkMatchPointRegistrationEvaluator::Error(QString msg)
 {
 	mitk::StatusBar::GetInstance()->DisplayErrorText(msg.toLatin1());
 	MITK_ERROR << msg.toStdString().c_str();
 }
 
 void QmitkMatchPointRegistrationEvaluator::CreateQtPartControl(QWidget* parent)
 {
 	// create GUI widgets from the Qt Designer's .ui file
 	m_Controls.setupUi(parent);
 
 	m_Parent = parent;
 
   this->m_Controls.registrationNodeSelector->SetDataStorage(this->GetDataStorage());
   this->m_Controls.registrationNodeSelector->SetSelectionIsOptional(true);
   this->m_Controls.movingNodeSelector->SetDataStorage(this->GetDataStorage());
   this->m_Controls.movingNodeSelector->SetSelectionIsOptional(false);
   this->m_Controls.targetNodeSelector->SetDataStorage(this->GetDataStorage());
   this->m_Controls.targetNodeSelector->SetSelectionIsOptional(false);
 
   this->m_Controls.registrationNodeSelector->SetInvalidInfo("Select valid registration.");
   this->m_Controls.registrationNodeSelector->SetEmptyInfo("Assuming identity. Select registration to change.");
   this->m_Controls.registrationNodeSelector->SetPopUpTitel("Select registration.");
   this->m_Controls.registrationNodeSelector->SetPopUpHint("Select a registration object that should be evaluated. If no registration is selected, identity will be assumed for evaluation.");
 
   this->m_Controls.movingNodeSelector->SetInvalidInfo("Select moving image.");
   this->m_Controls.movingNodeSelector->SetPopUpTitel("Select moving image.");
   this->m_Controls.movingNodeSelector->SetPopUpHint("Select the moving image for the evaluation. This is the image that will be mapped by the registration.");
   this->m_Controls.targetNodeSelector->SetInvalidInfo("Select target image.");
   this->m_Controls.targetNodeSelector->SetPopUpTitel("Select target image.");
   this->m_Controls.targetNodeSelector->SetPopUpHint("Select the target image for the evaluation.");
   this->m_Controls.checkAutoSelect->setChecked(true);
 
   this->ConfigureNodePredicates();
 
   connect(m_Controls.pbEval, SIGNAL(clicked()), this, SLOT(OnEvalBtnPushed()));
   connect(m_Controls.pbStop, SIGNAL(clicked()), this, SLOT(OnStopBtnPushed()));
   connect(m_Controls.evalSettings, SIGNAL(SettingsChanged(mitk::DataNode*)), this, SLOT(OnSettingsChanged(mitk::DataNode*)));
 
   connect(m_Controls.registrationNodeSelector, &QmitkAbstractNodeSelectionWidget::CurrentSelectionChanged, this, &QmitkMatchPointRegistrationEvaluator::OnNodeSelectionChanged);
   connect(m_Controls.movingNodeSelector, &QmitkAbstractNodeSelectionWidget::CurrentSelectionChanged, this, &QmitkMatchPointRegistrationEvaluator::OnNodeSelectionChanged);
   connect(m_Controls.targetNodeSelector, &QmitkAbstractNodeSelectionWidget::CurrentSelectionChanged, this, &QmitkMatchPointRegistrationEvaluator::OnNodeSelectionChanged);
 
-  this->m_SliceChangeListener.RenderWindowPartActivated(this->GetRenderWindowPart());
+  this->m_SliceChangeListener.RenderWindowPartActivated(this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN));
   connect(&m_SliceChangeListener, SIGNAL(SliceChanged()), this, SLOT(OnSliceChanged()));
 
   m_selectedEvalNode = this->GetDataStorage()->GetNamedNode(HelperNodeName);
 
   this->CheckInputs();
 	this->ConfigureControls();
 }
 
 void QmitkMatchPointRegistrationEvaluator::RenderWindowPartActivated(mitk::IRenderWindowPart* renderWindowPart)
 {
   this->m_SliceChangeListener.RenderWindowPartActivated(renderWindowPart);
 }
 
 void QmitkMatchPointRegistrationEvaluator::RenderWindowPartDeactivated(
   mitk::IRenderWindowPart* renderWindowPart)
 {
   this->m_SliceChangeListener.RenderWindowPartDeactivated(renderWindowPart);
 }
 
 void QmitkMatchPointRegistrationEvaluator::ConfigureNodePredicates()
 {
   this->m_Controls.registrationNodeSelector->SetNodePredicate(mitk::MITKRegistrationHelper::RegNodePredicate());
 
   this->m_Controls.movingNodeSelector->SetNodePredicate(mitk::MITKRegistrationHelper::ImageNodePredicate());
   this->m_Controls.targetNodeSelector->SetNodePredicate(mitk::MITKRegistrationHelper::ImageNodePredicate());
 }
 
 void QmitkMatchPointRegistrationEvaluator::CheckInputs()
 {
   if (!m_activeEvaluation)
   {
     bool autoSelectInput = m_Controls.checkAutoSelect->isChecked() && this->m_spSelectedRegNode != this->m_Controls.registrationNodeSelector->GetSelectedNode();
     this->m_spSelectedRegNode = this->m_Controls.registrationNodeSelector->GetSelectedNode();
     this->m_spSelectedMovingNode = this->m_Controls.movingNodeSelector->GetSelectedNode();
     this->m_spSelectedTargetNode = this->m_Controls.targetNodeSelector->GetSelectedNode();
 
     if (this->m_spSelectedRegNode.IsNotNull() && (this->m_spSelectedMovingNode.IsNull() || autoSelectInput))
     {
       mitk::BaseProperty* uidProp = m_spSelectedRegNode->GetData()->GetProperty(mitk::Prop_RegAlgMovingData);
 
       if (uidProp)
       {
         //search for the moving node
         mitk::NodePredicateDataProperty::Pointer predicate = mitk::NodePredicateDataProperty::New(mitk::Prop_UID,
           uidProp);
         mitk::DataNode::Pointer movingNode = this->GetDataStorage()->GetNode(predicate);
         if (movingNode.IsNotNull())
         {
           this->m_spSelectedMovingNode = movingNode;
           QmitkSingleNodeSelectionWidget::NodeList selection({ movingNode });
           this->m_Controls.movingNodeSelector->SetCurrentSelection(selection);
         }
       }
     }
 
     if (this->m_spSelectedRegNode.IsNotNull() && (this->m_spSelectedTargetNode.IsNull() || autoSelectInput))
     {
       mitk::BaseProperty* uidProp = m_spSelectedRegNode->GetData()->GetProperty(mitk::Prop_RegAlgTargetData);
 
       if (uidProp)
       {
         //search for the target node
         mitk::NodePredicateDataProperty::Pointer predicate = mitk::NodePredicateDataProperty::New(mitk::Prop_UID,
           uidProp);
         mitk::DataNode::Pointer targetNode = this->GetDataStorage()->GetNode(predicate);
         if (targetNode.IsNotNull())
         {
           this->m_spSelectedTargetNode = targetNode;
           QmitkSingleNodeSelectionWidget::NodeList selection({ targetNode });
           this->m_Controls.targetNodeSelector->SetCurrentSelection(selection);
         }
       }
     }
   }
 }
 
 void QmitkMatchPointRegistrationEvaluator::OnNodeSelectionChanged(QList<mitk::DataNode::Pointer> /*nodes*/)
 {
   this->CheckInputs();
 	this->ConfigureControls();
 }
 
 void QmitkMatchPointRegistrationEvaluator::NodeRemoved(const mitk::DataNode* node)
 {
   if (node == this->m_spSelectedMovingNode
     || node == this->m_spSelectedRegNode
     || node == this->m_spSelectedTargetNode
     || node == this->m_selectedEvalNode)
   {
     if (node == this->m_selectedEvalNode)
     {
       this->m_selectedEvalNode = nullptr;
     }
     this->OnStopBtnPushed();
     MITK_INFO << "Stopped current MatchPoint evaluation session, because at least one relevant node was removed from storage.";
   }
 }
 
 void QmitkMatchPointRegistrationEvaluator::ConfigureControls()
 {
   //config settings widget
   this->m_Controls.evalSettings->setVisible(m_activeEvaluation);
   this->m_Controls.pbEval->setEnabled(this->m_spSelectedMovingNode.IsNotNull()
     && this->m_spSelectedTargetNode.IsNotNull());
   this->m_Controls.pbEval->setVisible(!m_activeEvaluation);
   this->m_Controls.pbStop->setVisible(m_activeEvaluation);
   this->m_Controls.registrationNodeSelector->setEnabled(!m_activeEvaluation);
   this->m_Controls.movingNodeSelector->setEnabled(!m_activeEvaluation);
   this->m_Controls.targetNodeSelector->setEnabled(!m_activeEvaluation);
 }
 
 
 void QmitkMatchPointRegistrationEvaluator::OnSliceChanged()
 {
-  mitk::Point3D currentSelectedPosition = GetRenderWindowPart()->GetSelectedPosition(nullptr);
-  auto currentTimePoint = GetRenderWindowPart()->GetSelectedTimePoint();
+  auto* renderWindowPart = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN);
+  auto currentSelectedPosition = renderWindowPart->GetSelectedPosition(nullptr);
+  auto currentTimePoint = renderWindowPart->GetSelectedTimePoint();
 
   if (m_currentSelectedPosition != currentSelectedPosition
     || m_currentSelectedTimePoint != currentTimePoint
     || m_selectedNodeTime > m_currentPositionTime)
   {
     //the current position has been changed or the selected node has been changed since the last position validation -> check position
     m_currentSelectedPosition = currentSelectedPosition;
     m_currentSelectedTimePoint = currentTimePoint;
     m_currentPositionTime.Modified();
 
     if (this->m_selectedEvalNode.IsNotNull())
     {
       this->m_selectedEvalNode->SetProperty(mitk::nodeProp_RegEvalCurrentPosition, mitk::Point3dProperty::New(currentSelectedPosition));
     }
   }
 }
 
 void QmitkMatchPointRegistrationEvaluator::OnSettingsChanged(mitk::DataNode*)
 {
-	this->GetRenderWindowPart()->RequestUpdate();
+  auto* renderWindowPart = this->GetRenderWindowPart();
+
+  if (nullptr != renderWindowPart)
+    renderWindowPart->RequestUpdate();
 }
 
 void QmitkMatchPointRegistrationEvaluator::OnEvalBtnPushed()
 {
   //reinit view
   mitk::RenderingManager::GetInstance()->InitializeViews(m_spSelectedTargetNode->GetData()->GetTimeGeometry(), mitk::RenderingManager::REQUEST_UPDATE_ALL, true);
 
   mitk::RegEvaluationObject::Pointer regEval = mitk::RegEvaluationObject::New();
 
   mitk::MAPRegistrationWrapper::Pointer reg;
 
   if (m_spSelectedRegNode.IsNotNull())
   {
     reg = dynamic_cast<mitk::MAPRegistrationWrapper*>(this->m_spSelectedRegNode->GetData());
   }
   else
   {
     //generate a dymme reg to use
     reg = mitk::GenerateIdentityRegistration3D();
   }
 
   regEval->SetRegistration(reg);
   regEval->SetTargetNode(this->m_spSelectedTargetNode);
   regEval->SetMovingNode(this->m_spSelectedMovingNode);
 
   if (this->m_selectedEvalNode.IsNotNull())
   {
     this->GetDataStorage()->Remove(this->m_selectedEvalNode);
   }
 
   this->m_selectedEvalNode = mitk::DataNode::New();
   this->m_selectedEvalNode->SetData(regEval);
 
   mitk::RegEvaluationMapper2D::SetDefaultProperties(this->m_selectedEvalNode);
   this->m_selectedEvalNode->SetName(HelperNodeName);
   this->m_selectedEvalNode->SetBoolProperty("helper object", true);
   this->GetDataStorage()->Add(this->m_selectedEvalNode);
 
   this->m_Controls.evalSettings->SetNode(this->m_selectedEvalNode);
   this->OnSliceChanged();
 
-  this->GetRenderWindowPart()->RequestUpdate();
+  auto* renderWindowPart = this->GetRenderWindowPart();
+
+  if (nullptr != renderWindowPart)
+    renderWindowPart->RequestUpdate();
 
   this->m_activeEvaluation = true;
   this->CheckInputs();
   this->ConfigureControls();
 }
 
 void QmitkMatchPointRegistrationEvaluator::OnStopBtnPushed()
 {
   this->m_activeEvaluation = false;
 
   if (this->m_selectedEvalNode.IsNotNull())
   {
     this->GetDataStorage()->Remove(this->m_selectedEvalNode);
   }
   this->m_selectedEvalNode = nullptr;
 
   this->m_Controls.evalSettings->SetNode(this->m_selectedEvalNode);
 
   this->CheckInputs();
   this->ConfigureControls();
   if (nullptr != this->GetRenderWindowPart())
   {
     this->GetRenderWindowPart()->RequestUpdate();
   }
 }
diff --git a/Plugins/org.mitk.gui.qt.matchpoint.framereg/src/internal/QmitkMatchPointFrameCorrection.cpp b/Plugins/org.mitk.gui.qt.matchpoint.framereg/src/internal/QmitkMatchPointFrameCorrection.cpp
index d29ef602dc..e7c2cac264 100644
--- a/Plugins/org.mitk.gui.qt.matchpoint.framereg/src/internal/QmitkMatchPointFrameCorrection.cpp
+++ b/Plugins/org.mitk.gui.qt.matchpoint.framereg/src/internal/QmitkMatchPointFrameCorrection.cpp
@@ -1,717 +1,724 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 #include "org_mitk_gui_qt_matchpoint_framereg_Activator.h"
 
 // Blueberry
 #include <berryISelectionService.h>
 #include <berryIWorkbenchWindow.h>
 #include <berryISelectionProvider.h>
 #include <berryQModelIndexObject.h>
 
 // Mitk
 #include <mitkStatusBar.h>
 #include <mitkPointSet.h>
 #include <mitkImageTimeSelector.h>
 #include <mitkNodePredicateDataType.h>
 #include <mitkNodePredicateOr.h>
 #include <mitkNodePredicateAnd.h>
 #include <mitkNodePredicateProperty.h>
 #include <mitkNodePredicateDimension.h>
 #include <mitkNodePredicateGeometry.h>
 #include <mitkMAPAlgorithmInfoSelection.h>
 #include <mitkRegistrationHelper.h>
 #include <mitkResultNodeGenerationHelper.h>
 
 // Qmitk
 #include "QmitkMatchPointFrameCorrection.h"
 #include <QmitkRegistrationJob.h>
 #include <QmitkMappingJob.h>
 
 // Qt
 #include <QMessageBox>
 #include <QFileDialog>
 #include <QErrorMessage>
 #include <QThreadPool>
 #include <QDateTime>
 
 // MatchPoint
 #include <mapImageRegistrationAlgorithmInterface.h>
 #include <mapPointSetRegistrationAlgorithmInterface.h>
 #include <mapRegistrationAlgorithmInterface.h>
 #include <mapMaskedRegistrationAlgorithmInterface.h>
 #include <mapAlgorithmEvents.h>
 #include <mapAlgorithmWrapperEvent.h>
 #include <mapExceptionObjectMacros.h>
 #include <mapConvert.h>
 #include <mapDeploymentDLLAccess.h>
 
 const std::string QmitkMatchPointFrameCorrection::VIEW_ID =
   "org.mitk.views.matchpoint.algorithm.framereg";
 
 QmitkMatchPointFrameCorrection::QmitkMatchPointFrameCorrection()
   : m_Parent(nullptr), m_LoadedDLLHandle(nullptr), m_LoadedAlgorithm(nullptr), m_CanLoadAlgorithm(false), m_Working(false)
 {
   m_spSelectedTargetData = nullptr;
   m_spSelectedTargetMaskData = nullptr;
 }
 
 QmitkMatchPointFrameCorrection::~QmitkMatchPointFrameCorrection()
 {
   // remove selection service
   berry::ISelectionService* s = this->GetSite()->GetWorkbenchWindow()->GetSelectionService();
 
   if (s)
   {
     s->RemoveSelectionListener(m_AlgorithmSelectionListener.data());
   }
 }
 
 void QmitkMatchPointFrameCorrection::SetFocus()
 {
 }
 
 void QmitkMatchPointFrameCorrection::CreateConnections()
 {
   connect(m_Controls.imageNodeSelector, &QmitkAbstractNodeSelectionWidget::CurrentSelectionChanged, this, &QmitkMatchPointFrameCorrection::OnNodeSelectionChanged);
   connect(m_Controls.maskNodeSelector, &QmitkAbstractNodeSelectionWidget::CurrentSelectionChanged, this, &QmitkMatchPointFrameCorrection::OnNodeSelectionChanged);
 
   // ------
   // Tab 1 - Shared library loading interface
   // ------
 
   connect(m_Controls.m_pbLoadSelected, SIGNAL(clicked()), this, SLOT(OnLoadAlgorithmButtonPushed()));
 
   // -----
   // Tab 2 - Execution
   // -----
   connect(m_Controls.m_pbStartReg, SIGNAL(clicked()), this, SLOT(OnStartRegBtnPushed()));
   connect(m_Controls.m_pbSaveLog, SIGNAL(clicked()), this, SLOT(OnSaveLogBtnPushed()));
 
   // -----
   // Tab 4 - Frames
   // -----
   connect(m_Controls.m_btnFrameSelAll, SIGNAL(clicked()), this, SLOT(OnFramesSelectAllPushed()));
   connect(m_Controls.m_btnFrameDeSelAll, SIGNAL(clicked()), this, SLOT(OnFramesDeSelectAllPushed()));
   connect(m_Controls.m_btnFrameInvert, SIGNAL(clicked()), this, SLOT(OnFramesInvertPushed()));
 
 }
 
 const map::deployment::DLLInfo* QmitkMatchPointFrameCorrection::GetSelectedAlgorithmDLL() const
 {
   return m_SelectedAlgorithmInfo;
 }
 
 void QmitkMatchPointFrameCorrection::OnSelectedAlgorithmChanged()
 {
   std::stringstream descriptionString;
 
   ::map::deployment::DLLInfo::ConstPointer currentItemInfo = GetSelectedAlgorithmDLL();
 
   if (!currentItemInfo)
   {
     return;
   }
 
   m_Controls.m_teAlgorithmDetails->updateInfo(currentItemInfo);
 
   m_Controls.m_lbSelectedAlgorithm->setText(QString::fromStdString(
         currentItemInfo->getAlgorithmUID().getName()));
 
   // enable loading
   m_CanLoadAlgorithm = true;
   this->AdaptFolderGUIElements();
 }
 
 void QmitkMatchPointFrameCorrection::OnLoadAlgorithmButtonPushed()
 {
   map::deployment::DLLInfo::ConstPointer dllInfo = GetSelectedAlgorithmDLL();
 
   if (!dllInfo)
   {
     Error(QStringLiteral("No valid algorithm is selected. Cannot load algorithm. ABORTING."));
     return;
   }
 
   ::map::deployment::DLLHandle::Pointer tempDLLHandle = ::map::deployment::openDeploymentDLL(
         dllInfo->getLibraryFilePath());
   ::map::algorithm::RegistrationAlgorithmBase::Pointer tempAlgorithm
     = ::map::deployment::getRegistrationAlgorithm(tempDLLHandle);
 
   if (tempAlgorithm.IsNull())
   {
     Error(QStringLiteral("Error. Cannot load selected algorithm."));
     return;
   }
 
   this->m_LoadedAlgorithm = tempAlgorithm;
   this->m_LoadedDLLHandle = tempDLLHandle;
 
   this->m_Controls.m_AlgoConfigurator->setAlgorithm(m_LoadedAlgorithm);
 
   this->AdaptFolderGUIElements();
   this->ConfigureNodeSelectorPredicates();
   this->CheckInputs();
   this->ConfigureRegistrationControls();
   this->ConfigureProgressInfos();
   this->m_Controls.m_tabs->setCurrentIndex(1);
 }
 
 void QmitkMatchPointFrameCorrection::Error(QString msg)
 {
   mitk::StatusBar::GetInstance()->DisplayErrorText(msg.toLatin1());
   MITK_ERROR << msg.toStdString().c_str();
 
   m_Controls.m_teLog->append(QString("<font color='red'><b>") + msg + QString("</b></font>"));
 }
 
 void QmitkMatchPointFrameCorrection::AdaptFolderGUIElements()
 {
   m_Controls.m_pbLoadSelected->setEnabled(m_CanLoadAlgorithm);
 }
 
 void QmitkMatchPointFrameCorrection::CreateQtPartControl(QWidget* parent)
 {
 
   // create GUI widgets from the Qt Designer's .ui file
   m_Controls.setupUi(parent);
   m_Parent = parent;
 
   this->m_Controls.imageNodeSelector->SetDataStorage(this->GetDataStorage());
   this->m_Controls.imageNodeSelector->SetSelectionIsOptional(false);
   this->m_Controls.maskNodeSelector->SetDataStorage(this->GetDataStorage());
   this->m_Controls.maskNodeSelector->SetSelectionIsOptional(true);
 
   this->m_Controls.imageNodeSelector->SetInvalidInfo("Select dymamic image.");
   this->m_Controls.imageNodeSelector->SetPopUpTitel("Select dynamic image.");
   this->m_Controls.imageNodeSelector->SetPopUpHint("Select a dynamic image (time resolved) that should be frame corrected.");
   this->m_Controls.maskNodeSelector->SetInvalidInfo("Select target mask.");
   this->m_Controls.maskNodeSelector->SetPopUpTitel("Select target mask.");
   this->m_Controls.maskNodeSelector->SetPopUpHint("Select a target mask (mask of the target/first frame).");
 
   m_Controls.m_tabs->setCurrentIndex(0);
 
   m_Controls.m_mapperSettings->AllowSampling(false);
 
   m_AlgorithmSelectionListener.reset(new
                                      berry::SelectionChangedAdapter<QmitkMatchPointFrameCorrection>(this,
                                          &QmitkMatchPointFrameCorrection::OnAlgorithmSelectionChanged));
 
   // register selection listener
   GetSite()->GetWorkbenchWindow()->GetSelectionService()->AddSelectionListener(
     m_AlgorithmSelectionListener.data());
 
   this->ConfigureNodeSelectorPredicates();
   this->CreateConnections();
   this->AdaptFolderGUIElements();
   this->CheckInputs();
   this->ConfigureProgressInfos();
   this->ConfigureRegistrationControls();
 
   berry::ISelection::ConstPointer selection =
     GetSite()->GetWorkbenchWindow()->GetSelectionService()->GetSelection("org.mitk.views.matchpoint.algorithm.browser");
 
   this->UpdateAlgorithmSelection(selection);
 }
 
 void QmitkMatchPointFrameCorrection::ConfigureNodeSelectorPredicates()
 {
   auto isImage = mitk::MITKRegistrationHelper::ImageNodePredicate();
   mitk::NodePredicateBase::Pointer maskDimensionPredicate = mitk::NodePredicateOr::New(mitk::NodePredicateDimension::New(3), mitk::NodePredicateDimension::New(4)).GetPointer();
   mitk::NodePredicateDimension::Pointer imageDimensionPredicate = mitk::NodePredicateDimension::New(4);
 
   m_Controls.imageNodeSelector->setEnabled(m_LoadedAlgorithm.IsNotNull());
   m_Controls.maskNodeSelector->setEnabled(m_LoadedAlgorithm.IsNotNull());
 
   m_Controls.imageNodeSelector->SetNodePredicate(mitk::NodePredicateAnd::New(isImage, imageDimensionPredicate));
 
   mitk::NodePredicateAnd::Pointer maskPredicate = mitk::NodePredicateAnd::New(mitk::MITKRegistrationHelper::MaskNodePredicate(), maskDimensionPredicate);
   if (m_spSelectedTargetData != nullptr)
   {
     auto hasSameGeometry = mitk::NodePredicateGeometry::New(m_spSelectedTargetData->GetGeometry());
     hasSameGeometry->SetCheckPrecision(1e-10);
     maskPredicate = mitk::NodePredicateAnd::New(maskPredicate, hasSameGeometry);
   }
 
   m_Controls.maskNodeSelector->SetNodePredicate(maskPredicate);
 }
 
 void QmitkMatchPointFrameCorrection::CheckInputs()
 {
   mitk::DataNode::Pointer oldTargetNode = m_spSelectedTargetNode;
 
   m_spSelectedTargetNode = nullptr;
   m_spSelectedTargetData = nullptr;
 
   m_spSelectedTargetMaskNode = nullptr;
   m_spSelectedTargetMaskData = nullptr;
 
   if (m_LoadedAlgorithm.IsNull())
   {
     m_Controls.m_lbLoadedAlgorithmName->setText(
       QStringLiteral("<font color='red'>No algorithm seleted!</font>"));
   }
   else
   {
     m_spSelectedTargetNode = m_Controls.imageNodeSelector->GetSelectedNode();
     if (m_spSelectedTargetNode.IsNotNull())
     {
       m_spSelectedTargetData = m_spSelectedTargetNode->GetData();
     }
 
     m_spSelectedTargetMaskNode = m_Controls.maskNodeSelector->GetSelectedNode();
     if (m_spSelectedTargetMaskNode.IsNotNull())
     {
       m_spSelectedTargetMaskData = dynamic_cast<mitk::Image*>(m_spSelectedTargetMaskNode->GetData());
     }
   }
 
   if (oldTargetNode != m_spSelectedTargetNode)
   {
     ConfigureFrameList();
   }
 }
 
 
 mitk::DataStorage::SetOfObjects::Pointer QmitkMatchPointFrameCorrection::GetRegNodes() const
 {
 
   mitk::DataStorage::SetOfObjects::ConstPointer nodes = this->GetDataStorage()->GetAll();
   mitk::DataStorage::SetOfObjects::Pointer result = mitk::DataStorage::SetOfObjects::New();
 
   for (mitk::DataStorage::SetOfObjects::const_iterator pos = nodes->begin(); pos != nodes->end();
        ++pos)
   {
     if (mitk::MITKRegistrationHelper::IsRegNode(*pos))
     {
       result->push_back(*pos);
     }
   }
 
   return result;
 }
 
 std::string QmitkMatchPointFrameCorrection::GetDefaultJobName() const
 {
 
   mitk::DataStorage::SetOfObjects::ConstPointer nodes = this->GetRegNodes().GetPointer();
   mitk::DataStorage::SetOfObjects::ElementIdentifier newIndex = 0;
 
   bool isUnique = false;
 
   std::string baseName = "corrected #";
 
   if (m_spSelectedTargetNode.IsNotNull())
   {
     baseName = m_spSelectedTargetNode->GetName() + "corrected #";
   }
 
   std::string result = baseName;
 
   while (!isUnique)
   {
     ++newIndex;
     result = baseName + ::map::core::convert::toStr(newIndex);
     isUnique =  this->GetDataStorage()->GetNamedNode(result) == nullptr;
   }
 
   return result;
 }
 
 void QmitkMatchPointFrameCorrection::ConfigureRegistrationControls()
 {
   m_Controls.m_tabSelection->setEnabled(!m_Working);
   m_Controls.m_leRegJobName->setEnabled(!m_Working);
 
   m_Controls.m_pbStartReg->setEnabled(false);
 
   m_Controls.imageNodeSelector->setEnabled(!m_Working);
   m_Controls.maskNodeSelector->setEnabled(!m_Working);
 
   if (m_LoadedAlgorithm.IsNotNull())
   {
     m_Controls.m_tabSettings->setEnabled(!m_Working);
     m_Controls.m_tabExclusion->setEnabled(!m_Working);
     m_Controls.m_tabExecution->setEnabled(true);
     m_Controls.m_pbStartReg->setEnabled(m_spSelectedTargetNode.IsNotNull() && !m_Working);
     m_Controls.m_leRegJobName->setEnabled(!m_Working);
 
     typedef ::map::algorithm::facet::MaskedRegistrationAlgorithmInterface<3, 3> MaskRegInterface;
     const MaskRegInterface* pMaskReg = dynamic_cast<const MaskRegInterface*>
                                        (m_LoadedAlgorithm.GetPointer());
 
     m_Controls.maskNodeSelector->setVisible(pMaskReg != nullptr);
     m_Controls.label_TargetMask->setVisible(pMaskReg != nullptr);
     if (!pMaskReg)
     {
       m_Controls.maskNodeSelector->SetCurrentSelection(QmitkSingleNodeSelectionWidget::NodeList());
     }
 
     this->m_Controls.m_lbLoadedAlgorithmName->setText(
       QString::fromStdString(m_LoadedAlgorithm->getUID()->toStr()));
   }
   else
   {
     m_Controls.m_tabSettings->setEnabled(false);
     m_Controls.m_tabExclusion->setEnabled(false);
     m_Controls.m_tabExecution->setEnabled(false);
     this->m_Controls.m_lbLoadedAlgorithmName->setText(
       QStringLiteral("<font color='red'>no algorithm loaded!</font>"));
     m_Controls.maskNodeSelector->setVisible(false);
     m_Controls.label_TargetMask->setVisible(false);
   }
 
   if (!m_Working)
   {
     this->m_Controls.m_leRegJobName->setText(QString::fromStdString(this->GetDefaultJobName()));
   }
 }
 
 void QmitkMatchPointFrameCorrection::ConfigureProgressInfos()
 {
   const IIterativeAlgorithm* pIterative = dynamic_cast<const IIterativeAlgorithm*>
                                           (m_LoadedAlgorithm.GetPointer());
   const IMultiResAlgorithm* pMultiRes = dynamic_cast<const IMultiResAlgorithm*>
                                         (m_LoadedAlgorithm.GetPointer());
 
   m_Controls.m_progBarIteration->setVisible(pIterative);
   m_Controls.m_lbProgBarIteration->setVisible(pIterative);
 
 
   if (pIterative)
   {
     QString format = "%p% (%v/%m)";
 
     if (!pIterative->hasMaxIterationCount())
     {
       format = "%v";
       m_Controls.m_progBarIteration->setMaximum(0);
     }
     else
     {
       m_Controls.m_progBarIteration->setMaximum(pIterative->getMaxIterations());
     }
 
     m_Controls.m_progBarIteration->setFormat(format);
   }
 
   if (pMultiRes)
   {
     m_Controls.m_progBarLevel->setMaximum(pMultiRes->getResolutionLevels());
 
   }
   else
   {
     m_Controls.m_progBarLevel->setMaximum(1);
   }
 
   m_Controls.m_progBarIteration->reset();
   m_Controls.m_progBarLevel->reset();
   m_Controls.m_progBarFrame->reset();
 }
 
 void QmitkMatchPointFrameCorrection::ConfigureFrameList()
 {
   m_Controls.m_listFrames->clear();
 
   if (m_spSelectedTargetData.IsNotNull())
   {
     mitk::TimeGeometry::ConstPointer tg = m_spSelectedTargetData->GetTimeGeometry();
 
     for (unsigned int i = 1; i < tg->CountTimeSteps(); ++i)
     {
       QString lable = "Timepoint #" + QString::number(i) + QString(" (") + QString::number(
                         tg->GetMinimumTimePoint(i)) + QString(" ms - " + QString::number(tg->GetMaximumTimePoint(
                               i)) + QString(" ms)"));
       QListWidgetItem* item = new QListWidgetItem(lable, m_Controls.m_listFrames);
       item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
       item->setCheckState(Qt::Checked);
     }
   }
 }
 
 void QmitkMatchPointFrameCorrection::OnFramesSelectAllPushed()
 {
   for (int row = 0; row < m_Controls.m_listFrames->count(); row++)
   {
     QListWidgetItem* item = m_Controls.m_listFrames->item(row);
     item->setCheckState(Qt::Checked);
   }
 };
 
 void QmitkMatchPointFrameCorrection::OnFramesDeSelectAllPushed()
 {
   for (int row = 0; row < m_Controls.m_listFrames->count(); row++)
   {
     QListWidgetItem* item = m_Controls.m_listFrames->item(row);
     item->setCheckState(Qt::Unchecked);
   }
 };
 
 void QmitkMatchPointFrameCorrection::OnFramesInvertPushed()
 {
   for (int row = 0; row < m_Controls.m_listFrames->count(); row++)
   {
     QListWidgetItem* item = m_Controls.m_listFrames->item(row);
 
     if (item->checkState() == Qt::Unchecked)
     {
       item->setCheckState(Qt::Checked);
     }
     else
     {
       item->setCheckState(Qt::Unchecked);
     }
   }
 };
 
 mitk::TimeFramesRegistrationHelper::IgnoreListType
 QmitkMatchPointFrameCorrection::GenerateIgnoreList() const
 {
   mitk::TimeFramesRegistrationHelper::IgnoreListType result;
 
   for (int row = 0; row < m_Controls.m_listFrames->count(); row++)
   {
     QListWidgetItem* item = m_Controls.m_listFrames->item(row);
 
     if (item->checkState() == Qt::Unchecked)
     {
       result.push_back(row + 1);
     }
   }
 
   return result;
 }
 
 void QmitkMatchPointFrameCorrection::OnNodeSelectionChanged(QList<mitk::DataNode::Pointer> /*nodes*/)
 
 {
   if (!m_Working)
   {
     ConfigureNodeSelectorPredicates();
     CheckInputs();
     ConfigureRegistrationControls();
   }
 }
 
 void QmitkMatchPointFrameCorrection::OnStartRegBtnPushed()
 {
   this->m_Working = true;
 
   ////////////////////////////////
   //configure GUI
   this->ConfigureProgressInfos();
 
   m_Controls.m_progBarIteration->reset();
   m_Controls.m_progBarLevel->reset();
 
   this->ConfigureRegistrationControls();
 
   if (m_Controls.m_checkClearLog->checkState() == Qt::Checked)
   {
     this->m_Controls.m_teLog->clear();
   }
 
 
   /////////////////////////
   //create job and put it into the thread pool
   QmitkFramesRegistrationJob* pJob = new QmitkFramesRegistrationJob(m_LoadedAlgorithm);
   pJob->setAutoDelete(true);
 
   pJob->m_spTargetData = m_spSelectedTargetData;
   pJob->m_TargetDataUID = mitk::EnsureUID(this->m_spSelectedTargetNode->GetData());
   pJob->m_IgnoreList = this->GenerateIgnoreList();
 
   if (m_spSelectedTargetMaskData.IsNotNull())
   {
     pJob->m_spTargetMask = m_spSelectedTargetMaskData;
     pJob->m_TargetMaskDataUID = mitk::EnsureUID(this->m_spSelectedTargetMaskNode->GetData());
   }
 
   pJob->m_MappedName = m_Controls.m_leRegJobName->text().toStdString();
 
   m_Controls.m_mapperSettings->ConfigureJobSettings(pJob);
 
   connect(pJob, SIGNAL(Error(QString)), this, SLOT(OnRegJobError(QString)));
   connect(pJob, SIGNAL(Finished()), this, SLOT(OnRegJobFinished()));
   connect(pJob, SIGNAL(ResultIsAvailable(mitk::Image::Pointer, const QmitkFramesRegistrationJob*)),
           this, SLOT(OnMapResultIsAvailable(mitk::Image::Pointer, const QmitkFramesRegistrationJob*)),
           Qt::BlockingQueuedConnection);
 
   connect(pJob, SIGNAL(AlgorithmInfo(QString)), this, SLOT(OnAlgorithmInfo(QString)));
   connect(pJob, SIGNAL(AlgorithmStatusChanged(QString)), this,
           SLOT(OnAlgorithmStatusChanged(QString)));
   connect(pJob, SIGNAL(AlgorithmIterated(QString, bool, unsigned long)), this,
           SLOT(OnAlgorithmIterated(QString, bool, unsigned long)));
   connect(pJob, SIGNAL(LevelChanged(QString, bool, unsigned long)), this, SLOT(OnLevelChanged(QString,
           bool, unsigned long)));
   connect(pJob, SIGNAL(FrameRegistered(double)), this, SLOT(OnFrameRegistered(double)));
   connect(pJob, SIGNAL(FrameMapped(double)), this, SLOT(OnFrameMapped(double)));
   connect(pJob, SIGNAL(FrameProcessed(double)), this, SLOT(OnFrameProcessed(double)));
 
   QThreadPool* threadPool = QThreadPool::globalInstance();
   threadPool->start(pJob);
 }
 
 void QmitkMatchPointFrameCorrection::OnSaveLogBtnPushed()
 {
   QDateTime currentTime = QDateTime::currentDateTime();
   QString fileName = tr("registration_log_") + currentTime.toString(tr("yyyy-MM-dd_hh-mm-ss")) +
                      tr(".txt");
   fileName = QFileDialog::getSaveFileName(nullptr, tr("Save registration log"), fileName,
                                           tr("Text files (*.txt)"));
 
   if (fileName.isEmpty())
   {
     QMessageBox::critical(nullptr, tr("No file selected!"),
                           tr("Cannot save registration log file. Please selected a file."));
   }
   else
   {
     std::ofstream file;
 
     std::ios_base::openmode iOpenFlag = std::ios_base::out | std::ios_base::trunc;
     file.open(fileName.toStdString().c_str(), iOpenFlag);
 
     if (!file.is_open())
     {
       mitkThrow() << "Cannot open or create specified file to save. File path: "
                   << fileName.toStdString();
     }
 
     file << this->m_Controls.m_teLog->toPlainText().toStdString() << std::endl;
 
     file.close();
   }
 }
 
 void QmitkMatchPointFrameCorrection::OnRegJobError(QString err)
 {
   Error(err);
 };
 
 void QmitkMatchPointFrameCorrection::OnRegJobFinished()
 {
   this->m_Working = false;
 
-  this->GetRenderWindowPart()->RequestUpdate();
+  auto* renderWindowPart = this->GetRenderWindowPart();
+
+  if (nullptr != renderWindowPart)
+    renderWindowPart->RequestUpdate();
 
   this->CheckInputs();
   this->ConfigureRegistrationControls();
   this->ConfigureProgressInfos();
 };
 
 
 void QmitkMatchPointFrameCorrection::OnMapResultIsAvailable(mitk::Image::Pointer spMappedData,
     const QmitkFramesRegistrationJob* job)
 {
   m_Controls.m_teLog->append(QString("<b><font color='blue'>Corrected image stored. Name: ") +
                              QString::fromStdString(job->m_MappedName) + QString("</font></b>"));
 
   mitk::DataNode::Pointer spResultNode = mitk::generateMappedResultNode(job->m_MappedName,
                                          spMappedData.GetPointer(), "", job->m_TargetDataUID, false, job->m_InterpolatorLabel);
 
   this->GetDataStorage()->Add(spResultNode, this->m_spSelectedTargetNode);
-  this->GetRenderWindowPart()->RequestUpdate();
+
+  auto* renderWindowPart = this->GetRenderWindowPart();
+
+  if (nullptr != renderWindowPart)
+    renderWindowPart->RequestUpdate();
 };
 
 void QmitkMatchPointFrameCorrection::OnMapJobError(QString err)
 {
   Error(err);
 };
 
 void QmitkMatchPointFrameCorrection::OnAlgorithmIterated(QString info, bool hasIterationCount,
     unsigned long currentIteration)
 {
   if (hasIterationCount)
   {
     m_Controls.m_progBarIteration->setValue(currentIteration);
   }
 
   m_Controls.m_teLog->append(info);
 };
 
 void QmitkMatchPointFrameCorrection::OnLevelChanged(QString info, bool hasLevelCount,
     unsigned long currentLevel)
 {
   if (hasLevelCount)
   {
     m_Controls.m_progBarLevel->setValue(currentLevel);
   }
 
   m_Controls.m_teLog->append(QString("<b><font color='green'>") + info + QString("</font></b>"));
 };
 
 void QmitkMatchPointFrameCorrection::OnAlgorithmStatusChanged(QString info)
 {
   m_Controls.m_teLog->append(QString("<b><font color='blue'>") + info + QString(" </font></b>"));
 };
 
 void QmitkMatchPointFrameCorrection::OnAlgorithmInfo(QString info)
 {
   m_Controls.m_teLog->append(QString("<font color='gray'><i>") + info + QString("</i></font>"));
 };
 
 void QmitkMatchPointFrameCorrection::OnFrameProcessed(double progress)
 {
   m_Controls.m_teLog->append(QStringLiteral("<b><font color='blue'>Frame processed...</font></b>"));
   m_Controls.m_progBarFrame->setValue(100 * progress);
 };
 
 void QmitkMatchPointFrameCorrection::OnFrameRegistered(double progress)
 {
   m_Controls.m_teLog->append(QStringLiteral("<b><font color='blue'>Frame registered...</font></b>"));
   m_Controls.m_progBarFrame->setValue(100 * progress);
 };
 
 void QmitkMatchPointFrameCorrection::OnFrameMapped(double progress)
 {
   m_Controls.m_teLog->append(QStringLiteral("<b><font color='blue'>Frame mapped...</font></b>"));
   m_Controls.m_progBarFrame->setValue(100 * progress);
 };
 
 void QmitkMatchPointFrameCorrection::OnAlgorithmSelectionChanged(const
     berry::IWorkbenchPart::Pointer& sourcepart,
     const berry::ISelection::ConstPointer& selection)
 {
   // check for null selection
   if (selection.IsNull())
   {
     return;
   }
 
   if (sourcepart != this)
   {
     UpdateAlgorithmSelection(selection);
   }
 }
 
 void QmitkMatchPointFrameCorrection::UpdateAlgorithmSelection(berry::ISelection::ConstPointer
     selection)
 {
   mitk::MAPAlgorithmInfoSelection::ConstPointer currentSelection =
     selection.Cast<const mitk::MAPAlgorithmInfoSelection>();
 
   if (currentSelection)
   {
     mitk::MAPAlgorithmInfoSelection::AlgorithmInfoVectorType infoVector =
       currentSelection->GetSelectedAlgorithmInfo();
 
     if (!infoVector.empty())
     {
       // only the first selection is of interest, the rest will be skipped.
       this->m_SelectedAlgorithmInfo = infoVector[0];
     }
   }
 
   this->OnSelectedAlgorithmChanged();
 };
diff --git a/Plugins/org.mitk.gui.qt.matchpoint.manipulator/src/internal/QmitkMatchPointRegistrationManipulator.cpp b/Plugins/org.mitk.gui.qt.matchpoint.manipulator/src/internal/QmitkMatchPointRegistrationManipulator.cpp
index ac29f25c5d..2a0fafc773 100644
--- a/Plugins/org.mitk.gui.qt.matchpoint.manipulator/src/internal/QmitkMatchPointRegistrationManipulator.cpp
+++ b/Plugins/org.mitk.gui.qt.matchpoint.manipulator/src/internal/QmitkMatchPointRegistrationManipulator.cpp
@@ -1,496 +1,519 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 // Blueberry
 #include <berryISelectionService.h>
 #include <berryIWorkbenchWindow.h>
 
 // Mitk
 #include <mitkStatusBar.h>
 #include <mitkNodePredicateDataProperty.h>
 #include <mitkMAPRegistrationWrapper.h>
 #include "mitkRegVisPropertyTags.h"
 #include "mitkMatchPointPropertyTags.h"
 #include "mitkRegEvaluationObject.h"
 #include "mitkRegistrationHelper.h"
 #include "mitkRegEvaluationMapper2D.h"
 #include <mitkMAPAlgorithmHelper.h>
 #include <mitkResultNodeGenerationHelper.h>
 #include <mitkUIDHelper.h>
 #include "mitkProperties.h"
 
 // Qmitk
 #include "QmitkRenderWindow.h"
 #include "QmitkMatchPointRegistrationManipulator.h"
 #include <QmitkMappingJob.h>
 
 // Qt
 #include <QMessageBox>
 #include <QErrorMessage>
 #include <QTimer>
 #include <QThreadPool>
 
 //MatchPoint
 #include <mapRegistrationManipulator.h>
 #include <mapPreCachedRegistrationKernel.h>
 #include <mapCombinedRegistrationKernel.h>
 #include <mapNullRegistrationKernel.h>
 #include <mapRegistrationCombinator.h>
 
 #include <itkCompositeTransform.h>
 
 #include <boost/math/constants/constants.hpp>
 
 const std::string QmitkMatchPointRegistrationManipulator::VIEW_ID =
     "org.mitk.views.matchpoint.registration.manipulator";
 
 const std::string QmitkMatchPointRegistrationManipulator::HelperNodeName =
     "RegistrationManipulationEvaluationHelper";
 
 QmitkMatchPointRegistrationManipulator::QmitkMatchPointRegistrationManipulator()
   : m_Parent(nullptr), m_activeManipulation(false),
     m_currentSelectedTimePoint(0.), m_internalUpdate(false)
 {
   m_currentSelectedPosition.Fill(0.0);
 }
 
 QmitkMatchPointRegistrationManipulator::~QmitkMatchPointRegistrationManipulator()
 {
   if (this->m_EvalNode.IsNotNull() && this->GetDataStorage().IsNotNull())
   {
     this->GetDataStorage()->Remove(this->m_EvalNode);
   }
 }
 
 void QmitkMatchPointRegistrationManipulator::SetFocus()
 {
 
 }
 
 void QmitkMatchPointRegistrationManipulator::Error(QString msg)
 {
 	mitk::StatusBar::GetInstance()->DisplayErrorText(msg.toLatin1());
 	MITK_ERROR << msg.toStdString().c_str();
 }
 
 void QmitkMatchPointRegistrationManipulator::CreateQtPartControl(QWidget* parent)
 {
 	// create GUI widgets from the Qt Designer's .ui file
 	m_Controls.setupUi(parent);
 
 	m_Parent = parent;
 
   this->m_Controls.registrationNodeSelector->SetDataStorage(this->GetDataStorage());
   this->m_Controls.registrationNodeSelector->SetSelectionIsOptional(false);
   this->m_Controls.movingNodeSelector->SetDataStorage(this->GetDataStorage());
   this->m_Controls.movingNodeSelector->SetSelectionIsOptional(false);
   this->m_Controls.targetNodeSelector->SetDataStorage(this->GetDataStorage());
   this->m_Controls.targetNodeSelector->SetSelectionIsOptional(false);
 
   this->m_Controls.registrationNodeSelector->SetInvalidInfo("Select base registration.");
   this->m_Controls.registrationNodeSelector->SetPopUpTitel("Select registration.");
   this->m_Controls.registrationNodeSelector->SetPopUpHint("Select a registration object that should be used as starting point for the manual manipulation.");
 
   this->m_Controls.movingNodeSelector->SetInvalidInfo("Select moving image.");
   this->m_Controls.movingNodeSelector->SetPopUpTitel("Select moving image.");
   this->m_Controls.movingNodeSelector->SetPopUpHint("Select the moving image for the evaluation. This is the image that will be mapped by the registration.");
   this->m_Controls.targetNodeSelector->SetInvalidInfo("Select target image.");
   this->m_Controls.targetNodeSelector->SetPopUpTitel("Select target image.");
   this->m_Controls.targetNodeSelector->SetPopUpHint("Select the target image for the evaluation.");
   this->m_Controls.checkAutoSelect->setChecked(true);
 
   this->ConfigureNodePredicates();
 
   connect(m_Controls.pbStart, SIGNAL(clicked()), this, SLOT(OnStartBtnPushed()));
   connect(m_Controls.pbCancel, SIGNAL(clicked()), this, SLOT(OnCancelBtnPushed()));
   connect(m_Controls.pbStore, SIGNAL(clicked()), this, SLOT(OnStoreBtnPushed()));
   connect(m_Controls.evalSettings, SIGNAL(SettingsChanged(mitk::DataNode*)), this, SLOT(OnSettingsChanged(mitk::DataNode*)));
   connect(m_Controls.radioSelectedReg, SIGNAL(toggled(bool)), this, SLOT(OnRegSourceChanged()));
 
   connect(m_Controls.comboCenter, SIGNAL(currentIndexChanged(int)), this, SLOT(OnCenterTypeChanged(int)));
   connect(m_Controls.manipulationWidget, SIGNAL(RegistrationChanged(map::core::RegistrationBase*)), this, SLOT(OnRegistrationChanged()));
 
   connect(m_Controls.registrationNodeSelector, &QmitkAbstractNodeSelectionWidget::CurrentSelectionChanged, this, &QmitkMatchPointRegistrationManipulator::OnNodeSelectionChanged);
   connect(m_Controls.movingNodeSelector, &QmitkAbstractNodeSelectionWidget::CurrentSelectionChanged, this, &QmitkMatchPointRegistrationManipulator::OnNodeSelectionChanged);
   connect(m_Controls.targetNodeSelector, &QmitkAbstractNodeSelectionWidget::CurrentSelectionChanged, this, &QmitkMatchPointRegistrationManipulator::OnNodeSelectionChanged);
 
-  this->m_SliceChangeListener.RenderWindowPartActivated(this->GetRenderWindowPart());
+  this->m_SliceChangeListener.RenderWindowPartActivated(this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN));
   connect(&m_SliceChangeListener, SIGNAL(SliceChanged()), this, SLOT(OnSliceChanged()));
 
   m_Controls.radioNewReg->setChecked(true);
 
   m_EvalNode = this->GetDataStorage()->GetNamedNode(HelperNodeName);
 
   this->CheckInputs();
   this->StopSession();
 	this->ConfigureControls();
 }
 
 void QmitkMatchPointRegistrationManipulator::RenderWindowPartActivated(mitk::IRenderWindowPart* renderWindowPart)
 {
   this->m_SliceChangeListener.RenderWindowPartActivated(renderWindowPart);
 }
 
 void QmitkMatchPointRegistrationManipulator::RenderWindowPartDeactivated(
   mitk::IRenderWindowPart* renderWindowPart)
 {
   this->m_SliceChangeListener.RenderWindowPartDeactivated(renderWindowPart);
 }
 
 void QmitkMatchPointRegistrationManipulator::ConfigureNodePredicates()
 {
   this->m_Controls.registrationNodeSelector->SetNodePredicate(mitk::MITKRegistrationHelper::RegNodePredicate());
 
   this->m_Controls.movingNodeSelector->SetNodePredicate(mitk::MITKRegistrationHelper::ImageNodePredicate());
   this->m_Controls.targetNodeSelector->SetNodePredicate(mitk::MITKRegistrationHelper::ImageNodePredicate());
 }
 
 void QmitkMatchPointRegistrationManipulator::CheckInputs()
 {
   if (!m_activeManipulation)
   {
     bool autoSelectInput = m_Controls.checkAutoSelect->isChecked() && this->m_SelectedPreRegNode != this->m_Controls.registrationNodeSelector->GetSelectedNode();
     this->m_SelectedPreRegNode = this->m_Controls.registrationNodeSelector->GetSelectedNode();
     this->m_SelectedMovingNode = this->m_Controls.movingNodeSelector->GetSelectedNode();
     this->m_SelectedTargetNode = this->m_Controls.targetNodeSelector->GetSelectedNode();
 
     if (this->m_SelectedPreRegNode.IsNotNull())
     {
       mitk::MAPRegistrationWrapper* regWrapper = dynamic_cast<mitk::MAPRegistrationWrapper*>(m_SelectedPreRegNode->GetData());
       if (regWrapper)
       {
         this->m_SelectedPreReg = dynamic_cast<MAPRegistrationType*>(regWrapper->GetRegistration());
       }
     }
 
     if (this->m_SelectedPreRegNode.IsNotNull() && (this->m_SelectedMovingNode.IsNull() || autoSelectInput))
     {
       mitk::BaseProperty* uidProp = m_SelectedPreRegNode->GetData()->GetProperty(mitk::Prop_RegAlgMovingData);
 
       if (uidProp)
       {
         //search for the moving node
         mitk::NodePredicateDataProperty::Pointer predicate = mitk::NodePredicateDataProperty::New(mitk::Prop_UID,
           uidProp);
         mitk::DataNode::Pointer movingNode = this->GetDataStorage()->GetNode(predicate);
         if (movingNode.IsNotNull())
         {
           this->m_SelectedMovingNode = movingNode;
           QmitkSingleNodeSelectionWidget::NodeList selection({ movingNode });
           this->m_Controls.movingNodeSelector->SetCurrentSelection(selection);
         }
       }
     }
 
     if (this->m_SelectedPreRegNode.IsNotNull() && (this->m_SelectedTargetNode.IsNull() || autoSelectInput))
     {
       mitk::BaseProperty* uidProp = m_SelectedPreRegNode->GetData()->GetProperty(mitk::Prop_RegAlgTargetData);
 
       if (uidProp)
       {
         //search for the target node
         mitk::NodePredicateDataProperty::Pointer predicate = mitk::NodePredicateDataProperty::New(mitk::Prop_UID,
           uidProp);
         mitk::DataNode::Pointer targetNode = this->GetDataStorage()->GetNode(predicate);
         if (targetNode.IsNotNull())
         {
           this->m_SelectedTargetNode = targetNode;
           QmitkSingleNodeSelectionWidget::NodeList selection({ targetNode });
           this->m_Controls.targetNodeSelector->SetCurrentSelection(selection);
         }
       }
     }
   }
 }
 
 void QmitkMatchPointRegistrationManipulator::OnRegSourceChanged()
 {
   this->CheckInputs();
   this->ConfigureControls();
 }
 
 void QmitkMatchPointRegistrationManipulator::OnNodeSelectionChanged(QList<mitk::DataNode::Pointer> /*nodes*/)
 {
   this->CheckInputs();
   this->ConfigureControls();
 }
 
 void QmitkMatchPointRegistrationManipulator::NodeRemoved(const mitk::DataNode* node)
 {
   if (node == this->m_SelectedMovingNode
     || node == this->m_SelectedTargetNode
     || node == this->m_EvalNode)
   {
     if (node == this->m_EvalNode)
     {
       this->m_EvalNode = nullptr;
     }
     if (this->m_activeManipulation)
     {
       MITK_INFO << "Stopped current MatchPoint manual registration session, because at least one relevant node was removed from storage.";
     }
     this->OnCancelBtnPushed();
 
   }
 }
 
 void QmitkMatchPointRegistrationManipulator::ConfigureControls()
 {
   if (!m_activeManipulation)
   {
     QString name = "ManuelRegistration";
 
     if (m_SelectedPreRegNode.IsNotNull())
     {
       name = QString::fromStdString(m_SelectedPreRegNode->GetName()) + " manual refined";
     }
     this->m_Controls.lbNewRegName->setText(name);
   }
 
   //config settings widget
   this->m_Controls.groupReg->setEnabled(!m_activeManipulation);
 
   this->m_Controls.pbStart->setEnabled(this->m_SelectedMovingNode.IsNotNull()
     && this->m_SelectedTargetNode.IsNotNull()
     && !m_activeManipulation
     && (this->m_Controls.radioNewReg->isChecked() || this->m_SelectedPreReg.IsNotNull()));
 
   this->m_Controls.lbNewRegName->setEnabled(m_activeManipulation);
   this->m_Controls.checkMapEntity->setEnabled(m_activeManipulation);
   this->m_Controls.tabWidget->setEnabled(m_activeManipulation);
   this->m_Controls.pbCancel->setEnabled(m_activeManipulation);
   this->m_Controls.pbStore->setEnabled(m_activeManipulation);
   this->m_Controls.registrationNodeSelector->setEnabled(!m_activeManipulation && this->m_Controls.radioSelectedReg->isChecked());
   this->m_Controls.checkAutoSelect->setEnabled(!m_activeManipulation && this->m_Controls.radioSelectedReg->isChecked());
   this->m_Controls.movingNodeSelector->setEnabled(!m_activeManipulation);
   this->m_Controls.targetNodeSelector->setEnabled(!m_activeManipulation);
 }
 
 void QmitkMatchPointRegistrationManipulator::InitSession()
 {
   if (this->m_Controls.radioNewReg->isChecked())
   { //init to map the image centers
     auto movingCenter = m_SelectedMovingNode->GetData()->GetTimeGeometry()->GetCenterInWorld();
     auto targetCenter = m_SelectedTargetNode->GetData()->GetTimeGeometry()->GetCenterInWorld();
     this->m_Controls.manipulationWidget->Initialize(movingCenter, targetCenter);
   }
   else
   { //use selected pre registration as baseline
     m_Controls.manipulationWidget->Initialize(m_SelectedPreReg);
   }
 
   this->m_CurrentRegistration = m_Controls.manipulationWidget->GetInterimRegistration();
   this->m_CurrentRegistrationWrapper = mitk::MAPRegistrationWrapper::New(m_CurrentRegistration);
 
   this->m_Controls.comboCenter->setCurrentIndex(0);
   this->OnCenterTypeChanged(0);
 
   //reinit view
   mitk::RenderingManager::GetInstance()->InitializeViews(m_SelectedTargetNode->GetData()->GetTimeGeometry(), mitk::RenderingManager::REQUEST_UPDATE_ALL, true);
 
   //generate evaluation node
 
   mitk::RegEvaluationObject::Pointer regEval = mitk::RegEvaluationObject::New();
   regEval->SetRegistration(this->m_CurrentRegistrationWrapper);
   regEval->SetTargetNode(this->m_SelectedTargetNode);
   regEval->SetMovingNode(this->m_SelectedMovingNode);
 
   this->m_EvalNode = mitk::DataNode::New();
   this->m_EvalNode->SetData(regEval);
 
   mitk::RegEvaluationMapper2D::SetDefaultProperties(this->m_EvalNode);
   this->m_EvalNode->SetName(HelperNodeName);
   this->m_EvalNode->SetBoolProperty("helper object", true);
   this->GetDataStorage()->Add(this->m_EvalNode);
 
   this->m_Controls.evalSettings->SetNode(this->m_EvalNode);
 
   this->m_activeManipulation = true;
 }
 
 void QmitkMatchPointRegistrationManipulator::StopSession()
 {
   this->m_activeManipulation = false;
 
   if (this->m_EvalNode.IsNotNull())
   {
     this->GetDataStorage()->Remove(this->m_EvalNode);
   }
 
   this->m_EvalNode = nullptr;
 
   this->m_CurrentRegistration = nullptr;
   this->m_CurrentRegistrationWrapper = nullptr;
   m_Controls.manipulationWidget->Initialize();
 }
 
 
 void QmitkMatchPointRegistrationManipulator::OnRegistrationChanged()
 {
   if (this->m_EvalNode.IsNotNull())
   {
     this->m_EvalNode->Modified();
   }
   if (this->m_CurrentRegistrationWrapper.IsNotNull())
   {
     this->m_CurrentRegistrationWrapper->Modified();
   }
-  this->GetRenderWindowPart()->RequestUpdate();
+
+  auto* renderWindowPart = this->GetRenderWindowPart();
+
+  if (nullptr != renderWindowPart)
+    renderWindowPart->RequestUpdate();
 }
 
 void QmitkMatchPointRegistrationManipulator::OnSliceChanged()
 {
-  mitk::Point3D currentSelectedPosition = GetRenderWindowPart()->GetSelectedPosition(nullptr);
-  auto currentTimePoint = GetRenderWindowPart()->GetSelectedTimePoint();
+  auto* renderWindowPart = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN);
+  auto currentSelectedPosition = renderWindowPart->GetSelectedPosition(nullptr);
+  auto currentTimePoint = renderWindowPart->GetSelectedTimePoint();
 
   if (m_currentSelectedPosition != currentSelectedPosition
     || m_currentSelectedTimePoint != currentTimePoint
     || m_selectedNodeTime > m_currentPositionTime)
   {
     //the current position has been changed or the selected node has been changed since the last position validation -> check position
     m_currentSelectedPosition = currentSelectedPosition;
     m_currentSelectedTimePoint = currentTimePoint;
     m_currentPositionTime.Modified();
 
     if (this->m_EvalNode.IsNotNull())
     {
       this->m_EvalNode->SetProperty(mitk::nodeProp_RegEvalCurrentPosition, mitk::Point3dProperty::New(currentSelectedPosition));
     }
 
     if (m_activeManipulation && m_Controls.comboCenter->currentIndex() == 2)
     { //update transform with the current position.
       m_Controls.manipulationWidget->SetCenterOfRotation(m_currentSelectedPosition);
     }
   }
 }
 
 void QmitkMatchPointRegistrationManipulator::OnSettingsChanged(mitk::DataNode*)
 {
-	this->GetRenderWindowPart()->RequestUpdate();
+  auto* renderWindowPart = this->GetRenderWindowPart();
+
+  if (nullptr != renderWindowPart)
+    renderWindowPart->RequestUpdate();
 }
 
 void QmitkMatchPointRegistrationManipulator::OnStartBtnPushed()
 {
   this->InitSession();
   this->OnSliceChanged();
 
-  this->GetRenderWindowPart()->RequestUpdate();
+  auto* renderWindowPart = this->GetRenderWindowPart();
+
+  if (nullptr != renderWindowPart)
+    renderWindowPart->RequestUpdate();
 
   this->CheckInputs();
   this->ConfigureControls();
 }
 
 void QmitkMatchPointRegistrationManipulator::OnCancelBtnPushed()
 {
   this->StopSession();
 
   this->CheckInputs();
   this->ConfigureControls();
   if (this->GetRenderWindowPart())
   {
     this->GetRenderWindowPart()->RequestUpdate();
   }
 
 }
 
 void QmitkMatchPointRegistrationManipulator::OnStoreBtnPushed()
 {
   map::core::RegistrationBase::Pointer newReg = this->m_Controls.manipulationWidget->GenerateRegistration();
   auto newRegWrapper = mitk::MAPRegistrationWrapper::New(newReg);
 
   mitk::DataNode::Pointer spResultRegistrationNode = mitk::generateRegistrationResultNode(
     this->m_Controls.lbNewRegName->text().toStdString(), newRegWrapper, "org.mitk::manual_registration",
     mitk::EnsureUID(m_SelectedMovingNode->GetData()), mitk::EnsureUID(m_SelectedTargetNode->GetData()));
 
   this->GetDataStorage()->Add(spResultRegistrationNode);
 
   if (m_Controls.checkMapEntity->checkState() == Qt::Checked)
   {
     QmitkMappingJob* pMapJob = new QmitkMappingJob();
     pMapJob->setAutoDelete(true);
 
     pMapJob->m_spInputData = this->m_SelectedMovingNode->GetData();
     pMapJob->m_InputDataUID = mitk::EnsureUID(m_SelectedMovingNode->GetData());
     pMapJob->m_spRegNode = spResultRegistrationNode;
     pMapJob->m_doGeometryRefinement = false;
     pMapJob->m_spRefGeometry = this->m_SelectedTargetNode->GetData()->GetGeometry()->Clone().GetPointer();
 
     pMapJob->m_MappedName = this->m_Controls.lbNewRegName->text().toStdString() + std::string(" mapped moving data");
     pMapJob->m_allowUndefPixels = true;
     pMapJob->m_paddingValue = 100;
     pMapJob->m_allowUnregPixels = true;
     pMapJob->m_errorValue = 200;
     pMapJob->m_InterpolatorLabel = "Linear Interpolation";
     pMapJob->m_InterpolatorType = mitk::ImageMappingInterpolator::Linear;
 
     connect(pMapJob, SIGNAL(Error(QString)), this, SLOT(Error(QString)));
     connect(pMapJob, SIGNAL(MapResultIsAvailable(mitk::BaseData::Pointer, const QmitkMappingJob*)),
       this, SLOT(OnMapResultIsAvailable(mitk::BaseData::Pointer, const QmitkMappingJob*)),
       Qt::BlockingQueuedConnection);
 
     QThreadPool* threadPool = QThreadPool::globalInstance();
     threadPool->start(pMapJob);
   }
 
   this->StopSession();
 
   this->CheckInputs();
   this->ConfigureControls();
-  this->GetRenderWindowPart()->RequestUpdate();
+
+  auto* renderWindowPart = this->GetRenderWindowPart();
+
+  if (nullptr != renderWindowPart)
+    renderWindowPart->RequestUpdate();
 }
 
 void QmitkMatchPointRegistrationManipulator::OnMapResultIsAvailable(mitk::BaseData::Pointer spMappedData,
   const QmitkMappingJob* job)
 {
   mitk::DataNode::Pointer spMappedNode = mitk::generateMappedResultNode(job->m_MappedName,
     spMappedData, job->GetRegistration()->getRegistrationUID(), job->m_InputDataUID,
     job->m_doGeometryRefinement, job->m_InterpolatorLabel);
   this->GetDataStorage()->Add(spMappedNode);
-  this->GetRenderWindowPart()->RequestUpdate();
+
+  auto* renderWindowPart = this->GetRenderWindowPart();
+
+  if (nullptr != renderWindowPart)
+    renderWindowPart->RequestUpdate();
 }
 
 void QmitkMatchPointRegistrationManipulator::OnCenterTypeChanged(int index)
 {
   ConfigureTransformCenter(index);
 
   if (this->m_EvalNode.IsNotNull())
   {
     this->m_EvalNode->Modified();
   }
   if (this->m_CurrentRegistrationWrapper.IsNotNull())
   {
     this->m_CurrentRegistrationWrapper->Modified();
   }
-  this->GetRenderWindowPart()->RequestUpdate();
+
+  auto* renderWindowPart = this->GetRenderWindowPart();
+
+  if (nullptr != renderWindowPart)
+    renderWindowPart->RequestUpdate();
 }
 
 void QmitkMatchPointRegistrationManipulator::ConfigureTransformCenter(int centerType)
 {
   if (centerType == 0)
   { //image center
     auto center = m_SelectedMovingNode->GetData()->GetTimeGeometry()->GetCenterInWorld();
     m_Controls.manipulationWidget->SetCenterOfRotationIsRelativeToTarget(false);
     m_Controls.manipulationWidget->SetCenterOfRotation(center);
   }
   else if (centerType == 1)
   { //world origin
     mitk::Point3D center;
     center.Fill(0.0);
     m_Controls.manipulationWidget->SetCenterOfRotationIsRelativeToTarget(false);
     m_Controls.manipulationWidget->SetCenterOfRotation(center);
   }
   else
   { //current selected point
     m_Controls.manipulationWidget->SetCenterOfRotationIsRelativeToTarget(true);
     m_Controls.manipulationWidget->SetCenterOfRotation(m_currentSelectedPosition);
   }
 }
diff --git a/Plugins/org.mitk.gui.qt.matchpoint.mapper/src/internal/QmitkMatchPointMapper.cpp b/Plugins/org.mitk.gui.qt.matchpoint.mapper/src/internal/QmitkMatchPointMapper.cpp
index 31243b624a..85044298f9 100644
--- a/Plugins/org.mitk.gui.qt.matchpoint.mapper/src/internal/QmitkMatchPointMapper.cpp
+++ b/Plugins/org.mitk.gui.qt.matchpoint.mapper/src/internal/QmitkMatchPointMapper.cpp
@@ -1,580 +1,584 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 #include "org_mitk_gui_qt_matchpoint_mapper_Activator.h"
 
 // Blueberry
 #include <berryISelectionService.h>
 #include <berryIWorkbenchWindow.h>
 
 // Mitk
 #include <mitkImageAccessByItk.h>
 #include <mitkStatusBar.h>
 #include "mitkImageMappingHelper.h"
 #include "mitkMAPRegistrationWrapper.h"
 #include "mitkMatchPointPropertyTags.h"
 #include "mitkRegistrationHelper.h"
 #include <mitkResultNodeGenerationHelper.h>
 #include <mitkUIDHelper.h>
 #include <mitkMAPAlgorithmHelper.h>
 #include <mitkResultNodeGenerationHelper.h>
 #include <mitkNodePredicateFunction.h>
 #include <mitkNodePredicateOr.h>
 #include <mitkNodePredicateAnd.h>
 #include <mitkNodePredicateDataProperty.h>
 
 // Qmitk
 #include "QmitkMatchPointMapper.h"
 
 // Qt
 #include <QMessageBox>
 #include <QFileDialog>
 #include <QErrorMessage>
 #include <QThreadPool>
 
 const std::string QmitkMatchPointMapper::VIEW_ID = "org.mitk.views.matchpoint.mapper";
 
 QmitkMatchPointMapper::QmitkMatchPointMapper()
     : m_Parent(nullptr), m_preparedForBinaryInput(false)
 {
 }
 
 void QmitkMatchPointMapper::SetFocus()
 {
     //m_Controls.buttonPerformImageProcessing->setFocus();
 }
 
 void QmitkMatchPointMapper::CreateConnections()
 {
     connect(m_Controls.registrationNodeSelector, &QmitkAbstractNodeSelectionWidget::CurrentSelectionChanged, this, &QmitkMatchPointMapper::OnRegNodeSelectionChanged);
     connect(m_Controls.inputNodeSelector, &QmitkAbstractNodeSelectionWidget::CurrentSelectionChanged, this, &QmitkMatchPointMapper::OnInputNodeSelectionChanged);
     connect(m_Controls.referenceNodeSelector, &QmitkAbstractNodeSelectionWidget::CurrentSelectionChanged, this, &QmitkMatchPointMapper::OnReferenceNodeSelectionChanged);
 
     connect(m_Controls.m_cbManualRef, SIGNAL(clicked()), this, SLOT(OnManualRefChecked()));
     connect(m_Controls.m_cbLinkFactors, SIGNAL(clicked()), this, SLOT(OnLinkSampleFactorChecked()));
 
     connect(m_Controls.m_sbXFactor, SIGNAL(valueChanged(double)), this, SLOT(OnXFactorChanged(double)));
 
     connect(m_Controls.m_pbMap, SIGNAL(clicked()), this, SLOT(OnMapBtnPushed()));
     connect(m_Controls.m_pbRefine, SIGNAL(clicked()), this, SLOT(OnRefineBtnPushed()));
 }
 
 void QmitkMatchPointMapper::Error(QString msg)
 {
     mitk::StatusBar::GetInstance()->DisplayErrorText(msg.toLatin1());
     MITK_ERROR << msg.toStdString().c_str();
 
     m_Controls.m_teLog->append(QStringLiteral("<font color='red'><b>") + msg + QStringLiteral("</b></font>"));
 }
 
 void QmitkMatchPointMapper::CreateQtPartControl(QWidget* parent)
 {
     // create GUI widgets from the Qt Designer's .ui file
     m_Controls.setupUi(parent);
 
     m_Parent = parent;
 
     this->m_Controls.registrationNodeSelector->SetDataStorage(this->GetDataStorage());
     this->m_Controls.registrationNodeSelector->SetSelectionIsOptional(true);
     this->m_Controls.inputNodeSelector->SetDataStorage(this->GetDataStorage());
     this->m_Controls.inputNodeSelector->SetSelectionIsOptional(false);
     this->m_Controls.referenceNodeSelector->SetDataStorage(this->GetDataStorage());
     this->m_Controls.referenceNodeSelector->SetSelectionIsOptional(false);
 
     this->m_Controls.registrationNodeSelector->SetInvalidInfo("Select valid registration.");
     this->m_Controls.registrationNodeSelector->SetEmptyInfo("Assuming identity mapping. Select registration to change.");
     this->m_Controls.registrationNodeSelector->SetPopUpTitel("Select registration.");
     this->m_Controls.registrationNodeSelector->SetPopUpHint("Select a registration object that should be used for the mapping of the input data. If no registration is selected, identity will be assumed for the mapping.");
 
     this->m_Controls.inputNodeSelector->SetInvalidInfo("Select input data.");
     this->m_Controls.inputNodeSelector->SetPopUpTitel("Select input data.");
     this->m_Controls.inputNodeSelector->SetPopUpHint("Select the input data for the mapping. (Images or point sets are supported so far).");
     this->m_Controls.referenceNodeSelector->SetInvalidInfo("Select the reference image.");
     this->m_Controls.referenceNodeSelector->SetPopUpTitel("Select the reference image.");
     this->m_Controls.referenceNodeSelector->SetPopUpHint("Select the reference image that specifies the target geometrie the input should be mapped into.");
 
     this->ConfigureRegNodePredicate();
     this->ConfigureNodePredicates();
 
     // show first page
     m_Controls.m_tabs->setCurrentIndex(0);
 
     this->CreateConnections();
     this->CheckInputs();
     this->ConfigureProgressInfos();
     this->ConfigureMappingControls();
 }
 
 /** Method checks if the currently selected reg node has a direct kernel that
 * can be decomposed in a rotation matrix and a offset. If this is true, true
 * is returned. In all other cases false is returned.*/
 bool  QmitkMatchPointMapper::IsAbleToRefineGeometry() const
 {
     bool result = false;
 
     if (this->m_spSelectedRegNode.IsNotNull())
     {
         const mitk::MAPRegistrationWrapper* wrapper = dynamic_cast<const mitk::MAPRegistrationWrapper*>
             (this->m_spSelectedRegNode->GetData());
 
         //if the helper does not return null, we can refine the geometry.
         result = mitk::MITKRegistrationHelper::getAffineMatrix(wrapper, false).IsNotNull();
     }
 
     return result;
 }
 
 bool  QmitkMatchPointMapper::IsBinaryInput() const
 {
     auto maskPredicate = mitk::MITKRegistrationHelper::MaskNodePredicate();
 
     bool result = false;
 
     if(this->m_spSelectedInputNode.IsNotNull())
     {
       result = maskPredicate->CheckNode(this->m_spSelectedInputNode);
     }
 
     return result;
 }
 
 bool  QmitkMatchPointMapper::IsPointSetInput() const
 {
     bool result = false;
 
     if (this->m_spSelectedInputNode.IsNotNull())
     {
         result = dynamic_cast<const mitk::PointSet*>(this->m_spSelectedInputNode->GetData()) != nullptr;
     }
 
     return result;
 }
 
 mitk::DataNode::Pointer QmitkMatchPointMapper::GetAutoRefNodeByReg()
 {
     mitk::DataNode::Pointer spResult = nullptr;
 
     if (this->m_spSelectedRegNode.IsNotNull() && this->m_spSelectedRegNode->GetData())
     {
         std::string nodeName;
         mitk::BaseProperty* uidProp = m_spSelectedRegNode->GetData()->GetProperty(mitk::Prop_RegAlgTargetData);
 
         if (uidProp)
         {
             //search for the target node
             mitk::NodePredicateDataProperty::Pointer predicate = mitk::NodePredicateDataProperty::New(mitk::Prop_UID,
                 uidProp);
             spResult = this->GetDataStorage()->GetNode(predicate);
         }
     }
     if (spResult.IsNull() && this->m_spSelectedInputNode.IsNotNull())
     {
         //no really reference is available -> use the input as reference
         spResult = this->m_spSelectedInputNode;
         if (this->m_spSelectedRefNode != spResult)
         {
           m_Controls.m_teLog->append(
             QStringLiteral("<font color='gray'><i>Cannot determine reference automatically. Use input image as reference.</i></font>"));
         }
     }
 
     return spResult;
 }
 
 void QmitkMatchPointMapper::ConfigureRegNodePredicate(const mitk::DataNode* input)
 {
   mitk::NodePredicateBase::ConstPointer nodePredicate = mitk::MITKRegistrationHelper::RegNodePredicate();
 
   if (input != nullptr)
   {
     unsigned int dimension = 0;
 
     auto inputImage = dynamic_cast<mitk::Image*>(input->GetData());
     auto pointset = dynamic_cast<const mitk::PointSet*>(input->GetData());
     if (inputImage)
     {
       dimension = inputImage->GetDimension();
 
       if (inputImage->GetTimeSteps() > 1)
       {
         //images has multiple time steps -> remove one dimension.
         dimension -= 1;
       }
     }
     else if (pointset)
     {
       dimension = 3;
     }
 
     auto dimCheck = [dimension](const mitk::DataNode * node)
     {
       const mitk::MAPRegistrationWrapper* wrapper = dynamic_cast < const mitk::MAPRegistrationWrapper* >(node->GetData());
 
       return wrapper != nullptr && wrapper->GetMovingDimensions() == dimension;
     };
     mitk::NodePredicateFunction::Pointer hasCorrectDim = mitk::NodePredicateFunction::New(dimCheck);
 
     nodePredicate = mitk::NodePredicateAnd::New(nodePredicate, hasCorrectDim).GetPointer();
   }
 
   this->m_Controls.registrationNodeSelector->SetNodePredicate(nodePredicate);
 }
 
 std::function<bool(const mitk::DataNode *)> GenerateDimCheckLambda(unsigned int dim)
 {
   auto dimCheck = [dim](const mitk::DataNode * node)
   {
     auto inputImage = dynamic_cast<mitk::Image*>(node->GetData());
 
     return inputImage != nullptr &&
       (inputImage->GetDimension() == dim ||
       (inputImage->GetDimension() == dim + 1 && inputImage->GetTimeSteps()>1));
   };
 
   return dimCheck;
 }
 
 void QmitkMatchPointMapper::ConfigureNodePredicates(const mitk::DataNode* reg)
 {
   auto isImage = mitk::MITKRegistrationHelper::ImageNodePredicate();
   auto isPointSet = mitk::MITKRegistrationHelper::PointSetNodePredicate();
 
   auto isData = mitk::NodePredicateOr::New(isImage, isPointSet);
 
   mitk::NodePredicateBase::ConstPointer inputPredicate = isData.GetPointer();
   mitk::NodePredicateBase::ConstPointer refPredicate = isImage.GetPointer();
 
   if (reg != nullptr)
   {
     const mitk::MAPRegistrationWrapper* wrapper = dynamic_cast <const mitk::MAPRegistrationWrapper*>(reg->GetData());
 
     if (wrapper != nullptr)
     {
       auto movingDim = wrapper->GetMovingDimensions();
 
       auto dimCheck = GenerateDimCheckLambda(movingDim);
       auto hasCorrectDim = mitk::NodePredicateFunction::New(dimCheck);
 
       if (movingDim == 3)
       {
         //Remark: Point sets are always 3D
         auto is3DInput = mitk::NodePredicateOr::New(isPointSet, mitk::NodePredicateAnd::New(isImage, hasCorrectDim));
         inputPredicate = is3DInput.GetPointer();
       }
       else
       {
         auto is2DInput = mitk::NodePredicateAnd::New(isImage, hasCorrectDim);
         inputPredicate = is2DInput.GetPointer();
       }
 
       auto targetDim = wrapper->GetTargetDimensions();
 
       auto targetDimCheck = GenerateDimCheckLambda(targetDim);
       auto hasCorrectTargetDim = mitk::NodePredicateFunction::New(targetDimCheck);
 
       auto isRef = mitk::NodePredicateAnd::New(isImage, hasCorrectTargetDim);
       refPredicate = isRef;
 
     }
   }
   this->m_Controls.inputNodeSelector->SetNodePredicate(inputPredicate);
   this->m_Controls.referenceNodeSelector->SetNodePredicate(refPredicate);
 }
 
 void QmitkMatchPointMapper::CheckInputs()
 {
     this->m_spSelectedRegNode = this->m_Controls.registrationNodeSelector->GetSelectedNode();
     this->m_spSelectedInputNode = this->m_Controls.inputNodeSelector->GetSelectedNode();
     this->m_spSelectedRefNode = this->m_Controls.referenceNodeSelector->GetSelectedNode();
 
     if (!(m_Controls.m_cbManualRef->isChecked()))
     {
         auto autoRefNode = this->GetAutoRefNodeByReg();
         if (this->m_spSelectedRefNode != autoRefNode)
         {
           this->m_spSelectedRefNode = autoRefNode;
           QmitkSingleNodeSelectionWidget::NodeList selection;
 
           if (this->m_spSelectedRefNode.IsNotNull())
           {
             selection.append(this->m_spSelectedRefNode);
           }
           this->m_Controls.referenceNodeSelector->SetCurrentSelection(selection);
         }
     }
 
     if (this->m_spSelectedRefNode.IsNotNull() && this->m_spSelectedRefNode->GetData()
         && this->m_spSelectedRefNode->GetData()->GetTimeSteps() > 1)
     {
         m_Controls.m_teLog->append(
           QStringLiteral("<font color='gray'><i>Selected reference image has multiple time steps. Only geometry of time step 1 is used as reference.</i></font>"));
     }
 }
 
 void QmitkMatchPointMapper::ConfigureMappingControls()
 {
     bool validInput = m_spSelectedInputNode.IsNotNull();
     bool validRef = m_spSelectedRefNode.IsNotNull();
 
     this->m_Controls.referenceNodeSelector->setEnabled(this->m_Controls.m_cbManualRef->isChecked());
     this->m_Controls.m_pbMap->setEnabled(validInput  && validRef);
     this->m_Controls.m_pbRefine->setEnabled(validInput && this->IsAbleToRefineGeometry() && !this->IsPointSetInput());
 
     if (validInput)
     {
       if (m_spSelectedRegNode.IsNotNull())
       {
         this->m_Controls.m_leMappedName->setText(tr("mapped_") + QString::fromStdString(m_spSelectedInputNode->GetName())
           + tr("_by_") + QString::fromStdString(m_spSelectedRegNode->GetName()));
       }
       else
       {
         this->m_Controls.m_leMappedName->setText(tr("resampled_") + QString::fromStdString(m_spSelectedInputNode->GetName()));
       }
     }
     else
     {
         this->m_Controls.m_leMappedName->setText(tr("mappedData"));
     }
 
     if (this->IsBinaryInput() != this->m_preparedForBinaryInput)
     {
         if (this->IsBinaryInput())
         {
             m_Controls.m_teLog->append(
               QStringLiteral("<font color='gray'><i>Binary input (mask) detected. Preparing for mask mapping (default interpolation: nearest neigbour; padding value: 0)</i></font>"));
 
             this->m_Controls.m_comboInterpolator->setCurrentIndex(0);
             this->m_Controls.m_sbErrorValue->setValue(0);
             this->m_Controls.m_sbPaddingValue->setValue(0);
         }
         else
         {
             this->m_Controls.m_comboInterpolator->setCurrentIndex(1);
         }
 
         this->m_preparedForBinaryInput = this->IsBinaryInput();
     }
 
     OnLinkSampleFactorChecked();
 }
 
 void QmitkMatchPointMapper::ConfigureProgressInfos()
 {
 
 }
 
 void QmitkMatchPointMapper::OnRegNodeSelectionChanged(QList<mitk::DataNode::Pointer> nodes)
 {
   mitk::DataNode::Pointer regNode;
   if (!nodes.isEmpty())
   {
     regNode = nodes.front();
   }
 
   this->ConfigureNodePredicates(regNode);
   this->CheckInputs();
   this->ConfigureMappingControls();
 }
 
 void QmitkMatchPointMapper::OnInputNodeSelectionChanged(QList<mitk::DataNode::Pointer> nodes)
 {
   mitk::DataNode::Pointer inputNode;
   if (!nodes.isEmpty())
   {
     inputNode = nodes.front();
   }
 
   this->ConfigureRegNodePredicate(inputNode);
   this->CheckInputs();
   this->ConfigureMappingControls();
 }
 
 void QmitkMatchPointMapper::OnReferenceNodeSelectionChanged(QList<mitk::DataNode::Pointer> /*nodes*/)
 {
   this->CheckInputs();
   this->ConfigureMappingControls();
 }
 
 void QmitkMatchPointMapper::OnManualRefChecked()
 {
     this->CheckInputs();
     this->ConfigureMappingControls();
 }
 
 void QmitkMatchPointMapper::OnLinkSampleFactorChecked()
 {
     this->m_Controls.m_sbYFactor->setEnabled(!(this->m_Controls.m_cbLinkFactors->isChecked()));
     this->m_Controls.m_sbZFactor->setEnabled(!(this->m_Controls.m_cbLinkFactors->isChecked()));
 
     if (m_Controls.m_cbLinkFactors->isChecked())
     {
         this->m_Controls.m_sbYFactor->setValue(this->m_Controls.m_sbXFactor->value());
         this->m_Controls.m_sbZFactor->setValue(this->m_Controls.m_sbXFactor->value());
     }
 }
 
 
 void QmitkMatchPointMapper::OnMapBtnPushed()
 {
     SpawnMappingJob();
 }
 
 void QmitkMatchPointMapper::OnRefineBtnPushed()
 {
     SpawnMappingJob(true);
 }
 
 void QmitkMatchPointMapper::SpawnMappingJob(bool doGeometryRefinement)
 {
     if (m_Controls.m_checkClearLog->checkState() == Qt::Checked)
     {
         this->m_Controls.m_teLog->clear();
     }
 
     /////////////////////////
     //create job and put it into the thread pool
     QmitkMappingJob* pJob = new QmitkMappingJob();
     pJob->setAutoDelete(true);
 
     pJob->m_spInputData = this->m_spSelectedInputNode->GetData();
     pJob->m_InputDataUID = mitk::EnsureUID(this->m_spSelectedInputNode->GetData());
     pJob->m_doGeometryRefinement = doGeometryRefinement;
 
     pJob->m_spRegNode = m_spSelectedRegNode;
     if (m_spSelectedRegNode.IsNull())
     {
         pJob->m_spRegNode = mitk::DataNode::New();
         pJob->m_spRegNode->SetData(mitk::GenerateIdentityRegistration3D().GetPointer());
         pJob->m_spRegNode->SetName("Auto_Generated_Identity_Transform");
         m_Controls.m_teLog->append(
           QStringLiteral("<font color='gray'><i>No registration selected. Preforming mapping with identity transform</i></font>"));
     }
 
     if (!doGeometryRefinement)
     {
         pJob->m_spRefGeometry = m_spSelectedRefNode->GetData()->GetGeometry()->Clone().GetPointer();
 
         //check for super/sub sampling
         if (m_Controls.m_groupActivateSampling->isChecked())
         {
             //change the pixel count and  spacing of the geometry
             mitk::BaseGeometry::BoundsArrayType geoBounds = pJob->m_spRefGeometry->GetBounds();
             auto oldSpacing = pJob->m_spRefGeometry->GetSpacing();
             mitk::Vector3D geoSpacing;
 
             geoSpacing[0] = oldSpacing[0] / m_Controls.m_sbXFactor->value();
             geoSpacing[1] = oldSpacing[1] / m_Controls.m_sbYFactor->value();
             geoSpacing[2] = oldSpacing[2] / m_Controls.m_sbZFactor->value();
 
             geoBounds[1] = geoBounds[1] * m_Controls.m_sbXFactor->value();
             geoBounds[3] = geoBounds[3] * m_Controls.m_sbYFactor->value();
             geoBounds[5] = geoBounds[5] * m_Controls.m_sbZFactor->value();
 
             pJob->m_spRefGeometry->SetBounds(geoBounds);
             pJob->m_spRefGeometry->SetSpacing(geoSpacing);
 
             auto oldOrigin = pJob->m_spRefGeometry->GetOrigin();
 
             //if we change the spacing we must also correct the origin to ensure
             //that the voxel matrix still covers the same space. This is due the fact
             //that the origin is not in the corner of the voxel matrix, but in the center
             // of the voxel that is in the corner.
             mitk::Point3D newOrigin;
             for (mitk::Point3D::SizeType i = 0; i < 3; ++i)
             {
               newOrigin[i] = 0.5* (geoSpacing[i] - oldSpacing[i]) + oldOrigin[i];
             }
 
             pJob->m_spRefGeometry->SetOrigin(newOrigin);
         }
     }
 
     pJob->m_MappedName = m_Controls.m_leMappedName->text().toStdString();
     pJob->m_allowUndefPixels = m_Controls.m_groupAllowUndefPixels->isChecked();
     pJob->m_paddingValue = m_Controls.m_sbPaddingValue->value();
     pJob->m_allowUnregPixels = m_Controls.m_groupAllowUnregPixels->isChecked();
     pJob->m_errorValue = m_Controls.m_sbErrorValue->value();
     pJob->m_InterpolatorLabel = m_Controls.m_comboInterpolator->currentText().toStdString();
 
     switch (m_Controls.m_comboInterpolator->currentIndex())
     {
     case 0:
         pJob->m_InterpolatorType = mitk::ImageMappingInterpolator::NearestNeighbor;
         break;
 
     case 1:
         pJob->m_InterpolatorType = mitk::ImageMappingInterpolator::Linear;
         break;
 
     case 2:
         pJob->m_InterpolatorType = mitk::ImageMappingInterpolator::BSpline_3;
         break;
 
     case 3:
         pJob->m_InterpolatorType = mitk::ImageMappingInterpolator::WSinc_Hamming;
         break;
 
     case 4:
         pJob->m_InterpolatorType = mitk::ImageMappingInterpolator::WSinc_Welch;
         break;
     }
 
     connect(pJob, SIGNAL(Error(QString)), this, SLOT(OnMapJobError(QString)));
     connect(pJob, SIGNAL(MapResultIsAvailable(mitk::BaseData::Pointer, const QmitkMappingJob*)), this,
         SLOT(OnMapResultIsAvailable(mitk::BaseData::Pointer, const QmitkMappingJob*)),
         Qt::BlockingQueuedConnection);
     connect(pJob, SIGNAL(AlgorithmInfo(QString)), this, SLOT(OnMappingInfo(QString)));
 
     m_Controls.m_teLog->append(QStringLiteral("<b><font color='blue'>Started mapping job. Name: ") +
         m_Controls.m_leMappedName->text() + QStringLiteral("</font></b>"));
 
     QThreadPool* threadPool = QThreadPool::globalInstance();
     threadPool->start(pJob);
 }
 
 
 
 void QmitkMatchPointMapper::OnMapJobError(QString err)
 {
     Error(err);
 }
 
 void QmitkMatchPointMapper::OnMapResultIsAvailable(mitk::BaseData::Pointer spMappedData,
     const QmitkMappingJob* job)
 {
     m_Controls.m_teLog->append(QStringLiteral("<b><font color='blue'>Mapped entity stored. Name: ") +
         QString::fromStdString(job->m_MappedName) + QStringLiteral("</font></b>"));
 
     mitk::DataNode::Pointer spMappedNode = mitk::generateMappedResultNode(job->m_MappedName,
         spMappedData, job->GetRegistration()->getRegistrationUID(), job->m_InputDataUID,
         job->m_doGeometryRefinement, job->m_InterpolatorLabel);
     this->GetDataStorage()->Add(spMappedNode);
-    this->GetRenderWindowPart()->RequestUpdate();
+
+    auto* renderWindowPart = this->GetRenderWindowPart();
+
+    if (nullptr != renderWindowPart)
+      renderWindowPart->RequestUpdate();
 
     this->CheckInputs();
     this->ConfigureMappingControls();
 }
 
 void QmitkMatchPointMapper::OnMappingInfo(QString info)
 {
     m_Controls.m_teLog->append(QStringLiteral("<font color='gray'><i>") + info + QStringLiteral("</i></font>"));
 }
 
 void QmitkMatchPointMapper::OnXFactorChanged(double d)
 {
     if (m_Controls.m_cbLinkFactors->isChecked())
     {
         this->m_Controls.m_sbYFactor->setValue(d);
         this->m_Controls.m_sbZFactor->setValue(d);
     }
 }
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkScreenshotMaker.cpp b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkScreenshotMaker.cpp
index 94368892fb..1d13ca571c 100644
--- a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkScreenshotMaker.cpp
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkScreenshotMaker.cpp
@@ -1,493 +1,494 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 
 #include "QmitkScreenshotMaker.h"
 //#include "QmitkMovieMakerControls.h"
 #include "QmitkStepperAdapter.h"
 
 #include "mitkVtkPropRenderer.h"
 #include <QmitkRenderWindow.h>
 
 #include <iostream>
 
 #include <vtkRenderer.h>
 #include <vtkCamera.h>
 
 #include <qaction.h>
 #include <qfiledialog.h>
 #include <qtimer.h>
 #include <qdatetime.h>
 #include <qspinbox.h>
 #include <qcombobox.h>
 #include <qcolor.h>
 #include <qcolordialog.h>
 
 #include "qapplication.h"
 
 #include "vtkImageWriter.h"
 #include "vtkJPEGWriter.h"
 #include "vtkPNGWriter.h"
 #include "vtkRenderLargeImage.h"
 #include "vtkRenderWindowInteractor.h"
 #include "vtkRenderer.h"
 #include "vtkTestUtilities.h"
 
 #include <vtkActor.h>
 #include "vtkMitkRenderProp.h"
 
 #include <vtkRenderer.h>
 #include <vtkRenderWindow.h>
 #include "vtkRenderWindowInteractor.h"
 #include <qradiobutton.h>
 
 #include "mitkSliceNavigationController.h"
 #include "mitkPlanarFigure.h"
 #include <mitkWorkbenchUtil.h>
 #include <mitkImage.h>
 #include <itksys/SystemTools.hxx>
 
 QmitkScreenshotMaker::QmitkScreenshotMaker(QObject *parent, const char * /*name*/)
   : QmitkAbstractView(),
     m_Controls(nullptr),
     m_BackgroundColor(QColor(0,0,0)),
     m_SelectedNode(nullptr)
 {
   parentWidget = parent;
 }
 
 QmitkScreenshotMaker::~QmitkScreenshotMaker()
 {
 }
 
 void QmitkScreenshotMaker::CreateConnections()
 {
   if (m_Controls)
   {
     connect((QObject*) m_Controls->m_AllViews, SIGNAL(clicked()), (QObject*) this, SLOT(GenerateMultiplanar3DHighresScreenshot()));
     connect((QObject*) m_Controls->m_Shot, SIGNAL(clicked()), (QObject*) this, SLOT(GenerateMultiplanarScreenshots()));
     connect((QObject*) m_Controls->m_BackgroundColor, SIGNAL(clicked()), (QObject*) this, SLOT(SelectBackgroundColor()));
     connect((QObject*) m_Controls->btnScreenshot, SIGNAL(clicked()), this, SLOT(GenerateScreenshot()));
     connect((QObject*) m_Controls->m_HRScreenshot, SIGNAL(clicked()), this, SLOT(Generate3DHighresScreenshot()));
 
     QString styleSheet = "background-color:rgb(0,0,0)";
     m_Controls->m_BackgroundColor->setStyleSheet(styleSheet);
   }
 }
 
 mitk::DataNode::Pointer QmitkScreenshotMaker::GetTopLayerNode()
 {
   mitk::DataNode::Pointer out = nullptr;
 
   int layer = -1;
   auto nodes = GetDataStorage()->GetAll();
   for (auto node = nodes->begin(); node!=nodes->end(); ++node)
   {
     if (!(*node)->IsVisible(nullptr))
       continue;
     int current_layer;
     (*node)->GetIntProperty("layer", current_layer);
     if (current_layer>layer)
     {
       out = (*node);
       layer = current_layer;
     }
   }
 
   return out;
 }
 
 void QmitkScreenshotMaker::MultichannelScreenshot(mitk::VtkPropRenderer* renderer, QString fileName, QString filter)
 {
   auto node = GetTopLayerNode();
   if (node.IsNotNull() && dynamic_cast<mitk::Image*>(node->GetData()))
   {
     auto image = dynamic_cast<mitk::Image*>(node->GetData());
 
     std::string fname = itksys::SystemTools::GetFilenamePath(fileName.toStdString()) + "/" + itksys::SystemTools::GetFilenameWithoutExtension(fileName.toStdString());
     std::string ext = itksys::SystemTools::GetFilenameExtension(fileName.toStdString());
 
     mitk::PixelType chPixelType = image->GetImageDescriptor()->GetChannelTypeById(0);
     if (image->GetDimension() == 4)
     {
       MITK_INFO << "LOOPING THROUGH FOURTH DIMESNION IS NOT IMPLEMENTED";
     }
     else if (chPixelType.GetNumberOfComponents()>1)
     {
       for(int unsigned c=0; c<chPixelType.GetNumberOfComponents(); ++c)
       {
         node->SetProperty("Image.Displayed Component", mitk::IntProperty::New(c));
         this->TakeScreenshot(renderer->GetVtkRenderer(), 1, QString(fname.c_str()) + "_" + QString::number(c) + QString(ext.c_str()), filter);
       }
     }
     else
       this->TakeScreenshot(renderer->GetVtkRenderer(), 1, fileName, filter);
   }
   else
     this->TakeScreenshot(renderer->GetVtkRenderer(), 1, fileName, filter);
 }
 
 void QmitkScreenshotMaker::GenerateScreenshot()
 {
   if (m_LastFile.size()==0)
     m_LastFile = QDir::currentPath()+"/screenshot.png";
 
   QString filter;
   QString fileName = QFileDialog::getSaveFileName(nullptr, "Save screenshot to...", m_LastFile, m_PNGExtension + ";;" + m_JPGExtension, &filter);
 
   if (fileName.size()>0)
     m_LastFile = fileName;
 
-  auto renderWindowPart = this->GetRenderWindowPart(mitk::WorkbenchUtil::IRenderWindowPartStrategy::OPEN);
+  auto* renderWindowPart = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN);
 
-  auto renderer = renderWindowPart->GetQmitkRenderWindow(m_Controls->m_DirectionBox->currentText())->GetRenderer();
+  auto* renderer = renderWindowPart->GetQmitkRenderWindow(m_Controls->m_DirectionBox->currentText())->GetRenderer();
   if (renderer == nullptr)
     return;
 
   if (m_Controls->m_AllChannelsBox->isChecked())
     MultichannelScreenshot(renderer, fileName, filter);
   else
     this->TakeScreenshot(renderer->GetVtkRenderer(), 1, fileName, filter);
 }
 
 void QmitkScreenshotMaker::GenerateMultiplanarScreenshots()
 {
   if (m_LastPath.size()==0)
     m_LastPath = QDir::currentPath();
   QString filePath = QFileDialog::getExistingDirectory(nullptr, "Save screenshots to...", m_LastPath);
   if (filePath.size()>0)
     m_LastPath = filePath;
 
   if( filePath.isEmpty() )
   {
     return;
   }
 
   //emit StartBlockControls();
-  auto renderWindowPart = this->GetRenderWindowPart(mitk::WorkbenchUtil::IRenderWindowPartStrategy::OPEN);
+  auto* renderWindowPart = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN);
   renderWindowPart->EnableDecorations(false, QStringList{mitk::IRenderWindowPart::DECORATION_CORNER_ANNOTATION});
 
   QString fileName = "/axial.png";
   int c = 1;
   while (QFile::exists(filePath+fileName))
   {
     fileName = QString("/axial_");
     fileName += QString::number(c);
     fileName += ".png";
     c++;
   }
   vtkRenderer* renderer = renderWindowPart->GetQmitkRenderWindow("axial")->GetRenderer()->GetVtkRenderer();
   if (renderer != nullptr)
   {
     if (m_Controls->m_AllChannelsBox->isChecked())
       MultichannelScreenshot(renderWindowPart->GetQmitkRenderWindow("axial")->GetRenderer(), filePath+fileName, m_PNGExtension);
     else
       this->TakeScreenshot(renderer, 1, filePath+fileName);
   }
 
   fileName = "/sagittal.png";
   c = 1;
   while (QFile::exists(filePath+fileName))
   {
     fileName = QString("/sagittal_");
     fileName += QString::number(c);
     fileName += ".png";
     c++;
   }
   renderer = renderWindowPart->GetQmitkRenderWindow("sagittal")->GetRenderer()->GetVtkRenderer();
   if (renderer != nullptr)
   {
     if (m_Controls->m_AllChannelsBox->isChecked())
       MultichannelScreenshot(renderWindowPart->GetQmitkRenderWindow("sagittal")->GetRenderer(), filePath+fileName, m_PNGExtension);
     else
       this->TakeScreenshot(renderer, 1, filePath+fileName);
   }
 
   fileName = "/coronal.png";
   c = 1;
   while (QFile::exists(filePath+fileName))
   {
     fileName = QString("/coronal_");
     fileName += QString::number(c);
     fileName += ".png";
     c++;
   }
   renderer = renderWindowPart->GetQmitkRenderWindow("coronal")->GetRenderer()->GetVtkRenderer();
   if (renderer != nullptr)
   {
     if (m_Controls->m_AllChannelsBox->isChecked())
       MultichannelScreenshot(renderWindowPart->GetQmitkRenderWindow("coronal")->GetRenderer(), filePath+fileName, m_PNGExtension);
     else
       this->TakeScreenshot(renderer, 1, filePath+fileName);
   }
 
   /// TODO I do not find a simple way of doing this through the render window part API,
   /// however, I am also not convinced that this code is needed at all. The colour
   /// of the crosshair planes is never set to any colour other than these.
   /// I suggest a new 'mitk::DataNode* mitk::ILinkedRendererPart::GetSlicingPlane(const std::string& name) const'
   /// function to introduce that could return the individual ("axial", "sagittal" or
   /// "coronal" crosshair planes.
 
   //    mitk::DataNode* n = renderWindowPart->GetSlicingPlane("axial");
   //    if (n)
   //    {
   //        n->SetProperty( "color", mitk::ColorProperty::New( 1,0,0 ) );
   //    }
   //
   //    n = renderWindowPart->GetSlicingPlane("sagittal");
   //    if (n)
   //    {
   //        n->SetProperty( "color", mitk::ColorProperty::New( 0,1,0 ) );
   //    }
   //
   //    n = renderWindowPart->GetSlicingPlane("coronal");
   //    if (n)
   //    {
   //        n->SetProperty( "color", mitk::ColorProperty::New( 0,0,1 ) );
   //    }
 
   renderWindowPart->EnableDecorations(true, QStringList{mitk::IRenderWindowPart::DECORATION_CORNER_ANNOTATION});
 }
 
 void QmitkScreenshotMaker::Generate3DHighresScreenshot()
 {
   if (m_LastFile.size()==0)
     m_LastFile = QDir::currentPath()+"/3D_screenshot.png";
 
   QString filter;
   QString fileName = QFileDialog::getSaveFileName(nullptr, "Save screenshot to...", m_LastFile, m_PNGExtension + ";;" + m_JPGExtension, &filter);
 
   if (fileName.size()>0)
     m_LastFile = fileName;
   GenerateHR3DAtlasScreenshots(fileName, filter);
 
   mitk::RenderingManager::GetInstance()->RequestUpdateAll();
 }
 
 void QmitkScreenshotMaker::GenerateMultiplanar3DHighresScreenshot()
 {
   if (m_LastPath.size()==0)
     m_LastPath = QDir::currentPath();
   QString filePath = QFileDialog::getExistingDirectory( nullptr, "Save screenshots to...", m_LastPath);
   if (filePath.size()>0)
     m_LastPath = filePath;
 
   if( filePath.isEmpty() )
   {
     return;
   }
 
   QString fileName = "/3D_View1.png";
   int c = 1;
   while (QFile::exists(filePath+fileName))
   {
     fileName = QString("/3D_View1_");
     fileName += QString::number(c);
     fileName += ".png";
     c++;
   }
   GetCam()->Azimuth( -7.5 );
   GetCam()->Roll(-4);
   GenerateHR3DAtlasScreenshots(filePath+fileName);
   GetCam()->Roll(4);
 
   fileName = "/3D_View2.png";
   c = 1;
   while (QFile::exists(filePath+fileName))
   {
     fileName = QString("/3D_View2_");
     fileName += QString::number(c);
     fileName += ".png";
     c++;
   }
   GetCam()->Azimuth( 90 );
   GetCam()->Elevation( 4 );
   GenerateHR3DAtlasScreenshots(filePath+fileName);
 
   fileName = "/3D_View3.png";
   c = 1;
   while (QFile::exists(filePath+fileName))
   {
     fileName = QString("/3D_View3_");
     fileName += QString::number(c);
     fileName += ".png";
     c++;
   }
   GetCam()->Elevation( 90 );
   GetCam()->Roll( -2.5 );
   GenerateHR3DAtlasScreenshots(filePath+fileName);
 
   mitk::RenderingManager::GetInstance()->RequestUpdateAll();
 }
 
 void QmitkScreenshotMaker::GenerateHR3DAtlasScreenshots(QString fileName, QString filter)
 {
   // only works correctly for 3D RenderWindow
-  auto renderer = this->GetRenderWindowPart()->GetQmitkRenderWindow("3d")->GetRenderer()->GetVtkRenderer();
+  auto* renderWindowPart = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN);
+  auto* renderer = renderWindowPart->GetQmitkRenderWindow("3d")->GetRenderer()->GetVtkRenderer();
 
   if (nullptr != renderer)
   {
-    this->GetRenderWindowPart()->EnableDecorations(false);
+    renderWindowPart->EnableDecorations(false);
     this->TakeScreenshot(renderer, this->m_Controls->m_MagFactor->text().toFloat(), fileName, filter);
-    this->GetRenderWindowPart()->EnableDecorations(true);
+    renderWindowPart->EnableDecorations(true);
   }
 }
 
 vtkCamera* QmitkScreenshotMaker::GetCam()
 {
-  mitk::BaseRenderer* renderer = this->GetRenderWindowPart(mitk::WorkbenchUtil::IRenderWindowPartStrategy::OPEN)->GetQmitkRenderWindow("3d")->GetRenderer();
+  auto* renderer = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetQmitkRenderWindow("3d")->GetRenderer();
   vtkCamera* cam = nullptr;
   const mitk::VtkPropRenderer *propRenderer = dynamic_cast<const mitk::VtkPropRenderer * >( renderer );
   if (propRenderer)
   {
     // get vtk renderer
     vtkRenderer* vtkrenderer = propRenderer->GetVtkRenderer();
     if (vtkrenderer)
     {
       // get vtk camera
       vtkCamera* vtkcam = vtkrenderer->GetActiveCamera();
       if (vtkcam)
       {
         // vtk smart pointer handling
         cam = vtkcam;
         cam->Register( nullptr );
       }
     }
   }
   return cam;
 }
 
 void QmitkScreenshotMaker::OnSelectionChanged(berry::IWorkbenchPart::Pointer /*part*/, const QList<mitk::DataNode::Pointer>& nodes)
 {
   if(nodes.size())
     m_SelectedNode = nodes[0];
 }
 
 void QmitkScreenshotMaker::CreateQtPartControl(QWidget *parent)
 {
   if (!m_Controls)
   {
     m_Parent = parent;
     m_Controls = new Ui::QmitkScreenshotMakerControls;
     m_Controls->setupUi(parent);
 
     // Initialize "Selected Window" combo box
     const mitk::RenderingManager::RenderWindowVector rwv =
         mitk::RenderingManager::GetInstance()->GetAllRegisteredRenderWindows();
 
   }
 
   this->CreateConnections();
 
 }
 
 void QmitkScreenshotMaker::SetFocus()
 {
   m_Controls->btnScreenshot->setFocus();
 }
 
 void QmitkScreenshotMaker::RenderWindowPartActivated(mitk::IRenderWindowPart* /*renderWindowPart*/)
 {
   m_Parent->setEnabled(true);
 }
 
 void QmitkScreenshotMaker::RenderWindowPartDeactivated(mitk::IRenderWindowPart* /*renderWindowPart*/)
 {
   m_Parent->setEnabled(false);
 }
 
 void QmitkScreenshotMaker::TakeScreenshot(vtkRenderer* renderer, unsigned int magnificationFactor, QString fileName, QString filter)
 {
   if ((renderer == nullptr) ||(magnificationFactor < 1) || fileName.isEmpty())
     return;
 
   bool doubleBuffering( renderer->GetRenderWindow()->GetDoubleBuffer() );
   renderer->GetRenderWindow()->DoubleBufferOff();
 
   vtkImageWriter* fileWriter = nullptr;
 
   QFileInfo fi(fileName);
   QString suffix = fi.suffix().toLower();
 
   if (suffix.isEmpty() || (suffix != "png" && suffix != "jpg" && suffix != "jpeg"))
   {
     if (filter == m_PNGExtension)
     {
       suffix = "png";
     }
     else if (filter == m_JPGExtension)
     {
       suffix = "jpg";
     }
     fileName += "." + suffix;
   }
 
   if (suffix.compare("jpg", Qt::CaseInsensitive) == 0 || suffix.compare("jpeg", Qt::CaseInsensitive) == 0)
   {
     vtkJPEGWriter* w = vtkJPEGWriter::New();
     w->SetQuality(100);
     w->ProgressiveOff();
     fileWriter = w;
   }
   else //default is png
   {
     fileWriter = vtkPNGWriter::New();
   }
 
   vtkRenderLargeImage* magnifier = vtkRenderLargeImage::New();
   magnifier->SetInput(renderer);
   magnifier->SetMagnification(magnificationFactor);
   //magnifier->Update();
   fileWriter->SetInputConnection(magnifier->GetOutputPort());
   fileWriter->SetFileName(fileName.toLatin1());
 
   // vtkRenderLargeImage has problems with different layers, therefore we have to
   // temporarily deactivate all other layers.
   // we set the background to white, because it is nicer than black...
   double oldBackground[3];
   renderer->GetBackground(oldBackground);
 
 
   //  QColor color = QColorDialog::getColor();
   double bgcolor[] = {m_BackgroundColor.red()/255.0, m_BackgroundColor.green()/255.0, m_BackgroundColor.blue()/255.0};
   renderer->SetBackground(bgcolor);
 
-  mitk::IRenderWindowPart* renderWindowPart = this->GetRenderWindowPart();
+  mitk::IRenderWindowPart* renderWindowPart = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN);
 
   renderWindowPart->EnableDecorations(false);
 
   fileWriter->Write();
   fileWriter->Delete();
 
   renderWindowPart->EnableDecorations(true);
 
   renderer->SetBackground(oldBackground);
 
   renderer->GetRenderWindow()->SetDoubleBuffer(doubleBuffering);
 }
 
 void QmitkScreenshotMaker::SelectBackgroundColor()
 {
   m_BackgroundColor = QColorDialog::getColor();
 
   m_Controls->m_BackgroundColor->setAutoFillBackground(true);
 
 
   QString styleSheet = "background-color:rgb(";
   styleSheet.append(QString::number(m_BackgroundColor.red()));
   styleSheet.append(",");
   styleSheet.append(QString::number(m_BackgroundColor.green()));
   styleSheet.append(",");
   styleSheet.append(QString::number(m_BackgroundColor.blue()));
   styleSheet.append(")");
   m_Controls->m_BackgroundColor->setStyleSheet(styleSheet);
 }
diff --git a/Plugins/org.mitk.gui.qt.overlaymanager/src/internal/QmitkOverlayManagerView.cpp b/Plugins/org.mitk.gui.qt.overlaymanager/src/internal/QmitkOverlayManagerView.cpp
index 491e002d1a..af14922701 100644
--- a/Plugins/org.mitk.gui.qt.overlaymanager/src/internal/QmitkOverlayManagerView.cpp
+++ b/Plugins/org.mitk.gui.qt.overlaymanager/src/internal/QmitkOverlayManagerView.cpp
@@ -1,532 +1,532 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 #include <memory>
 
 // Blueberry
 #include <berryIBerryPreferences.h>
 #include <berryISelectionService.h>
 #include <berryIWorkbenchWindow.h>
 
 // Qmitk
 #include "QmitkAddNewPropertyDialog.h"
 #include "QmitkOverlayManagerView.h"
 #include "QmitkPropertyItemDelegate.h"
 #include "QmitkPropertyItemModel.h"
 #include <QmitkRenderWindow.h>
 
 // Qt
 #include <QMessageBox>
 #include <QPainter>
 #include <QSortFilterProxyModel>
 
 #include "internal/org_mitk_gui_qt_overlaymanager_Activator.h"
 
 #include "mitkAnnotationUtils.h"
 #include "mitkGetPropertyService.h"
 #include "mitkLayoutAnnotationRenderer.h"
 #include "mitkManualPlacementAnnotationRenderer.h"
 #include "mitkRenderingManager.h"
 #include <mitkColorBarAnnotation.h>
 #include <mitkIPropertyAliases.h>
 #include <mitkIPropertyDescriptions.h>
 #include <mitkIPropertyPersistence.h>
 #include <mitkLabelAnnotation3D.h>
 #include <mitkLogoAnnotation.h>
 #include <mitkScaleLegendAnnotation.h>
 #include <mitkTextAnnotation2D.h>
 #include <mitkTextAnnotation3D.h>
 
 const std::string QmitkOverlayManagerView::VIEW_ID = "org.mitk.views.overlaymanager";
 
 QmitkOverlayManagerView::QmitkOverlayManagerView()
   : m_Parent(nullptr),
     m_PropertyNameChangedTag(0),
     m_OverlayManagerObserverTag(0),
     m_PropertyAliases(nullptr),
     m_PropertyDescriptions(nullptr),
     m_PropertyPersistence(nullptr),
     m_ProxyModel(nullptr),
     m_Model(nullptr),
     m_Delegate(nullptr),
     m_Renderer(nullptr),
     m_AddOverlayMenu(nullptr)
 {
 }
 
 QmitkOverlayManagerView::~QmitkOverlayManagerView()
 {
 }
 
 void QmitkOverlayManagerView::SetFocus()
 {
 }
 
 void QmitkOverlayManagerView::CreateQtPartControl(QWidget *parent)
 {
   // create GUI widgets from the Qt Designer's .ui file
   m_Controls.setupUi(parent);
   m_Controls.m_OverlayList->clear();
 
-  mitk::IRenderWindowPart *renderWindowPart = this->GetRenderWindowPart();
+  auto* renderWindowPart = this->GetRenderWindowPart();
 
   if (renderWindowPart != nullptr)
   {
     QHash<QString, QmitkRenderWindow *> renderWindows = renderWindowPart->GetQmitkRenderWindows();
 
     Q_FOREACH (QString renderWindow, renderWindows.keys())
     {
       if (!m_Renderer)
         m_Renderer = renderWindows[renderWindow]->GetRenderer();
       m_Controls.m_RendererCB->addItem(renderWindow);
     }
   }
 
   InitializeAddOverlayMenu();
 
   m_ProxyModel = new QSortFilterProxyModel(m_Controls.m_PropertyTree);
   m_Model = new QmitkPropertyItemModel(m_ProxyModel);
 
   m_ProxyModel->setSourceModel(m_Model);
   m_ProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
   m_ProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
   m_ProxyModel->setDynamicSortFilter(true);
 
   m_Delegate = new QmitkPropertyItemDelegate(m_Controls.m_PropertyTree);
 
   m_Controls.m_PropertyTree->setItemDelegateForColumn(1, m_Delegate);
   m_Controls.m_PropertyTree->setModel(m_ProxyModel);
   m_Controls.m_PropertyTree->setColumnWidth(0, 160);
   m_Controls.m_PropertyTree->sortByColumn(0, Qt::AscendingOrder);
   m_Controls.m_PropertyTree->setSelectionBehavior(QAbstractItemView::SelectRows);
   m_Controls.m_PropertyTree->setSelectionMode(QAbstractItemView::SingleSelection);
   m_Controls.m_PropertyTree->setEditTriggers(QAbstractItemView::SelectedClicked | QAbstractItemView::DoubleClicked);
 
   connect(m_Controls.m_RendererCB, SIGNAL(currentIndexChanged(int)), this, SLOT(OnPropertyListChanged(int)));
   connect(m_Controls.newButton, SIGNAL(clicked()), this, SLOT(OnAddNewProperty()));
   connect(m_Controls.m_PropertyTree->selectionModel(),
           SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)),
           this,
           SLOT(OnCurrentRowChanged(const QModelIndex &, const QModelIndex &)));
   connect(m_Controls.m_OverlayList,
           SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)),
           this,
           SLOT(OnOverlaySelectionChanged(QListWidgetItem *, QListWidgetItem *)));
   connect(m_Controls.m_DeleteOverlay, SIGNAL(clicked()), this, SLOT(OnDelete()));
   connect(m_Controls.m_AddOverlay, SIGNAL(clicked()), this, SLOT(OnAddOverlay()));
 
   itk::MemberCommand<QmitkOverlayManagerView>::Pointer command = itk::MemberCommand<QmitkOverlayManagerView>::New();
   command->SetCallbackFunction(this, &QmitkOverlayManagerView::OnFocusChanged);
   m_RenderWindowFocusObserverTag =
     mitk::RenderingManager::GetInstance()->AddObserver(mitk::FocusChangedEvent(), command);
 }
 
 void QmitkOverlayManagerView::OnFocusChanged(itk::Object * /*caller*/, const itk::EventObject &event)
 {
   const mitk::FocusChangedEvent *focusEvent = dynamic_cast<const mitk::FocusChangedEvent *>(&event);
   if (focusEvent)
   {
-    QHash<QString, QmitkRenderWindow *> renderWindows = this->GetRenderWindowPart()->GetQmitkRenderWindows();
+    QHash<QString, QmitkRenderWindow *> renderWindows = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetQmitkRenderWindows();
     m_Controls.m_RendererCB->clear();
     Q_FOREACH (QString renderWindow, renderWindows.keys())
     {
       m_Controls.m_RendererCB->addItem(renderWindow);
       if (renderWindows[renderWindow]->GetVtkRenderWindow() ==
           mitk::RenderingManager::GetInstance()->GetFocusedRenderWindow())
       {
         m_Controls.m_RendererCB->setCurrentText(renderWindow);
       }
     }
     this->OnActivateOverlayList();
   }
 }
 
 QString QmitkOverlayManagerView::GetPropertyNameOrAlias(const QModelIndex &index)
 {
   QString propertyName;
 
   if (index.isValid())
   {
     QModelIndex current = index;
 
     while (current.isValid())
     {
       QString name = m_ProxyModel->data(m_ProxyModel->index(current.row(), 0, current.parent())).toString();
 
       propertyName.prepend(propertyName.isEmpty() ? name : name.append('.'));
 
       current = current.parent();
     }
   }
 
   return propertyName;
 }
 
 void QmitkOverlayManagerView::OnCurrentRowChanged(const QModelIndex &current, const QModelIndex &)
 {
   if (m_PropertyDescriptions != nullptr && current.isValid())
   {
     QString name = this->GetPropertyNameOrAlias(current);
 
     if (!name.isEmpty())
     {
       QString alias;
       bool isTrueName = true;
 
       if (m_PropertyAliases != nullptr)
       {
         std::string trueName = m_PropertyAliases->GetPropertyName(name.toStdString());
 
         if (trueName.empty() && !m_SelectionClassName.empty())
           trueName = m_PropertyAliases->GetPropertyName(name.toStdString(), m_SelectionClassName);
 
         if (!trueName.empty())
         {
           alias = name;
           name = QString::fromStdString(trueName);
           isTrueName = false;
         }
       }
 
       QString description = QString::fromStdString(m_PropertyDescriptions->GetDescription(name.toStdString()));
       std::vector<std::string> aliases;
 
       if (!isTrueName && m_PropertyAliases != nullptr)
       {
         aliases = m_PropertyAliases->GetAliases(name.toStdString(), m_SelectionClassName);
 
         if (aliases.empty() && !m_SelectionClassName.empty())
           aliases = m_PropertyAliases->GetAliases(name.toStdString());
       }
 
       bool isPersistent = false;
       // QString persistenceKey;
 
       if (m_PropertyPersistence != nullptr)
       {
         isPersistent = m_PropertyPersistence->HasInfo(name.toStdString());
 
         /*if (isPersistent)
         {
           persistenceKey = QString::fromStdString(m_PropertyPersistence->GetInfo(name.toStdString())->GetKey());
 
           if (persistenceKey.isEmpty())
             persistenceKey = name;
         }*/
       }
 
       if (!description.isEmpty() || !aliases.empty() || isPersistent)
       {
         QString customizedDescription;
 
         if (!description.isEmpty())
           customizedDescription += "<p>" + description + "</p>";
 
         if (!aliases.empty() || isPersistent)
         {
           customizedDescription += "<div align=\"right\">";
 
           if (!aliases.empty())
           {
             customizedDescription += aliases.size() > 1 ?
                                        "<img height=\"32\" src=\":/org_mitk_icons/icons/awesome/scalable/tags.svg\"/>" :
                                        "<img height=\"32\" src=\":/org_mitk_icons/icons/awesome/scalable/tag.svg\"/>";
           }
 
           if (isPersistent)
             customizedDescription +=
               "<img height=\"32\" src=\":/org_mitk_icons/icons/awesome/scalable/actions/document-save.svg\"/>";
 
           customizedDescription += "</div>";
         }
 
         return;
       }
     }
   }
 }
 
 void QmitkOverlayManagerView::OnPropertyNameChanged(const itk::EventObject &)
 {
   mitk::PropertyList *propertyList = m_Model->GetPropertyList();
 
   if (propertyList != nullptr)
   {
     mitk::BaseProperty *nameProperty = propertyList->GetProperty("name");
 
     if (nameProperty != nullptr)
     {
       QString partName = "Properties (";
       partName.append(QString::fromStdString(nameProperty->GetValueAsString())).append(')');
       this->SetPartName(partName);
     }
   }
 }
 
 void QmitkOverlayManagerView::OnSelectionChanged(berry::IWorkbenchPart::Pointer,
                                                  const QList<mitk::DataNode::Pointer> &)
 {
 }
 
 void QmitkOverlayManagerView::InitializeAddOverlayMenu()
 {
   m_AddOverlayMenu = new QMenu(m_Controls.m_AddOverlay);
 
   m_AddOverlayMenu->addAction("TextAnnotation2D");
   m_AddOverlayMenu->addAction("TextAnnotation3D");
   m_AddOverlayMenu->addAction("LabelAnnotation");
   m_AddOverlayMenu->addAction("ColorBarAnnotation");
   m_AddOverlayMenu->addAction("ScaleLegendAnnotation");
   m_AddOverlayMenu->addAction("LogoAnnotation");
 }
 
 void QmitkOverlayManagerView::Activated()
 {
   //  this->OnActivateOverlayList();
 }
 
 void QmitkOverlayManagerView::Deactivated()
 {
 }
 
 void QmitkOverlayManagerView::Visible()
 {
   this->OnActivateOverlayList();
 }
 
 void QmitkOverlayManagerView::Hidden()
 {
 }
 
 void QmitkOverlayManagerView::OnPropertyListChanged(int index)
 {
   if (index == -1)
     return;
 
   QString renderer = m_Controls.m_RendererCB->itemText(index);
 
-  QmitkRenderWindow *renwin = this->GetRenderWindowPart()->GetQmitkRenderWindow(renderer);
+  auto *renwin = this->GetRenderWindowPart()->GetQmitkRenderWindow(renderer);
   m_Renderer = renwin ? renwin->GetRenderer() : nullptr;
 
   this->OnOverlaySelectionChanged(m_Controls.m_OverlayList->currentItem(), nullptr);
   this->OnActivateOverlayList();
 }
 
 void QmitkOverlayManagerView::OnAddNewProperty()
 {
   std::unique_ptr<QmitkAddNewPropertyDialog> dialog(
     new QmitkAddNewPropertyDialog(m_SelectedOverlay, m_Renderer, m_Parent));
 
   if (dialog->exec() == QDialog::Accepted)
     this->m_Model->Update();
 }
 
 void QmitkOverlayManagerView::OnActivateOverlayList()
 {
   if (!m_Renderer)
     return;
   std::vector<mitk::AbstractAnnotationRenderer *> arList =
     mitk::AnnotationUtils::GetAnnotationRenderer(m_Renderer->GetName());
   m_Controls.m_OverlayList->clear();
   for (auto ar : arList)
   {
     for (auto overlay : ar->GetServices())
     {
       QListWidgetItem *item = new QListWidgetItem();
       item->setData(Qt::UserRole, QVariant(overlay->GetMicroserviceID().c_str()));
       QString text(overlay->GetName().c_str());
       if (text.length() > 0)
       {
         text.append(" : ");
       }
       text.append(overlay->GetNameOfClass());
       item->setText(text);
       m_Controls.m_OverlayList->addItem(item);
     }
   }
 }
 
 void QmitkOverlayManagerView::OnOverlaySelectionChanged(QListWidgetItem *current, QListWidgetItem *)
 {
   mitk::PropertyList *propertyList = m_Model->GetPropertyList();
 
   if (propertyList != nullptr)
   {
     mitk::BaseProperty *nameProperty = propertyList->GetProperty("name");
 
     if (nameProperty != nullptr)
       nameProperty->RemoveObserver(m_PropertyNameChangedTag);
 
     m_PropertyNameChangedTag = 0;
   }
 
   mitk::Annotation *overlay = nullptr;
   QString oID;
   if (current)
   {
     oID = current->data(Qt::UserRole).toString();
     OverlayMapType::iterator it = m_OverlayMap.find(oID.toStdString());
     if (it != m_OverlayMap.end())
       overlay = it->second;
     else
     {
       overlay = mitk::AnnotationUtils::GetAnnotation(oID.toStdString());
     }
   }
 
   if (!overlay)
   {
     m_SelectedOverlay = nullptr;
 
     this->SetPartName("Overlay Properties");
     m_Model->SetPropertyList(nullptr);
     m_Delegate->SetPropertyList(nullptr);
 
     m_Controls.newButton->setEnabled(false);
   }
   else
   {
     m_SelectedOverlay = overlay;
 
     QString selectionClassName = m_SelectedOverlay->GetNameOfClass();
 
     m_SelectionClassName = selectionClassName.toStdString();
 
     mitk::PropertyList::Pointer propertyList = overlay->GetPropertyList();
 
     m_Model->SetPropertyList(propertyList, selectionClassName);
     m_Delegate->SetPropertyList(propertyList);
 
     OnPropertyNameChanged(itk::ModifiedEvent());
 
     mitk::BaseProperty *nameProperty = m_SelectedOverlay->GetProperty("name");
 
     if (nameProperty != nullptr)
     {
       itk::ReceptorMemberCommand<QmitkOverlayManagerView>::Pointer command =
         itk::ReceptorMemberCommand<QmitkOverlayManagerView>::New();
       command->SetCallbackFunction(this, &QmitkOverlayManagerView::OnPropertyNameChanged);
       m_PropertyNameChangedTag = nameProperty->AddObserver(itk::ModifiedEvent(), command);
     }
 
     m_Controls.newButton->setEnabled(true);
   }
 
   if (!m_ProxyModel->filterRegExp().isEmpty())
     m_Controls.m_PropertyTree->expandAll();
 }
 
 void QmitkOverlayManagerView::OnDelete()
 {
   if (m_SelectedOverlay.IsNotNull())
   {
     m_OverlayMap.erase(m_SelectedOverlay->GetMicroserviceID());
     m_SelectedOverlay = nullptr;
     OnActivateOverlayList();
   }
 }
 
 void QmitkOverlayManagerView::OnAddOverlay()
 {
   QAction *action = m_AddOverlayMenu->exec(QCursor::pos());
 
   mitk::Annotation::Pointer overlay;
 
   if (action != nullptr)
   {
     const QString widgetKey = action->text();
 
     if (widgetKey == "TextAnnotation2D")
       overlay = CreateTextOverlay2D();
 
     else if (widgetKey == "TextAnnotation3D")
       overlay = CreateTextOverlay3D();
 
     else if (widgetKey == "LabelAnnotation")
       overlay = CreateLabelOverlay();
 
     else if (widgetKey == "ColorBarAnnotation")
       overlay = CreateColorBarOverlay();
 
     else if (widgetKey == "ScaleLegendAnnotation")
       overlay = CreateScaleLegendOverlay();
 
     else if (widgetKey == "LogoAnnotation")
       overlay = CreateLogoOverlay();
 
     mitk::BaseRenderer *renderer =
-      this->GetRenderWindowPart()->GetQmitkRenderWindow(m_Controls.m_RendererCB->currentText())->GetRenderer();
+      this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetQmitkRenderWindow(m_Controls.m_RendererCB->currentText())->GetRenderer();
     mitk::LayoutAnnotationRenderer::AddAnnotation(overlay, renderer);
     m_OverlayMap[overlay->GetMicroserviceID()] = overlay;
   }
   OnActivateOverlayList();
 }
 
 mitk::Annotation::Pointer QmitkOverlayManagerView::CreateTextOverlay2D()
 {
   mitk::TextAnnotation2D::Pointer to = mitk::TextAnnotation2D::New();
   to->SetText("Test");
   return to.GetPointer();
 }
 
 mitk::Annotation::Pointer QmitkOverlayManagerView::CreateTextOverlay3D()
 {
   mitk::TextAnnotation3D::Pointer to = mitk::TextAnnotation3D::New();
   return to.GetPointer();
 }
 
 mitk::Annotation::Pointer QmitkOverlayManagerView::CreateLabelOverlay()
 {
   mitk::LabelAnnotation3D::Pointer to = mitk::LabelAnnotation3D::New();
   return to.GetPointer();
 }
 
 mitk::Annotation::Pointer QmitkOverlayManagerView::CreateColorBarOverlay()
 {
   mitk::ColorBarAnnotation::Pointer to = mitk::ColorBarAnnotation::New();
   return to.GetPointer();
 }
 
 mitk::Annotation::Pointer QmitkOverlayManagerView::CreateScaleLegendOverlay()
 {
   mitk::ScaleLegendAnnotation::Pointer to = mitk::ScaleLegendAnnotation::New();
   return to.GetPointer();
 }
 
 mitk::Annotation::Pointer QmitkOverlayManagerView::CreateLogoOverlay()
 {
   mitk::LogoAnnotation::Pointer to = mitk::LogoAnnotation::New();
   return to.GetPointer();
 }
 
-void QmitkOverlayManagerView::RenderWindowPartActivated(mitk::IRenderWindowPart * /*renderWindowPart*/)
+void QmitkOverlayManagerView::RenderWindowPartActivated(mitk::IRenderWindowPart* renderWindowPart)
 {
   if (m_Controls.m_RendererCB->count() == 0)
   {
-    QHash<QString, QmitkRenderWindow *> renderWindows = this->GetRenderWindowPart()->GetQmitkRenderWindows();
+    QHash<QString, QmitkRenderWindow *> renderWindows = renderWindowPart->GetQmitkRenderWindows();
 
     Q_FOREACH (QString renderWindow, renderWindows.keys())
     {
       m_Controls.m_RendererCB->addItem(renderWindow);
     }
   }
   OnActivateOverlayList();
 }
 
 void QmitkOverlayManagerView::RenderWindowPartDeactivated(mitk::IRenderWindowPart *)
 {
   if (m_Controls.m_RendererCB->count() > 0)
   {
     m_Controls.m_RendererCB->clear();
   }
   m_Controls.m_OverlayList->clear();
 }
diff --git a/Plugins/org.mitk.gui.qt.properties/src/internal/QmitkPropertyTreeView.cpp b/Plugins/org.mitk.gui.qt.properties/src/internal/QmitkPropertyTreeView.cpp
index 7d2d2f0ce5..a95ddd70ce 100644
--- a/Plugins/org.mitk.gui.qt.properties/src/internal/QmitkPropertyTreeView.cpp
+++ b/Plugins/org.mitk.gui.qt.properties/src/internal/QmitkPropertyTreeView.cpp
@@ -1,364 +1,370 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 #include "QmitkAddNewPropertyDialog.h"
 #include "QmitkPropertyItemDelegate.h"
 #include "QmitkPropertyItemModel.h"
 #include "QmitkPropertyItemSortFilterProxyModel.h"
 #include "QmitkPropertyTreeView.h"
 #include <berryIBerryPreferences.h>
 #include <berryQtStyleManager.h>
 #include <mitkIPropertyAliases.h>
 #include <mitkIPropertyDescriptions.h>
 #include <mitkIPropertyPersistence.h>
 #include <QmitkRenderWindow.h>
 #include <QPainter>
 #include <memory>
 
 const std::string QmitkPropertyTreeView::VIEW_ID = "org.mitk.views.properties";
 
 QmitkPropertyTreeView::QmitkPropertyTreeView()
   : m_PropertyAliases(mitk::CoreServices::GetPropertyAliases(nullptr), nullptr),
     m_PropertyDescriptions(mitk::CoreServices::GetPropertyDescriptions(nullptr), nullptr),
     m_PropertyPersistence(mitk::CoreServices::GetPropertyPersistence(nullptr), nullptr),
     m_ProxyModel(nullptr),
     m_Model(nullptr),
     m_Delegate(nullptr),
     m_Renderer(nullptr)
 {
 }
 
 QmitkPropertyTreeView::~QmitkPropertyTreeView()
 {
 }
 
 void QmitkPropertyTreeView::SetFocus()
 {
   m_Controls.filterLineEdit->setFocus();
 }
 
-void QmitkPropertyTreeView::RenderWindowPartActivated(mitk::IRenderWindowPart* /*renderWindowPart*/)
+void QmitkPropertyTreeView::RenderWindowPartActivated(mitk::IRenderWindowPart* renderWindowPart)
 {
   if (m_Controls.propertyListComboBox->count() == 2)
   {
-    QHash<QString, QmitkRenderWindow*> renderWindows = this->GetRenderWindowPart()->GetQmitkRenderWindows();
+    QHash<QString, QmitkRenderWindow*> renderWindows = renderWindowPart->GetQmitkRenderWindows();
 
     Q_FOREACH(QString renderWindow, renderWindows.keys())
     {
       m_Controls.propertyListComboBox->insertItem(m_Controls.propertyListComboBox->count() - 1, QString("Data node: ") + renderWindow);
     }
   }
 }
 
 void QmitkPropertyTreeView::RenderWindowPartDeactivated(mitk::IRenderWindowPart*)
 {
   if (m_Controls.propertyListComboBox->count() > 2)
   {
     m_Controls.propertyListComboBox->clear();
     m_Controls.propertyListComboBox->addItem("Data node: common");
     m_Controls.propertyListComboBox->addItem("Base data");
   }
 }
 
 void QmitkPropertyTreeView::CreateQtPartControl(QWidget* parent)
 {
   m_Controls.setupUi(parent);
 
   m_Controls.propertyListComboBox->addItem("Data node: common");
 
   mitk::IRenderWindowPart* renderWindowPart = this->GetRenderWindowPart();
   if (renderWindowPart != nullptr)
   {
     QHash<QString, QmitkRenderWindow*> renderWindows = renderWindowPart->GetQmitkRenderWindows();
 
     for(const auto& renderWindow : renderWindows.keys())
     {
       m_Controls.propertyListComboBox->addItem(QString("Data node: ") + renderWindow);
     }
   }
 
   m_Controls.propertyListComboBox->addItem("Base data");
 
   m_Controls.newButton->setEnabled(false);
 
   this->HideAllIcons();
 
   m_ProxyModel = new QmitkPropertyItemSortFilterProxyModel(m_Controls.treeView);
   m_Model = new QmitkPropertyItemModel(m_ProxyModel);
 
   m_ProxyModel->setSourceModel(m_Model);
   m_ProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
   m_ProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
   m_ProxyModel->setDynamicSortFilter(true);
 
   m_Delegate = new QmitkPropertyItemDelegate(m_Controls.treeView);
 
   m_Controls.singleSlot->SetDataStorage(GetDataStorage());
   m_Controls.singleSlot->SetSelectionIsOptional(true);
   m_Controls.singleSlot->SetEmptyInfo(QString("Please select a data node"));
   m_Controls.singleSlot->SetPopUpTitel(QString("Select data node"));
 
   m_SelectionServiceConnector = std::make_unique<QmitkSelectionServiceConnector>();
   SetAsSelectionListener(true);
 
   m_Controls.filterLineEdit->setClearButtonEnabled(true);
 
   m_Controls.treeView->setItemDelegateForColumn(1, m_Delegate);
   m_Controls.treeView->setModel(m_ProxyModel);
   m_Controls.treeView->setColumnWidth(0, 160);
   m_Controls.treeView->sortByColumn(0, Qt::AscendingOrder);
   m_Controls.treeView->setSelectionBehavior(QAbstractItemView::SelectRows);
   m_Controls.treeView->setSelectionMode(QAbstractItemView::SingleSelection);
   m_Controls.treeView->setEditTriggers(QAbstractItemView::SelectedClicked | QAbstractItemView::DoubleClicked);
 
   const int ICON_SIZE = 32;
 
   auto icon = berry::QtStyleManager::ThemeIcon(QStringLiteral(":/org_mitk_icons/icons/awesome/scalable/tags.svg"));
   m_Controls.tagsLabel->setPixmap(icon.pixmap(ICON_SIZE));
 
   icon = berry::QtStyleManager::ThemeIcon(QStringLiteral(":/org_mitk_icons/icons/awesome/scalable/tag.svg"));
   m_Controls.tagLabel->setPixmap(icon.pixmap(ICON_SIZE));
 
   icon = berry::QtStyleManager::ThemeIcon(QStringLiteral(":/org_mitk_icons/icons/awesome/scalable/actions/document-save.svg"));
   m_Controls.saveLabel->setPixmap(icon.pixmap(ICON_SIZE));
 
   connect(m_Controls.singleSlot, &QmitkSingleNodeSelectionWidget::CurrentSelectionChanged,
     this, &QmitkPropertyTreeView::OnCurrentSelectionChanged);
   connect(m_Controls.filterLineEdit, &QLineEdit::textChanged,
     this, &QmitkPropertyTreeView::OnFilterTextChanged);
   connect(m_Controls.propertyListComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
     this, &QmitkPropertyTreeView::OnPropertyListChanged);
   connect(m_Controls.newButton, &QPushButton::clicked,
     this, &QmitkPropertyTreeView::OnAddNewProperty);
   connect(m_Controls.treeView->selectionModel(), &QItemSelectionModel::currentRowChanged,
     this, &QmitkPropertyTreeView::OnCurrentRowChanged);
   connect(m_Model, &QmitkPropertyItemModel::modelReset,
     this, &QmitkPropertyTreeView::OnModelReset);
 }
 
 void QmitkPropertyTreeView::SetAsSelectionListener(bool checked)
 {
   if (checked)
   {
     m_SelectionServiceConnector->AddPostSelectionListener(GetSite()->GetWorkbenchWindow()->GetSelectionService());
     connect(m_SelectionServiceConnector.get(), &QmitkSelectionServiceConnector::ServiceSelectionChanged, m_Controls.singleSlot, &QmitkSingleNodeSelectionWidget::SetCurrentSelection);
   }
   else
   {
     m_SelectionServiceConnector->RemovePostSelectionListener();
     disconnect(m_SelectionServiceConnector.get(), &QmitkSelectionServiceConnector::ServiceSelectionChanged, m_Controls.singleSlot, &QmitkSingleNodeSelectionWidget::SetCurrentSelection);
   }
 }
 
 QString QmitkPropertyTreeView::GetPropertyNameOrAlias(const QModelIndex& index)
 {
   QString propertyName;
 
   if (index.isValid())
   {
     QModelIndex current = index;
 
     while (current.isValid())
     {
       QString name = m_ProxyModel->data(m_ProxyModel->index(current.row(), 0, current.parent())).toString();
 
       propertyName.prepend(propertyName.isEmpty()
         ? name
         : name.append('.'));
 
       current = current.parent();
     }
   }
 
   return propertyName;
 }
 
 void QmitkPropertyTreeView::OnCurrentSelectionChanged(QList<mitk::DataNode::Pointer> nodes)
 {
   if (nodes.empty() || nodes.front().IsNull())
   {
     m_SelectedNode = nullptr;
 
     this->SetPartName("Properties");
     m_Model->SetPropertyList(nullptr);
     m_Delegate->SetPropertyList(nullptr);
 
     m_Controls.newButton->setEnabled(false);
 
     return;
   }
 
   // node is selected, create tree with node properties
   m_SelectedNode = nodes.front();
   mitk::PropertyList* propertyList = m_Model->GetPropertyList();
   if (m_Renderer == nullptr && m_Controls.propertyListComboBox->currentText() == "Base data")
   {
     propertyList = m_SelectedNode->GetData() != nullptr
       ? m_SelectedNode->GetData()->GetPropertyList()
       : nullptr;
   }
   else
   {
     propertyList = m_SelectedNode->GetPropertyList(m_Renderer);
   }
 
   QString selectionClassName = m_SelectedNode->GetData() != nullptr
     ? m_SelectedNode->GetData()->GetNameOfClass()
     : "";
 
   m_SelectionClassName = selectionClassName.toStdString();
 
   m_Model->SetPropertyList(propertyList, selectionClassName);
   m_Delegate->SetPropertyList(propertyList);
 
   m_Controls.newButton->setEnabled(true);
 
   if (!m_ProxyModel->filterRegExp().isEmpty())
   {
     m_Controls.treeView->expandAll();
   }
 }
 
 void QmitkPropertyTreeView::HideAllIcons()
 {
   m_Controls.tagLabel->hide();
   m_Controls.tagsLabel->hide();
   m_Controls.saveLabel->hide();
 }
 
 void QmitkPropertyTreeView::OnCurrentRowChanged(const QModelIndex& current, const QModelIndex&)
 {
   if (current.isValid())
   {
     QString name = this->GetPropertyNameOrAlias(current);
 
     if (!name.isEmpty())
     {
       QString alias;
       bool isTrueName = true;
 
       std::string trueName = m_PropertyAliases->GetPropertyName(name.toStdString());
 
       if (trueName.empty() && !m_SelectionClassName.empty())
         trueName = m_PropertyAliases->GetPropertyName(name.toStdString(), m_SelectionClassName);
 
       if (!trueName.empty())
       {
         alias = name;
         name = QString::fromStdString(trueName);
         isTrueName = false;
       }
 
       QString description = QString::fromStdString(m_PropertyDescriptions->GetDescription(name.toStdString()));
       std::vector<std::string> aliases;
 
       if (!isTrueName)
       {
         aliases = m_PropertyAliases->GetAliases(name.toStdString(), m_SelectionClassName);
 
         if (aliases.empty() && !m_SelectionClassName.empty())
           aliases = m_PropertyAliases->GetAliases(name.toStdString());
       }
 
       bool isPersistent = m_PropertyPersistence->HasInfo(name.toStdString());
 
       if (!description.isEmpty() || !aliases.empty() || isPersistent)
       {
         QString customizedDescription;
 
         if (!aliases.empty())
         {
           customizedDescription = "<h3 style=\"margin-bottom:0\">" + name + "</h3>";
 
           std::size_t numAliases = aliases.size();
           std::size_t lastAlias = numAliases - 1;
 
           for (std::size_t i = 0; i < numAliases; ++i)
           {
             customizedDescription += i != lastAlias
               ? "<h5 style=\"margin-top:0;margin-bottom:0\">"
               : "<h5 style=\"margin-top:0;margin-bottom:10px\">";
 
             customizedDescription += QString::fromStdString(aliases[i]) + "</h5>";
           }
         }
         else
         {
           customizedDescription = "<h3 style=\"margin-bottom:10px\">" + name + "</h3>";
         }
 
         if (!description.isEmpty())
           customizedDescription += "<p>" + description + "</p>";
 
         m_Controls.tagsLabel->setVisible(!aliases.empty() && aliases.size() > 1);
         m_Controls.tagLabel->setVisible(!aliases.empty() && aliases.size() == 1);
         m_Controls.saveLabel->setVisible(isPersistent);
 
         m_Controls.descriptionLabel->setText(customizedDescription);
         m_Controls.descriptionLabel->show();
 
         return;
       }
     }
   }
 
   m_Controls.descriptionLabel->hide();
   this->HideAllIcons();
 }
 
 void QmitkPropertyTreeView::OnPropertyListChanged(int index)
 {
   if (index == -1)
     return;
 
   QString renderer = m_Controls.propertyListComboBox->itemText(index);
 
   if (renderer.startsWith("Data node: "))
     renderer = QString::fromStdString(renderer.toStdString().substr(11));
 
-  m_Renderer = renderer != "common" && renderer != "Base data"
-    ? this->GetRenderWindowPart()->GetQmitkRenderWindow(renderer)->GetRenderer()
-    : nullptr;
+  m_Renderer = nullptr;
+
+  if (renderer != "common" && renderer != "Base data")
+  {
+    auto* renderWindowPart = this->GetRenderWindowPart();
+
+    if (nullptr != renderWindowPart)
+      m_Renderer = renderWindowPart->GetQmitkRenderWindow(renderer)->GetRenderer();
+  }
 
   QList<mitk::DataNode::Pointer> nodes;
 
   if (m_SelectedNode.IsNotNull())
     nodes << m_SelectedNode;
 
   this->OnCurrentSelectionChanged(nodes);
 }
 
 void QmitkPropertyTreeView::OnAddNewProperty()
 {
   std::unique_ptr<QmitkAddNewPropertyDialog> dialog(m_Controls.propertyListComboBox->currentText() != "Base data"
     ? new QmitkAddNewPropertyDialog(m_SelectedNode, m_Renderer)
     : new QmitkAddNewPropertyDialog(m_SelectedNode->GetData()));
 
   if (dialog->exec() == QDialog::Accepted)
     this->m_Model->Update();
 }
 
 void QmitkPropertyTreeView::OnFilterTextChanged(const QString& filter)
 {
   m_ProxyModel->setFilterWildcard(filter);
 
   if (filter.isEmpty())
     m_Controls.treeView->collapseAll();
   else
     m_Controls.treeView->expandAll();
 }
 
 void QmitkPropertyTreeView::OnModelReset()
 {
   m_Controls.descriptionLabel->hide();
   this->HideAllIcons();
 }
diff --git a/Plugins/org.mitk.gui.qt.segmentation/src/internal/QmitkSegmentationView.cpp b/Plugins/org.mitk.gui.qt.segmentation/src/internal/QmitkSegmentationView.cpp
index 117e144453..24688749a9 100644
--- a/Plugins/org.mitk.gui.qt.segmentation/src/internal/QmitkSegmentationView.cpp
+++ b/Plugins/org.mitk.gui.qt.segmentation/src/internal/QmitkSegmentationView.cpp
@@ -1,904 +1,904 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 #include <QObject>
 
 #include "mitkProperties.h"
 #include "mitkSegTool2D.h"
 #include "mitkStatusBar.h"
 
 #include "QmitkNewSegmentationDialog.h"
 #include <QmitkSegmentationOrganNamesHandling.cpp>
 
 #include <QMessageBox>
 
 #include <berryIWorkbenchPage.h>
 
 #include "QmitkSegmentationView.h"
 
 #include <mitkSurfaceToImageFilter.h>
 
 #include "mitkVtkResliceInterpolationProperty.h"
 
 #include "mitkApplicationCursor.h"
 #include "mitkSegmentationObjectFactory.h"
 #include "mitkPluginActivator.h"
 #include "mitkCameraController.h"
 #include "mitkLabelSetImage.h"
 #include "mitkImageTimeSelector.h"
 #include "mitkNodePredicateSubGeometry.h"
 
 #include <QmitkRenderWindow.h>
 
 #include "usModuleResource.h"
 #include "usModuleResourceStream.h"
 
 //micro service to get the ToolManager instance
 #include "mitkToolManagerProvider.h"
 
 #include <mitkWorkbenchUtil.h>
 #include <regex>
 
 const std::string QmitkSegmentationView::VIEW_ID = "org.mitk.views.segmentation";
 
 QmitkSegmentationView::QmitkSegmentationView()
   : m_Parent(nullptr)
   , m_Controls(nullptr)
   , m_RenderWindowPart(nullptr)
   , m_MouseCursorSet(false)
   , m_DataSelectionChanged(false)
 {
   mitk::TNodePredicateDataType<mitk::Image>::Pointer isImage = mitk::TNodePredicateDataType<mitk::Image>::New();
   mitk::NodePredicateDataType::Pointer isDwi = mitk::NodePredicateDataType::New("DiffusionImage");
   mitk::NodePredicateDataType::Pointer isDti = mitk::NodePredicateDataType::New("TensorImage");
   mitk::NodePredicateDataType::Pointer isOdf = mitk::NodePredicateDataType::New("OdfImage");
   auto isSegment = mitk::NodePredicateDataType::New("Segment");
 
   mitk::NodePredicateOr::Pointer validImages = mitk::NodePredicateOr::New();
   validImages->AddPredicate(mitk::NodePredicateAnd::New(isImage, mitk::NodePredicateNot::New(isSegment)));
   validImages->AddPredicate(isDwi);
   validImages->AddPredicate(isDti);
   validImages->AddPredicate(isOdf);
 
   m_IsNotAHelperObject = mitk::NodePredicateNot::New(mitk::NodePredicateProperty::New("helper object", mitk::BoolProperty::New(true)));
 
   m_IsOfTypeImagePredicate = mitk::NodePredicateAnd::New(validImages, m_IsNotAHelperObject);
 
   mitk::NodePredicateProperty::Pointer isBinaryPredicate = mitk::NodePredicateProperty::New("binary", mitk::BoolProperty::New(true));
   mitk::NodePredicateNot::Pointer isNotBinaryPredicate = mitk::NodePredicateNot::New(isBinaryPredicate);
 
   mitk::NodePredicateAnd::Pointer isABinaryImagePredicate = mitk::NodePredicateAnd::New(m_IsOfTypeImagePredicate, isBinaryPredicate);
   mitk::NodePredicateAnd::Pointer isNotABinaryImagePredicate = mitk::NodePredicateAnd::New(m_IsOfTypeImagePredicate, isNotBinaryPredicate);
 
   auto isMLImageType = mitk::TNodePredicateDataType<mitk::LabelSetImage>::New();
   mitk::NodePredicateAnd::Pointer isAMLImagePredicate = mitk::NodePredicateAnd::New(isMLImageType, m_IsNotAHelperObject);
   mitk::NodePredicateAnd::Pointer isNotAMLImagePredicate = mitk::NodePredicateAnd::New(mitk::NodePredicateNot::New(isMLImageType), m_IsNotAHelperObject);
 
   m_IsASegmentationImagePredicate = mitk::NodePredicateOr::New(isABinaryImagePredicate, isAMLImagePredicate);
   m_IsAPatientImagePredicate = mitk::NodePredicateAnd::New(isNotABinaryImagePredicate, isNotAMLImagePredicate);
 }
 
 QmitkSegmentationView::~QmitkSegmentationView()
 {
   if (m_Controls)
   {
     SetToolSelectionBoxesEnabled(false);
     // deactivate all tools
     mitk::ToolManagerProvider::GetInstance()->GetToolManager()->ActivateTool(-1);
 
     // removing all observers
     for (NodeTagMapType::iterator dataIter = m_WorkingDataObserverTags.begin(); dataIter != m_WorkingDataObserverTags.end(); ++dataIter)
     {
       (*dataIter).first->GetProperty("visible")->RemoveObserver((*dataIter).second);
     }
     m_WorkingDataObserverTags.clear();
 
     mitk::RenderingManager::GetInstance()->RemoveObserver(m_RenderingManagerObserverTag);
 
     ctkPluginContext* context = mitk::PluginActivator::getContext();
     ctkServiceReference ppmRef = context->getServiceReference<mitk::PlanePositionManagerService>();
     mitk::PlanePositionManagerService* service = context->getService<mitk::PlanePositionManagerService>(ppmRef);
     service->RemoveAllPlanePositions();
     context->ungetService(ppmRef);
     SetToolManagerSelection(nullptr, nullptr);
   }
 
   delete m_Controls;
 }
 
 void QmitkSegmentationView::NewNodeObjectsGenerated(mitk::ToolManager::DataVectorType* nodes)
 {
    if (!nodes) return;
 
    mitk::ToolManager* toolManager = mitk::ToolManagerProvider::GetInstance()->GetToolManager();
    if (!toolManager) return;
    for (mitk::ToolManager::DataVectorType::iterator iter = nodes->begin(); iter != nodes->end(); ++iter)
    {
       this->FireNodeSelected( *iter );
       // only last iteration meaningful, multiple generated objects are not taken into account here
    }
 }
 
 void QmitkSegmentationView::RenderWindowPartActivated(mitk::IRenderWindowPart* renderWindowPart)
 {
   if (m_RenderWindowPart != renderWindowPart)
   {
     m_RenderWindowPart = renderWindowPart;
   }
 
   if (m_Parent)
   {
     m_Parent->setEnabled(true);
   }
 
   // tell the interpolation about tool manager, data storage and render window part
   if (m_Controls)
   {
     mitk::ToolManager* toolManager = mitk::ToolManagerProvider::GetInstance()->GetToolManager();
     m_Controls->m_SlicesInterpolator->SetDataStorage(this->GetDataStorage());
     QList<mitk::SliceNavigationController*> controllers;
     controllers.push_back(renderWindowPart->GetQmitkRenderWindow("axial")->GetSliceNavigationController());
     controllers.push_back(renderWindowPart->GetQmitkRenderWindow("sagittal")->GetSliceNavigationController());
     controllers.push_back(renderWindowPart->GetQmitkRenderWindow("coronal")->GetSliceNavigationController());
     m_Controls->m_SlicesInterpolator->Initialize(toolManager, controllers);
   }
 }
 
 void QmitkSegmentationView::RenderWindowPartDeactivated(mitk::IRenderWindowPart* /*renderWindowPart*/)
 {
   m_RenderWindowPart = nullptr;
   if (m_Parent)
   {
     m_Parent->setEnabled(false);
   }
 }
 
 void QmitkSegmentationView::OnPreferencesChanged(const berry::IBerryPreferences* prefs)
 {
    if (m_Controls != nullptr)
    {
       bool slimView = prefs->GetBool("slim view", false);
       m_Controls->m_ManualToolSelectionBox2D->SetShowNames(!slimView);
       m_Controls->m_ManualToolSelectionBox3D->SetShowNames(!slimView);
       m_Controls->btnNewSegmentation->setToolButtonStyle(slimView
         ? Qt::ToolButtonIconOnly
         : Qt::ToolButtonTextOnly);
    }
 
    auto autoSelectionEnabled = prefs->GetBool("auto selection", true);
    m_Controls->patImageSelector->SetAutoSelectNewNodes(autoSelectionEnabled);
    m_Controls->segImageSelector->SetAutoSelectNewNodes(autoSelectionEnabled);
    this->ForceDisplayPreferencesUponAllImages();
 }
 
 void QmitkSegmentationView::CreateNewSegmentation()
 {
    mitk::DataNode::Pointer node = mitk::ToolManagerProvider::GetInstance()->GetToolManager()->GetReferenceData(0);
    if (node.IsNotNull())
    {
      mitk::Image::ConstPointer referenceImage = dynamic_cast<mitk::Image*>(node->GetData());
      if (referenceImage.IsNotNull())
      {
        if (referenceImage->GetDimension() > 1)
        {
          // ask about the name and organ type of the new segmentation
          QmitkNewSegmentationDialog* dialog = new QmitkNewSegmentationDialog(m_Parent); // needs a QWidget as parent, "this" is not QWidget
          QStringList organColors = mitk::OrganNamesHandling::GetDefaultOrganColorString();;
 
          dialog->SetSuggestionList(organColors);
 
          int dialogReturnValue = dialog->exec();
          if (dialogReturnValue == QDialog::Rejected)
          {
            // user clicked cancel or pressed Esc or something similar
            return;
          }
 
          const auto currentTimePoint = mitk::RenderingManager::GetInstance()->GetTimeNavigationController()->GetSelectedTimePoint();
          unsigned int imageTimeStep = 0;
          if (referenceImage->GetTimeGeometry()->IsValidTimePoint(currentTimePoint))
          {
            imageTimeStep = referenceImage->GetTimeGeometry()->TimePointToTimeStep(currentTimePoint);
          }
 
          auto segTemplateImage = referenceImage;
          if (referenceImage->GetDimension() > 3)
          {
            auto result = QMessageBox::question(m_Parent, tr("Create a static or dynamic segmentation?"), tr("The patient image has multiple time steps.\n\nDo you want to create a static segmentation that is identical for all time steps or do you want to create a dynamic segmentation to segment individual time steps?"), tr("Create static segmentation"), tr("Create dynamic segmentation"), QString(), 0,0);
            if (result == 0)
            {
              auto selector = mitk::ImageTimeSelector::New();
              selector->SetInput(referenceImage);
              selector->SetTimeNr(0);
              selector->Update();
 
              const auto refTimeGeometry = referenceImage->GetTimeGeometry();
              auto newTimeGeometry = mitk::ProportionalTimeGeometry::New();
              newTimeGeometry->SetFirstTimePoint(refTimeGeometry->GetMinimumTimePoint());
              newTimeGeometry->SetStepDuration(refTimeGeometry->GetMaximumTimePoint() - refTimeGeometry->GetMinimumTimePoint());
 
              mitk::Image::Pointer newImage = selector->GetOutput();
              newTimeGeometry->SetTimeStepGeometry(referenceImage->GetGeometry(imageTimeStep), 0);
              newImage->SetTimeGeometry(newTimeGeometry);
              segTemplateImage = newImage;
            }
          }
 
          // ask the user about an organ type and name, add this information to the image's (!) propertylist
          // create a new image of the same dimensions and smallest possible pixel type
          mitk::ToolManager* toolManager = mitk::ToolManagerProvider::GetInstance()->GetToolManager();
          mitk::Tool* firstTool = toolManager->GetToolById(0);
          if (firstTool)
          {
            try
            {
              std::string newNodeName = dialog->GetSegmentationName().toStdString();
              if (newNodeName.empty())
              {
                newNodeName = "no_name";
              }
 
              mitk::DataNode::Pointer emptySegmentation = firstTool->CreateEmptySegmentationNode(segTemplateImage, newNodeName, dialog->GetColor());
              // initialize showVolume to false to prevent recalculating the volume while working on the segmentation
              emptySegmentation->SetProperty("showVolume", mitk::BoolProperty::New(false));
              if (!emptySegmentation)
              {
                return; // could be aborted by user
              }
 
              mitk::OrganNamesHandling::UpdateOrganList(organColors, dialog->GetSegmentationName(), dialog->GetColor());
 
              // escape ';' here (replace by '\;'), see longer comment above
              QString stringForStorage = organColors.replaceInStrings(";", "\\;").join(";");
              MITK_DEBUG << "Will store: " << stringForStorage;
              this->GetPreferences()->Put("Organ-Color-List", stringForStorage);
              this->GetPreferences()->Flush();
 
              if (mitk::ToolManagerProvider::GetInstance()->GetToolManager()->GetWorkingData(0))
              {
                mitk::ToolManagerProvider::GetInstance()->GetToolManager()->GetWorkingData(0)->SetSelected(false);
              }
              emptySegmentation->SetSelected(true);
              this->GetDataStorage()->Add(emptySegmentation, node); // add as a child, because the segmentation "derives" from the original
 
              m_Controls->segImageSelector->SetCurrentSelectedNode(emptySegmentation);
              mitk::RenderingManager::GetInstance()->InitializeViews(referenceImage->GetTimeGeometry(), mitk::RenderingManager::REQUEST_UPDATE_ALL, true);
              mitk::RenderingManager::GetInstance()->GetTimeNavigationController()->GetTime()->SetPos(imageTimeStep);
            }
            catch (const std::bad_alloc&)
            {
              QMessageBox::warning(nullptr, tr("Create new segmentation"), tr("Could not allocate memory for new segmentation"));
            }
          }
        }
        else
        {
          QMessageBox::information(nullptr, tr("Segmentation"), tr("Segmentation is currently not supported for 2D images"));
        }
      }
    }
    else
    {
      MITK_ERROR << "'Create new segmentation' button should never be clickable unless a patient image is selected...";
    }
 }
 
 void QmitkSegmentationView::OnVisiblePropertyChanged()
 {
    this->CheckRenderingState();
 }
 
 void QmitkSegmentationView::NodeAdded(const mitk::DataNode *node)
 {
   if (!m_IsASegmentationImagePredicate->CheckNode(node))
   {
     return;
   }
 
   itk::SimpleMemberCommand<QmitkSegmentationView>::Pointer command = itk::SimpleMemberCommand<QmitkSegmentationView>::New();
   command->SetCallbackFunction(this, &QmitkSegmentationView::OnVisiblePropertyChanged);
   m_WorkingDataObserverTags.insert(std::pair<mitk::DataNode*, unsigned long>(const_cast<mitk::DataNode*>(node), node->GetProperty("visible")->AddObserver(itk::ModifiedEvent(), command)));
 
   ApplyDisplayOptions(const_cast<mitk::DataNode*>(node));
 }
 
 void QmitkSegmentationView::NodeRemoved(const mitk::DataNode* node)
 {
   if (m_IsASegmentationImagePredicate->CheckNode(node))
   {
     //First of all remove all possible contour markers of the segmentation
     mitk::DataStorage::SetOfObjects::ConstPointer allContourMarkers = this->GetDataStorage()->GetDerivations(node, mitk::NodePredicateProperty::New("isContourMarker", mitk::BoolProperty::New(true)));
 
     ctkPluginContext* context = mitk::PluginActivator::getContext();
     ctkServiceReference ppmRef = context->getServiceReference<mitk::PlanePositionManagerService>();
     mitk::PlanePositionManagerService* service = context->getService<mitk::PlanePositionManagerService>(ppmRef);
 
     for (mitk::DataStorage::SetOfObjects::ConstIterator it = allContourMarkers->Begin(); it != allContourMarkers->End(); ++it)
     {
       std::string nodeName = node->GetName();
       unsigned int t = nodeName.find_last_of(" ");
       unsigned int id = atof(nodeName.substr(t + 1).c_str()) - 1;
 
       service->RemovePlanePosition(id);
 
       this->GetDataStorage()->Remove(it->Value());
     }
 
     context->ungetService(ppmRef);
     service = nullptr;
 
     if ((mitk::ToolManagerProvider::GetInstance()->GetToolManager()->GetWorkingData(0) == node) && m_Controls->patImageSelector->GetSelectedNode().IsNotNull())
     {
       this->SetToolManagerSelection(mitk::ToolManagerProvider::GetInstance()->GetToolManager()->GetReferenceData(0), nullptr);
       this->UpdateWarningLabel(tr("Select or create a segmentation"));
     }
 
     mitk::Image* image = dynamic_cast<mitk::Image*>(node->GetData());
     mitk::SurfaceInterpolationController::GetInstance()->RemoveInterpolationSession(image);
   }
 
   mitk::DataNode* tempNode = const_cast<mitk::DataNode*>(node);
   //Remove observer if one was registered
   auto finding = m_WorkingDataObserverTags.find(tempNode);
   if (finding != m_WorkingDataObserverTags.end())
   {
     node->GetProperty("visible")->RemoveObserver(m_WorkingDataObserverTags[tempNode]);
     m_WorkingDataObserverTags.erase(tempNode);
   }
 }
 
 void QmitkSegmentationView::OnPatientSelectionChanged(QList<mitk::DataNode::Pointer> nodes)
 {
    if(! nodes.empty())
    {
       this->UpdateWarningLabel("");
       auto node = nodes.first();
 
       auto segPredicate = mitk::NodePredicateAnd::New(m_IsASegmentationImagePredicate.GetPointer(), mitk::NodePredicateSubGeometry::New(node->GetData()->GetGeometry()));
 
       m_Controls->segImageSelector->SetNodePredicate(segPredicate);
 
       mitk::DataNode* segNode = m_Controls->segImageSelector->GetSelectedNode();
       this->SetToolManagerSelection(node, segNode);
       if (segNode)
       {
         //Doing this we can assure that the segmentation is always visible if the segmentation and the patient image are
         //loaded separately
         int layer(10);
         node->GetIntProperty("layer", layer);
         layer++;
         segNode->SetProperty("layer", mitk::IntProperty::New(layer));
         this->CheckRenderingState();
       }
       else
       {
          this->SetToolSelectionBoxesEnabled( false );
          this->UpdateWarningLabel(tr("Select or create a segmentation"));
       }
    }
    else
    {
      m_Controls->segImageSelector->SetNodePredicate(m_IsASegmentationImagePredicate);
      this->UpdateWarningLabel(tr("Please select an image!"));
      this->SetToolSelectionBoxesEnabled( false );
    }
 }
 
 void QmitkSegmentationView::OnSegmentationSelectionChanged(QList<mitk::DataNode::Pointer> nodes)
 {
    if (nodes.empty())
    {
       this->UpdateWarningLabel(tr("Select or create a segmentation"));
       this->SetToolSelectionBoxesEnabled( false );
       return;
    }
 
    auto refNode = m_Controls->patImageSelector->GetSelectedNode();
    auto segNode = nodes.front();
 
    if (!refNode)
    {
      this->UpdateWarningLabel(tr("Please select the matching patient image!"));
      this->SetToolSelectionBoxesEnabled(false);
      this->SetToolManagerSelection(nullptr, segNode);
      return;
    }
 
    this->CheckRenderingState();
    if ( m_Controls->lblSegmentationWarnings->isVisible()) // "this->CheckRenderingState()" caused a warning. we do not need to go any further
       return;
 
    this->SetToolManagerSelection(refNode, segNode);
 
    if (segNode)
    {
      //Doing this we can assure that the segmenation is always visible if the segmentation and the patient image are
      //loaded separately
      int layer(10);
      refNode->GetIntProperty("layer", layer);
      layer++;
      segNode->SetProperty("layer", mitk::IntProperty::New(layer));
    }
    else
    {
      this->SetToolSelectionBoxesEnabled(false);
      this->UpdateWarningLabel(tr("Select or create a segmentation"));
    }
 
    mitk::IRenderWindowPart* renderWindowPart = this->GetRenderWindowPart();
    if (!renderWindowPart || !segNode->IsVisible(renderWindowPart->GetQmitkRenderWindow("axial")->GetRenderer()))
    {
      this->UpdateWarningLabel(tr("The selected segmentation is currently not visible!"));
      this->SetToolSelectionBoxesEnabled( false );
    }
 }
 
 void QmitkSegmentationView::OnShowMarkerNodes (bool state)
 {
    mitk::SegTool2D::Pointer manualSegmentationTool;
 
    unsigned int numberOfExistingTools = mitk::ToolManagerProvider::GetInstance()->GetToolManager()->GetTools().size();
 
    for(unsigned int i = 0; i < numberOfExistingTools; i++)
    {
       manualSegmentationTool = dynamic_cast<mitk::SegTool2D*>(mitk::ToolManagerProvider::GetInstance()->GetToolManager()->GetToolById(i));
 
       if (manualSegmentationTool)
       {
          if(state == true)
          {
             manualSegmentationTool->SetShowMarkerNodes( true );
          }
          else
          {
             manualSegmentationTool->SetShowMarkerNodes( false );
          }
       }
    }
 }
 
 void QmitkSegmentationView::OnContourMarkerSelected(const mitk::DataNode *node)
 {
    QmitkRenderWindow* selectedRenderWindow = nullptr;
-   QmitkRenderWindow* axialRenderWindow = GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetQmitkRenderWindow("axial");
-   QmitkRenderWindow* sagittalRenderWindow = GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetQmitkRenderWindow("sagittal");
-   QmitkRenderWindow* coronalRenderWindow = GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetQmitkRenderWindow("coronal");
-   QmitkRenderWindow* _3DRenderWindow = GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetQmitkRenderWindow("3d");
+   auto* renderWindowPart = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN);
+   auto* axialRenderWindow = renderWindowPart->GetQmitkRenderWindow("axial");
+   auto* sagittalRenderWindow = renderWindowPart->GetQmitkRenderWindow("sagittal");
+   auto* coronalRenderWindow = renderWindowPart->GetQmitkRenderWindow("coronal");
+   auto* _3DRenderWindow = renderWindowPart->GetQmitkRenderWindow("3d");
    bool PlanarFigureInitializedWindow = false;
 
    // find initialized renderwindow
    if (node->GetBoolProperty("PlanarFigureInitializedWindow",
       PlanarFigureInitializedWindow, axialRenderWindow->GetRenderer()))
    {
       selectedRenderWindow = axialRenderWindow;
    }
    if (!selectedRenderWindow && node->GetBoolProperty(
       "PlanarFigureInitializedWindow", PlanarFigureInitializedWindow,
       sagittalRenderWindow->GetRenderer()))
    {
       selectedRenderWindow = sagittalRenderWindow;
    }
    if (!selectedRenderWindow && node->GetBoolProperty(
       "PlanarFigureInitializedWindow", PlanarFigureInitializedWindow,
       coronalRenderWindow->GetRenderer()))
    {
       selectedRenderWindow = coronalRenderWindow;
    }
    if (!selectedRenderWindow && node->GetBoolProperty(
       "PlanarFigureInitializedWindow", PlanarFigureInitializedWindow,
       _3DRenderWindow->GetRenderer()))
    {
       selectedRenderWindow = _3DRenderWindow;
    }
 
    // make node visible
    if (selectedRenderWindow)
    {
       std::string nodeName = node->GetName();
       unsigned int t = nodeName.find_last_of(" ");
       unsigned int id = atof(nodeName.substr(t+1).c_str())-1;
 
       {
          ctkPluginContext* context = mitk::PluginActivator::getContext();
          ctkServiceReference ppmRef = context->getServiceReference<mitk::PlanePositionManagerService>();
          mitk::PlanePositionManagerService* service = context->getService<mitk::PlanePositionManagerService>(ppmRef);
          selectedRenderWindow->GetSliceNavigationController()->ExecuteOperation(service->GetPlanePosition(id));
          context->ungetService(ppmRef);
       }
 
       selectedRenderWindow->GetRenderer()->GetCameraController()->Fit();
       mitk::RenderingManager::GetInstance()->RequestUpdateAll();
    }
 }
 
 void QmitkSegmentationView::OnSelectionChanged(berry::IWorkbenchPart::Pointer /*part*/, const QList<mitk::DataNode::Pointer> &nodes)
 {
   if (nodes.size() != 0)
   {
     std::string markerName = "Position";
     unsigned int numberOfNodes = nodes.size();
     std::string nodeName = nodes.at(0)->GetName();
     if ((numberOfNodes == 1) && (nodeName.find(markerName) == 0))
     {
       this->OnContourMarkerSelected(nodes.at(0));
       return;
     }
   }
 }
 
 void QmitkSegmentationView::OnTabWidgetChanged(int id)
 {
    //always disable tools on tab changed
    mitk::ToolManagerProvider::GetInstance()->GetToolManager()->ActivateTool(-1);
 
    //2D Tab ID = 0
    //3D Tab ID = 1
    if (id == 0)
    {
       //Hide 3D selection box, show 2D selection box
       m_Controls->m_ManualToolSelectionBox3D->hide();
       m_Controls->m_ManualToolSelectionBox2D->show();
       //Deactivate possible active tool
 
       //TODO Remove possible visible interpolations -> Maybe changes in SlicesInterpolator
    }
    else
    {
       //Hide 3D selection box, show 2D selection box
       m_Controls->m_ManualToolSelectionBox2D->hide();
       m_Controls->m_ManualToolSelectionBox3D->show();
       //Deactivate possible active tool
    }
 }
 
 void QmitkSegmentationView::SetToolManagerSelection(mitk::DataNode* referenceData, mitk::DataNode* workingData)
 {
   // called as a result of new BlueBerry selections
   //   tells the ToolManager for manual segmentation about new selections
   //   updates GUI information about what the user should select
   mitk::ToolManager* toolManager = mitk::ToolManagerProvider::GetInstance()->GetToolManager();
   toolManager->SetReferenceData(const_cast<mitk::DataNode*>(referenceData));
   toolManager->SetWorkingData(const_cast<mitk::DataNode*>(workingData));
 
   m_Controls->btnNewSegmentation->setEnabled(referenceData != nullptr);
 }
 
 void QmitkSegmentationView::ForceDisplayPreferencesUponAllImages()
 {
    if (!m_Parent)
    {
      return;
    }
 
    // check all images and segmentations in DataStorage:
    // (items in brackets are implicitly done by previous steps)
    // 1.
    //   if  a reference image is selected,
    //     show the reference image
    //     and hide all other images (orignal and segmentation),
    //     (and hide all segmentations of the other original images)
    //     and show all the reference's segmentations
    //   if no reference image is selected, do do nothing
    //
    // 2.
    //   if  a segmentation is selected,
    //     show it
    //     (and hide all all its siblings (childs of the same parent, incl, nullptr parent))
    //   if no segmentation is selected, do nothing
 
    if (!m_Controls)
    {
      return; // might happen on initialization (preferences loaded)
    }
 
    mitk::ToolManager* toolManager = mitk::ToolManagerProvider::GetInstance()->GetToolManager();
    mitk::DataNode::Pointer referenceData = toolManager->GetReferenceData(0);
    mitk::DataNode::Pointer workingData =   toolManager->GetWorkingData(0);
 
    // 1.
    if (referenceData.IsNotNull())
    {
       // iterate all images
      mitk::DataStorage::SetOfObjects::ConstPointer allImages = this->GetDataStorage()->GetSubset(m_IsASegmentationImagePredicate);
 
       for ( mitk::DataStorage::SetOfObjects::const_iterator iter = allImages->begin(); iter != allImages->end(); ++iter)
 
       {
          mitk::DataNode* node = *iter;
          // apply display preferences
          ApplyDisplayOptions(node);
 
          // set visibility
          node->SetVisibility(node == referenceData);
       }
    }
 
    // 2.
    if (workingData.IsNotNull())
       workingData->SetVisibility(true);
 
    mitk::RenderingManager::GetInstance()->RequestUpdateAll();
 }
 
 void QmitkSegmentationView::ApplyDisplayOptions(mitk::DataNode* node)
 {
   if (!node)
   {
     return;
   }
 
   mitk::BoolProperty::Pointer drawOutline = mitk::BoolProperty::New(GetPreferences()->GetBool("draw outline", true));
   mitk::LabelSetImage* labelSetImage = dynamic_cast<mitk::LabelSetImage*>(node->GetData());
   if (nullptr != labelSetImage)
   {
     // node is actually a multi label segmentation,
     // but its outline property can be set in the 'single label' segmentation preference page as well
     node->SetProperty("labelset.contour.active", drawOutline);
     //node->SetProperty("opacity", mitk::FloatProperty::New(drawOutline->GetValue() ? 1.0f : 0.3f));
     // force render window update to show outline
     node->GetData()->Modified();
   }
   else
   {
     // node is a 'single label' segmentation
     bool isBinary = false;
     node->GetBoolProperty("binary", isBinary);
     if (isBinary)
     {
       node->SetProperty("outline binary", drawOutline);
       node->SetProperty("outline width", mitk::FloatProperty::New(2.0));
       //node->SetProperty("opacity", mitk::FloatProperty::New(drawOutline->GetValue() ? 1.0f : 0.3f));
       // force render window update to show outline
       node->GetData()->Modified();
     }
   }
 }
 
 void QmitkSegmentationView::CheckRenderingState()
 {
   mitk::IRenderWindowPart* renderWindowPart = this->GetRenderWindowPart();
   mitk::DataNode* workingNode = m_Controls->segImageSelector->GetSelectedNode();
 
   if (!workingNode)
   {
     this->SetToolSelectionBoxesEnabled(false);
     this->UpdateWarningLabel(tr("Select or create a segmentation"));
     return;
   }
 
   bool selectedNodeIsVisible = renderWindowPart && workingNode->IsVisible(renderWindowPart->GetQmitkRenderWindow("axial")->GetRenderer());
 
   if (!selectedNodeIsVisible)
   {
     this->SetToolSelectionBoxesEnabled(false);
     this->UpdateWarningLabel(tr("The selected segmentation is currently not visible!"));
     return;
   }
 
    /*
    * Here we check whether the geometry of the selected segmentation image if aligned with the worldgeometry
    * At the moment it is not supported to use a geometry different from the selected image for reslicing.
    * For further information see Bug 16063
    */
 
-   const mitk::BaseGeometry* worldGeo = this->GetRenderWindowPart()->GetQmitkRenderWindow("3d")->GetSliceNavigationController()->GetCurrentGeometry3D();
+   const mitk::BaseGeometry* worldGeo = renderWindowPart->GetQmitkRenderWindow("3d")->GetSliceNavigationController()->GetCurrentGeometry3D();
 
    if (workingNode && worldGeo)
    {
 
       const mitk::BaseGeometry* workingNodeGeo = workingNode->GetData()->GetGeometry();
-      const mitk::BaseGeometry* worldGeo = this->GetRenderWindowPart()->GetQmitkRenderWindow("3d")->GetSliceNavigationController()->GetCurrentGeometry3D();
+      const mitk::BaseGeometry* worldGeo = renderWindowPart->GetQmitkRenderWindow("3d")->GetSliceNavigationController()->GetCurrentGeometry3D();
 
       if (mitk::Equal(*workingNodeGeo->GetBoundingBox(), *worldGeo->GetBoundingBox(), mitk::eps, true))
       {
          this->SetToolManagerSelection(m_Controls->patImageSelector->GetSelectedNode(), workingNode);
          this->SetToolSelectionBoxesEnabled(true);
          this->UpdateWarningLabel("");
          return;
       }
    }
 
    this->SetToolManagerSelection(m_Controls->patImageSelector->GetSelectedNode(), nullptr);
    this->SetToolSelectionBoxesEnabled(false);
    this->UpdateWarningLabel(tr("Please perform a reinit on the segmentation image!"));
 }
 
 void QmitkSegmentationView::UpdateWarningLabel(QString text)
 {
    if (text.size() == 0)
       m_Controls->lblSegmentationWarnings->hide();
    else
       m_Controls->lblSegmentationWarnings->show();
    m_Controls->lblSegmentationWarnings->setText("<font color=\"red\">" + text + "</font>");
 }
 
 void QmitkSegmentationView::CreateQtPartControl(QWidget* parent)
 {
    // setup the basic GUI of this view
    m_Parent = parent;
 
    m_Controls = new Ui::QmitkSegmentationControls;
    m_Controls->setupUi(parent);
 
    m_Controls->patImageSelector->SetDataStorage(GetDataStorage());
    m_Controls->patImageSelector->SetNodePredicate(m_IsAPatientImagePredicate);
    m_Controls->patImageSelector->SetSelectionIsOptional(false);
    m_Controls->patImageSelector->SetInvalidInfo("Select an image.");
    m_Controls->patImageSelector->SetPopUpTitel("Select an image.");
    m_Controls->patImageSelector->SetPopUpHint("Select an image that should be used to define the geometry and bounds of the segmentation.");
 
    UpdateWarningLabel(tr("Please select an image"));
 
    if (m_Controls->patImageSelector->GetSelectedNode().IsNotNull())
    {
      UpdateWarningLabel(tr("Select or create a new segmentation"));
    }
 
    m_Controls->segImageSelector->SetDataStorage(GetDataStorage());
    m_Controls->segImageSelector->SetNodePredicate(m_IsASegmentationImagePredicate);
    m_Controls->segImageSelector->SetSelectionIsOptional(false);
    m_Controls->segImageSelector->SetInvalidInfo("Select a segmentation.");
    m_Controls->segImageSelector->SetPopUpTitel("Select a segmentation.");
    m_Controls->segImageSelector->SetPopUpHint("Select a segmentation that should be modified. Only segmentation with the same geometry and within the bounds of the reference image are selected.");
 
    if (m_Controls->segImageSelector->GetSelectedNode().IsNotNull())
    {
      UpdateWarningLabel("");
    }
 
    mitk::ToolManager* toolManager = mitk::ToolManagerProvider::GetInstance()->GetToolManager();
    assert(toolManager);
 
    toolManager->SetDataStorage(*(GetDataStorage()));
    toolManager->InitializeTools();
 
    QString segTools2D = tr("Add Subtract Paint Wipe 'Region Growing' Fill Erase 'Live Wire' '2D Fast Marching'");
    QString segTools3D = tr("Threshold 'UL Threshold' Otsu 'Fast Marching 3D' 'Region Growing 3D' Watershed Picking");
 
    std::regex extSegTool2DRegEx("SegTool2D$");
    std::regex extSegTool3DRegEx("SegTool3D$");
 
    auto tools = toolManager->GetTools();
 
    for (const auto &tool : tools)
    {
      if (std::regex_search(tool->GetNameOfClass(), extSegTool2DRegEx))
      {
        segTools2D.append(QString(" '%1'").arg(tool->GetName()));
      }
      else if (std::regex_search(tool->GetNameOfClass(), extSegTool3DRegEx))
      {
        segTools3D.append(QString(" '%1'").arg(tool->GetName()));
      }
    }
 
    // all part of open source MITK
    m_Controls->m_ManualToolSelectionBox2D->setEnabled(true);
    m_Controls->m_ManualToolSelectionBox2D->SetGenerateAccelerators(true);
    m_Controls->m_ManualToolSelectionBox2D->SetToolGUIArea(m_Controls->m_ManualToolGUIContainer2D);
 
    m_Controls->m_ManualToolSelectionBox2D->SetDisplayedToolGroups(segTools2D.toStdString());
    m_Controls->m_ManualToolSelectionBox2D->SetLayoutColumns(3);
    m_Controls->m_ManualToolSelectionBox2D->SetEnabledMode(QmitkToolSelectionBox::EnabledWithReferenceAndWorkingDataVisible);
    connect(m_Controls->m_ManualToolSelectionBox2D, &QmitkToolSelectionBox::ToolSelected, this, &QmitkSegmentationView::OnManualTool2DSelected);
 
    //setup 3D Tools
    m_Controls->m_ManualToolSelectionBox3D->setEnabled(true);
    m_Controls->m_ManualToolSelectionBox3D->SetGenerateAccelerators(true);
    m_Controls->m_ManualToolSelectionBox3D->SetToolGUIArea(m_Controls->m_ManualToolGUIContainer3D);
    //specify tools to be added to 3D Tool area
    m_Controls->m_ManualToolSelectionBox3D->SetDisplayedToolGroups(segTools3D.toStdString());
    m_Controls->m_ManualToolSelectionBox3D->SetLayoutColumns(3);
    m_Controls->m_ManualToolSelectionBox3D->SetEnabledMode(QmitkToolSelectionBox::EnabledWithReferenceAndWorkingDataVisible);
 
    //Hide 3D selection box, show 2D selection box
    m_Controls->m_ManualToolSelectionBox3D->hide();
    m_Controls->m_ManualToolSelectionBox2D->show();
 
    // update the list of segmentations
    toolManager->NewNodeObjectsGenerated += mitk::MessageDelegate1<QmitkSegmentationView, mitk::ToolManager::DataVectorType*>(this, &QmitkSegmentationView::NewNodeObjectsGenerated);
 
    // create signal/slot connections
    connect(m_Controls->patImageSelector, &QmitkAbstractNodeSelectionWidget::CurrentSelectionChanged, this, &QmitkSegmentationView::OnPatientSelectionChanged);
    connect(m_Controls->segImageSelector, &QmitkAbstractNodeSelectionWidget::CurrentSelectionChanged, this, &QmitkSegmentationView::OnSegmentationSelectionChanged);
 
    connect(m_Controls->btnNewSegmentation, &QToolButton::clicked, this, &QmitkSegmentationView::CreateNewSegmentation);
    connect(m_Controls->tabWidgetSegmentationTools, &QTabWidget::currentChanged, this, &QmitkSegmentationView::OnTabWidgetChanged);
    connect(m_Controls->m_SlicesInterpolator, &QmitkSlicesInterpolator::SignalShowMarkerNodes, this, &QmitkSegmentationView::OnShowMarkerNodes);
 
    // set callback function for already existing nodes (images & segmentations)
    mitk::DataStorage::SetOfObjects::ConstPointer allImages = GetDataStorage()->GetSubset(m_IsOfTypeImagePredicate);
    for (mitk::DataStorage::SetOfObjects::const_iterator iter = allImages->begin(); iter != allImages->end(); ++iter)
    {
      mitk::DataNode* node = *iter;
      itk::SimpleMemberCommand<QmitkSegmentationView>::Pointer command = itk::SimpleMemberCommand<QmitkSegmentationView>::New();
      command->SetCallbackFunction(this, &QmitkSegmentationView::OnVisiblePropertyChanged);
      m_WorkingDataObserverTags.insert(std::pair<mitk::DataNode*, unsigned long>(node, node->GetProperty("visible")->AddObserver(itk::ModifiedEvent(), command)));
    }
 
    itk::SimpleMemberCommand<QmitkSegmentationView>::Pointer command = itk::SimpleMemberCommand<QmitkSegmentationView>::New();
    command->SetCallbackFunction(this, &QmitkSegmentationView::CheckRenderingState);
    m_RenderingManagerObserverTag = mitk::RenderingManager::GetInstance()->AddObserver(mitk::RenderingManagerViewsInitializedEvent(), command);
 
    SetToolManagerSelection(m_Controls->patImageSelector->GetSelectedNode(), m_Controls->segImageSelector->GetSelectedNode());
 
-   m_RenderWindowPart = GetRenderWindowPart();
-   if (m_RenderWindowPart)
-   {
-     RenderWindowPartActivated(m_RenderWindowPart);
-   }
+   m_RenderWindowPart = this->GetRenderWindowPart();
+
+   if (nullptr != m_RenderWindowPart)
+     this->RenderWindowPartActivated(m_RenderWindowPart);
 
    //Should be done last, if everything else is configured because it triggers the autoselection of data.
    m_Controls->patImageSelector->SetAutoSelectNewNodes(true);
    m_Controls->segImageSelector->SetAutoSelectNewNodes(true);
 }
 
 void QmitkSegmentationView::SetFocus()
 {
   m_Controls->btnNewSegmentation->setFocus();
 }
 
 void QmitkSegmentationView::OnManualTool2DSelected(int id)
 {
    if (id >= 0)
    {
       std::string text = "Active Tool: \"";
       mitk::ToolManager* toolManager = mitk::ToolManagerProvider::GetInstance()->GetToolManager();
       text += toolManager->GetToolById(id)->GetName();
       text += "\"";
       mitk::StatusBar::GetInstance()->DisplayText(text.c_str());
 
       us::ModuleResource resource = toolManager->GetToolById(id)->GetCursorIconResource();
       this->SetMouseCursor(resource, 0, 0);
    }
    else
    {
       this->ResetMouseCursor();
       mitk::StatusBar::GetInstance()->DisplayText("");
    }
 }
 
 void QmitkSegmentationView::ResetMouseCursor()
 {
    if ( m_MouseCursorSet )
    {
       mitk::ApplicationCursor::GetInstance()->PopCursor();
       m_MouseCursorSet = false;
    }
 }
 
 void QmitkSegmentationView::SetMouseCursor( const us::ModuleResource& resource, int hotspotX, int hotspotY )
 {
    // Remove previously set mouse cursor
    if (m_MouseCursorSet)
       this->ResetMouseCursor();
 
    if (resource)
    {
      us::ModuleResourceStream cursor(resource, std::ios::binary);
      mitk::ApplicationCursor::GetInstance()->PushCursor(cursor, hotspotX, hotspotY);
      m_MouseCursorSet = true;
    }
 }
 
 void QmitkSegmentationView::SetToolSelectionBoxesEnabled(bool status)
 {
   if (status)
   {
     m_Controls->m_ManualToolSelectionBox2D->RecreateButtons();
     m_Controls->m_ManualToolSelectionBox3D->RecreateButtons();
   }
 
   m_Controls->m_ManualToolSelectionBox2D->setEnabled(status);
   m_Controls->m_ManualToolSelectionBox3D->setEnabled(status);
   m_Controls->m_SlicesInterpolator->setEnabled(status);
 }
diff --git a/Plugins/org.mitk.gui.qt.tofutil/src/internal/QmitkToFUtilView.cpp b/Plugins/org.mitk.gui.qt.tofutil/src/internal/QmitkToFUtilView.cpp
index 33520df2fe..92920c9c2f 100644
--- a/Plugins/org.mitk.gui.qt.tofutil/src/internal/QmitkToFUtilView.cpp
+++ b/Plugins/org.mitk.gui.qt.tofutil/src/internal/QmitkToFUtilView.cpp
@@ -1,526 +1,535 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 // Blueberry
 #include <mitkIRenderingManager.h>
 #include <mitkIRenderWindowPart.h>
 #include <mitkILinkedRenderWindowPart.h>
 
 // Qmitk
 #include "QmitkToFUtilView.h"
 
 // Qt
 #include <QMessageBox>
 #include <QString>
 #include <qmessagebox.h>
 #include <qfiledialog.h>
 #include <qcombobox.h>
 
 // MITK
 #include <mitkBaseRenderer.h>
 #include <mitkToFDistanceImageToPointSetFilter.h>
 #include <mitkTransferFunction.h>
 #include <mitkTransferFunctionProperty.h>
 #include <mitkToFDeviceFactoryManager.h>
 #include <mitkToFCameraDevice.h>
 #include <mitkCameraIntrinsicsProperty.h>
 #include <mitkSmartPointerProperty.h>
 #include <mitkRenderingModeProperty.h>
 #include <mitkVtkScalarModeProperty.h>
 
 // VTK
 #include <vtkCamera.h>
 #include <vtkPointData.h>
 #include <vtkPolyData.h>
 
 // ITK
 #include <itkCommand.h>
 #include <itksys/SystemTools.hxx>
 
 const std::string QmitkToFUtilView::VIEW_ID = "org.mitk.views.tofutil";
 
 //Constructor
 QmitkToFUtilView::QmitkToFUtilView()
   : QmitkAbstractView()
   , m_Controls(nullptr)
   , m_Framerateoutput(false)
   , m_MitkDistanceImage(nullptr), m_MitkAmplitudeImage(nullptr), m_MitkIntensityImage(nullptr), m_Surface(nullptr)
   , m_DistanceImageNode(nullptr), m_AmplitudeImageNode(nullptr), m_IntensityImageNode(nullptr), m_RGBImageNode(nullptr), m_SurfaceNode(nullptr)
   , m_ToFImageRecorder(nullptr), m_ToFImageGrabber(nullptr), m_ToFDistanceImageToSurfaceFilter(nullptr), m_ToFCompositeFilter(nullptr)
   , m_2DDisplayCount(0)
   , m_RealTimeClock(nullptr)
   , m_StepsForFramerate(100)
   , m_2DTimeBefore(0.0)
   , m_2DTimeAfter(0.0)
   , m_CameraIntrinsics(nullptr)
 {
   this->m_Frametimer = new QTimer(this);
 
   this->m_ToFDistanceImageToSurfaceFilter = mitk::ToFDistanceImageToSurfaceFilter::New();
   this->m_ToFCompositeFilter = mitk::ToFCompositeFilter::New();
   this->m_ToFImageRecorder = mitk::ToFImageRecorder::New();
 }
 
 //Destructor, specifically calling OnToFCameraStopped() and OnToFCammeraDiconnected()
 QmitkToFUtilView::~QmitkToFUtilView()
 {
   OnToFCameraStopped();
   OnToFCameraDisconnected();
 }
 
 //Createing the PartControl Signal-Slot principal
 void QmitkToFUtilView::CreateQtPartControl( QWidget *parent )
 {
   // build up qt view, unless already done
   if ( !m_Controls )
   {
     // create GUI widgets from the Qt Designer's .ui file
     m_Controls = new Ui::QmitkToFUtilViewControls;
     m_Controls->setupUi( parent );
 
     //Looking for Input and Defining reaction
     connect(m_Frametimer, SIGNAL(timeout()), this, SLOT(OnUpdateCamera()));
 
     connect( (QObject*)(m_Controls->m_ToFConnectionWidget), SIGNAL(KinectAcquisitionModeChanged()), this, SLOT(OnKinectAcquisitionModeChanged()) ); // Todo in Widget2
     connect( (QObject*)(m_Controls->m_ToFConnectionWidget), SIGNAL(ToFCameraConnected()), this, SLOT(OnToFCameraConnected()) );
     connect( (QObject*)(m_Controls->m_ToFConnectionWidget), SIGNAL(ToFCameraDisconnected()), this, SLOT(OnToFCameraDisconnected()) );
     connect( (QObject*)(m_Controls->m_ToFRecorderWidget), SIGNAL(ToFCameraStarted()), this, SLOT(OnToFCameraStarted()) );
     connect( (QObject*)(m_Controls->m_ToFRecorderWidget), SIGNAL(ToFCameraStopped()), this, SLOT(OnToFCameraStopped()) );
     connect( (QObject*)(m_Controls->m_ToFRecorderWidget), SIGNAL(RecordingStarted()), this, SLOT(OnToFCameraStopped()) );
     connect( (QObject*)(m_Controls->m_ToFRecorderWidget), SIGNAL(RecordingStopped()), this, SLOT(OnToFCameraStarted()) );
 }
 }
 
 //SetFocus-Method -> actually seting Focus to the Recorder
 void QmitkToFUtilView::SetFocus()
 {
   m_Controls->m_ToFRecorderWidget->setFocus();
 }
 
 //Activated-Method->Generating RenderWindow
 void QmitkToFUtilView::Activated()
 {
   //get the current RenderWindowPart or open a new one if there is none
-  if (this->GetRenderWindowPart(mitk::WorkbenchUtil::IRenderWindowPartStrategy::OPEN))
+  auto* renderWindowPart = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN);
+  if (nullptr != renderWindowPart)
   {
-    mitk::ILinkedRenderWindowPart* linkedRenderWindowPart = dynamic_cast<mitk::ILinkedRenderWindowPart*>(this->GetRenderWindowPart());
+    auto* linkedRenderWindowPart = dynamic_cast<mitk::ILinkedRenderWindowPart*>(renderWindowPart);
     if (linkedRenderWindowPart == nullptr)
     {
       MITK_ERROR << "No linked render window part avaiable!!!";
     }
     else
     {
       linkedRenderWindowPart->EnableSlicingPlanes(false);
     }
-    GetRenderWindowPart()->GetQmitkRenderWindow("axial")->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Axial);
-    GetRenderWindowPart()->GetQmitkRenderWindow("axial")->GetSliceNavigationController()->SliceLockedOn();
-    GetRenderWindowPart()->GetQmitkRenderWindow("sagittal")->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Axial);
-    GetRenderWindowPart()->GetQmitkRenderWindow("sagittal")->GetSliceNavigationController()->SliceLockedOn();
-    GetRenderWindowPart()->GetQmitkRenderWindow("coronal")->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Axial);
-    GetRenderWindowPart()->GetQmitkRenderWindow("coronal")->GetSliceNavigationController()->SliceLockedOn();
+    renderWindowPart->GetQmitkRenderWindow("axial")->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Axial);
+    renderWindowPart->GetQmitkRenderWindow("axial")->GetSliceNavigationController()->SliceLockedOn();
+    renderWindowPart->GetQmitkRenderWindow("sagittal")->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Axial);
+    renderWindowPart->GetQmitkRenderWindow("sagittal")->GetSliceNavigationController()->SliceLockedOn();
+    renderWindowPart->GetQmitkRenderWindow("coronal")->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Axial);
+    renderWindowPart->GetQmitkRenderWindow("coronal")->GetSliceNavigationController()->SliceLockedOn();
 
     mitk::RenderingManager::GetInstance()->InitializeViews();
 
     this->UseToFVisibilitySettings(true);
 
     if (this->m_ToFCompositeFilter)
     {
       m_Controls->m_ToFCompositeFilterWidget->SetToFCompositeFilter(this->m_ToFCompositeFilter);
     }
     if (this->GetDataStorage())
     {
       m_Controls->m_ToFCompositeFilterWidget->SetDataStorage(this->GetDataStorage());
     }
 
     if (this->m_ToFImageGrabber.IsNull())
     {
       m_Controls->m_ToFRecorderWidget->setEnabled(false);
       m_Controls->m_ToFVisualisationSettingsWidget->setEnabled(false);
       m_Controls->m_ToFCompositeFilterWidget->setEnabled(false);
       m_Controls->m_ToFMeasurementWidget->setEnabled(false);
       m_Controls->m_ToFSurfaceGenerationWidget->setEnabled(false);
     }
   }
 }
 
 //ZomnnieView-Method -> Resetting GUI to default. Why not just QmitkToFUtilView()?!
 void QmitkToFUtilView::ActivatedZombieView(berry::IWorkbenchPartReference::Pointer /*zombieView*/)
 {
   ResetGUIToDefault();
 }
 
 void QmitkToFUtilView::Deactivated()
 {
 }
 
 void QmitkToFUtilView::Visible()
 {
 }
 
 //Reset of the ToFUtilView
 void QmitkToFUtilView::Hidden()
 {
   ResetGUIToDefault();
 }
 
 void QmitkToFUtilView::OnToFCameraConnected()
 {
   MITK_DEBUG <<"OnToFCameraConnected";
   this->m_2DDisplayCount = 0;
 
   this->m_ToFImageGrabber = m_Controls->m_ToFConnectionWidget->GetToFImageGrabber();
 
   // initialize surface generation
   this->m_ToFDistanceImageToSurfaceFilter = mitk::ToFDistanceImageToSurfaceFilter::New();
 
   // initialize ToFImageRecorder and ToFRecorderWidget
   this->m_ToFImageRecorder = mitk::ToFImageRecorder::New();
   this->m_ToFImageRecorder->SetCameraDevice(this->m_ToFImageGrabber->GetCameraDevice());
   m_Controls->m_ToFRecorderWidget->SetParameter(this->m_ToFImageGrabber, this->m_ToFImageRecorder);
   m_Controls->m_ToFRecorderWidget->setEnabled(true);
   m_Controls->m_ToFRecorderWidget->ResetGUIToInitial();
   m_Controls->m_ToFVisualisationSettingsWidget->setEnabled(false);
 
   // initialize ToFCompositeFilterWidget
   this->m_ToFCompositeFilter = mitk::ToFCompositeFilter::New();
   if (this->m_ToFCompositeFilter)
   {
     m_Controls->m_ToFCompositeFilterWidget->SetToFCompositeFilter(this->m_ToFCompositeFilter);
   }
   if (this->GetDataStorage())
   {
     m_Controls->m_ToFCompositeFilterWidget->SetDataStorage(this->GetDataStorage());
   }
 
   if ( this->GetRenderWindowPart() )
     // initialize measurement widget
     m_Controls->m_ToFMeasurementWidget->InitializeWidget(this->GetRenderWindowPart()->GetQmitkRenderWindows(),this->GetDataStorage(), this->m_ToFDistanceImageToSurfaceFilter->GetCameraIntrinsics());
   else
     MITK_WARN << "No render window part available!!! MeasurementWidget will not work.";
 
   this->m_RealTimeClock = mitk::RealTimeClock::New();
   this->m_2DTimeBefore = this->m_RealTimeClock->GetCurrentStamp();
 
   this->RequestRenderWindowUpdate();
 }
 
 void QmitkToFUtilView::ResetGUIToDefault()
 {
-  if(this->GetRenderWindowPart())
+  auto* renderWindowPart = this->GetRenderWindowPart();
+  if(nullptr != renderWindowPart)
   {
-    mitk::ILinkedRenderWindowPart* linkedRenderWindowPart = dynamic_cast<mitk::ILinkedRenderWindowPart*>(this->GetRenderWindowPart());
+    auto* linkedRenderWindowPart = dynamic_cast<mitk::ILinkedRenderWindowPart*>(renderWindowPart);
     if(linkedRenderWindowPart == nullptr)
     {
       MITK_ERROR << "No linked render window part avaiable!!!";
     }
     else
     {
       linkedRenderWindowPart->EnableSlicingPlanes(true);
     }
-    GetRenderWindowPart()->GetQmitkRenderWindow("axial")->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Axial);
-    GetRenderWindowPart()->GetQmitkRenderWindow("axial")->GetSliceNavigationController()->SliceLockedOff();
-    GetRenderWindowPart()->GetQmitkRenderWindow("sagittal")->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Sagittal);
-    GetRenderWindowPart()->GetQmitkRenderWindow("sagittal")->GetSliceNavigationController()->SliceLockedOff();
-    GetRenderWindowPart()->GetQmitkRenderWindow("coronal")->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Frontal);
-    GetRenderWindowPart()->GetQmitkRenderWindow("coronal")->GetSliceNavigationController()->SliceLockedOff();
+    renderWindowPart->GetQmitkRenderWindow("axial")->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Axial);
+    renderWindowPart->GetQmitkRenderWindow("axial")->GetSliceNavigationController()->SliceLockedOff();
+    renderWindowPart->GetQmitkRenderWindow("sagittal")->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Sagittal);
+    renderWindowPart->GetQmitkRenderWindow("sagittal")->GetSliceNavigationController()->SliceLockedOff();
+    renderWindowPart->GetQmitkRenderWindow("coronal")->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Frontal);
+    renderWindowPart->GetQmitkRenderWindow("coronal")->GetSliceNavigationController()->SliceLockedOff();
 
     this->UseToFVisibilitySettings(false);
 
     //global reinit
     mitk::RenderingManager::GetInstance()->InitializeViews();
     this->RequestRenderWindowUpdate();
   }
 }
 
 void QmitkToFUtilView::OnToFCameraDisconnected()
 {
   this->GetDataStorage()->Remove(m_DistanceImageNode);
   if(m_RGBImageNode)
     this->GetDataStorage()->Remove(m_RGBImageNode);
   if(m_AmplitudeImageNode)
     this->GetDataStorage()->Remove(m_AmplitudeImageNode);
   if(m_IntensityImageNode)
     this->GetDataStorage()->Remove(m_IntensityImageNode);
   if(m_SurfaceNode)
     this->GetDataStorage()->Remove(m_SurfaceNode);
 
   m_Controls->m_ToFRecorderWidget->OnStop();
   m_Controls->m_ToFRecorderWidget->setEnabled(false);
   m_Controls->m_ToFVisualisationSettingsWidget->setEnabled(false);
   m_Controls->m_ToFMeasurementWidget->setEnabled(false);
   m_Controls->m_ToFSurfaceGenerationWidget->setEnabled(false);
   //clean up measurement widget
   m_Controls->m_ToFMeasurementWidget->CleanUpWidget();
 }
 
 void QmitkToFUtilView::OnKinectAcquisitionModeChanged()
 {
   if (m_ToFCompositeFilter.IsNotNull()&&m_ToFImageGrabber.IsNotNull())
   {
     if (m_SelectedCamera.contains("Kinect"))
     {
       if (m_ToFImageGrabber->GetBoolProperty("RGB"))
       {
         this->m_RGBImageNode = ReplaceNodeData("RGB image",this->m_ToFImageGrabber->GetOutput(3));
         this->m_ToFDistanceImageToSurfaceFilter->SetInput(3,this->m_ToFImageGrabber->GetOutput(3));
       }
       else if (m_ToFImageGrabber->GetBoolProperty("IR"))
       {
         this->m_MitkAmplitudeImage = m_ToFCompositeFilter->GetOutput(1);
         this->m_AmplitudeImageNode = ReplaceNodeData("Amplitude image",m_MitkAmplitudeImage);
       }
     }
     this->UseToFVisibilitySettings(true);
   }
 }
 
 void QmitkToFUtilView::OnToFCameraStarted()
 {
   if (m_ToFImageGrabber.IsNotNull())
   {
     // initialize camera intrinsics
     if (this->m_ToFImageGrabber->GetProperty("CameraIntrinsics"))
     {
       m_CameraIntrinsics = dynamic_cast<mitk::CameraIntrinsicsProperty*>(this->m_ToFImageGrabber->GetProperty("CameraIntrinsics"))->GetValue();
       MITK_INFO << m_CameraIntrinsics->ToString();
     }
     else
     {
       m_CameraIntrinsics = nullptr;
       MITK_ERROR << "No camera intrinsics were found!";
     }
 
     // set camera intrinsics
     if ( m_CameraIntrinsics.IsNotNull() )
     {
       this->m_ToFDistanceImageToSurfaceFilter->SetCameraIntrinsics(m_CameraIntrinsics);
     }
 
     // initial update of image grabber
     this->m_ToFImageGrabber->Update();
 
     bool hasRGBImage = false;
     m_ToFImageGrabber->GetCameraDevice()->GetBoolProperty("HasRGBImage",hasRGBImage);
 
     bool hasIntensityImage = false;
     m_ToFImageGrabber->GetCameraDevice()->GetBoolProperty("HasIntensityImage",hasIntensityImage);
 
     bool hasAmplitudeImage = false;
     m_ToFImageGrabber->GetCameraDevice()->GetBoolProperty("HasAmplitudeImage",hasAmplitudeImage);
 
     this->m_ToFCompositeFilter->SetInput(0,this->m_ToFImageGrabber->GetOutput(0));
     if(hasAmplitudeImage)
       this->m_ToFCompositeFilter->SetInput(1,this->m_ToFImageGrabber->GetOutput(1));
     if(hasIntensityImage)
       this->m_ToFCompositeFilter->SetInput(2,this->m_ToFImageGrabber->GetOutput(2));
 
     // initial update of composite filter
     this->m_ToFCompositeFilter->Update();
     this->m_MitkDistanceImage = m_ToFCompositeFilter->GetOutput();
     this->m_DistanceImageNode = ReplaceNodeData("Distance image",m_MitkDistanceImage);
 
     std::string rgbFileName;
     m_ToFImageGrabber->GetCameraDevice()->GetStringProperty("RGBImageFileName",rgbFileName);
 
     if(hasRGBImage || (rgbFileName!=""))
     {
       if(m_ToFImageGrabber->GetBoolProperty("IR"))
       {
         this->m_MitkAmplitudeImage = m_ToFCompositeFilter->GetOutput(1);
       }
       else
       {
         this->m_RGBImageNode = ReplaceNodeData("RGB image",this->m_ToFImageGrabber->GetOutput(3));
       }
     }
     else
     {
       this->m_RGBImageNode = nullptr;
     }
 
     if(hasAmplitudeImage)
     {
       this->m_MitkAmplitudeImage = m_ToFCompositeFilter->GetOutput(1);
       this->m_AmplitudeImageNode = ReplaceNodeData("Amplitude image",m_MitkAmplitudeImage);
     }
 
     if(hasIntensityImage)
     {
       this->m_MitkIntensityImage = m_ToFCompositeFilter->GetOutput(2);
       this->m_IntensityImageNode = ReplaceNodeData("Intensity image",m_MitkIntensityImage);
     }
 
     this->m_ToFDistanceImageToSurfaceFilter->SetInput(0,m_MitkDistanceImage);
     this->m_ToFDistanceImageToSurfaceFilter->SetInput(1,m_MitkAmplitudeImage);
     this->m_ToFDistanceImageToSurfaceFilter->SetInput(2,m_MitkIntensityImage);
 
     this->UseToFVisibilitySettings(true);
 
     this->m_SurfaceNode = ReplaceNodeData("Surface", nullptr);
     m_Controls->m_ToFCompositeFilterWidget->UpdateFilterParameter();
     // initialize visualization widget
     m_Controls->m_ToFVisualisationSettingsWidget->Initialize(this->m_DistanceImageNode,
                                                              this->m_AmplitudeImageNode,
                                                              this->m_IntensityImageNode,
                                                              this->m_SurfaceNode);
     m_Controls->m_ToFSurfaceGenerationWidget->Initialize(m_ToFDistanceImageToSurfaceFilter,
                                                          m_ToFImageGrabber,
                                                          m_CameraIntrinsics,
                                                          m_SurfaceNode,
-                                                         GetRenderWindowPart()->GetQmitkRenderWindow("3d")->GetRenderer()->GetVtkRenderer()->GetActiveCamera());
+                                                         GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetQmitkRenderWindow("3d")->GetRenderer()->GetVtkRenderer()->GetActiveCamera());
     // set distance image to measurement widget
     m_Controls->m_ToFMeasurementWidget->SetDistanceImage(m_MitkDistanceImage);
 
     this->m_Frametimer->start(50);
 
     m_Controls->m_ToFVisualisationSettingsWidget->setEnabled(true);
     m_Controls->m_ToFCompositeFilterWidget->setEnabled(true);
     m_Controls->m_ToFMeasurementWidget->setEnabled(true);
     m_Controls->m_ToFSurfaceGenerationWidget->setEnabled(true);
   }
 }
 
 void QmitkToFUtilView::OnToFCameraStopped()
 {
   m_Controls->m_ToFVisualisationSettingsWidget->setEnabled(false);
   m_Controls->m_ToFCompositeFilterWidget->setEnabled(false);
 
   this->m_Frametimer->stop();
 }
 
 void QmitkToFUtilView::OnUpdateCamera()
 {
   if(!m_Controls->m_ToFSurfaceGenerationWidget->UpdateSurface())
   {
     // update pipeline
     this->m_MitkDistanceImage->Update();
   }
 
   this->RequestRenderWindowUpdate();
 
   if (m_Framerateoutput)
   {
     this->m_2DDisplayCount++;
     if ((this->m_2DDisplayCount % this->m_StepsForFramerate) == 0)
     {
       this->m_2DTimeAfter = this->m_RealTimeClock->GetCurrentStamp() - this->m_2DTimeBefore;
       MITK_INFO << " 2D-Display-framerate (fps): " << this->m_StepsForFramerate / (this->m_2DTimeAfter / 1000);
       this->m_2DTimeBefore = this->m_RealTimeClock->GetCurrentStamp();
     }
   }
 
 }
 
 void QmitkToFUtilView::OnChangeCoronalWindowOutput(int index)
 {
   this->OnToFCameraStopped();
   if(index == 0)
   {
     if(this->m_IntensityImageNode.IsNotNull())
       this->m_IntensityImageNode->SetVisibility(false);
     if(this->m_RGBImageNode.IsNotNull())
       this->m_RGBImageNode->SetVisibility(true);
   }
   else if(index == 1)
   {
     if(this->m_IntensityImageNode.IsNotNull())
       this->m_IntensityImageNode->SetVisibility(true);
     if(this->m_RGBImageNode.IsNotNull())
       this->m_RGBImageNode->SetVisibility(false);
   }
   this->RequestRenderWindowUpdate();
   this->OnToFCameraStarted();
 }
 
 mitk::DataNode::Pointer QmitkToFUtilView::ReplaceNodeData( std::string nodeName, mitk::BaseData* data )
 {
   mitk::DataNode::Pointer node = this->GetDataStorage()->GetNamedNode(nodeName);
   if (node.IsNull())
   {
     node = mitk::DataNode::New();
     node->SetName(nodeName);
     node->SetBoolProperty("binary",false);
     node->SetData(data);
     this->GetDataStorage()->Add(node);
   }
   else
   {
     node->SetData(data);
   }
   return node;
 }
 
 void QmitkToFUtilView::UseToFVisibilitySettings(bool useToF)
 {
   //We need this property for every node.
-  mitk::RenderingModeProperty::Pointer renderingModePropertyForTransferFunction = mitk::RenderingModeProperty::New(mitk::RenderingModeProperty::COLORTRANSFERFUNCTION_COLOR);
+  auto renderingModePropertyForTransferFunction = mitk::RenderingModeProperty::New(mitk::RenderingModeProperty::COLORTRANSFERFUNCTION_COLOR);
+
+  auto* renderWindowPart = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN);
+
+  auto* axialRenderer = mitk::BaseRenderer::GetInstance(renderWindowPart->GetQmitkRenderWindow("axial")->renderWindow());
+  auto* sagittalRenderer = mitk::BaseRenderer::GetInstance(renderWindowPart->GetQmitkRenderWindow("sagittal")->renderWindow());
+  auto* coronalRenderer = mitk::BaseRenderer::GetInstance(renderWindowPart->GetQmitkRenderWindow("coronal")->renderWindow());
+  auto* threeDimRenderer = mitk::BaseRenderer::GetInstance(renderWindowPart->GetQmitkRenderWindow("3d")->renderWindow());
 
   // set node properties
   if (m_DistanceImageNode.IsNotNull())
   {
     this->m_DistanceImageNode->SetProperty( "visible" , mitk::BoolProperty::New( true ));
-    this->m_DistanceImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("sagittal")->renderWindow() ) );
-    this->m_DistanceImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("coronal")->renderWindow() ) );
-    this->m_DistanceImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("3d")->renderWindow() ) );
+    this->m_DistanceImageNode->SetVisibility( !useToF, sagittalRenderer );
+    this->m_DistanceImageNode->SetVisibility( !useToF, coronalRenderer );
+    this->m_DistanceImageNode->SetVisibility( !useToF, threeDimRenderer );
     this->m_DistanceImageNode->SetProperty("Image Rendering.Mode", renderingModePropertyForTransferFunction);
   }
   if (m_AmplitudeImageNode.IsNotNull())
   {
-    this->m_AmplitudeImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("axial")->renderWindow() ) );
-    this->m_AmplitudeImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("coronal")->renderWindow() ) );
-    this->m_AmplitudeImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("3d")->renderWindow() ) );
+    this->m_AmplitudeImageNode->SetVisibility( !useToF, axialRenderer );
+    this->m_AmplitudeImageNode->SetVisibility( !useToF, coronalRenderer );
+    this->m_AmplitudeImageNode->SetVisibility( !useToF, threeDimRenderer );
     this->m_AmplitudeImageNode->SetProperty("Image Rendering.Mode", renderingModePropertyForTransferFunction);
   }
   if (m_IntensityImageNode.IsNotNull())
   {
       this->m_IntensityImageNode->SetProperty( "visible" , mitk::BoolProperty::New( true ));
-      this->m_IntensityImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("axial")->renderWindow() ) );
-      this->m_IntensityImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("sagittal")->renderWindow() ) );
-      this->m_IntensityImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("3d")->renderWindow() ) );
+      this->m_IntensityImageNode->SetVisibility( !useToF, axialRenderer );
+      this->m_IntensityImageNode->SetVisibility( !useToF, sagittalRenderer );
+      this->m_IntensityImageNode->SetVisibility( !useToF, threeDimRenderer );
       this->m_IntensityImageNode->SetProperty("Image Rendering.Mode", renderingModePropertyForTransferFunction);
   }
   if ((m_RGBImageNode.IsNotNull()))
   {
       this->m_RGBImageNode->SetProperty( "visible" , mitk::BoolProperty::New( true ));
-      this->m_RGBImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("axial")->renderWindow() ) );
-      this->m_RGBImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("sagittal")->renderWindow() ) );
-      this->m_RGBImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("3d")->renderWindow() ) );
+      this->m_RGBImageNode->SetVisibility( !useToF, axialRenderer );
+      this->m_RGBImageNode->SetVisibility( !useToF, sagittalRenderer );
+      this->m_RGBImageNode->SetVisibility( !useToF, threeDimRenderer );
   }
   // initialize images
   if (m_MitkDistanceImage.IsNotNull())
   {
       mitk::RenderingManager::GetInstance()->InitializeViews(
           this->m_MitkDistanceImage->GetTimeGeometry(), mitk::RenderingManager::REQUEST_UPDATE_2DWINDOWS, true);
   }
   if(this->m_SurfaceNode.IsNotNull())
   {
-    QHash<QString, QmitkRenderWindow*> renderWindowHashMap = this->GetRenderWindowPart()->GetQmitkRenderWindows();
+    QHash<QString, QmitkRenderWindow*> renderWindowHashMap = renderWindowPart->GetQmitkRenderWindows();
     QHashIterator<QString, QmitkRenderWindow*> i(renderWindowHashMap);
     while (i.hasNext()){
       i.next();
       this->m_SurfaceNode->SetVisibility( false, mitk::BaseRenderer::GetInstance(i.value()->renderWindow()) );
     }
-    this->m_SurfaceNode->SetVisibility( true, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("3d")->renderWindow() ) );
+    this->m_SurfaceNode->SetVisibility( true, mitk::BaseRenderer::GetInstance(renderWindowPart->GetQmitkRenderWindow("3d")->renderWindow() ) );
   }
   //disable/enable gradient background
-  this->GetRenderWindowPart()->EnableDecorations(!useToF, QStringList(QString("background")));
+  renderWindowPart->EnableDecorations(!useToF, QStringList(QString("background")));
 
   if((this->m_RGBImageNode.IsNotNull()))
   {
     bool RGBImageHasDifferentResolution = false;
     m_ToFImageGrabber->GetCameraDevice()->GetBoolProperty("RGBImageHasDifferentResolution",RGBImageHasDifferentResolution);
     if(RGBImageHasDifferentResolution)
     {
       //update the display geometry by using the RBG image node. Only for renderwindow coronal
-      mitk::RenderingManager::GetInstance()->InitializeView( GetRenderWindowPart()->GetQmitkRenderWindow("coronal")->renderWindow(), this->m_RGBImageNode->GetData()->GetGeometry() );
+      mitk::RenderingManager::GetInstance()->InitializeView( renderWindowPart->GetQmitkRenderWindow("coronal")->renderWindow(), this->m_RGBImageNode->GetData()->GetGeometry() );
     }
   }
 }
diff --git a/Plugins/org.mitk.gui.qt.ultrasound/src/internal/QmitkUltrasoundSupport.cpp b/Plugins/org.mitk.gui.qt.ultrasound/src/internal/QmitkUltrasoundSupport.cpp
index e5291986ee..0931863ea5 100644
--- a/Plugins/org.mitk.gui.qt.ultrasound/src/internal/QmitkUltrasoundSupport.cpp
+++ b/Plugins/org.mitk.gui.qt.ultrasound/src/internal/QmitkUltrasoundSupport.cpp
@@ -1,583 +1,583 @@
 /*============================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) German Cancer Research Center (DKFZ)
 All rights reserved.
 
 Use of this source code is governed by a 3-clause BSD license that can be
 found in the LICENSE file.
 
 ============================================================================*/
 
 // Blueberry
 #include <berryISelectionService.h>
 #include <berryIWorkbenchWindow.h>
 
 //Mitk
 #include <mitkDataNode.h>
 #include <mitkNodePredicateNot.h>
 #include <mitkNodePredicateProperty.h>
 #include <mitkIRenderingManager.h>
 #include <mitkImageGenerator.h>
 
 // Qmitk
 #include "QmitkUltrasoundSupport.h"
 
 // Qt
 #include <QMessageBox>
 #include <QSettings>
 #include <QTimer>
 
 // Ultrasound
 #include "mitkUSDevice.h"
 #include "QmitkUSAbstractCustomWidget.h"
 
 #include <usModuleContext.h>
 #include <usGetModuleContext.h>
 #include "usServiceReference.h"
 #include "internal/org_mitk_gui_qt_ultrasound_Activator.h"
 
 const std::string QmitkUltrasoundSupport::VIEW_ID = "org.mitk.views.ultrasoundsupport";
 
 QmitkUltrasoundSupport::QmitkUltrasoundSupport()
   : m_Controls(nullptr), m_ControlCustomWidget(nullptr), m_ControlBModeWidget(nullptr),
   m_ControlProbesWidget(nullptr), m_ImageAlreadySetToNode(false),
   m_CurrentImageWidth(0), m_CurrentImageHeight(0)
 {
   ctkPluginContext* pluginContext = mitk::PluginActivator::GetContext();
 
   if (pluginContext)
   {
     // to be notified about service event of an USDevice
     pluginContext->connectServiceListener(this, "OnDeviceServiceEvent",
       QString::fromStdString("(" + us::ServiceConstants::OBJECTCLASS() + "=" + us_service_interface_iid<mitk::USDevice>() + ")"));
   }
 }
 
 QmitkUltrasoundSupport::~QmitkUltrasoundSupport()
 {
   try
   {
     StoreUISettings();
     StopTimers();
 
     // Get all active devicesand deactivate them to prevent freeze
     std::vector<mitk::USDevice*> devices = this->m_Controls->m_ActiveVideoDevices->GetAllServices<mitk::USDevice>();
     for (size_t i = 0; i < devices.size(); i++)
     {
       mitk::USDevice::Pointer device = devices[i];
       if (device.IsNotNull() && device->GetIsActive())
       {
         device->Deactivate();
         device->Disconnect();
       }
     }
   }
   catch (std::exception &e)
   {
     MITK_ERROR << "Exception during call of destructor! Message: " << e.what();
   }
 }
 
 void QmitkUltrasoundSupport::SetFocus()
 {
 }
 
 void QmitkUltrasoundSupport::CreateQtPartControl(QWidget *parent)
 {
   //initialize timers
   m_UpdateTimer = new QTimer(this);
   m_RenderingTimer2d = new QTimer(this);
   m_RenderingTimer3d = new QTimer(this);
 
   // build up qt view, unless already done
   if (!m_Controls)
   {
     // create GUI widgets from the Qt Designer's .ui file
     m_Controls = new Ui::UltrasoundSupportControls;
 
     // create GUI widgets from the Qt Designer's .ui file
     m_Controls->setupUi(parent);
 
     //load persistence data before connecting slots (so no slots are called in this phase...)
     LoadUISettings();
 
     //connect signals and slots...
     connect(m_Controls->m_DeviceManagerWidget, SIGNAL(NewDeviceButtonClicked()), this, SLOT(OnClickedAddNewDevice())); // Change Widget Visibilities
     connect(m_Controls->m_DeviceManagerWidget, SIGNAL(NewDeviceButtonClicked()), this->m_Controls->m_NewVideoDeviceWidget, SLOT(CreateNewDevice())); // Init NewDeviceWidget
     connect(m_Controls->m_ActiveVideoDevices, SIGNAL(ServiceSelectionChanged(us::ServiceReferenceU)), this, SLOT(OnChangedActiveDevice()));
     connect(m_Controls->m_RunImageTimer, SIGNAL(clicked()), this, SLOT(OnChangedActiveDevice()));
     connect(m_Controls->m_ShowImageStream, SIGNAL(clicked()), this, SLOT(OnChangedActiveDevice()));
     connect(m_Controls->m_NewVideoDeviceWidget, SIGNAL(Finished()), this, SLOT(OnNewDeviceWidgetDone())); // After NewDeviceWidget finished editing
     connect(m_Controls->m_FrameRatePipeline, SIGNAL(valueChanged(int)), this, SLOT(OnChangedFramerateLimit()));
     connect(m_Controls->m_FrameRate2d, SIGNAL(valueChanged(int)), this, SLOT(OnChangedFramerateLimit()));
     connect(m_Controls->m_FrameRate3d, SIGNAL(valueChanged(int)), this, SLOT(OnChangedFramerateLimit()));
     connect(m_Controls->m_FreezeButton, SIGNAL(clicked()), this, SLOT(OnClickedFreezeButton()));
     connect(m_UpdateTimer, SIGNAL(timeout()), this, SLOT(UpdateImage()));
     connect(m_RenderingTimer2d, SIGNAL(timeout()), this, SLOT(RenderImage2d()));
     connect(m_RenderingTimer3d, SIGNAL(timeout()), this, SLOT(RenderImage3d()));
     connect(m_Controls->m_Update2DView, SIGNAL(clicked()), this, SLOT(StartTimers()));
     connect(m_Controls->m_Update3DView, SIGNAL(clicked()), this, SLOT(StartTimers()));
     connect(m_Controls->m_DeviceManagerWidget, SIGNAL(EditDeviceButtonClicked(mitk::USDevice::Pointer)), this, SLOT(OnClickedEditDevice())); //Change Widget Visibilities
     connect(m_Controls->m_DeviceManagerWidget, SIGNAL(EditDeviceButtonClicked(mitk::USDevice::Pointer)), this->m_Controls->m_NewVideoDeviceWidget, SLOT(EditDevice(mitk::USDevice::Pointer)));
 
     connect(m_Controls->m_SetXPoint1, SIGNAL(clicked()), this, SLOT(SetXPoint1()));
     connect(m_Controls->m_SetXPoint2, SIGNAL(clicked()), this, SLOT(SetXPoint2()));
     connect(m_Controls->m_SetYPoint1, SIGNAL(clicked()), this, SLOT(SetYPoint1()));
     connect(m_Controls->m_SetYPoint2, SIGNAL(clicked()), this, SLOT(SetYPoint2()));
     connect(m_Controls->m_SaveSpacing, SIGNAL(clicked()), this, SLOT(WriteSpacingToDevice()));
 
 
     // Initializations
     m_Controls->m_NewVideoDeviceWidget->setVisible(false);
     std::string filter = "(&(" + us::ServiceConstants::OBJECTCLASS() + "="
       + "org.mitk.services.UltrasoundDevice)("
       + mitk::USDevice::GetPropertyKeys().US_PROPKEY_ISACTIVE + "=true))";
     m_Controls->m_ActiveVideoDevices->Initialize<mitk::USDevice>(
       mitk::USDevice::GetPropertyKeys().US_PROPKEY_LABEL, filter);
     m_Controls->m_ActiveVideoDevices->SetAutomaticallySelectFirstEntry(true);
     m_FrameCounterPipeline = 0;
     m_FrameCounter2d = 0;
     m_FrameCounter3d = 0;
 
     m_Controls->tabWidget->setTabEnabled(1, false);
   }
 }
 
 void QmitkUltrasoundSupport::OnClickedAddNewDevice()
 {
   m_Controls->m_NewVideoDeviceWidget->setVisible(true);
   m_Controls->m_DeviceManagerWidget->setVisible(false);
   m_Controls->m_Headline->setText("Add New Video Device:");
   m_Controls->m_WidgetActiveDevices->setVisible(false);
 }
 
 void QmitkUltrasoundSupport::OnClickedEditDevice()
 {
   m_Controls->m_NewVideoDeviceWidget->setVisible(true);
   m_Controls->m_DeviceManagerWidget->setVisible(false);
   m_Controls->m_WidgetActiveDevices->setVisible(false);
   m_Controls->m_Headline->setText("Edit Video Device:");
 }
 
 void QmitkUltrasoundSupport::UpdateImage()
 {
   //Update device
   m_Device->Modified();
   m_Device->Update();
 
 
   //Only update the view if the image is shown
   if (m_Controls->m_ShowImageStream->isChecked())
   {
     //Update data nodes
     for (size_t i = 0; i < m_AmountOfOutputs; i++)
     {
       mitk::Image::Pointer curOutput = m_Device->GetOutput(i);
       if (curOutput->IsEmpty())
       {
         m_Node.at(i)->SetName("No Data received yet ...");
         //create a noise image for correct initialization of level window, etc.
         mitk::Image::Pointer randomImage = mitk::ImageGenerator::GenerateRandomImage<float>(32, 32, 1, 1, 1, 1, 1, 255, 0);
         m_Node.at(i)->SetData(randomImage);
         curOutput->SetGeometry(randomImage->GetGeometry());
       }
       else
       {
         std::stringstream nodeName;
         nodeName << "US Viewing Stream - Image " << i;
         m_Node.at(i)->SetName(nodeName.str());
         m_Node.at(i)->SetData(curOutput);
         m_Node.at(i)->Modified();
       }
       // if the geometry changed: reinitialize the ultrasound image
       if ((i==0) && (m_OldGeometry.IsNotNull()) &&
         (curOutput->GetGeometry() != nullptr) &&
         (!mitk::Equal(*(m_OldGeometry.GetPointer()), *(curOutput->GetGeometry()), 0.0001, false))
         )
       {
         mitk::IRenderWindowPart* renderWindow = this->GetRenderWindowPart();
         if ((renderWindow != nullptr) && (curOutput->GetTimeGeometry()->IsValid()) && (m_Controls->m_ShowImageStream->isChecked()))
         {
           renderWindow->GetRenderingManager()->InitializeViews(
             curOutput->GetGeometry(), mitk::RenderingManager::REQUEST_UPDATE_ALL, true);
           renderWindow->GetRenderingManager()->RequestUpdateAll();
         }
         m_CurrentImageWidth = curOutput->GetDimension(0);
         m_CurrentImageHeight = curOutput->GetDimension(1);
         m_OldGeometry = dynamic_cast<mitk::SlicedGeometry3D*>(curOutput->GetGeometry());
       }
     }
   }
 
 
 
   //Update frame counter
   m_FrameCounterPipeline++;
   if (m_FrameCounterPipeline >0)
   {
     //compute framerate of pipeline update
     int nMilliseconds = m_Clock.restart();
     int fps = 1000.0 / nMilliseconds;
     m_FPSPipeline = fps;
     m_FrameCounterPipeline = 0;
 
     //display lowest framerate in UI
     int lowestFPS = m_FPSPipeline;
     if (m_Controls->m_Update2DView->isChecked() && (m_FPS2d < lowestFPS)) { lowestFPS = m_FPS2d; }
     if (m_Controls->m_Update3DView->isChecked() && (m_FPS3d < lowestFPS)) { lowestFPS = m_FPS3d; }
     m_Controls->m_FramerateLabel->setText("Current Framerate: " + QString::number(lowestFPS) + " FPS");
   }
 }
 
 void QmitkUltrasoundSupport::RenderImage2d()
 {
   if (!m_Controls->m_Update2DView->isChecked())
     return;
 
   this->RequestRenderWindowUpdate(mitk::RenderingManager::REQUEST_UPDATE_2DWINDOWS);
   m_FrameCounter2d++;
   if (m_FrameCounter2d >0)
   {
     //compute framerate of 2d render window update
     int nMilliseconds = m_Clock2d.restart();
     int fps = 1000.0f / (nMilliseconds);
     m_FPS2d = fps;
     m_FrameCounter2d = 0;
   }
 }
 
 void QmitkUltrasoundSupport::RenderImage3d()
 {
   if (!m_Controls->m_Update3DView->isChecked())
     return;
 
   this->RequestRenderWindowUpdate(mitk::RenderingManager::REQUEST_UPDATE_3DWINDOWS);
   m_FrameCounter3d++;
   if (m_FrameCounter3d >0)
   {
     //compute framerate of 2d render window update
     int nMilliseconds = m_Clock3d.restart();
     int fps = 1000.0f / (nMilliseconds);
     m_FPS3d = fps;
     m_FrameCounter3d = 0;
   }
 }
 
 void QmitkUltrasoundSupport::OnChangedFramerateLimit()
 {
   StopTimers();
   int intervalPipeline = (1000 / m_Controls->m_FrameRatePipeline->value());
   int interval2D = (1000 / m_Controls->m_FrameRate2d->value());
   int interval3D = (1000 / m_Controls->m_FrameRate3d->value());
   SetTimerIntervals(intervalPipeline, interval2D, interval3D);
   StartTimers();
 }
 
 void QmitkUltrasoundSupport::OnClickedFreezeButton()
 {
   if (m_Device.IsNull())
   {
     MITK_WARN("UltrasoundSupport") << "Freeze button clicked though no device is selected.";
     return;
   }
   if (m_Device->GetIsFreezed())
   {
     m_Device->SetIsFreezed(false);
     m_Controls->m_FreezeButton->setText("Freeze");
   }
   else
   {
     m_Device->SetIsFreezed(true);
     m_Controls->m_FreezeButton->setText("Start Viewing Again");
   }
 }
 
 void QmitkUltrasoundSupport::OnChangedActiveDevice()
 {
   //clean up and stop timer
   StopTimers();
   this->RemoveControlWidgets();
   for (size_t j = 0; j < m_Node.size(); j++)
   {
     this->GetDataStorage()->Remove(m_Node.at(j));
     m_Node.at(j)->ReleaseData();
   }
   m_Node.clear();
   //get current device, abort if it is invalid
   m_Device = m_Controls->m_ActiveVideoDevices->GetSelectedService<mitk::USDevice>();
   if (m_Device.IsNull())
   {
     m_Controls->tabWidget->setTabEnabled(1, false);
     return;
   }
   m_AmountOfOutputs = m_Device->GetNumberOfIndexedOutputs();
   // clear data storage, create new nodes and add
   for (size_t i = 0; i < m_AmountOfOutputs; i++)
   {
     mitk::DataNode::Pointer currentNode = mitk::DataNode::New();
     std::stringstream nodeName;
     nodeName << "US Viewing Stream - Image " << i;
     currentNode->SetName(nodeName.str());
     //create a dummy image (gray values 0..255) for correct initialization of level window, etc.
     mitk::Image::Pointer dummyImage = mitk::ImageGenerator::GenerateRandomImage<float>(100, 100, 1, 1, 1, 1, 1, 255, 0);
     currentNode->SetData(dummyImage);
     m_OldGeometry = dynamic_cast<mitk::SlicedGeometry3D*>(dummyImage->GetGeometry());
     m_Node.push_back(currentNode);
     //show node if the option is enabled
     if (m_Controls->m_ShowImageStream->isChecked())
     {
         this->GetDataStorage()->Add(m_Node.at(i));
     }
   }
 
   //create the widgets for this device and enable the widget tab
   this->CreateControlWidgets();
   m_Controls->tabWidget->setTabEnabled(1, true);
 
   //start timer
   if (m_Controls->m_RunImageTimer->isChecked())
   {
     int intervalPipeline = (1000 / m_Controls->m_FrameRatePipeline->value());
     int interval2D = (1000 / m_Controls->m_FrameRate2d->value());
     int interval3D = (1000 / m_Controls->m_FrameRate3d->value());
     SetTimerIntervals(intervalPipeline, interval2D, interval3D);
     StartTimers();
     m_Controls->m_TimerWidget->setEnabled(true);
   }
   else
   {
     m_Controls->m_TimerWidget->setEnabled(false);
   }
 }
 
 void QmitkUltrasoundSupport::OnNewDeviceWidgetDone()
 {
   m_Controls->m_NewVideoDeviceWidget->setVisible(false);
   m_Controls->m_DeviceManagerWidget->setVisible(true);
   m_Controls->m_Headline->setText("Ultrasound Devices:");
   m_Controls->m_WidgetActiveDevices->setVisible(true);
 }
 
 void QmitkUltrasoundSupport::CreateControlWidgets()
 {
   m_ControlProbesWidget = new QmitkUSControlsProbesWidget(m_Device->GetControlInterfaceProbes(), m_Controls->m_ToolBoxControlWidgets);
   m_Controls->probesWidgetContainer->addWidget(m_ControlProbesWidget);
 
   // create b mode widget for current device
   m_ControlBModeWidget = new QmitkUSControlsBModeWidget(m_Device->GetControlInterfaceBMode(), m_Controls->m_ToolBoxControlWidgets);
   m_Controls->m_ToolBoxControlWidgets->addItem(m_ControlBModeWidget, "B Mode Controls");
   if (!m_Device->GetControlInterfaceBMode())
   {
     m_Controls->m_ToolBoxControlWidgets->setItemEnabled(m_Controls->m_ToolBoxControlWidgets->count() - 1, false);
   }
 
   // create doppler widget for current device
   m_ControlDopplerWidget = new QmitkUSControlsDopplerWidget(m_Device->GetControlInterfaceDoppler(), m_Controls->m_ToolBoxControlWidgets);
   m_Controls->m_ToolBoxControlWidgets->addItem(m_ControlDopplerWidget, "Doppler Controls");
   if (!m_Device->GetControlInterfaceDoppler())
   {
     m_Controls->m_ToolBoxControlWidgets->setItemEnabled(m_Controls->m_ToolBoxControlWidgets->count() - 1, false);
   }
 
   ctkPluginContext* pluginContext = mitk::PluginActivator::GetContext();
   if (pluginContext)
   {
     std::string filter = "(org.mitk.services.UltrasoundCustomWidget.deviceClass=" + m_Device->GetDeviceClass() + ")";
     //Hint: The following three lines are a workaround. Till now the only US video device was an USVideoDevice.
     // And everything worked fine. However, the ultrasound image source can be an USIGTLDevice (IGTL Client), as well.
     // This second option wasn't considered yet. So, the custom control widget will work correctly only, if
     // the filter declares the device class as org.mitk.modules.us.USVideoDevice. Another option, how to deal with
     // the two possible ultrasound image devices would be to change the returned string of the method
     // std::string QmitkUSControlsCustomVideoDeviceWidget::GetDeviceClass(), which always returns the string
     // org.mitk.modules.us.USVideoDevice of the USVideoDevice class. If there is a possility to change the
     // returned string dynamically between "IGTL Client" and "org.mitk.modules.us.USVideoDevice" the following
     // three lines will not be needed.
     if (m_Device->GetDeviceClass().compare("IGTL Client") == 0)
     {
       filter = "(org.mitk.services.UltrasoundCustomWidget.deviceClass=" + mitk::USVideoDevice::GetDeviceClassStatic() + ")";
     }
 
     QString interfaceName = QString::fromStdString(us_service_interface_iid<QmitkUSAbstractCustomWidget>());
     m_CustomWidgetServiceReference = pluginContext->getServiceReferences(interfaceName, QString::fromStdString(filter));
 
     if (m_CustomWidgetServiceReference.size() > 0)
     {
       m_ControlCustomWidget = pluginContext->getService<QmitkUSAbstractCustomWidget>
         (m_CustomWidgetServiceReference.at(0))->CloneForQt(m_Controls->tab2);
       m_ControlCustomWidget->SetDevice(m_Device);
       m_Controls->m_ToolBoxControlWidgets->addItem(m_ControlCustomWidget, "Custom Controls");
     }
     else
     {
       m_Controls->m_ToolBoxControlWidgets->addItem(new QWidget(m_Controls->m_ToolBoxControlWidgets), "Custom Controls");
       m_Controls->m_ToolBoxControlWidgets->setItemEnabled(m_Controls->m_ToolBoxControlWidgets->count() - 1, false);
     }
   }
 
   // select first enabled control widget
   for (int n = 0; n < m_Controls->m_ToolBoxControlWidgets->count(); ++n)
   {
     if (m_Controls->m_ToolBoxControlWidgets->isItemEnabled(n))
     {
       m_Controls->m_ToolBoxControlWidgets->setCurrentIndex(n);
       break;
     }
   }
 }
 
 void QmitkUltrasoundSupport::RemoveControlWidgets()
 {
   if (!m_ControlProbesWidget) { return; } //widgets do not exist... nothing to do
 
   // remove all control widgets from the tool box widget
   while (m_Controls->m_ToolBoxControlWidgets->count() > 0)
   {
     m_Controls->m_ToolBoxControlWidgets->removeItem(0);
   }
 
   // remove probes widget (which is not part of the tool box widget)
   m_Controls->probesWidgetContainer->removeWidget(m_ControlProbesWidget);
   delete m_ControlProbesWidget;
   m_ControlProbesWidget = nullptr;
 
   delete m_ControlBModeWidget;
   m_ControlBModeWidget = nullptr;
 
   delete m_ControlDopplerWidget;
   m_ControlDopplerWidget = nullptr;
 
   // delete custom widget if it is present
   if (m_ControlCustomWidget)
   {
     ctkPluginContext* pluginContext = mitk::PluginActivator::GetContext();
     delete m_ControlCustomWidget; m_ControlCustomWidget = nullptr;
     if (m_CustomWidgetServiceReference.size() > 0)
     {
       pluginContext->ungetService(m_CustomWidgetServiceReference.at(0));
     }
   }
 }
 
 void QmitkUltrasoundSupport::OnDeviceServiceEvent(const ctkServiceEvent event)
 {
   if (m_Device.IsNull() || event.getType() != ctkServiceEvent::MODIFIED)
   {
     return;
   }
 
   ctkServiceReference service = event.getServiceReference();
 
   if (m_Device->GetManufacturer() != service.getProperty(QString::fromStdString(mitk::USDevice::GetPropertyKeys().US_PROPKEY_MANUFACTURER)).toString().toStdString()
     && m_Device->GetName() != service.getProperty(QString::fromStdString(mitk::USDevice::GetPropertyKeys().US_PROPKEY_NAME)).toString().toStdString())
   {
     return;
   }
 
   if (!m_Device->GetIsActive() && m_UpdateTimer->isActive())
   {
     StopTimers();
   }
 
   if (m_CurrentDynamicRange != service.getProperty(QString::fromStdString(mitk::USDevice::GetPropertyKeys().US_PROPKEY_BMODE_DYNAMIC_RANGE)).toDouble())
   {
     m_CurrentDynamicRange = service.getProperty(QString::fromStdString(mitk::USDevice::GetPropertyKeys().US_PROPKEY_BMODE_DYNAMIC_RANGE)).toDouble();
 
     // update level window for the current dynamic range
     mitk::LevelWindow levelWindow;
     m_Node.at(0)->GetLevelWindow(levelWindow);
     levelWindow.SetAuto(m_curOutput.at(0), true, true);
     m_Node.at(0)->SetLevelWindow(levelWindow);
   }
 }
 
 void QmitkUltrasoundSupport::StoreUISettings()
 {
   QSettings settings;
   settings.beginGroup(QString::fromStdString(VIEW_ID));
   settings.setValue("DisplayImage", QVariant(m_Controls->m_ShowImageStream->isChecked()));
   settings.setValue("RunImageTimer", QVariant(m_Controls->m_RunImageTimer->isChecked()));
   settings.setValue("Update2DView", QVariant(m_Controls->m_Update2DView->isChecked()));
   settings.setValue("Update3DView", QVariant(m_Controls->m_Update3DView->isChecked()));
   settings.setValue("UpdateRatePipeline", QVariant(m_Controls->m_FrameRatePipeline->value()));
   settings.setValue("UpdateRate2d", QVariant(m_Controls->m_FrameRate2d->value()));
   settings.setValue("UpdateRate3d", QVariant(m_Controls->m_FrameRate3d->value()));
   settings.endGroup();
 }
 
 void QmitkUltrasoundSupport::LoadUISettings()
 {
   QSettings settings;
   settings.beginGroup(QString::fromStdString(VIEW_ID));
   m_Controls->m_ShowImageStream->setChecked(settings.value("DisplayImage", true).toBool());
   m_Controls->m_RunImageTimer->setChecked(settings.value("RunImageTimer", true).toBool());
   m_Controls->m_Update2DView->setChecked(settings.value("Update2DView", true).toBool());
   m_Controls->m_Update3DView->setChecked(settings.value("Update3DView", true).toBool());
   m_Controls->m_FrameRatePipeline->setValue(settings.value("UpdateRatePipeline", 50).toInt());
   m_Controls->m_FrameRate2d->setValue(settings.value("UpdateRate2d", 20).toInt());
   m_Controls->m_FrameRate3d->setValue(settings.value("UpdateRate3d", 5).toInt());
   settings.endGroup();
 }
 
 void QmitkUltrasoundSupport::StartTimers()
 {
   m_Clock.start();
   m_UpdateTimer->start();
   if (m_Controls->m_Update2DView->isChecked()) { m_RenderingTimer2d->start(); }
   if (m_Controls->m_Update3DView->isChecked()) { m_RenderingTimer3d->start(); }
 }
 
 void QmitkUltrasoundSupport::StopTimers()
 {
   m_UpdateTimer->stop();
   m_RenderingTimer2d->stop();
   m_RenderingTimer3d->stop();
 }
 
 void QmitkUltrasoundSupport::SetTimerIntervals(int intervalPipeline, int interval2D, int interval3D)
 {
   m_UpdateTimer->setInterval(intervalPipeline);
   m_RenderingTimer2d->setInterval(interval2D);
   m_RenderingTimer3d->setInterval(interval3D);
 }
 
 
 /* Spacing methods */
 void QmitkUltrasoundSupport::SetXPoint1()
 {
-  m_Xpoint1 = this->GetRenderWindowPart()->GetSelectedPosition();
+  m_Xpoint1 = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetSelectedPosition();
   m_XSpacing = ComputeSpacing(m_Xpoint1, m_Xpoint2, m_Controls->m_XDistance->value());
   m_Controls->m_XSpacing->setText(QString("X Spacing: ") + QString::number(m_XSpacing) + " mm");
 }
 void QmitkUltrasoundSupport::SetXPoint2()
 {
-  m_Xpoint2 = this->GetRenderWindowPart()->GetSelectedPosition();
+  m_Xpoint2 = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetSelectedPosition();
   m_XSpacing = ComputeSpacing(m_Xpoint1, m_Xpoint2, m_Controls->m_XDistance->value());
   m_Controls->m_XSpacing->setText(QString("X Spacing: ") + QString::number(m_XSpacing) + " mm");
 }
 void QmitkUltrasoundSupport::SetYPoint1()
 {
-  m_Ypoint1 = this->GetRenderWindowPart()->GetSelectedPosition();
+  m_Ypoint1 = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetSelectedPosition();
   m_YSpacing = ComputeSpacing(m_Ypoint1, m_Ypoint2, m_Controls->m_YDistance->value());
   m_Controls->m_YSpacing->setText(QString("Y Spacing: ") + QString::number(m_YSpacing) + " mm");
 }
 void QmitkUltrasoundSupport::SetYPoint2()
 {
-  m_Ypoint2 = this->GetRenderWindowPart()->GetSelectedPosition();
+  m_Ypoint2 = this->GetRenderWindowPart(mitk::WorkbenchUtil::OPEN)->GetSelectedPosition();
   m_YSpacing = ComputeSpacing(m_Ypoint1, m_Ypoint2, m_Controls->m_YDistance->value());
   m_Controls->m_YSpacing->setText(QString("Y Spacing: ") + QString::number(m_YSpacing) + " mm");
 }
 void QmitkUltrasoundSupport::WriteSpacingToDevice()
 {
   this->m_Device->SetSpacing(m_XSpacing, m_YSpacing);
   MITK_INFO << "Spacing saved to device object, please save device data to permanently store the spacing.";
 }
 double QmitkUltrasoundSupport::ComputeSpacing(mitk::Point3D p1, mitk::Point3D p2, double distance)
 {
   double spacing = 0;
   double pointDistance = p1.EuclideanDistanceTo(p2);
   spacing = distance / pointDistance;
   return spacing;
 }