ITK  5.3.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  * http://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  itkTypeMacro(WarpHarmonicEnergyCalculator, Object);
61 
63  using ImageType = TInputImage;
64 
66  using ImagePointer = typename TInputImage::Pointer;
67 
69  using ImageConstPointer = typename TInputImage::ConstPointer;
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 
90 
100  void
101  SetUseImageSpacing(bool);
102  itkGetConstMacro(UseImageSpacing, bool);
103  itkBooleanMacro(UseImageSpacing);
105 
107 
111  itkSetMacro(DerivativeWeights, WeightsType);
112  itkGetConstReferenceMacro(DerivativeWeights, WeightsType);
114 
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);
139 
140  double
141  EvaluateAtNeighborhood(ConstNeighborhoodIteratorType & it) const;
142 
143 private:
144  double m_HarmonicEnergy{ 0.0 };
146 
148  bool m_RegionSetByUser{ false };
149 
150  bool m_UseImageSpacing{ true };
151 
153 
155 };
156 } // end namespace itk
157 
158 #ifndef ITK_MANUAL_INSTANTIATION
159 # include "itkWarpHarmonicEnergyCalculator.hxx"
160 #endif
161 
162 #endif /* itkWarpHarmonicEnergyCalculator_h */
itk::WarpHarmonicEnergyCalculator::ImagePointer
typename TInputImage::Pointer ImagePointer
Definition: itkWarpHarmonicEnergyCalculator.h:66
itkObjectFactory.h
itk::ConstNeighborhoodIterator::RadiusType
typename Superclass::RadiusType RadiusType
Definition: itkConstNeighborhoodIterator.h:71
itkConstNeighborhoodIterator.h
itk::WarpHarmonicEnergyCalculator::ImageType
TInputImage ImageType
Definition: itkWarpHarmonicEnergyCalculator.h:63
itk::WarpHarmonicEnergyCalculator::m_Region
RegionType m_Region
Definition: itkWarpHarmonicEnergyCalculator.h:147
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:59
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::WarpHarmonicEnergyCalculator::m_DerivativeWeights
WeightsType m_DerivativeWeights
Definition: itkWarpHarmonicEnergyCalculator.h:152
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: itkAnnulusOperator.h:24
itk::ConstNeighborhoodIterator
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
Definition: itkConstNeighborhoodIterator.h:51
itk::WarpHarmonicEnergyCalculator::m_NeighborhoodRadius
RadiusType m_NeighborhoodRadius
Definition: itkWarpHarmonicEnergyCalculator.h:154
itkVector.h
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62
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
itk::WarpHarmonicEnergyCalculator::m_Image
ImageConstPointer m_Image
Definition: itkWarpHarmonicEnergyCalculator.h:145