ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkGradientStructureTensorImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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
19//
20// Created by Jean-Marie Mirebeau on 05/03/2014.
21//
22//
23
24#ifndef itkGradientStructureTensorImageFilter_h
25#define itkGradientStructureTensorImageFilter_h
26
27#include "itkCastImageFilter.h"
29#include "itkAddImageFilter.h"
33
34namespace itk
35{
50template <typename TImage,
52 TImage::ImageDimension>>
53class GradientStructureTensorImageFilter : public ImageToImageFilter<TImage, TTensorImage>
54{
55public:
56 ITK_DISALLOW_COPY_AND_MOVE(GradientStructureTensorImageFilter);
57
62
64 itkNewMacro(Self);
66 itkOverrideGetNameOfClassMacro(GradientStructureTensorImageFilter);
67
68 using InputImageDimensionType = typename Superclass::InputImageType::ImageDimensionType;
69 static constexpr InputImageDimensionType InputImageDimension = Superclass::InputImageType::ImageDimension;
70
71 using ImageType = TImage;
72 using PixelType = typename ImageType::PixelType;
73 using TensorImageType = TTensorImage;
74 using TensorType = typename TensorImageType::PixelType;
75 using ScalarType = typename TensorType::ComponentType;
77
79 itkSetMacro(NoiseScale, ScalarType);
81 itkSetMacro(FeatureScale, ScalarType);
83 itkSetMacro(RescaleForUnitMaximumTrace, bool);
84
85 itkGetConstMacro(NoiseScale, ScalarType);
86 itkGetConstMacro(FeatureScale, ScalarType);
87 itkGetConstMacro(RescaleForUnitMaximumTrace, bool);
88 itkGetConstMacro(PostRescaling, ScalarType);
89
90protected:
91 void
92 GenerateData() override;
93
99
101 {};
102 template <bool>
103 struct Dispatch : public DispatchBase
104 {};
105
106 void
107 IntermediateFilter(const Dispatch<true> &);
108 void
109 IntermediateFilter(const Dispatch<false> &);
110 typename TensorImageType::Pointer m_IntermediateResult;
111
114
116 {
119 {
120 TensorType m;
121 for (InputImageDimensionType i = 0; i < InputImageDimension; ++i)
122 {
123 for (InputImageDimensionType j = i; j < InputImageDimension; ++j)
124 {
125 m(i, j) = u[i] * u[j];
126 }
127 }
128 return m;
129 }
130 };
132 {
134 operator()(const TensorType & t) const
135 {
136 return t.GetTrace();
137 }
138 };
140 {
143 operator()(const TensorType & t) const
144 {
145 return t * scaling;
146 }
147 };
148
150};
151
152} // end namespace itk
153
154#ifndef ITK_MANUAL_INSTANTIATION
155# include "itkGradientStructureTensorImageFilter.hxx"
156#endif
157
158#endif
A templated class holding a n-Dimensional covariant vector.
void GenerateData() override
Global rescaling constant used.
void IntermediateFilter(const Dispatch< false > &)
void IntermediateFilter(const Dispatch< true > &)
Templated n-dimensional image class.
Definition itkImage.h:89
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
#define itkSetMacro(name, type)