ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkSymmetricEigenAnalysisImageFilter.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 itkSymmetricEigenAnalysisImageFilter_h
19 #define itkSymmetricEigenAnalysisImageFilter_h
20 
23 
24 namespace itk
25 {
26 // This functor class invokes the computation of Eigen Analysis for
27 // every pixel. The input pixel type must provide the API for the [][]
28 // operator, while the output pixel type must provide the API for the
29 // [] operator. Input pixel matrices should be symmetric.
30 //
31 // The default operation is to order eigen values in ascending order.
32 // You may also use OrderEigenValuesBy( ) to order eigen values by
33 // magnitude as is common with use of tensors in vessel extraction.
34 namespace Functor
35 {
36 template< typename TInput, typename TOutput >
38 {
39 public:
40  typedef typename TInput::RealValueType RealValueType;
45  {
46  return false;
47  }
48 
49  bool operator==(const SymmetricEigenAnalysisFunction & other) const
50  {
51  return !( *this != other );
52  }
53 
54  inline TOutput operator()(const TInput & x) const
55  {
56  TOutput eigenValues;
57 
58  m_Calculator.ComputeEigenValues(x, eigenValues);
59  return eigenValues;
60  }
61 
63  void SetDimension(unsigned int n)
64  {
66  }
67  unsigned int GetDimension() const
68  {
69  return m_Calculator.GetDimension();
70  }
72 
78  typedef enum {
83 
87  {
88  if ( order == OrderByMagnitude )
89  {
91  }
92  else if ( order == DoNotOrder )
93  {
95  }
96  }
98 
99 private:
101 };
102 } // end namespace functor
103 
124 template< typename TInputImage, typename TOutputImage = TInputImage >
126  public
127  UnaryFunctorImageFilter< TInputImage, TOutputImage,
128  Functor::SymmetricEigenAnalysisFunction<
129  typename TInputImage::PixelType,
130  typename TOutputImage::PixelType > >
131 {
132 public:
135  typedef UnaryFunctorImageFilter<
136  TInputImage, TOutputImage,
138  typename TInputImage::PixelType,
139  typename TOutputImage::PixelType > > Superclass;
140 
143 
145  typedef typename TOutputImage::PixelType OutputPixelType;
146  typedef typename TInputImage::PixelType InputPixelType;
147  typedef typename InputPixelType::ValueType InputValueType;
149 
155  typedef typename FunctorType::EigenValueOrderType EigenValueOrderType;
156 
160  {
161  this->GetFunctor().OrderEigenValuesBy(order);
162  }
163 
166 
168  itkNewMacro(Self);
169 
171  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE
172  { this->Superclass::PrintSelf(os, indent); }
173 
176  void SetDimension(unsigned int p)
177  {
178  this->GetFunctor().SetDimension(p);
179  }
180  unsigned int GetDimension() const
181  {
182  return this->GetFunctor().GetDimension();
183  }
185 
186 #ifdef ITK_USE_CONCEPT_CHECKING
187  // Begin concept checking
188  itkConceptMacro( InputHasNumericTraitsCheck,
190  // End concept checking
191 #endif
192 
193 protected:
196 
197 private:
198  SymmetricEigenAnalysisImageFilter(const Self &); //purposely not implemented
199  void operator=(const Self &); //purposely not implemented
200 };
201 } // end namespace itk
202 
203 #endif
bool operator!=(const SymmetricEigenAnalysisFunction &) const
bool operator==(const SymmetricEigenAnalysisFunction &other) const
Computes the eigen-values of every input symmetric matrix pixel.
SymmetricEigenAnalysis< TInput, TOutput > CalculatorType
virtual void PrintSelf(std::ostream &os, Indent indent) const override
void PrintSelf(std::ostream &os, Indent indent) const override
unsigned int ComputeEigenValues(const TMatrix &A, TVector &EigenValues) const
void SetDimension(const unsigned int n)
Implements pixel-wise generic operation on one image.
UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::SymmetricEigenAnalysisFunction< typename TInputImage::PixelType, typename TOutputImage::PixelType > > Superclass
Control indentation during Print() invocation.
Definition: itkIndent.h:49
#define itkConceptMacro(name, concept)