ITK  4.6.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;
98 
107  virtual bool EvaluateAtContinuousIndex(
108  const ContinuousIndexType & index) const;
109 
118  virtual bool EvaluateAtIndex(const IndexType & index) const;
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;
158 
159 private:
160  MahalanobisDistanceThresholdImageFunction(const Self &); //purposely not
161  // implemented
162  void operator=(const Self &); //purposely not
163 
164  // implemented
165 
166  double m_Threshold;
167 
168  // This is intended only for Image of Vector pixel type.
170  PixelType
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
Light weight base class for most itk classes.
Point< TCoordRep, itkGetStaticConstMacro(ImageDimension) > PointType
virtual bool Evaluate(const PointType &point) const
MahalanobisDistanceMembershipFunction models class membership using Mahalanobis distance.
virtual double EvaluateDistanceAtIndex(const IndexType &index) const
virtual double EvaluateDistance(const PointType &point) const
Statistics::MahalanobisDistanceMembershipFunction< PixelType > MahalanobisDistanceFunctionType
Returns true if the pixel value of a vector image has a Mahalanobis distance below the value specifie...
void SetCovariance(const CovarianceMatrixType &cov)
virtual bool EvaluateAtContinuousIndex(const ContinuousIndexType &index) const
const MeanVectorType & GetMean() const
ContinuousIndex< TCoordRep, itkGetStaticConstMacro(ImageDimension) > ContinuousIndexType
void SetMean(const MeanVectorType &mean)
void PrintSelf(std::ostream &os, Indent indent) const
Control indentation during Print() invocation.
Definition: itkIndent.h:49
const CovarianceMatrixType & GetCovariance() const
Evaluates a function of an image at specified position.
virtual bool EvaluateAtIndex(const IndexType &index) const