OTB  6.7.0
Orfeo Toolbox
otbFastICAInternalOptimizerVectorImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 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>
47  : public PersistentImageFilter<TInputImage, TOutputImage>
48 {
49 public:
55 
57  itkNewMacro(Self);
58 
60  itkTypeMacro(FastICAInternalOptimizerVectorImageFilter, ImageToImageFilter);
61 
63  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
64  itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
66 
68  typedef TInputImage InputImageType;
69  typedef typename InputImageType::RegionType InputRegionType;
70 
71  typedef TOutputImage OutputImageType;
72  typedef typename OutputImageType::RegionType OutputRegionType;
73 
77 
82  typedef typename MatrixType::InternalMatrixType InternalMatrixType;
83  typedef typename InternalMatrixType::element_type MatrixElementType;
84 
87 
88  typedef std::function<double(double)> NonLinearityType;
89 
90  itkSetMacro(CurrentBandForLoop, unsigned int);
91  itkGetMacro(CurrentBandForLoop, unsigned int);
92 
93  itkGetMacro(W, InternalMatrixType);
94  itkSetMacro(W, InternalMatrixType);
95 
96  void SetNonLinearity(NonLinearityType NonLinearity,
97  NonLinearityType NonLinearityDerivative)
98  {
99  m_NonLinearity = NonLinearity;
100  m_NonLinearityDerivative = NonLinearityDerivative;
101  this->Modified();
102  }
103 
104  itkGetMacro(Beta, double);
105  itkGetMacro(Den, double);
106 
107  virtual void Reset() override;
108 
109  virtual void Synthetize() override;
110 
111 protected:
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 private:
132  FastICAInternalOptimizerVectorImageFilter( const Self & ); // not implemented
133  void operator= ( const Self & ); // not implemented
134 }; // end of class
135 
136 } // end of namespace otb
137 
138 #ifndef OTB_MANUAL_INSTANTIATION
140 #endif
141 
142 
143 #endif
144 
145 
void SetNonLinearity(NonLinearityType NonLinearity, NonLinearityType NonLinearityDerivative)
Apply a matrix multiplication over the channels of an image.
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
CovarianceEstimatorFilterType::MatrixObjectType MatrixObjectType
Internal optimisation of the FastICA unmixing filter.
unsigned int ThreadIdType
RealType ComponentType
Definition: mvdTypes.h:88
StreamingStatisticsVectorImageFilter< InputImageType > CovarianceEstimatorFilterType
This class streams the whole input image through the PersistentStatisticsImageFilter.
MatrixImageFilter< TInputImage, TOutputImage > TransformFilterType
This filter is the base class for all filter persisting data through multiple update. For instance, a filter computing global statistics on an image with streaming capabilities will have to keep the temporary results for each streamed piece of the image in order to synthesize the global statistics at the end. This filter is an itk::ImageToImageFilter, providing two additional methods. The first one, Synthetize(), allows the user to synthesize temporary data produced by the multiple updates on different pieces of the image to the global result. The second one, Reset(), allows the user to reset the temporary data for a new input image for instance.