ITK  6.0.0
Insight Toolkit
itkPCAShapeSignedDistanceFunction.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 itkPCAShapeSignedDistanceFunction_h
19 #define itkPCAShapeSignedDistanceFunction_h
20 
22 #include "itkImage.h"
25 #include "itkTransform.h"
26 
27 namespace itk
28 {
66 template <typename TCoordRep, unsigned int VSpaceDimension, typename TImage = Image<double, VSpaceDimension>>
67 class ITK_TEMPLATE_EXPORT PCAShapeSignedDistanceFunction
68  : public ShapeSignedDistanceFunction<TCoordRep, VSpaceDimension>
69 {
70 public:
71  ITK_DISALLOW_COPY_AND_MOVE(PCAShapeSignedDistanceFunction);
72 
76 
79 
81  itkOverrideGetNameOfClassMacro(PCAShapeSignedDistanceFunction);
82 
84  itkNewMacro(Self);
85 
87  static constexpr unsigned int SpaceDimension = Superclass::SpaceDimension;
88 
90  using typename Superclass::CoordRepType;
91 
93  using typename Superclass::InputType;
94 
96  using typename Superclass::OutputType;
97 
99  using typename Superclass::PointType;
100 
102  using typename Superclass::ParametersType;
103 
105  using ImageType = TImage;
107  using ImagePointerVector = std::vector<ImagePointer>;
108 
111 
115  using InterpolatorPointerVector = std::vector<InterpolatorPointer>;
116 
120  using ExtrapolatorPointerVector = std::vector<ExtrapolatorPointer>;
121 
125  using FunctionPointerVector = std::vector<FunctionPointer>;
126 
129  void
130  SetNumberOfPrincipalComponents(unsigned int n);
131 
132  itkGetConstMacro(NumberOfPrincipalComponents, unsigned int);
133 
135  itkSetObjectMacro(MeanImage, ImageType);
136  itkGetModifiableObjectMacro(MeanImage, ImageType);
140  void
142  {
143  m_PrincipalComponentImages = v;
144  }
145  // ImagePointerVector & GetPrincipalComponentImages()
146  // { return m_PrincipalComponentImages; }
151  itkSetMacro(PrincipalComponentStandardDeviations, ParametersType);
152  itkGetConstMacro(PrincipalComponentStandardDeviations, ParametersType);
156  itkSetObjectMacro(Transform, TransformType);
157  itkGetModifiableObjectMacro(Transform, TransformType);
161  void
162  SetParameters(const ParametersType &) override;
163 
164  unsigned int
165  GetNumberOfShapeParameters() const override
166  {
167  return m_NumberOfPrincipalComponents;
168  }
169  unsigned int
170  GetNumberOfPoseParameters() const override
171  {
172  return m_Transform ? m_Transform->GetNumberOfParameters() : 0;
173  }
174 
176  OutputType
177  Evaluate(const PointType & point) const override;
178 
181  void
182  Initialize() override;
183 
184 protected:
186  ~PCAShapeSignedDistanceFunction() override = default;
187 
188  void
189  PrintSelf(std::ostream & os, Indent indent) const override;
190 
191 private:
193  unsigned int m_NumberOfPrincipalComponents{};
194  unsigned int m_NumberOfTransformParameters{};
195 
196  ImagePointer m_MeanImage{};
197  ImagePointerVector m_PrincipalComponentImages{};
198  ParametersType m_PrincipalComponentStandardDeviations{};
199 
201  typename TransformType::Pointer m_Transform{};
202 
203  InterpolatorPointerVector m_Interpolators{};
204  ExtrapolatorPointerVector m_Extrapolators{};
205 
207  ParametersType m_WeightOfPrincipalComponents{};
208  ParametersType m_TransformParameters{};
209 };
210 } // end namespace itk
211 
212 #ifndef ITK_MANUAL_INSTANTIATION
213 # include "itkPCAShapeSignedDistanceFunction.hxx"
214 #endif
215 
216 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::ExtrapolateImageFunction
Base class for all image extrapolaters.
Definition: itkExtrapolateImageFunction.h:44
itk::PCAShapeSignedDistanceFunction::FunctionPointerVector
std::vector< FunctionPointer > FunctionPointerVector
Definition: itkPCAShapeSignedDistanceFunction.h:125
itk::OptimizerParameters< double >
itk::PCAShapeSignedDistanceFunction
Compute the signed distance from a N-dimensional PCA Shape.
Definition: itkPCAShapeSignedDistanceFunction.h:67
itk::PCAShapeSignedDistanceFunction::FunctionPointer
typename FunctionType::Pointer FunctionPointer
Definition: itkPCAShapeSignedDistanceFunction.h:124
itk::PCAShapeSignedDistanceFunction::ImageType
TImage ImageType
Definition: itkPCAShapeSignedDistanceFunction.h:105
itk::PCAShapeSignedDistanceFunction::ExtrapolatorPointerVector
std::vector< ExtrapolatorPointer > ExtrapolatorPointerVector
Definition: itkPCAShapeSignedDistanceFunction.h:120
itkShapeSignedDistanceFunction.h
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itkImage.h
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::PCAShapeSignedDistanceFunction::InterpolatorPointerVector
std::vector< InterpolatorPointer > InterpolatorPointerVector
Definition: itkPCAShapeSignedDistanceFunction.h:115
itk::PCAShapeSignedDistanceFunction::InterpolatorPointer
typename InterpolatorType::Pointer InterpolatorPointer
Definition: itkPCAShapeSignedDistanceFunction.h:114
itk::ImageFunction
Evaluates a function of an image at specified position.
Definition: itkImageFunction.h:55
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::ShapeSignedDistanceFunction
Base class for functions which evaluates the signed distance from a shape.
Definition: itkShapeSignedDistanceFunction.h:53
itk::point
*par Constraints *The filter requires an image with at least two dimensions and a vector *length of at least The theory supports extension to scalar but *the implementation of the itk vector classes do not **The template parameter TRealType must be floating point(float or double) or *a user-defined "real" numerical type with arithmetic operations defined *sufficient to compute derivatives. **\par Performance *This filter will automatically multithread if run with *SetUsePrincipleComponents
itk::PCAShapeSignedDistanceFunction::ExtrapolatorPointer
typename ExtrapolatorType::Pointer ExtrapolatorPointer
Definition: itkPCAShapeSignedDistanceFunction.h:119
itk::PCAShapeSignedDistanceFunction::SetPrincipalComponentImages
void SetPrincipalComponentImages(ImagePointerVector v)
Definition: itkPCAShapeSignedDistanceFunction.h:141
itkExtrapolateImageFunction.h
itk::PCAShapeSignedDistanceFunction::GetNumberOfShapeParameters
unsigned int GetNumberOfShapeParameters() const override
Definition: itkPCAShapeSignedDistanceFunction.h:165
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::Transform
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:83
itkTransform.h
itk::PCAShapeSignedDistanceFunction::ImagePointer
typename ImageType::Pointer ImagePointer
Definition: itkPCAShapeSignedDistanceFunction.h:106
itkInterpolateImageFunction.h
itk::PCAShapeSignedDistanceFunction::GetNumberOfPoseParameters
unsigned int GetNumberOfPoseParameters() const override
Definition: itkPCAShapeSignedDistanceFunction.h:170
itk::InterpolateImageFunction
Base class for all image interpolators.
Definition: itkInterpolateImageFunction.h:45
itk::PCAShapeSignedDistanceFunction::ImagePointerVector
std::vector< ImagePointer > ImagePointerVector
Definition: itkPCAShapeSignedDistanceFunction.h:107