18 #ifndef itkGradientImageFilter_h
19 #define itkGradientImageFilter_h
31 template <
typename TPixelType,
unsigned int VImageDimension>
63 template <
typename TInputImage,
64 typename TOperatorValueType = float,
65 typename TOutputValueType = float,
66 typename TOutputImageType =
67 Image<CovariantVector<TOutputValueType, TInputImage::ImageDimension>, TInputImage::ImageDimension>>
75 static constexpr
unsigned int InputImageDimension = TInputImage::ImageDimension;
76 static constexpr
unsigned int OutputImageDimension = TOutputImageType::ImageDimension;
111 GenerateInputRequestedRegion()
override;
118 itkSetMacro(UseImageSpacing,
bool);
119 itkGetConstMacro(UseImageSpacing,
bool);
120 itkBooleanMacro(UseImageSpacing);
123 #if !defined(ITK_FUTURE_LEGACY_REMOVE)
128 SetUseImageSpacingOn()
130 this->SetUseImageSpacing(
true);
137 SetUseImageSpacingOff()
139 this->SetUseImageSpacing(
false);
145 OverrideBoundaryCondition(ImageBoundaryCondition<TInputImage> * boundaryCondition);
147 #ifdef ITK_USE_CONCEPT_CHECKING
149 itkConceptMacro(InputConvertibleToOutputCheck, (Concept::Convertible<InputPixelType, OutputValueType>));
150 itkConceptMacro(OutputHasNumericTraitsCheck, (Concept::HasNumericTraits<OutputValueType>));
164 itkSetMacro(UseImageDirection,
bool);
165 itkGetConstMacro(UseImageDirection,
bool);
166 itkBooleanMacro(UseImageDirection);
170 GradientImageFilter();
171 ~GradientImageFilter()
override =
default;
173 PrintSelf(std::ostream & os, Indent indent)
const override;
186 DynamicThreadedGenerateData(
const OutputImageRegionType & outputRegionForThread)
override;
191 GenerateOutputInformation()
override;
195 template <
typename TValue>
199 if (this->m_UseImageDirection)
202 it.GetImage()->TransformLocalVectorToPhysicalVector(gradient, physicalGradient);
211 template <
typename T>
216 if (this->m_UseImageDirection)
218 it.
GetImage()->TransformLocalVectorToPhysicalVector(gradient, it.
Value());
222 it.
Value() = gradient;
227 bool m_UseImageSpacing{
true };
231 bool m_UseImageDirection{
true };
234 std::unique_ptr<ImageBoundaryCondition<TInputImage, TInputImage>> m_BoundaryCondition{
235 std::make_unique<ZeroFluxNeumannBoundaryCondition<TInputImage>>()
240 #ifndef ITK_MANUAL_INSTANTIATION
241 # include "itkGradientImageFilter.hxx"