OTB  10.0.0
Orfeo Toolbox
otbFastICAInternalOptimizerVectorImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbFastICAInternalOptimizerVectorImageFilter_h
22 #define otbFastICAInternalOptimizerVectorImageFilter_h
23 
24 #include "otbMacro.h"
25 #include "otbMatrixImageFilter.h"
28 #include <functional>
29 
30 namespace otb
31 {
45 template <class TInputImage, class TOutputImage>
46 class ITK_EXPORT FastICAInternalOptimizerVectorImageFilter : public PersistentImageFilter<TInputImage, TOutputImage>
47 {
48 public:
51  typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass;
52  typedef itk::SmartPointer<Self> Pointer;
53  typedef itk::SmartPointer<const Self> ConstPointer;
54 
56  itkNewMacro(Self);
57 
59  itkTypeMacro(FastICAInternalOptimizerVectorImageFilter, ImageToImageFilter);
60 
62  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
63  itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
65 
67  typedef TInputImage InputImageType;
68  typedef typename InputImageType::RegionType InputRegionType;
69 
70  typedef TOutputImage OutputImageType;
71  typedef typename OutputImageType::RegionType OutputRegionType;
72 
76 
80  typedef typename MatrixObjectType::ComponentType MatrixType;
81  typedef typename MatrixType::InternalMatrixType InternalMatrixType;
82  typedef typename InternalMatrixType::element_type MatrixElementType;
83 
86 
87  typedef std::function<double(double)> NonLinearityType;
88 
89  itkSetMacro(CurrentBandForLoop, unsigned int);
90  itkGetMacro(CurrentBandForLoop, unsigned int);
91 
92  itkGetMacro(W, InternalMatrixType);
93  itkSetMacro(W, InternalMatrixType);
94 
95  void SetNonLinearity(NonLinearityType NonLinearity, NonLinearityType NonLinearityDerivative)
96  {
97  m_NonLinearity = NonLinearity;
98  m_NonLinearityDerivative = NonLinearityDerivative;
99  this->Modified();
100  }
101 
102  itkGetMacro(Beta, double);
103  itkGetMacro(Den, double);
104 
105  virtual void Reset() override;
106 
107  virtual void Synthetize() override;
108 
109 protected:
112  {
113  }
114 
115  void GenerateOutputInformation() override;
116  void ThreadedGenerateData(const OutputRegionType&, itk::ThreadIdType) override;
117 
118  unsigned int m_CurrentBandForLoop;
119 
120  std::vector<double> m_BetaVector;
121  std::vector<double> m_DenVector;
122  std::vector<double> m_NbSamples;
123 
124  double m_Beta;
125  double m_Den;
126 
131 
132 private:
134  void operator=(const Self&); // not implemented
135 }; // end of class
136 
137 } // end of namespace otb
138 
139 #ifndef OTB_MANUAL_INSTANTIATION
141 #endif
142 
143 
144 #endif
Internal optimisation of the FastICA unmixing filter.
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
void SetNonLinearity(NonLinearityType NonLinearity, NonLinearityType NonLinearityDerivative)
StreamingStatisticsVectorImageFilter< InputImageType > CovarianceEstimatorFilterType
CovarianceEstimatorFilterType::MatrixObjectType MatrixObjectType
MatrixImageFilter< TInputImage, TOutputImage > TransformFilterType
Apply a matrix multiplication over the channels of an image.
itk::SmartPointer< Self > Pointer
This filter is the base class for all filter persisting data through multiple update....
This class streams the whole input image through the PersistentStatisticsImageFilter.
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.