ITK  4.9.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 
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 
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 
126  virtual double EvaluateDistance(const PointType & point) const;
127 
134  virtual double EvaluateDistanceAtIndex(const IndexType & index) const;
135 
137  itkGetConstReferenceMacro(Threshold, double);
138  itkSetMacro(Threshold, double);
140 
142  void SetMean(const MeanVectorType & mean);
143 
145  const MeanVectorType & GetMean() const;
146 
149  void SetCovariance(const CovarianceMatrixType & cov);
150 
152  const CovarianceMatrixType & GetCovariance() const;
153 
154 protected:
157  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
158 
159 private:
160  MahalanobisDistanceThresholdImageFunction(const Self &) ITK_DELETE_FUNCTION;
161  void operator=(const Self &) ITK_DELETE_FUNCTION;
162 
163  double m_Threshold;
164 
165  // This is intended only for Image of Vector pixel type.
166  typedef Statistics::MahalanobisDistanceMembershipFunction<
167  PixelType
169 
171  MahalanobisDistanceFunctionPointer m_MahalanobisDistanceMembershipFunction;
172 
173  // Cached versions of the mean and covariance to manage the
174  // difference in vector/matrix types between this class and the
175  // membership function used internally.
178 };
179 } // end namespace itk
180 
181 #ifndef ITK_MANUAL_INSTANTIATION
182 #include "itkMahalanobisDistanceThresholdImageFunction.hxx"
183 #endif
184 
185 #endif
Light weight base class for most itk classes.
Point< TCoordRep, itkGetStaticConstMacro(ImageDimension) > PointType
virtual bool Evaluate(const PointType &point) const override
virtual bool EvaluateAtIndex(const IndexType &index) const override
virtual bool EvaluateAtContinuousIndex(const ContinuousIndexType &index) const override
MahalanobisDistanceMembershipFunction models class membership using Mahalanobis distance.
virtual double EvaluateDistanceAtIndex(const IndexType &index) const
virtual double EvaluateDistance(const PointType &point) const
void PrintSelf(std::ostream &os, Indent indent) const override
Returns true if the pixel value of a vector image has a Mahalanobis distance below the value specifie...
void SetCovariance(const CovarianceMatrixType &cov)
const MeanVectorType & GetMean() const
ContinuousIndex< TCoordRep, itkGetStaticConstMacro(ImageDimension) > ContinuousIndexType
void SetMean(const MeanVectorType &mean)
Control indentation during Print() invocation.
Definition: itkIndent.h:49
const CovarianceMatrixType & GetCovariance() const
Evaluates a function of an image at specified position.