ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkRecursiveSeparableImageFilter.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#ifndef itkRecursiveSeparableImageFilter_h
19#define itkRecursiveSeparableImageFilter_h
20
22#include "itkNumericTraits.h"
24
25namespace itk
26{
47template <typename TInputImage, typename TOutputImage = TInputImage>
48class ITK_TEMPLATE_EXPORT RecursiveSeparableImageFilter : public InPlaceImageFilter<TInputImage, TOutputImage>
49{
50public:
51 ITK_DISALLOW_COPY_AND_MOVE(RecursiveSeparableImageFilter);
52
58
60 itkOverrideGetNameOfClassMacro(RecursiveSeparableImageFilter);
61
63 using InputImagePointer = typename TInputImage::Pointer;
64 using InputImageConstPointer = typename TInputImage::ConstPointer;
65
71 using InputPixelType = typename TInputImage::PixelType;
74
75 using OutputImageRegionType = typename TOutputImage::RegionType;
76
78 using InputImageType = TInputImage;
79
81 using OutputImageType = TOutputImage;
82
84 itkGetConstMacro(Direction, unsigned int);
85
87 itkSetMacro(Direction, unsigned int);
88
90 void
91 SetInputImage(const TInputImage *);
92
94 const TInputImage *
96
97protected:
99 ~RecursiveSeparableImageFilter() override = default;
100 void
101 PrintSelf(std::ostream & os, Indent indent) const override;
102
103 void
105
106 void
107 GenerateData() override;
108
109 void
111
120 void
122
127 virtual void
128 SetUp(ScalarRealType spacing) = 0;
129
136 void
137 FilterDataArray(RealType * outs, const RealType * data, RealType * scratch, SizeValueType ln) const;
138
139protected:
145
153
159
166
171
172
173 template <typename T1, typename T2>
174 static inline void
175 MathEMAMAMAM(T1 & out,
176 const T1 & a1,
177 const T2 & b1,
178 const T1 & a2,
179 const T2 & b2,
180 const T1 & a3,
181 const T2 & b3,
182 const T1 & a4,
183 const T2 & b4)
184 {
185 out = a1 * b1 + a2 * b2 + a3 * b3 + a4 * b4;
186 }
187
188
189 template <typename T1, typename T2>
190 static inline void
192 const VariableLengthVector<T1> & a1,
193 const T2 & b1,
194 const VariableLengthVector<T1> & a2,
195 const T2 & b2,
196 const VariableLengthVector<T1> & a3,
197 const T2 & b3,
198 const VariableLengthVector<T1> & a4,
199 const T2 & b4)
200 {
201 const unsigned int sz = a1.GetSize();
202 if (sz != out.GetSize())
203 {
204 out.SetSize(sz);
205 }
206 for (unsigned int i = 0; i < sz; ++i)
207 {
208 out[i] = a1[i] * b1 + a2[i] * b2 + a3[i] * b3 + a4[i] * b4;
209 }
210 }
211
212 template <typename T1, typename T2>
213 static inline void
214 MathSMAMAMAM(T1 & out,
215 const T1 & a1,
216 const T2 & b1,
217 const T1 & a2,
218 const T2 & b2,
219 const T1 & a3,
220 const T2 & b3,
221 const T1 & a4,
222 const T2 & b4)
223 {
224 out -= a1 * b1 + a2 * b2 + a3 * b3 + a4 * b4;
225 }
226
227 template <typename T1, typename T2>
228 static inline void
230 const VariableLengthVector<T1> & a1,
231 const T2 & b1,
232 const VariableLengthVector<T1> & a2,
233 const T2 & b2,
234 const VariableLengthVector<T1> & a3,
235 const T2 & b3,
236 const VariableLengthVector<T1> & a4,
237 const T2 & b4)
238 {
239 const unsigned int sz = a1.GetSize();
240 if (sz != out.GetSize())
241 {
242 out.SetSize(sz);
243 }
244 for (unsigned int i = 0; i < sz; ++i)
245 {
246 out[i] -= a1[i] * b1 + a2[i] * b2 + a3[i] * b3 + a4[i] * b4;
247 }
248 }
249
250private:
253 unsigned int m_Direction{ 0 };
254};
255} // end namespace itk
256
257#ifndef ITK_MANUAL_INSTANTIATION
258# include "itkRecursiveSeparableImageFilter.hxx"
259#endif
260
261#endif
Base class for all data objects in ITK.
Control indentation during Print() invocation.
Definition itkIndent.h:50
typename NumericTraits< InputPixelType >::ScalarRealType ScalarRealType
typename TInputImage::ConstPointer InputImageConstPointer
void EnlargeOutputRequestedRegion(DataObject *output) override
void BeforeThreadedGenerateData() override
void DynamicThreadedGenerateData(const OutputImageRegionType &) override
static void MathEMAMAMAM(VariableLengthVector< T1 > &out, const VariableLengthVector< T1 > &a1, const T2 &b1, const VariableLengthVector< T1 > &a2, const T2 &b2, const VariableLengthVector< T1 > &a3, const T2 &b3, const VariableLengthVector< T1 > &a4, const T2 &b4)
void SetInputImage(const TInputImage *)
static void MathEMAMAMAM(T1 &out, const T1 &a1, const T2 &b1, const T1 &a2, const T2 &b2, const T1 &a3, const T2 &b3, const T1 &a4, const T2 &b4)
virtual void SetUp(ScalarRealType spacing)=0
InPlaceImageFilter< TInputImage, TOutputImage > Superclass
typename NumericTraits< InputPixelType >::RealType RealType
static void MathSMAMAMAM(T1 &out, const T1 &a1, const T2 &b1, const T1 &a2, const T2 &b2, const T1 &a3, const T2 &b3, const T1 &a4, const T2 &b4)
void FilterDataArray(RealType *outs, const RealType *data, RealType *scratch, SizeValueType ln) const
typename TOutputImage::RegionType OutputImageRegionType
void PrintSelf(std::ostream &os, Indent indent) const override
~RecursiveSeparableImageFilter() override=default
const TInputImage * GetInputImage()
static void MathSMAMAMAM(VariableLengthVector< T1 > &out, const VariableLengthVector< T1 > &a1, const T2 &b1, const VariableLengthVector< T1 > &a2, const T2 &b2, const VariableLengthVector< T1 > &a3, const T2 &b3, const VariableLengthVector< T1 > &a4, const T2 &b4)
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition itkIntTypes.h:86