ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkMahalanobisDistanceThresholdImageFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 {
48 template< typename TInputImage, typename TCoordRep = float >
50  public ImageFunction< TInputImage, bool, TCoordRep >
51 {
52 public:
58 
61 
63  itkNewMacro(Self);
64 
66  typedef typename Superclass::InputImageType InputImageType;
67 
69  typedef typename TInputImage::PixelType PixelType;
70 
72  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
73 
75  typedef typename Superclass::PointType PointType;
76 
78  typedef typename Superclass::IndexType IndexType;
79 
81  typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
82 
84  typedef vnl_matrix< double > CovarianceMatrixType;
85 
87  typedef vnl_vector< double > MeanVectorType;
88 
97  virtual bool Evaluate(const PointType & point) const ITK_OVERRIDE;
98 
107  virtual bool EvaluateAtContinuousIndex(
108  const ContinuousIndexType & index) const ITK_OVERRIDE;
109 
118  virtual bool EvaluateAtIndex(const IndexType & index) const ITK_OVERRIDE;
119 
124  virtual double EvaluateDistance(const PointType & point) const;
125 
130  virtual double EvaluateDistanceAtIndex(const IndexType & index) const;
131 
133  itkGetConstReferenceMacro(Threshold, double);
134  itkSetMacro(Threshold, double);
136 
139  void SetMean(const MeanVectorType & mean);
140 
143  itkGetConstReferenceMacro(Mean, MeanVectorType);
144 
147  void SetCovariance(const CovarianceMatrixType & cov);
148 
151  itkGetConstReferenceMacro(Covariance, CovarianceMatrixType);
152 
153 protected:
156  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
157 
158 private:
159  ITK_DISALLOW_COPY_AND_ASSIGN(MahalanobisDistanceThresholdImageFunction);
160 
161  double m_Threshold;
162 
163  // This is intended only for Image of Vector pixel type.
165  PixelType
167 
170 
171  // Cached versions of the mean and covariance to manage the
172  // difference in vector/matrix types between this class and the
173  // membership function used internally.
176 };
177 } // end namespace itk
178 
179 #ifndef ITK_MANUAL_INSTANTIATION
180 #include "itkMahalanobisDistanceThresholdImageFunction.hxx"
181 #endif
182 
183 #endif
Light weight base class for most itk classes.
MahalanobisDistanceMembershipFunction models class membership using Mahalanobis distance.
Statistics::MahalanobisDistanceMembershipFunction< PixelType > MahalanobisDistanceFunctionType
Returns true if the pixel value of a vector image has a Mahalanobis distance below the value specifie...
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Evaluates a function of an image at specified position.