ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
rtkForwardDifferenceGradientImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright RTK 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 * 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#ifndef rtkForwardDifferenceGradientImageFilter_h
20#define rtkForwardDifferenceGradientImageFilter_h
21
22#include <itkCovariantVector.h>
25
26#include "rtkMacro.h"
27
28namespace rtk
29{
49
50template <typename TInputImage,
51 typename TOperatorValueType = float,
52 typename TOuputValue = float,
53 typename TOuputImage =
55class ITK_TEMPLATE_EXPORT ForwardDifferenceGradientImageFilter
56 : public itk::ImageToImageFilter<TInputImage, TOuputImage>
57{
58public:
59 ITK_DISALLOW_COPY_AND_MOVE(ForwardDifferenceGradientImageFilter);
60
62 static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
63 static constexpr unsigned int OutputImageDimension = TOuputImage::ImageDimension;
64
67
69 using InputImageType = TInputImage;
70 using InputImagePointer = typename InputImageType::Pointer;
71 using OutputImageType = TOuputImage;
72 using OutputImagePointer = typename OutputImageType::Pointer;
73
78
80 itkNewMacro(Self);
81
83 itkOverrideGetNameOfClassMacro(ForwardDifferenceGradientImageFilter);
84
86 using OperatorValueType = TOperatorValueType;
87 using OutputValueType = TOuputValue;
88 using InputPixelType = typename InputImageType::PixelType;
89 using CovariantVectorType = typename OutputImageType::PixelType;
90 using OutputImageRegionType = typename OutputImageType::RegionType;
91
98 void
100
103 void
105 {
106 this->SetUseImageSpacing(true);
107 }
108
111 void
113 {
114 this->SetUseImageSpacing(false);
115 }
116
119 itkSetMacro(UseImageSpacing, bool);
120 itkGetConstMacro(UseImageSpacing, bool);
121
125 void
126 SetDimensionsProcessed(bool * DimensionsProcessed);
127
129 void
131
132 // Begin concept checking
135 // End concept checking
136
147 itkSetMacro(UseImageDirection, bool);
148 itkGetConstMacro(UseImageDirection, bool);
149 itkBooleanMacro(UseImageDirection);
150
151protected:
154 void
155 PrintSelf(std::ostream & os, itk::Indent indent) const override;
156
167 void
168 DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
169
170 void
172
173private:
174 // // An overloaded method which may transform the gradient to a
175 // // physical vector and converts to the correct output pixel type.
176 // template <typename TValue>
177 // void SetOutputPixel( ImageRegionIterator< VectorImage<TValue,OutputImageDimension> > &it, CovariantVectorType
178 // &gradient )
179 // {
180 // if ( this->m_UseImageDirection )
181 // {
182 // CovariantVectorType physicalGradient;
183 // it.GetImage()->TransformLocalVectorToPhysicalVector( gradient, physicalGradient );
184 // it.Set( OutputPixelType( physicalGradient.GetDataPointer(), InputImageDimension, false ) );
185 // }
186 // else
187 // {
188 // it.Set( OutputPixelType( gradient.GetDataPointer(), InputImageDimension, false ) );
189 // }
190 // }
191
192 template <typename T>
193 void
195 {
196 it.Value() = gradient;
197 }
198
199
201
202 // flag to take or not the image direction into account
203 // when computing the derivatives.
205
206 // list of the dimensions along which the gradient has
207 // to be computed. The components on other dimensions
208 // are set to zero
209 bool m_DimensionsProcessed[TInputImage::ImageDimension];
210
213};
214} // namespace rtk
215
216#ifndef ITK_MANUAL_INSTANTIATION
217# include "rtkForwardDifferenceGradientImageFilter.hxx"
218#endif
219
220#endif
A virtual base object that defines an interface to a class of boundary condition objects for use by n...
const PixelType & Value() const
A multi-dimensional iterator templated over image type that walks a region of pixels.
Base class for filters that take an image as input and produce an image as output.
Templated n-dimensional image class.
Definition itkImage.h:89
Control indentation during Print() invocation.
Definition itkIndent.h:53
Implements transparent reference counting.
void SetDimensionsProcessed(bool *DimensionsProcessed)
void OverrideBoundaryCondition(itk::ImageBoundaryCondition< TInputImage > *boundaryCondition)
void SetOutputPixel(itk::ImageRegionIterator< T > &it, CovariantVectorType &gradient)
void PrintSelf(std::ostream &os, itk::Indent indent) const override
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
#define itkConceptMacro(name, conceptType)
Compile-time check that a template argument satisfies an itk::Concept.
#define itkSetMacro(name, type)