ITK  5.2.0
Insight Toolkit
itkMahalanobisDistanceThresholdImageFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkMahalanobisDistanceThresholdImageFunction_h
19 #define itkMahalanobisDistanceThresholdImageFunction_h
20 
21 #include "itkImageFunction.h"
23 
24 namespace itk
25 {
49 template <typename TInputImage, typename TCoordRep = float>
50 class ITK_TEMPLATE_EXPORT MahalanobisDistanceThresholdImageFunction : public ImageFunction<TInputImage, bool, TCoordRep>
51 {
52 public:
53  ITK_DISALLOW_COPY_AND_MOVE(MahalanobisDistanceThresholdImageFunction);
54 
60 
63 
65  itkNewMacro(Self);
66 
68  using InputImageType = typename Superclass::InputImageType;
69 
71  using PixelType = typename TInputImage::PixelType;
72 
74  static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
75 
77  using PointType = typename Superclass::PointType;
78 
80  using IndexType = typename Superclass::IndexType;
81 
83  using ContinuousIndexType = typename Superclass::ContinuousIndexType;
84 
86  using CovarianceMatrixType = vnl_matrix<double>;
87 
89  using MeanVectorType = vnl_vector<double>;
90 
99  bool
100  Evaluate(const PointType & point) const override;
101 
110  bool
111  EvaluateAtContinuousIndex(const ContinuousIndexType & index) const override;
112 
121  bool
122  EvaluateAtIndex(const IndexType & index) const override;
123 
128  virtual double
129  EvaluateDistance(const PointType & point) const;
130 
135  virtual double
136  EvaluateDistanceAtIndex(const IndexType & index) const;
137 
139  itkGetConstReferenceMacro(Threshold, double);
140  itkSetMacro(Threshold, double);
142 
145  void
146  SetMean(const MeanVectorType & mean);
147 
150  itkGetConstReferenceMacro(Mean, MeanVectorType);
151 
154  void
155  SetCovariance(const CovarianceMatrixType & covariance);
156 
159  itkGetConstReferenceMacro(Covariance, CovarianceMatrixType);
160 
161 protected:
163  ~MahalanobisDistanceThresholdImageFunction() override = default;
164  void
165  PrintSelf(std::ostream & os, Indent indent) const override;
166 
167 private:
168  double m_Threshold;
169 
170  // This is intended only for Image of Vector pixel type.
172 
175 
176  // Cached versions of the mean and covariance to manage the
177  // difference in vector/matrix types between this class and the
178  // membership function used internally.
181 };
182 } // end namespace itk
183 
184 #ifndef ITK_MANUAL_INSTANTIATION
185 # include "itkMahalanobisDistanceThresholdImageFunction.hxx"
186 #endif
187 
188 #endif
itk::MahalanobisDistanceThresholdImageFunction::InputImageType
typename Superclass::InputImageType InputImageType
Definition: itkMahalanobisDistanceThresholdImageFunction.h:68
itkImageFunction.h
itk::MahalanobisDistanceThresholdImageFunction::m_MahalanobisDistanceMembershipFunction
MahalanobisDistanceFunctionPointer m_MahalanobisDistanceMembershipFunction
Definition: itkMahalanobisDistanceThresholdImageFunction.h:174
itkMahalanobisDistanceMembershipFunction.h
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::MahalanobisDistanceThresholdImageFunction::PixelType
typename TInputImage::PixelType PixelType
Definition: itkMahalanobisDistanceThresholdImageFunction.h:71
itk::MahalanobisDistanceThresholdImageFunction::CovarianceMatrixType
vnl_matrix< double > CovarianceMatrixType
Definition: itkMahalanobisDistanceThresholdImageFunction.h:86
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::MahalanobisDistanceThresholdImageFunction::MeanVectorType
vnl_vector< double > MeanVectorType
Definition: itkMahalanobisDistanceThresholdImageFunction.h:89
itk::MahalanobisDistanceThresholdImageFunction::IndexType
typename Superclass::IndexType IndexType
Definition: itkMahalanobisDistanceThresholdImageFunction.h:80
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageFunction
Evaluates a function of an image at specified position.
Definition: itkImageFunction.h:55
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::MahalanobisDistanceThresholdImageFunction::m_Covariance
CovarianceMatrixType m_Covariance
Definition: itkMahalanobisDistanceThresholdImageFunction.h:180
itk::MahalanobisDistanceThresholdImageFunction::m_Mean
MeanVectorType m_Mean
Definition: itkMahalanobisDistanceThresholdImageFunction.h:179
itk::MahalanobisDistanceThresholdImageFunction::ContinuousIndexType
typename Superclass::ContinuousIndexType ContinuousIndexType
Definition: itkMahalanobisDistanceThresholdImageFunction.h:83
itk::MahalanobisDistanceThresholdImageFunction::PointType
typename Superclass::PointType PointType
Definition: itkMahalanobisDistanceThresholdImageFunction.h:77
itk::MahalanobisDistanceThresholdImageFunction::m_Threshold
double m_Threshold
Definition: itkMahalanobisDistanceThresholdImageFunction.h:168
itk::MahalanobisDistanceThresholdImageFunction
Returns true if the pixel value of a vector image has a Mahalanobis distance below the value specifie...
Definition: itkMahalanobisDistanceThresholdImageFunction.h:50
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Statistics::MahalanobisDistanceMembershipFunction
MahalanobisDistanceMembershipFunction models class membership using Mahalanobis distance.
Definition: itkMahalanobisDistanceMembershipFunction.h:62
itk::MahalanobisDistanceThresholdImageFunction::MahalanobisDistanceFunctionPointer
typename MahalanobisDistanceFunctionType::Pointer MahalanobisDistanceFunctionPointer
Definition: itkMahalanobisDistanceThresholdImageFunction.h:173