diff --git a/Plugins/org.mitk.gui.qt.cmdlinemodules/src/internal/QmitkCmdLineModuleProgressWidget.cpp b/Plugins/org.mitk.gui.qt.cmdlinemodules/src/internal/QmitkCmdLineModuleProgressWidget.cpp
index cb6dd79e02..6bd4788c17 100644
--- a/Plugins/org.mitk.gui.qt.cmdlinemodules/src/internal/QmitkCmdLineModuleProgressWidget.cpp
+++ b/Plugins/org.mitk.gui.qt.cmdlinemodules/src/internal/QmitkCmdLineModuleProgressWidget.cpp
@@ -1,564 +1,599 @@
 /*===================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) University College London (UCL).
 All rights reserved.
 
 This software is distributed WITHOUT ANY WARRANTY; without
 even the implied warranty of MERCHANTABILITY or FITNESS FOR
 A PARTICULAR PURPOSE.
 
 See LICENSE.txt or http://www.mitk.org for details.
 
 ===================================================================*/
 
 #include "QmitkCmdLineModuleProgressWidget.h"
 #include "ui_QmitkCmdLineModuleProgressWidget.h"
 
 // Qt
 #include <QFile>
 #include <QFileInfo>
 #include <QDir>
 #include <QMessageBox>
 #include <QVBoxLayout>
 #include <QLayoutItem>
 #include <QTextBrowser>
 #include <QByteArray>
 #include <QApplication>
+#include <QRegExp>
 
 // CTK
 #include <ctkCmdLineModuleFuture.h>
 #include <ctkCmdLineModuleFutureWatcher.h>
 #include <ctkCmdLineModuleManager.h>
 #include <ctkCmdLineModuleFrontend.h>
 #include <ctkCmdLineModuleDescription.h>
 #include <ctkCmdLineModuleParameter.h>
 #include <ctkCollapsibleGroupBox.h>
 
 // MITK
 #include <mitkIOUtil.h>
 #include <mitkDataStorage.h>
 #include <mitkDataNode.h>
 #include <QmitkCommonFunctionality.h>
 #include <QmitkCustomVariants.h>
 #include "QmitkCmdLineModuleGui.h"
 
 //-----------------------------------------------------------------------------
 QmitkCmdLineModuleProgressWidget::QmitkCmdLineModuleProgressWidget(QWidget *parent)
   : QWidget(parent)
 , m_ModuleManager(NULL)
 , m_DataStorage(NULL)
 , m_TemporaryDirectoryName("")
 , m_UI(new Ui::QmitkCmdLineModuleProgressWidget)
 , m_Layout(NULL)
 , m_ModuleFrontEnd(NULL)
 , m_FutureWatcher(NULL)
 {
   m_UI->setupUi(this);
   m_UI->m_RemoveButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_TitleBarCloseButton));
 
   m_Layout = new QVBoxLayout();
   m_Layout->setContentsMargins(0,0,0,0);
   m_Layout->setSpacing(0);
   m_UI->m_ParametersGroupBox->setLayout(m_Layout);
 
   qRegisterMetaType<mitk::DataNode::Pointer>();
   qRegisterMetaType<ctkCmdLineModuleReference>();
 
   connect(m_UI->m_RemoveButton, SIGNAL(clicked()), this, SLOT(OnRemoveButtonClicked()));
 
   // Due to Qt bug 12152, we cannot listen to the "paused" signal because it is
   // not emitted directly when the QFuture is paused. Instead, it is emitted after
   // resuming the future, after the "resume" signal has been emitted... we use
   // a polling approach instead.
   connect(&m_PollPauseTimer, SIGNAL(timeout()), SLOT(OnCheckModulePaused()));
   m_PollPauseTimer.setInterval(300);
   m_PollPauseTimer.start();
 }
 
 
 //-----------------------------------------------------------------------------
 QmitkCmdLineModuleProgressWidget::~QmitkCmdLineModuleProgressWidget()
 {
   if (m_ModuleFrontEnd != NULL)
   {
     delete m_ModuleFrontEnd;
   }
 
   this->ClearUpTemporaryFiles();
 
   delete m_UI;
 }
 
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::SetManager(ctkCmdLineModuleManager* manager)
 {
   this->m_ModuleManager = manager;
 }
 
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::SetDataStorage(mitk::DataStorage* dataStorage)
 {
   this->m_DataStorage = dataStorage;
 }
 
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::SetTemporaryDirectory(const QString& directoryName)
 {
   this->m_TemporaryDirectoryName = directoryName;
 }
 
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::SetOutputDirectory(const QString& directoryName)
 {
   this->m_OutputDirectoryName = directoryName;
 }
 
 
 //-----------------------------------------------------------------------------
 QString QmitkCmdLineModuleProgressWidget::GetTitle()
 {
   assert(m_ModuleFrontEnd);
 
   ctkCmdLineModuleReference reference = m_ModuleFrontEnd->moduleReference();
   ctkCmdLineModuleDescription description = reference.description();
 
   return description.title();
 }
 
 
 //-----------------------------------------------------------------------------
 QString QmitkCmdLineModuleProgressWidget::GetFullName() const
 {
   assert(m_ModuleFrontEnd);
 
   ctkCmdLineModuleReference reference = m_ModuleFrontEnd->moduleReference();
   ctkCmdLineModuleDescription description = reference.description();
 
   return description.categoryDotTitle();
 }
 
 
+//-----------------------------------------------------------------------------
+QString QmitkCmdLineModuleProgressWidget::GetValidNodeName(const QString& nodeName)
+{
+  QString outputName = nodeName;
+
+  // We will allow A-Z, a-z, 0-9, period, hyphen and underscore in the output file name.
+  // This method is parsing a node name, and other bits of code add on a file extension .nii.
+  // So, in the output string from this function, we should not allow period, so that
+  // the second recommendation on this page:
+  // http://www.boost.org/doc/libs/1_43_0/libs/filesystem/doc/portability_guide.htm
+  // is still true.
+
+  QRegExp rx("[A-Z|a-z|0-9|-|_]{1,1}");
+
+  QString singleLetter;
+
+  for (int i = 0; i < outputName.size(); i++)
+  {
+    if (i == 0 && outputName[i] == '-')
+    {
+      outputName[i] = '_';
+    }
+
+    singleLetter = outputName[i];
+
+    if (!rx.exactMatch(singleLetter))
+    {
+      outputName[i] = '-';
+    }
+  }
+  return outputName;
+}
+
+
 //-----------------------------------------------------------------------------
 bool QmitkCmdLineModuleProgressWidget::IsStarted() const
 {
   bool isStarted = false;
   if (m_FutureWatcher != NULL && m_FutureWatcher->isStarted())
   {
     isStarted = true;
   }
   return isStarted;
 }
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::OnCheckModulePaused()
 {
   if (!this->IsStarted())
   {
     return;
   }
 
   if (this->m_FutureWatcher->future().isPaused())
   {
     if (!m_UI->m_PauseButton->isChecked())
     {
       m_UI->m_PauseButton->setChecked(true);
     }
   }
   else
   {
     if (m_UI->m_PauseButton->isChecked())
     {
       m_UI->m_PauseButton->setChecked(false);
     }
   }
 }
 
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::OnPauseButtonToggled(bool toggled)
 {
   this->m_FutureWatcher->setPaused(toggled);
 
   if (toggled)
   {
     this->m_UI->m_ProgressTitle->setText(this->GetTitle() + ": paused");
   }
   else
   {
     this->m_UI->m_ProgressTitle->setText(this->GetTitle() + ": resumed");
   }
 }
 
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::OnRemoveButtonClicked()
 {
   this->deleteLater();
 }
 
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::OnModuleStarted()
 {
   this->m_UI->m_ProgressBar->setMaximum(0);
 
   QString message = "started.";
   this->PublishMessage(message);
 
   emit started();
 }
 
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::OnModuleCanceled()
 {
   QString message = "cancelling.";
   this->PublishMessage(message);
 
   this->m_UI->m_PauseButton->setEnabled(false);
   this->m_UI->m_PauseButton->setChecked(false);
   this->m_UI->m_CancelButton->setEnabled(false);
   this->m_UI->m_RemoveButton->setEnabled(true);
 
   this->m_UI->m_ParametersGroupBox->setCollapsed(true);
   this->m_UI->m_ConsoleGroupBox->setCollapsed(true);
   this->m_UI->m_ProgressTitle->setText(this->GetTitle() + ": cancelled");
 
   message = "cancelled.";
   this->PublishMessage(message);
 }
 
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::OnModuleFinished()
 {
   this->m_UI->m_PauseButton->setEnabled(false);
   this->m_UI->m_PauseButton->setChecked(false);
   this->m_UI->m_CancelButton->setEnabled(false);
   this->m_UI->m_RemoveButton->setEnabled(true);
 
   if (!this->m_FutureWatcher->isCanceled())
   {
     QString message = "finishing.";
     this->PublishMessage(message);
 
     // If no incremental results from stdout, try getting hold of the whole buffer and printing it.
     if (m_OutputCount == 0)
     {
       message = "Output channel is:";
       this->PublishMessage(message);
       this->PublishByteArray(this->m_FutureWatcher->readAllOutputData());
     }
 
     // If no incremental results from stderr, try getting hold of the whole buffer and printing it.
     if (m_ErrorCount == 0)
     {
       message = "Error channel is:";
       this->PublishMessage(message);
       this->PublishByteArray(this->m_FutureWatcher->readAllErrorData());
     }
 
     this->m_UI->m_ProgressTitle->setText(this->GetTitle() + ": finished");
 
     this->LoadOutputData();
     this->ClearUpTemporaryFiles();
 
     message = "finished.";
     this->PublishMessage(message);
 
   }
 
   emit finished();
 }
 
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::OnModuleResumed()
 {
   this->m_UI->m_PauseButton->setChecked(false);
 }
 
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::OnModuleProgressRangeChanged(int progressMin, int progressMax)
 {
   this->m_UI->m_ProgressBar->setMinimum(progressMin);
   this->m_UI->m_ProgressBar->setMaximum(progressMax);
 }
 
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::OnModuleProgressTextChanged(const QString& progressText)
 {
   this->m_UI->m_Console->appendPlainText(progressText);
 }
 
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::OnModuleProgressValueChanged(int progressValue)
 {
   this->m_UI->m_ProgressBar->setValue(progressValue);
 }
 
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::OnOutputDataReady()
 {
   m_OutputCount++;
   this->PublishByteArray(this->m_FutureWatcher->readPendingOutputData());
 }
 
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::OnErrorDataReady()
 {
   m_ErrorCount++;
   this->PublishByteArray(this->m_FutureWatcher->readPendingErrorData());
 }
 
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::PublishMessage(const QString& message)
 {
   QString prefix = ""; // Can put additional prefix here if needed.
   QString outputMessage = prefix + message;
 
   qDebug() << outputMessage;
   this->m_UI->m_Console->appendPlainText(outputMessage);
 }
 
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::PublishByteArray(const QByteArray& array)
 {
   QString message = array.data();
   this->PublishMessage(message);
 }
 
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::ClearUpTemporaryFiles()
 {
   QString message;
   QString fileName;
 
   foreach (fileName, m_TemporaryFileNames)
   {
     QFile file(fileName);
     if (file.exists())
     {
       message = QObject::tr("removing %1").arg(fileName);
       this->PublishMessage(message);
 
       bool success = file.remove();
 
       message = QObject::tr("removed %1, successfully=%2").arg(fileName).arg(success);
       this->PublishMessage(message);
     }
   }
 }
 
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::LoadOutputData()
 {
   assert(m_DataStorage);
 
   std::vector<std::string> fileNames;
 
   QString fileName;
   foreach (fileName, m_OutputDataToLoad)
   {
     QString message = QObject::tr("loading %1").arg(fileName);
     this->PublishMessage(message);
 
     fileNames.push_back(fileName.toStdString());
   }
 
   if (fileNames.size() > 0)
   {
     int numberLoaded = mitk::IOUtil::LoadFiles(fileNames, *(m_DataStorage));
 
     QString message = QObject::tr("loaded %1 files").arg(numberLoaded);
     this->PublishMessage(message);
   }
 }
 
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::SetFrontend(QmitkCmdLineModuleGui* frontEnd)
 {
   assert(frontEnd);
   assert(m_ModuleManager);
   assert(m_DataStorage);
 
   // We are assuming that this method is ONLY EVER CALLED ONCE.
   assert(!m_ModuleFrontEnd);
 
   // Assign the frontEnd to the member variable.
   m_ModuleFrontEnd = frontEnd;
 
   // We put the new GUI into the layout.
   m_Layout->insertWidget(0, m_ModuleFrontEnd->getGui());
 
   // And configure a few other niceties.
   m_UI->m_ProgressTitle->setText(this->GetTitle());
   m_UI->m_ConsoleGroupBox->setCollapsed(true);     // We basically call SetFrontend then Run
   m_UI->m_ParametersGroupBox->setCollapsed(true);  // so in practice the user will only want the progress bar.
 }
 
 
 //-----------------------------------------------------------------------------
 void QmitkCmdLineModuleProgressWidget::Run()
 {
   assert(m_ModuleManager);
   assert(m_DataStorage);
   assert(m_ModuleFrontEnd);
 
   m_OutputDataToLoad.clear();
 
   QString parameterName;
   QString message;
   QList<ctkCmdLineModuleParameter> parameters;
 
   ctkCmdLineModuleReference reference = m_ModuleFrontEnd->moduleReference();
   ctkCmdLineModuleDescription description = reference.description();
 
   // Check we have valid output. If at all possible, they should be somewhere writable.
 
   parameters = m_ModuleFrontEnd->parameters("image", ctkCmdLineModuleFrontend::Output);
   parameters << m_ModuleFrontEnd->parameters("file", ctkCmdLineModuleFrontend::Output);
   parameters << m_ModuleFrontEnd->parameters("geometry", ctkCmdLineModuleFrontend::Output);
 
   foreach (ctkCmdLineModuleParameter parameter, parameters)
   {
     parameterName = parameter.name();
     QString outputFileName = m_ModuleFrontEnd->value(parameterName, ctkCmdLineModuleFrontend::DisplayRole).toString();
 
     // Try to make sure we are not running in the application installation folder,
     // as more likely than not, it should not have write access, and you certainly
     // don't want users output files dumped there.
     //
     // eg. C:/Program Files (Windows), /Applications (Mac), /usr/local (Linux) etc.
 
     QFileInfo outputFileInfo(outputFileName);
 
     QString applicationDir = QApplication::applicationDirPath();
     QString outputDir = outputFileInfo.dir().absolutePath();
 
     if (applicationDir == outputDir)
     {
       qDebug() << "QmitkCmdLineModuleProgressWidget::Run(), output folder = application folder, so will swap to defaultOutputDir, specified in CLI module preferences";
 
       QFileInfo newOutputFileInfo(m_OutputDirectoryName, outputFileInfo.fileName());
       QString newOutputFileAbsolutePath = newOutputFileInfo.absoluteFilePath();
 
       qDebug() << "QmitkCmdLineModuleProgressWidget::Run(), swapping " << outputFileName << " to " << newOutputFileAbsolutePath;
 
       QMessageBox msgBox;
         msgBox.setText("The output directory is the same as the application installation directory");
         msgBox.setInformativeText(tr("Output file:\n%1\n\nwill be swapped to\n%2").arg(outputFileName).arg(newOutputFileAbsolutePath));
         msgBox.setStandardButtons(QMessageBox::Ok);
         msgBox.setIcon(QMessageBox::Warning);
         msgBox.exec();
 
       m_ModuleFrontEnd->setValue(parameterName, newOutputFileAbsolutePath, ctkCmdLineModuleFrontend::DisplayRole);
     }
   }
 
   // For each output image or file, store the filename, so we can auto-load it once the process finishes.
   foreach (ctkCmdLineModuleParameter parameter, parameters)
   {
     parameterName = parameter.name();
     QString outputFileName = m_ModuleFrontEnd->value(parameterName, ctkCmdLineModuleFrontend::DisplayRole).toString();
 
     if (!outputFileName.isEmpty())
     {
       m_OutputDataToLoad.push_back(outputFileName);
 
       message = "Registered " + outputFileName + " to auto load upon completion.";
       this->PublishMessage(message);
     }
   }
 
   // For each input image, write a temporary file as a Nifti image (TODO - iterate through list of file formats).
   // and then save the full path name back on the parameter.
 
   message = "Saving image data to temporary storage...";
   this->PublishMessage(message);
 
   parameters = m_ModuleFrontEnd->parameters("image", ctkCmdLineModuleFrontend::Input);
   foreach (ctkCmdLineModuleParameter parameter, parameters)
   {
     parameterName = parameter.name();
 
     QVariant tmp = m_ModuleFrontEnd->value(parameterName, ctkCmdLineModuleFrontend::UserRole);
     mitk::DataNode::Pointer node = tmp.value<mitk::DataNode::Pointer>();
 
     if (node.IsNotNull())
     {
       mitk::Image* image = dynamic_cast<mitk::Image*>(node->GetData());
       if (image != NULL)
       {
-        QString name = QString::fromStdString(node->GetName());
+        QString name = this->GetValidNodeName(QString::fromStdString(node->GetName()));
         int pid = QCoreApplication::applicationPid();
         int randomInt = qrand() % 1000000;
 
-        QString fileName = m_TemporaryDirectoryName + "/" + name + QString::number(pid) + "." + QString::number(randomInt) + ".nii";
+        QString fileName = m_TemporaryDirectoryName + "/" + name + QString::number(pid) + "_" + QString::number(randomInt) + ".nii";
 
         message = "Saving " + fileName;
         this->PublishMessage(message);
 
         std::string tmpFN = CommonFunctionality::SaveImage(image, fileName.toStdString().c_str());
         QString temporaryStorageFileName = QString::fromStdString(tmpFN);
 
         m_TemporaryFileNames.push_back(temporaryStorageFileName);
         m_ModuleFrontEnd->setValue(parameterName, temporaryStorageFileName);
 
         message = "Saved " + temporaryStorageFileName;
         this->PublishMessage(message);
       } // end if image
     } // end if node
   } // end foreach input image
 
   m_OutputCount = 0;
   m_ErrorCount = 0;
 
   // Now we run stuff.
   message = "starting.";
   this->PublishMessage(message);
 
   if (m_FutureWatcher == NULL)
   {
     m_FutureWatcher = new ctkCmdLineModuleFutureWatcher();
 
     connect(m_FutureWatcher, SIGNAL(started()), SLOT(OnModuleStarted()));
     connect(m_FutureWatcher, SIGNAL(canceled()), SLOT(OnModuleCanceled()));
     connect(m_FutureWatcher, SIGNAL(finished()), SLOT(OnModuleFinished()));
     connect(m_FutureWatcher, SIGNAL(resumed()), SLOT(OnModuleResumed()));
     connect(m_FutureWatcher, SIGNAL(progressRangeChanged(int,int)), SLOT(OnModuleProgressRangeChanged(int,int)));
     connect(m_FutureWatcher, SIGNAL(progressTextChanged(QString)), SLOT(OnModuleProgressTextChanged(QString)));
     connect(m_FutureWatcher, SIGNAL(progressValueChanged(int)), SLOT(OnModuleProgressValueChanged(int)));
     connect(m_FutureWatcher, SIGNAL(outputDataReady()), SLOT(OnOutputDataReady()));
     connect(m_FutureWatcher, SIGNAL(errorDataReady()), SLOT(OnErrorDataReady()));
 
     connect(m_UI->m_CancelButton, SIGNAL(clicked()), m_FutureWatcher, SLOT(cancel()));
     connect(m_UI->m_PauseButton, SIGNAL(toggled(bool)), this, SLOT(OnPauseButtonToggled(bool)));
 
   }
   ctkCmdLineModuleFuture future = m_ModuleManager->run(m_ModuleFrontEnd);
   m_FutureWatcher->setFuture(future);
 
   m_UI->m_PauseButton->setEnabled(future.canPause());
   m_UI->m_CancelButton->setEnabled(future.canCancel());
   m_UI->m_RemoveButton->setEnabled(!future.isRunning());
 
   // Give some immediate indication that we are running.
   m_UI->m_ProgressTitle->setText(description.title() + ": running");
 }
diff --git a/Plugins/org.mitk.gui.qt.cmdlinemodules/src/internal/QmitkCmdLineModuleProgressWidget.h b/Plugins/org.mitk.gui.qt.cmdlinemodules/src/internal/QmitkCmdLineModuleProgressWidget.h
index 12fe69bf92..e04c7fec35 100644
--- a/Plugins/org.mitk.gui.qt.cmdlinemodules/src/internal/QmitkCmdLineModuleProgressWidget.h
+++ b/Plugins/org.mitk.gui.qt.cmdlinemodules/src/internal/QmitkCmdLineModuleProgressWidget.h
@@ -1,220 +1,228 @@
 /*===================================================================
 
 The Medical Imaging Interaction Toolkit (MITK)
 
 Copyright (c) University College London (UCL).
 All rights reserved.
 
 This software is distributed WITHOUT ANY WARRANTY; without
 even the implied warranty of MERCHANTABILITY or FITNESS FOR
 A PARTICULAR PURPOSE.
 
 See LICENSE.txt or http://www.mitk.org for details.
 
 ===================================================================*/
 
 #ifndef QMITKCMDLINEMODULEPROGRESSWIDGET_H
 #define QMITKCMDLINEMODULEPROGRESSWIDGET_H
 
 #include <QWidget>
 #include <QTimer>
 
 class QVBoxLayout;
 class QmitkCmdLineModuleGui;
 class ctkCmdLineModuleManager;
 class ctkCmdLineModuleFutureWatcher;
 
 namespace Ui {
 class QmitkCmdLineModuleProgressWidget;
 }
 
 namespace mitk {
 class DataStorage;
 }
 
 /**
  * \class QmitkCmdLineModuleProgressWidget
  * \brief Based on ctkCmdLineModuleExplorerProgressWidget, implements a progress widget
  * with console output, and space for storing the GUI widgets.
  * \author Matt Clarkson (m.clarkson@ucl.ac.uk)
  * \ingroup org_mitk_gui_qt_cmdlinemodules_internal
  * \sa ctkCmdLineModuleExplorerProgressWidget
  */
 class QmitkCmdLineModuleProgressWidget : public QWidget
 {
   Q_OBJECT
 
 public:
 
   QmitkCmdLineModuleProgressWidget(QWidget *parent = 0);
   virtual ~QmitkCmdLineModuleProgressWidget();
 
   /**
    * \brief Sets the manager on this object, and must be called immediately
    * after construction, before using the widget.
    */
   void SetManager(ctkCmdLineModuleManager* manager);
 
   /**
    * \brief Sets the DataStorage on this object, and must be called immediately
    * after construction, before using the widget.
    */
   void SetDataStorage(mitk::DataStorage* dataStorage);
 
   /**
    * \brief Sets the Temporary Directory on this widget, and must be called
    * immediately after construction, before using the widget.
    */
   void SetTemporaryDirectory(const QString& directoryName);
 
   /**
    * \brief Sets the Output Directory on this widget, and must be called
    * immediately after construction, before using the widget.
    */
   void SetOutputDirectory(const QString& directoryName);
 
   /**
    * \brief Tells this widget, which module frontend it is running
    * \param frontEnd our QmitkCmdLineModuleGui class derived from ctkCmdLineModuleFrontend
    */
   void SetFrontend(QmitkCmdLineModuleGui* frontEnd);
 
   /**
    * \brief Runs the module that this widget is currently referring to.
    */
   void Run();
 
 Q_SIGNALS:
 
   // These signals so that container classes such as CommandLineModuleView
   // can keep track of how many modules are running simultaneously.
 
   void started();   // emmitted when the module is started.
   void finished();  // emmitted when the module is completely finished.
 
 private Q_SLOTS:
 
   void OnCheckModulePaused();
 
   void OnPauseButtonToggled(bool toggled);
   void OnRemoveButtonClicked();
 
   void OnModuleStarted();
   void OnModuleCanceled();
   void OnModuleFinished();
   void OnModuleResumed();
   void OnModuleProgressRangeChanged(int progressMin, int progressMax);
   void OnModuleProgressTextChanged(const QString& progressText);
   void OnModuleProgressValueChanged(int progressValue);
   void OnOutputDataReady();
   void OnErrorDataReady();
 
 private:
 
   /**
    * \brief Simply returns true if this widget is considered as having been started.
    */
   bool IsStarted() const;
 
   /**
    * \brief Used to write output to the console widget, and also to qDebug().
    */
   void PublishMessage(const QString& message);
 
   /**
    * \brief Used to write output to the console widget, and also to qDebug().
    */
   void PublishByteArray(const QByteArray& array);
 
   /**
    * \brief Destroys any images listed in m_TemporaryFileNames.
    */
   void ClearUpTemporaryFiles();
 
   /**
    * \brief Loads any data listed in m_OutputDataToLoad into the m_DataStorage.
    */
   void LoadOutputData();
 
   /**
    * \brief Utility method to look up the title from the description.
    */
   QString GetTitle();
 
   /**
    * \brief Returns <category>.<title>, derived from the ctkCmdLineModuleReference and
    * hence from the ctkCmdLineModuleDescription.
    */
   QString GetFullName() const;
 
+  /**
+   * \brief Takes nodeName, and makes sure that it only contains A-Z, a-z, 0-9, hyphen and underscore,
+   * and does not use hyphen as the first character.
+   *
+   * Inspired by <a href="http://www.boost.org/doc/libs/1_43_0/libs/filesystem/doc/portability_guide.htm">boost recommendations</a>.
+   */
+  QString GetValidNodeName(const QString& nodeName);
+
   /**
    * \brief This must be injected before the Widget is used.
    */
   ctkCmdLineModuleManager *m_ModuleManager;
 
   /**
    * \brief This must be injected before the Widget is used.
    */
   mitk::DataStorage *m_DataStorage;
 
   /**
    * \brief This must be injected before the Widget is used.
    */
   QString m_TemporaryDirectoryName;
 
   /**
    * \brief This must be injected before the Widget is used.
    */
   QString m_OutputDirectoryName;
 
   /**
    * \brief We instantiate the main widgets from this .ui file.
    */
   Ui::QmitkCmdLineModuleProgressWidget *m_UI;
 
   /**
    * \brief The m_ParametersGroupBox needs a layout.
    */
   QVBoxLayout *m_Layout;
 
   /**
    * \brief The QmitkCmdLineModuleGui is created by the QmitkCmdLineModuleFactoryGui outside
    * of this class and injected into this class before being run.
    */
   QmitkCmdLineModuleGui *m_ModuleFrontEnd;
 
   /**
    * \brief Main object to keep track of a running command line module.
    */
   ctkCmdLineModuleFutureWatcher *m_FutureWatcher;
 
   /**
    * \brief Due to Qt bug 12152, we use a timer to correctly check for a paused module.
    */
   QTimer m_PollPauseTimer;
 
   /**
    * \brief We store a list of temporary file names that are saved to disk before
    * launching a command line app, and then must be cleared up when the command line
    * app successfully finishes.
    */
   QStringList m_TemporaryFileNames;
 
   /**
    * \brief We store a list of output images, so that on successful completion of
    * the command line module, we automatically load the output data into the mitk::DataStorage.
    */
   QStringList m_OutputDataToLoad;
 
   /**
    * \brief We track how many times the OnOutputDataReady is called.
    */
   int m_OutputCount;
 
   /**
    * \brief We track how many times the OnErrorDataReady is called.
    */
   int m_ErrorCount;
 };
 
 #endif // QMITKCMDLINEMODULEPROGRESSWIDGET_H