ITK  4.2.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 
73  typedef enum {
78 
82  {
83  if ( order == OrderByMagnitude )
84  {
86  }
87  else if ( order == DoNotOrder )
88  {
90  }
91  }
93 
94 private:
96 };
97 } // end namespace functor
98 
119 template< typename TInputImage, typename TOutputImage = TInputImage >
121  public
122  UnaryFunctorImageFilter< TInputImage, TOutputImage,
123  Functor::SymmetricEigenAnalysisFunction<
124  typename TInputImage::PixelType,
125  typename TOutputImage::PixelType > >
126 {
127 public:
130  typedef UnaryFunctorImageFilter<
131  TInputImage, TOutputImage,
133  typename TInputImage::PixelType,
134  typename TOutputImage::PixelType > > Superclass;
135 
138 
139  typedef typename Superclass::OutputImageType OutputImageType;
140  typedef typename TOutputImage::PixelType OutputPixelType;
141  typedef typename TInputImage::PixelType InputPixelType;
142  typedef typename InputPixelType::ValueType InputValueType;
143  typedef typename Superclass::FunctorType FunctorType;
144 
150  typedef typename FunctorType::EigenValueOrderType EigenValueOrderType;
151 
154  void OrderEigenValuesBy(EigenValueOrderType order)
155  {
156  this->GetFunctor().OrderEigenValuesBy(order);
157  }
158 
161 
163  itkNewMacro(Self);
164 
166  void PrintSelf(std::ostream & os, Indent indent) const
167  { this->Superclass::PrintSelf(os, indent); }
168 
171  void SetDimension(unsigned int p)
172  {
173  this->GetFunctor().SetDimension(p);
174  }
175 
176 #ifdef ITK_USE_CONCEPT_CHECKING
177 
178  itkConceptMacro( InputHasNumericTraitsCheck,
180 
182 #endif
183 protected:
186 private:
187  SymmetricEigenAnalysisImageFilter(const Self &); //purposely not implemented
188  void operator=(const Self &); //purposely not implemented
189 };
190 } // end namespace itk
192 
193 #endif
194