ITK  6.0.0
Insight Toolkit
itkWarpHarmonicEnergyCalculator.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 itkWarpHarmonicEnergyCalculator_h
19 #define itkWarpHarmonicEnergyCalculator_h
20 
21 #include "itkObject.h"
22 #include "itkObjectFactory.h"
24 #include "itkVector.h"
25 
26 namespace itk
27 {
44 template <typename TInputImage>
45 class ITK_TEMPLATE_EXPORT WarpHarmonicEnergyCalculator : public Object
46 {
47 public:
48  ITK_DISALLOW_COPY_AND_MOVE(WarpHarmonicEnergyCalculator);
49 
52  using Superclass = Object;
55 
57  itkNewMacro(Self);
58 
60  itkOverrideGetNameOfClassMacro(WarpHarmonicEnergyCalculator);
61 
63  using ImageType = TInputImage;
64 
67 
70 
72  using PixelType = typename TInputImage::PixelType;
73 
76 
79 
81  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
82 
84  static constexpr unsigned int VectorDimension = PixelType::Dimension;
85 
89  using RadiusType = typename ConstNeighborhoodIteratorType::RadiusType;
90 
100  void
101  SetUseImageSpacing(bool);
102  itkGetConstMacro(UseImageSpacing, bool);
103  itkBooleanMacro(UseImageSpacing);
107 
111  itkSetMacro(DerivativeWeights, WeightsType);
112  itkGetConstReferenceMacro(DerivativeWeights, WeightsType);
116  itkSetConstObjectMacro(Image, ImageType);
117 
119  void
120  Compute();
121 
123  itkGetConstMacro(HarmonicEnergy, double);
124 
126  void
127  SetRegion(const RegionType & region);
128 
129 protected:
131  ~WarpHarmonicEnergyCalculator() override = default;
132  void
133  PrintSelf(std::ostream & os, Indent indent) const override;
134 
136  itkGetConstReferenceMacro(NeighborhoodRadius, RadiusType);
137  itkSetMacro(NeighborhoodRadius, RadiusType);
140  double
141  EvaluateAtNeighborhood(ConstNeighborhoodIteratorType & it) const;
142 
143 private:
144  double m_HarmonicEnergy{ 0.0 };
145  ImageConstPointer m_Image{};
146 
147  RegionType m_Region{};
148  bool m_RegionSetByUser{ false };
149 
150  bool m_UseImageSpacing{ true };
151 
152  WeightsType m_DerivativeWeights{};
153 
154  RadiusType m_NeighborhoodRadius{};
155 };
156 } // end namespace itk
157 
158 #ifndef ITK_MANUAL_INSTANTIATION
159 # include "itkWarpHarmonicEnergyCalculator.hxx"
160 #endif
161 
162 #endif /* itkWarpHarmonicEnergyCalculator_h */
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::WarpHarmonicEnergyCalculator::ImagePointer
typename TInputImage::Pointer ImagePointer
Definition: itkWarpHarmonicEnergyCalculator.h:66
itkObjectFactory.h
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itkConstNeighborhoodIterator.h
itk::WarpHarmonicEnergyCalculator::ImageType
TInputImage ImageType
Definition: itkWarpHarmonicEnergyCalculator.h:63
itk::WarpHarmonicEnergyCalculator::RadiusType
typename ConstNeighborhoodIteratorType::RadiusType RadiusType
Definition: itkWarpHarmonicEnergyCalculator.h:89
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::WarpHarmonicEnergyCalculator::PixelType
typename TInputImage::PixelType PixelType
Definition: itkWarpHarmonicEnergyCalculator.h:72
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::WarpHarmonicEnergyCalculator
Compute the harmonic energy of a deformation field.
Definition: itkWarpHarmonicEnergyCalculator.h:45
itk::WarpHarmonicEnergyCalculator::IndexType
typename TInputImage::IndexType IndexType
Definition: itkWarpHarmonicEnergyCalculator.h:75
itk::FixedArray< double, ImageDimension >
itkObject.h
itk::WarpHarmonicEnergyCalculator::RegionType
typename TInputImage::RegionType RegionType
Definition: itkWarpHarmonicEnergyCalculator.h:78
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ConstNeighborhoodIterator
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
Definition: itkConstNeighborhoodIterator.h:51
itkVector.h
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:88
itk::GTest::TypedefsAndConstructors::Dimension2::Dimension
constexpr unsigned int Dimension
Definition: itkGTestTypedefsAndConstructors.h:44
itk::WarpHarmonicEnergyCalculator::ImageConstPointer
typename TInputImage::ConstPointer ImageConstPointer
Definition: itkWarpHarmonicEnergyCalculator.h:69