diff --git a/Modules/ModelFit/src/Common/mitkPixelBasedParameterFitImageGenerator.cpp b/Modules/ModelFit/src/Common/mitkPixelBasedParameterFitImageGenerator.cpp
index 306bc796ad..ee293b11e4 100644
--- a/Modules/ModelFit/src/Common/mitkPixelBasedParameterFitImageGenerator.cpp
+++ b/Modules/ModelFit/src/Common/mitkPixelBasedParameterFitImageGenerator.cpp
@@ -1,275 +1,275 @@
 /*============================================================================
 
 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 "itkCommand.h"
 #include "itkMultiOutputNaryFunctorImageFilter.h"
 
 #include "mitkPixelBasedParameterFitImageGenerator.h"
 #include "mitkImageTimeSelector.h"
 #include "mitkImageAccessByItk.h"
 #include "mitkImageCast.h"
 #include "mitkModelFitFunctorPolicy.h"
 
 #include "mitkExtractTimeGrid.h"
 
 void
   mitk::PixelBasedParameterFitImageGenerator::
   onFitProgressEvent(::itk::Object* caller, const ::itk::EventObject& /*eventObject*/)
 {
-  this->InvokeEvent(::itk::ProgressEvent());
 
   auto* process = dynamic_cast<itk::ProcessObject*>(caller);
   if (process)
   {
     this->m_Progress = process->GetProgress();
   }
+  this->InvokeEvent(::itk::ProgressEvent());
 };
 
 template <typename TPixel, unsigned int VDim>
 void
   mitk::PixelBasedParameterFitImageGenerator::DoPrepareMask(itk::Image<TPixel, VDim>* image)
 {
   m_InternalMask = dynamic_cast<InternalMaskType*>(image);
 
   if (m_InternalMask.IsNull())
   {
     MITK_INFO << "Parameter Fit Generator. Need to cast mask for parameter fit.";
     using InputImageType = itk::Image<TPixel, VDim>;
     using CastFilterType = itk::CastImageFilter< InputImageType, InternalMaskType >;
     typename CastFilterType::Pointer  spImageCaster =  CastFilterType::New();
 
     spImageCaster->SetInput(image);
 
     m_InternalMask = spImageCaster->GetOutput();
     spImageCaster->Update();
   }
 }
 
 template<typename TImage>
 mitk::PixelBasedParameterFitImageGenerator::ParameterImageMapType StoreResultImages( mitk::ModelFitFunctorBase::ParameterNamesType &paramNames, itk::ImageSource<TImage>* source, mitk::ModelFitFunctorBase::ParameterNamesType::size_type startPos, mitk::ModelFitFunctorBase::ParameterNamesType::size_type& endPos )
 {
   mitk::PixelBasedParameterFitImageGenerator::ParameterImageMapType result;
   for (mitk::ModelFitFunctorBase::ParameterNamesType::size_type j = 0; j < paramNames.size(); ++j)
   {
     if (source->GetNumberOfOutputs() < startPos+j)
     {
       mitkThrow() << "Error while generating fitted parameter images. Number of sources is too low and does not match expected parameter number. Output size: "<< source->GetNumberOfOutputs()<<"; number of param names: "<<paramNames.size()<<";source start pos: " << startPos;
     }
 
     mitk::Image::Pointer paramImage = mitk::Image::New();
     typename TImage::ConstPointer outputImg = source->GetOutput(startPos+j);
     mitk::CastToMitkImage(outputImg, paramImage);
 
     result.insert(std::make_pair(paramNames[j],paramImage));
   }
 
   endPos = startPos + paramNames.size();
 
   return result;
 }
 
 template <typename TPixel, unsigned int VDim>
 void
   mitk::PixelBasedParameterFitImageGenerator::DoParameterFit(itk::Image<TPixel, VDim>* /*image*/)
 {
   using InputFrameImageType = itk::Image<TPixel, VDim-1>;
   using ParameterImageType = itk::Image<ScalarType, VDim-1>;
 
   using FitFilterType = itk::MultiOutputNaryFunctorImageFilter<InputFrameImageType, ParameterImageType, ModelFitFunctorPolicy, InternalMaskType>;
 
   typename FitFilterType::Pointer fitFilter = FitFilterType::New();
 
   typename ::itk::MemberCommand<Self>::Pointer spProgressCommand = ::itk::MemberCommand<Self>::New();
   spProgressCommand->SetCallbackFunction(this, &Self::onFitProgressEvent);
   fitFilter->AddObserver(::itk::ProgressEvent(), spProgressCommand);
 
   //add the time frames to the fit filter
   mitk::ImageTimeSelector::Pointer imageTimeSelector = mitk::ImageTimeSelector::New();
   imageTimeSelector->SetInput(this->m_DynamicImage);
   std::vector<Image::Pointer> frameCache;
   for (unsigned int i = 0; i < this->m_DynamicImage->GetTimeSteps(); ++i)
   {
     typename InputFrameImageType::Pointer frameImage;
     imageTimeSelector->SetTimeNr(i);
     imageTimeSelector->UpdateLargestPossibleRegion();
 
     Image::Pointer frameMITKImage = imageTimeSelector->GetOutput();
     frameCache.push_back(frameMITKImage);
     mitk::CastToItkImage(frameMITKImage, frameImage);
     fitFilter->SetInput(i,frameImage);
   }
 
   ModelBaseType::TimeGridType timeGrid = ExtractTimeGrid(m_DynamicImage);
   if (m_TimeGridByParameterizer)
   {
     if (timeGrid.GetSize() != m_ModelParameterizer->GetDefaultTimeGrid().GetSize())
     {
       mitkThrow() << "Cannot do fitting. Filter is set to use default time grid of the parameterizer, but grid size does not match the number of input image frames. Grid size: " << m_ModelParameterizer->GetDefaultTimeGrid().GetSize() << "; frame count: " << timeGrid.GetSize();
     }
 
   }
   else
   {
     this->m_ModelParameterizer->SetDefaultTimeGrid(timeGrid);
   }
 
   ModelFitFunctorPolicy functor;
 
   functor.SetModelFitFunctor(this->m_FitFunctor);
   functor.SetModelParameterizer(this->m_ModelParameterizer);
   fitFilter->SetFunctor(functor);
   if (this->m_InternalMask.IsNotNull())
   {
     fitFilter->SetMask(this->m_InternalMask);
   }
 
   //generate the fits
   fitFilter->Update();
 
   //convert the outputs into mitk images and fill the parameter image map
   ModelBaseType::Pointer refModel = this->m_ModelParameterizer->GenerateParameterizedModel();
   ModelFitFunctorBase::ParameterNamesType paramNames = refModel->GetParameterNames();
   ModelFitFunctorBase::ParameterNamesType derivedParamNames = refModel->GetDerivedParameterNames();
   ModelFitFunctorBase::ParameterNamesType criterionNames = this->m_FitFunctor->GetCriterionNames();
   ModelFitFunctorBase::ParameterNamesType evaluationParamNames = this->m_FitFunctor->GetEvaluationParameterNames();
   ModelFitFunctorBase::ParameterNamesType debugParamNames = this->m_FitFunctor->GetDebugParameterNames();
 
   if (fitFilter->GetNumberOfOutputs() != (paramNames.size() + derivedParamNames.size() + criterionNames.size() + evaluationParamNames.size() + debugParamNames.size()))
   {
     mitkThrow() << "Error while generating fitted parameter images. Fit filter output size does not match expected parameter number. Output size: "<< fitFilter->GetNumberOfOutputs();
   }
 
   ModelFitFunctorBase::ParameterNamesType::size_type resultPos = 0;
   this->m_TempResultMap = StoreResultImages<ParameterImageType>(paramNames,fitFilter,resultPos, resultPos);
   this->m_TempDerivedResultMap = StoreResultImages<ParameterImageType>(derivedParamNames,fitFilter,resultPos, resultPos);
   this->m_TempCriterionResultMap = StoreResultImages<ParameterImageType>(criterionNames,fitFilter,resultPos, resultPos);
   this->m_TempEvaluationResultMap = StoreResultImages<ParameterImageType>(evaluationParamNames,fitFilter,resultPos, resultPos);
   //also add debug params (if generated) to the evaluation result map
   mitk::PixelBasedParameterFitImageGenerator::ParameterImageMapType debugMap = StoreResultImages<ParameterImageType>(debugParamNames, fitFilter, resultPos, resultPos);
   this->m_TempEvaluationResultMap.insert(debugMap.begin(), debugMap.end());
 }
 
 bool
   mitk::PixelBasedParameterFitImageGenerator::HasOutdatedResult() const
 {
   bool result = Superclass::HasOutdatedResult();
 
   if (m_ModelParameterizer.IsNotNull())
   {
     if (m_ModelParameterizer->GetMTime() > this->m_GenerationTimeStamp)
     {
       result = true;
     }
   }
 
   if (m_FitFunctor.IsNotNull())
   {
     if (m_FitFunctor->GetMTime() > this->m_GenerationTimeStamp)
     {
       result = true;
     }
   }
 
   if (m_DynamicImage.IsNotNull())
   {
     if (m_DynamicImage->GetMTime() > this->m_GenerationTimeStamp)
     {
       result = true;
     }
   }
 
   if (m_Mask.IsNotNull())
   {
     if (m_Mask->GetMTime() > this->m_GenerationTimeStamp)
     {
       result = true;
     }
   }
 
   return result;
 
 };
 
 void
   mitk::PixelBasedParameterFitImageGenerator::CheckValidInputs() const
 {
   Superclass::CheckValidInputs();
 
   if (m_DynamicImage.IsNull())
   {
     mitkThrow() << "Cannot generate fitted parameter images. Input dynamic image is not set.";
   }
 
 };
 
 void mitk::PixelBasedParameterFitImageGenerator::DoFitAndGetResults(ParameterImageMapType& parameterImages, ParameterImageMapType& derivedParameterImages, ParameterImageMapType& criterionImages, ParameterImageMapType& evaluationParameterImages)
 {
   this->m_Progress = 0;
 
   if(this->m_Mask.IsNotNull())
   {
     AccessFixedDimensionByItk(m_Mask, mitk::PixelBasedParameterFitImageGenerator::DoPrepareMask, 3);
   }
   else
   {
     this->m_InternalMask = nullptr;
   }
 
   AccessFixedDimensionByItk(m_DynamicImage, mitk::PixelBasedParameterFitImageGenerator::DoParameterFit, 4);
 
   parameterImages = this->m_TempResultMap;
   derivedParameterImages = this->m_TempDerivedResultMap;
   criterionImages = this->m_TempCriterionResultMap;
   evaluationParameterImages = this->m_TempEvaluationResultMap;
 
 };
 
 double
   mitk::PixelBasedParameterFitImageGenerator::GetProgress() const
 {
   return m_Progress;
 };
 
 mitk::PixelBasedParameterFitImageGenerator::ParameterNamesType
 mitk::PixelBasedParameterFitImageGenerator::GetParameterNames() const
 {
   ParameterizerType::ModelBasePointer parameterizedModel =
     m_ModelParameterizer->GenerateParameterizedModel();
 
   return parameterizedModel->GetParameterNames();
 }
 
 mitk::PixelBasedParameterFitImageGenerator::ParameterNamesType
 mitk::PixelBasedParameterFitImageGenerator::GetDerivedParameterNames() const
 {
   ParameterizerType::ModelBasePointer parameterizedModel =
     m_ModelParameterizer->GenerateParameterizedModel();
 
   return parameterizedModel->GetDerivedParameterNames();
 }
 
 mitk::PixelBasedParameterFitImageGenerator::ParameterNamesType
 mitk::PixelBasedParameterFitImageGenerator::GetCriterionNames() const
 {
   return this->m_FitFunctor->GetCriterionNames();
 }
 
 mitk::PixelBasedParameterFitImageGenerator::ParameterNamesType
 mitk::PixelBasedParameterFitImageGenerator::GetEvaluationParameterNames() const
 {
   auto evals = this->m_FitFunctor->GetEvaluationParameterNames();
   auto debugs = this->m_FitFunctor->GetDebugParameterNames();
 
   evals.insert(evals.end(), debugs.begin(), debugs.end());
 
   return evals;
 }
diff --git a/Modules/ModelFit/src/Common/mitkROIBasedParameterFitImageGenerator.cpp b/Modules/ModelFit/src/Common/mitkROIBasedParameterFitImageGenerator.cpp
index 78fcf960fe..9cb6ff5928 100644
--- a/Modules/ModelFit/src/Common/mitkROIBasedParameterFitImageGenerator.cpp
+++ b/Modules/ModelFit/src/Common/mitkROIBasedParameterFitImageGenerator.cpp
@@ -1,264 +1,264 @@
 /*============================================================================
 
 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 "itkChangeInformationImageFilter.h"
 
 #include "mitkROIBasedParameterFitImageGenerator.h"
 #include "mitkImageAccessByItk.h"
 #include "mitkImageCast.h"
 
 void
 mitk::ROIBasedParameterFitImageGenerator::
 onFitProgressEvent(::itk::Object* caller, const ::itk::EventObject& /*eventObject*/)
 {
-  this->InvokeEvent(::itk::ProgressEvent());
 
   itk::ProcessObject* process = dynamic_cast<itk::ProcessObject*>(caller);
 
   if (process)
   {
     this->m_Progress = process->GetProgress();
   }
+  this->InvokeEvent(::itk::ProgressEvent());
 };
 
 template <typename TPixel, unsigned int VDim>
 void
 mitk::ROIBasedParameterFitImageGenerator::DoImageGeneration(itk::Image<TPixel, VDim>* image,
     double value)
 {
   typedef itk::Image<TPixel, VDim> MaskType;
   typedef itk::Image<ScalarType, VDim> ParameterImageType;
 
   typedef itk::ChangeInformationImageFilter< ParameterImageType > OutputImageInformationFilterType;
   typename OutputImageInformationFilterType::Pointer copyGeoInfoFilter =
     OutputImageInformationFilterType::New();
 
   typename ParameterImageType::Pointer paramImg = ParameterImageType::New();
 
   copyGeoInfoFilter->ChangeDirectionOn();
   copyGeoInfoFilter->SetOutputDirection(image->GetDirection());
   copyGeoInfoFilter->ChangeOriginOn();
   copyGeoInfoFilter->SetOutputOrigin(image->GetOrigin());
   copyGeoInfoFilter->ChangeSpacingOn();
   copyGeoInfoFilter->SetOutputSpacing(image->GetSpacing());
   copyGeoInfoFilter->SetInput(paramImg);
   copyGeoInfoFilter->Update();
 
   paramImg = copyGeoInfoFilter->GetOutput();
   paramImg->SetRegions(image->GetLargestPossibleRegion());
   paramImg->Allocate();
   paramImg->FillBuffer(0.0);
 
   typedef itk::ImageRegionConstIterator<MaskType> MaskIteratorType;
   typedef itk::ImageRegionIterator<ParameterImageType> ImageIteratorType;
 
   MaskIteratorType maskItr(image, image->GetLargestPossibleRegion());
   ImageIteratorType imgItr(paramImg, image->GetLargestPossibleRegion());
   maskItr.GoToBegin();
   imgItr.GoToBegin();
   while (!maskItr.IsAtEnd())
   {
     if (maskItr.Get() > 0.0)
     {
       imgItr.Set(value);
     }
 
     ++maskItr;
     ++imgItr;
   }
 
   m_TempResultImage = Image::New();
   mitk::CastToMitkImage(paramImg, m_TempResultImage);
 }
 
 bool
 mitk::ROIBasedParameterFitImageGenerator::HasOutdatedResult() const
 {
   bool result = Superclass::HasOutdatedResult();
 
   if (m_ModelParameterizer.IsNotNull())
   {
     if (m_ModelParameterizer->GetMTime() > this->m_GenerationTimeStamp)
     {
       result = true;
     }
   }
 
   if (m_Mask.IsNotNull())
   {
     if (m_Mask->GetMTime() > this->m_GenerationTimeStamp)
     {
       result = true;
     }
   }
 
   if (m_FitFunctor.IsNotNull())
   {
     if (m_FitFunctor->GetMTime() > this->m_GenerationTimeStamp)
     {
       result = true;
     }
   }
 
   return result;
 };
 
 void
 mitk::ROIBasedParameterFitImageGenerator::CheckValidInputs() const
 {
   Superclass::CheckValidInputs();
 
   if (m_Mask.IsNull())
   {
     mitkThrow() << "Cannot generate fitted parameter images. Input mask is not set.";
   }
 
   if (m_Signal.Size() != m_TimeGrid.Size())
   {
     mitkThrow() << "Cannot generate fitted parameter images. Signal and TimeGrid do not match.";
   }
 
 };
 
 void mitk::ROIBasedParameterFitImageGenerator::DoFitAndGetResults(ParameterImageMapType&
     parameterImages, ParameterImageMapType& derivedParameterImages,
     ParameterImageMapType& criterionImages, ParameterImageMapType& evaluationParameterImages)
 {
   this->m_Progress = 0;
 
   //fit the signal
   ModelParameterizerBase::IndexType index;
   index.Fill(0);
   this->m_ModelParameterizer->SetDefaultTimeGrid(m_TimeGrid);
   ParameterizerType::ModelBasePointer parameterizedModel =
     m_ModelParameterizer->GenerateParameterizedModel(index);
   ParameterizerType::ParametersType initialParameters =
     m_ModelParameterizer->GetInitialParameterization(index);
 
   ModelFitFunctorBase::InputPixelArrayType inputValues;
 
   for (SignalType::const_iterator pos = m_Signal.begin(); pos != m_Signal.end(); ++pos)
   {
     inputValues.push_back(*pos);
   }
 
   ModelFitFunctorBase::OutputPixelArrayType fitResult = m_FitFunctor->Compute(inputValues,
       parameterizedModel, initialParameters);
 
   //generate the results maps
   ParameterImageMapType tempResultMap;
   ParameterImageMapType tempDerivedResultMap;
   ParameterImageMapType tempEvaluationResultMap;
   ParameterImageMapType tempCriterionResultMap;
 
   ModelFitFunctorBase::ParameterNamesType paramNames = parameterizedModel->GetParameterNames();
   ModelFitFunctorBase::ParameterNamesType derivedParamNames =
     parameterizedModel->GetDerivedParameterNames();
   ModelFitFunctorBase::ParameterNamesType criterionNames = this->m_FitFunctor->GetCriterionNames();
   ModelFitFunctorBase::ParameterNamesType evaluationParamNames =
     this->m_FitFunctor->GetEvaluationParameterNames();
   ModelFitFunctorBase::ParameterNamesType debugParamNames = this->m_FitFunctor->GetDebugParameterNames();
 
   if (fitResult.size() != (paramNames.size() + derivedParamNames.size() + criterionNames.size() +
                            evaluationParamNames.size() + debugParamNames.size()))
   {
     mitkThrow() <<
                 "Error while generating fitted parameter images. Fit functor output size does not match expected parameter number. Output size: "
                 << fitResult.size();
   }
 
   for (ModelFitFunctorBase::ParameterNamesType::size_type j = 0; j < paramNames.size(); ++j)
   {
     ModelFitFunctorBase::OutputPixelArrayType::value_type value = fitResult[j];
     AccessByItk_n(m_Mask, mitk::ROIBasedParameterFitImageGenerator::DoImageGeneration, (value));
     tempResultMap.insert(std::make_pair(paramNames[j], m_TempResultImage));
   }
 
   ModelFitFunctorBase::ParameterNamesType::size_type offset = paramNames.size();
   for (ModelFitFunctorBase::ParameterNamesType::size_type j = 0; j < derivedParamNames.size(); ++j)
   {
     ModelFitFunctorBase::OutputPixelArrayType::value_type value = fitResult[j + offset];
     AccessByItk_n(m_Mask, mitk::ROIBasedParameterFitImageGenerator::DoImageGeneration, (value));
     tempDerivedResultMap.insert(std::make_pair(derivedParamNames[j], m_TempResultImage));
   }
 
   offset += derivedParamNames.size();
   for (ModelFitFunctorBase::ParameterNamesType::size_type j = 0; j < criterionNames.size(); ++j)
   {
     ModelFitFunctorBase::OutputPixelArrayType::value_type value = fitResult[j + offset];
     AccessByItk_n(m_Mask, mitk::ROIBasedParameterFitImageGenerator::DoImageGeneration, (value));
     tempCriterionResultMap.insert(std::make_pair(criterionNames[j], m_TempResultImage));
   }
 
   offset += criterionNames.size();
   for (ModelFitFunctorBase::ParameterNamesType::size_type j = 0; j < evaluationParamNames.size(); ++j)
   {
     ModelFitFunctorBase::OutputPixelArrayType::value_type value = fitResult[j + offset];
     AccessByItk_n(m_Mask, mitk::ROIBasedParameterFitImageGenerator::DoImageGeneration, (value));
     tempEvaluationResultMap.insert(std::make_pair(evaluationParamNames[j], m_TempResultImage));
   }
 
   offset += evaluationParamNames.size();
   for (ModelFitFunctorBase::ParameterNamesType::size_type j = 0; j < debugParamNames.size(); ++j)
   { //add debug params (if they are generated to the evaluation result map
     ModelFitFunctorBase::OutputPixelArrayType::value_type value = fitResult[j + offset];
     AccessByItk_n(m_Mask, mitk::ROIBasedParameterFitImageGenerator::DoImageGeneration, (value));
     tempEvaluationResultMap.insert(std::make_pair(debugParamNames[j], m_TempResultImage));
   }
 
   parameterImages = tempResultMap;
   derivedParameterImages = tempDerivedResultMap;
   criterionImages = tempCriterionResultMap;
   evaluationParameterImages = tempEvaluationResultMap;
 
 };
 
 double
 mitk::ROIBasedParameterFitImageGenerator::GetProgress() const
 {
   return m_Progress;
 };
 
 mitk::ROIBasedParameterFitImageGenerator::ParameterNamesType
 mitk::ROIBasedParameterFitImageGenerator::GetParameterNames() const
 {
   ParameterizerType::ModelBasePointer parameterizedModel =
     m_ModelParameterizer->GenerateParameterizedModel();
 
   return parameterizedModel->GetParameterNames();
 }
 
 mitk::ROIBasedParameterFitImageGenerator::ParameterNamesType
 mitk::ROIBasedParameterFitImageGenerator::GetDerivedParameterNames() const
 {
   ParameterizerType::ModelBasePointer parameterizedModel =
     m_ModelParameterizer->GenerateParameterizedModel();
 
   return parameterizedModel->GetDerivedParameterNames();
 }
 
 mitk::ROIBasedParameterFitImageGenerator::ParameterNamesType
 mitk::ROIBasedParameterFitImageGenerator::GetCriterionNames() const
 {
   return this->m_FitFunctor->GetCriterionNames();
 }
 
 mitk::ROIBasedParameterFitImageGenerator::ParameterNamesType
 mitk::ROIBasedParameterFitImageGenerator::GetEvaluationParameterNames() const
 {
   auto evals = this->m_FitFunctor->GetEvaluationParameterNames();
   auto debugs = this->m_FitFunctor->GetDebugParameterNames();
 
   evals.insert(evals.end(), debugs.begin(), debugs.end());
 
   return evals;
 }
diff --git a/Modules/Pharmacokinetics/src/Common/mitkPixelBasedDescriptionParameterImageGenerator.cpp b/Modules/Pharmacokinetics/src/Common/mitkPixelBasedDescriptionParameterImageGenerator.cpp
index 287ca01c4a..301fd846cb 100644
--- a/Modules/Pharmacokinetics/src/Common/mitkPixelBasedDescriptionParameterImageGenerator.cpp
+++ b/Modules/Pharmacokinetics/src/Common/mitkPixelBasedDescriptionParameterImageGenerator.cpp
@@ -1,191 +1,191 @@
 /*============================================================================
 
 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 "itkCommand.h"
 #include "itkMultiOutputNaryFunctorImageFilter.h"
 
 #include "mitkPixelBasedDescriptionParameterImageGenerator.h"
 #include "mitkImageTimeSelector.h"
 #include "mitkImageAccessByItk.h"
 #include "mitkImageCast.h"
 #include "mitkSimpleFunctorPolicy.h"
 #include "mitkModelBase.h"
 
 void
   mitk::PixelBasedDescriptionParameterImageGenerator::
   onFitProgressEvent(::itk::Object* caller, const ::itk::EventObject& /*eventObject*/)
 {
-  this->InvokeEvent(::itk::ProgressEvent());
 
   itk::ProcessObject* process = dynamic_cast<itk::ProcessObject*>(caller);
   if (process)
   {
     this->m_Progress = process->GetProgress();
   }
+  this->InvokeEvent(::itk::ProgressEvent());
 };
 
 template <typename TPixel, unsigned int VDim>
 void
   mitk::PixelBasedDescriptionParameterImageGenerator::DoPrepareMask(itk::Image<TPixel, VDim>* image)
 {
   m_InternalMask = dynamic_cast<InternalMaskType*>(image);
 
   if (m_InternalMask.IsNull())
   {
     MITK_INFO << "Parameter Fit Generator. Need to cast mask for parameter fit.";
     typedef itk::Image<TPixel, VDim> InputImageType;
     typedef itk::CastImageFilter< InputImageType, InternalMaskType > CastFilterType;
     typename CastFilterType::Pointer  spImageCaster =  CastFilterType::New();
 
     spImageCaster->SetInput(image);
 
     m_InternalMask = spImageCaster->GetOutput();
     spImageCaster->Update();
   }
 }
 
 template<typename TImage>
 mitk::PixelBasedDescriptionParameterImageGenerator::ParameterImageMapType StoreResultImages(const mitk::CurveParameterFunctor::ParameterNamesType &paramNames, itk::ImageSource<TImage>* source)
 {
   if (source->GetNumberOfOutputs() != paramNames.size())
   {
     mitkThrow() << "Error while generating fitted parameter images. Number of sources does not match expected parameter number. Output size: " << source->GetNumberOfOutputs() << "; number of param names: " << paramNames.size();
   }
 
   mitk::PixelBasedDescriptionParameterImageGenerator::ParameterImageMapType result;
   for (mitk::CurveParameterFunctor::ParameterNamesType::size_type j = 0; j < paramNames.size(); ++j)
   {
     mitk::Image::Pointer paramImage = mitk::Image::New();
     typename TImage::ConstPointer outputImg = source->GetOutput(j);
     mitk::CastToMitkImage(outputImg, paramImage);
 
     result.insert(std::make_pair(paramNames[j],paramImage));
   }
 
   return result;
 }
 
 template <typename TPixel, unsigned int VDim>
 void
   mitk::PixelBasedDescriptionParameterImageGenerator::DoParameterCalculation(itk::Image<TPixel, VDim>* /*image*/)
 {
   typedef itk::Image<TPixel, VDim-1> InputFrameImageType;
   typedef itk::Image<ScalarType, VDim-1> ParameterImageType;
 
   typedef itk::MultiOutputNaryFunctorImageFilter<InputFrameImageType, ParameterImageType, SimpleFunctorPolicy, InternalMaskType> DescriptorFilterType;
 
   typename DescriptorFilterType::Pointer descFilter = DescriptorFilterType::New();
 
   typename ::itk::MemberCommand<Self>::Pointer spProgressCommand = ::itk::MemberCommand<Self>::New();
   spProgressCommand->SetCallbackFunction(this, &Self::onFitProgressEvent);
   descFilter->AddObserver(::itk::ProgressEvent(), spProgressCommand);
 
   //add the time frames to the descriptor filter
   std::vector<Image::Pointer> frameCache;
   for (unsigned int i = 0; i < this->m_DynamicImage->GetTimeSteps(); ++i)
   {
     typename InputFrameImageType::Pointer frameImage;
     mitk::ImageTimeSelector::Pointer imageTimeSelector =	mitk::ImageTimeSelector::New();
     imageTimeSelector->SetInput(this->m_DynamicImage);
     imageTimeSelector->SetTimeNr(i);
     imageTimeSelector->UpdateLargestPossibleRegion();
 
     Image::Pointer frameMITKImage = imageTimeSelector->GetOutput();
     frameCache.push_back(frameMITKImage);
     mitk::CastToItkImage(frameMITKImage, frameImage);
     descFilter->SetInput(i,frameImage);
   }
 
 
   SimpleFunctorPolicy functor;
 
   functor.SetFunctor(this->m_Functor);
   descFilter->SetFunctor(functor);
   if (this->m_InternalMask.IsNotNull())
   {
     descFilter->SetMask(this->m_InternalMask);
   }
 
   //generate the fits
   descFilter->Update();
 
   //convert the outputs into mitk images and fill the parameter image map
   CurveParameterFunctor::ParameterNamesType paramNames = this->m_Functor->GetDescriptionParameterNames();
 
   if (descFilter->GetNumberOfOutputs() != (paramNames.size()))
   {
     mitkThrow() << "Error while generating fitted parameter images. Fit filter output size does not match expected parameter number. Output size: "<< descFilter->GetNumberOfOutputs();
   }
 
   this->m_TempResultMap = StoreResultImages<ParameterImageType>(paramNames,descFilter);
 }
 
 bool
   mitk::PixelBasedDescriptionParameterImageGenerator::HasOutdatedResult() const
 {
   bool result = Superclass::HasOutdatedResult();
 
   if (m_DynamicImage.IsNotNull())
   {
     if (m_DynamicImage->GetMTime() > this->m_GenerationTimeStamp)
     {
       result = true;
     }
   }
 
   if (m_Mask.IsNotNull())
   {
     if (m_Mask->GetMTime() > this->m_GenerationTimeStamp)
     {
       result = true;
     }
   }
 
   return result;
 
 };
 
 void
   mitk::PixelBasedDescriptionParameterImageGenerator::CheckValidInputs() const
 {
   Superclass::CheckValidInputs();
 
   if (m_DynamicImage.IsNull())
   {
     mitkThrow() << "Cannot generate fitted parameter images. Input dynamic image is not set.";
   }
 
 };
 
 void mitk::PixelBasedDescriptionParameterImageGenerator::DoParameterCalculationAndGetResults(ParameterImageMapType& parameterImages)
 {
   this->m_Progress = 0;
 
   if(this->m_Mask.IsNotNull())
   {
     AccessFixedDimensionByItk(m_Mask, mitk::PixelBasedDescriptionParameterImageGenerator::DoPrepareMask, 3);
   }
   else
   {
     this->m_InternalMask = nullptr;
   }
 
   AccessFixedDimensionByItk(m_DynamicImage, mitk::PixelBasedDescriptionParameterImageGenerator::DoParameterCalculation, 4);
 
   parameterImages = this->m_TempResultMap;
  };
 
 double
   mitk::PixelBasedDescriptionParameterImageGenerator::GetProgress() const
 {
   return m_Progress;
 };