Medical Imaging Interaction Toolkit  2021.10.99-9c07a326
Medical Imaging Interaction Toolkit
mitkPixelBasedParameterFitImageGenerator.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef __MITK_PIXEL_BASED_PARAMETER_FIT_IMAGE_GENERATOR_H_
14 #define __MITK_PIXEL_BASED_PARAMETER_FIT_IMAGE_GENERATOR_H_
15 
16 #include <map>
17 
18 #include <mitkImage.h>
19 
23 
24 #include "MitkModelFitExports.h"
25 
26 namespace mitk
27 {
28 
41 {
42 public:
44 
45  itkNewMacro(Self);
46 
48  typedef std::vector<ParameterImagePixelType> FunctorValueArrayType;
49 
51 
53 
57 
58  itkSetObjectMacro(DynamicImage, Image);
59  itkGetConstObjectMacro(DynamicImage, Image);
60 
61  itkSetObjectMacro(Mask, Image);
62  itkGetConstObjectMacro(Mask, Image);
63 
64  itkSetObjectMacro(FitFunctor, FitFunctorType);
65  itkGetObjectMacro(FitFunctor, FitFunctorType);
66 
67  itkSetObjectMacro(ModelParameterizer, ParameterizerType);
68  itkGetObjectMacro(ModelParameterizer, ParameterizerType);
69 
70  itkSetMacro(TimeGridByParameterizer, bool);
71  itkGetMacro(TimeGridByParameterizer, bool);
72  itkBooleanMacro(TimeGridByParameterizer);
73 
74  double GetProgress() const override;
75 
76  ParameterNamesType GetParameterNames() const override;
77 
78  ParameterNamesType GetDerivedParameterNames() const override;
79 
80  ParameterNamesType GetCriterionNames() const override;
81 
82  ParameterNamesType GetEvaluationParameterNames() const override;
83 
84 protected:
85  PixelBasedParameterFitImageGenerator() : m_Progress(0), m_TimeGridByParameterizer(false)
86  {
87  m_InternalMask = nullptr;
88  m_Mask = nullptr;
89  m_DynamicImage = nullptr;
90  };
91 
92  ~PixelBasedParameterFitImageGenerator() override = default;
93 
94  template <typename TPixel, unsigned int VDim>
95  void DoParameterFit(itk::Image<TPixel, VDim>* image);
96 
97  template <typename TPixel, unsigned int VDim>
98  void DoPrepareMask(itk::Image<TPixel, VDim>* image);
99 
100  void onFitProgressEvent(::itk::Object* caller, const ::itk::EventObject& eventObject);
101 
102  bool HasOutdatedResult() const override;
103  void CheckValidInputs() const override;
104  void DoFitAndGetResults(ParameterImageMapType& parameterImages, ParameterImageMapType& derivedParameterImages, ParameterImageMapType& criterionImages, ParameterImageMapType& evaluationParameterImages) override;
105 
106 private:
107  Image::Pointer m_DynamicImage;
108  Image::Pointer m_Mask;
109 
110  typedef itk::Image<unsigned char, 3> InternalMaskType;
111  InternalMaskType::Pointer m_InternalMask;
112 
113  FitFunctorType::Pointer m_FitFunctor;
114 
115  ParameterizerType::Pointer m_ModelParameterizer;
116 
117  ParameterImageMapType m_TempResultMap;
118  ParameterImageMapType m_TempDerivedResultMap;
119  ParameterImageMapType m_TempEvaluationResultMap;
120  ParameterImageMapType m_TempCriterionResultMap;
121 
122  double m_Progress;
125  bool m_TimeGridByParameterizer;
126 };
127 
128 }
129 
130 #endif // __MITK_PARAMETER_FIT_IMAGE_GENERATOR_H_
Base class for (dynamic) models. A model can be used to calculate its signal given the discrete time ...
Definition: mitkModelBase.h:47
ParameterFitImageGeneratorBase::ModelBaseType ModelBaseType
double ScalarType
ParameterFitImageGeneratorBase::ParameterImageMapType ParameterImageMapType
ModelBaseType::ParameterNamesType ParameterNamesType
DataCollection - Class to facilitate loading/accessing structured data.
#define MITKMODELFIT_EXPORT
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
Image class for storing images.
Definition: mitkImage.h:69
std::map< ParameterNameType, Image::Pointer > ParameterImageMapType
ParameterFitImageGeneratorBase::ParameterNameType ParameterNameType