go home Home | Main Page | Topics | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Loading...
Searching...
No Matches
itkTransformRigidityPenaltyTerm.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
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 itkTransformRigidityPenaltyTerm_h
19#define itkTransformRigidityPenaltyTerm_h
20
22
26
28#include "itkNeighborhood.h"
29#include "itkImageRegionIterator.h"
30#include "itkNeighborhoodOperatorImageFilter.h"
31#include "itkNeighborhoodIterator.h"
32
34#include "itkGrayscaleDilateImageFilter.h"
35#include "itkBinaryBallStructuringElement.h"
36#include "itkImageRegionIterator.h"
37
38namespace itk
39{
69
70template <typename TFixedImage, typename TScalarType>
71class ITK_TEMPLATE_EXPORT TransformRigidityPenaltyTerm : public TransformPenaltyTerm<TFixedImage, TScalarType>
72{
73public:
75
79 using Pointer = SmartPointer<Self>;
80 using ConstPointer = SmartPointer<const Self>;
81
83 itkNewMacro(Self);
84
87
89 using typename Superclass::CoordinateRepresentationType;
90 using typename Superclass::MovingImageType;
91 using typename Superclass::MovingImagePixelType;
92 using typename Superclass::MovingImagePointer;
93 using typename Superclass::MovingImageConstPointer;
94 using typename Superclass::FixedImageType;
95 using typename Superclass::FixedImagePointer;
96 using typename Superclass::FixedImageConstPointer;
97 using typename Superclass::FixedImageRegionType;
98 using typename Superclass::TransformType;
99 using typename Superclass::TransformPointer;
100 using typename Superclass::InputPointType;
101 using typename Superclass::OutputPointType;
102 using typename Superclass::TransformJacobianType;
103 using typename Superclass::InterpolatorType;
104 using typename Superclass::InterpolatorPointer;
105 using typename Superclass::RealType;
106 using typename Superclass::GradientPixelType;
107 using typename Superclass::GradientImageType;
108 using typename Superclass::GradientImagePointer;
109 using typename Superclass::FixedImageMaskType;
111 using typename Superclass::MovingImageMaskType;
113 using typename Superclass::MeasureType;
114 using typename Superclass::DerivativeType;
115 using typename Superclass::DerivativeValueType;
116 using typename Superclass::ParametersType;
117 using typename Superclass::FixedImagePixelType;
120 using typename Superclass::ScalarType;
121
130
132 using typename Superclass::SpatialJacobianType;
134 using typename Superclass::SpatialHessianType;
136 using typename Superclass::InternalMatrixType;
137
139 itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension);
140 itkStaticConstMacro(MovingImageDimension, unsigned int, FixedImageType::ImageDimension);
141 itkStaticConstMacro(ImageDimension, unsigned int, FixedImageType::ImageDimension);
142
144 void
145 Initialize() override;
146
152 using CoefficientImagePointer = typename CoefficientImageType::Pointer;
153 using CoefficientImageSpacingType = typename CoefficientImageType::SpacingType;
154
156 using NeighborhoodType = Neighborhood<ScalarType, Self::FixedImageDimension>;
157 using NeighborhoodSizeType = typename NeighborhoodType::SizeType;
158 using CoefficientImageIteratorType = ImageRegionIterator<CoefficientImageType>;
159 using NOIFType = NeighborhoodOperatorImageFilter<CoefficientImageType, CoefficientImageType>;
160 using NeighborhoodIteratorType = NeighborhoodIterator<CoefficientImageType>;
161 using RadiusType = typename NeighborhoodIteratorType::RadiusType;
162
165 using RigidityImagePointer = typename RigidityImageType::Pointer;
166 using RigidityPixelType = typename RigidityImageType::PixelType;
167 using RigidityImageRegionType = typename RigidityImageType::RegionType;
168 using RigidityImageIndexType = typename RigidityImageType::IndexType;
169 using RigidityImagePointType = typename RigidityImageType::PointType;
170 using StructuringElementType = BinaryBallStructuringElement<RigidityPixelType, Self::FixedImageDimension>;
171 using SERadiusType = typename StructuringElementType::RadiusType;
172 using DilateFilterType = GrayscaleDilateImageFilter<RigidityImageType, RigidityImageType, StructuringElementType>;
173 using DilateFilterPointer = typename DilateFilterType::Pointer;
174
176 void
178
180 MeasureType
181 GetValue(const ParametersType & parameters) const override;
182
184 void
185 GetDerivative(const ParametersType & parameters, DerivativeType & derivative) const override;
186
188 void
189 BeforeThreadedGetValueAndDerivative(const ParametersType & parameters) const override;
190
192 void
193 GetValueAndDerivative(const ParametersType & parameters,
194 MeasureType & value,
195 DerivativeType & derivative) const override;
196
201
203 // itkSetObjectMacro( RigidityCoefficientImage, RigidityImageType );
204
206 itkSetClampMacro(LinearityConditionWeight, ScalarType, 0.0, NumericTraits<ScalarType>::max());
207 itkGetConstMacro(LinearityConditionWeight, ScalarType);
208
210 itkSetClampMacro(OrthonormalityConditionWeight, ScalarType, 0.0, NumericTraits<ScalarType>::max());
211 itkGetConstMacro(OrthonormalityConditionWeight, ScalarType);
212
214 itkSetClampMacro(PropernessConditionWeight, ScalarType, 0.0, NumericTraits<ScalarType>::max());
215 itkGetConstMacro(PropernessConditionWeight, ScalarType);
216
218 itkSetMacro(UseLinearityCondition, bool);
219
221 itkSetMacro(UseOrthonormalityCondition, bool);
222
224 itkSetMacro(UsePropernessCondition, bool);
225
229 itkSetMacro(CalculateLinearityCondition, bool);
230
234 itkSetMacro(CalculateOrthonormalityCondition, bool);
235
239 itkSetMacro(CalculatePropernessCondition, bool);
240
242 itkGetConstReferenceMacro(LinearityConditionValue, MeasureType);
243
245 itkGetConstReferenceMacro(OrthonormalityConditionValue, MeasureType);
246
248 itkGetConstReferenceMacro(PropernessConditionValue, MeasureType);
249
251 itkGetConstReferenceMacro(LinearityConditionGradientMagnitude, MeasureType);
252
254 itkGetConstReferenceMacro(OrthonormalityConditionGradientMagnitude, MeasureType);
255
257 itkGetConstReferenceMacro(PropernessConditionGradientMagnitude, MeasureType);
258
260 // itkGetConstReferenceMacro( RigidityPenaltyTermValue, MeasureType );
261
263 itkSetMacro(DilateRigidityImages, bool);
264
266 itkSetClampMacro(DilationRadiusMultiplier,
267 CoordinateRepresentationType,
268 0.1,
269 NumericTraits<CoordinateRepresentationType>::max());
270
272 itkSetObjectMacro(FixedRigidityImage, RigidityImageType);
273
275 itkSetObjectMacro(MovingRigidityImage, RigidityImageType);
276
278 itkSetMacro(UseFixedRigidityImage, bool);
279
281 itkSetMacro(UseMovingRigidityImage, bool);
282
284 void
285 FillRigidityCoefficientImage(const ParametersType & parameters) const;
286
287protected:
291 ~TransformRigidityPenaltyTerm() override = default;
292
294 void
295 PrintSelf(std::ostream & os, Indent indent) const override;
296
297private:
299 virtual void
301
303 void
305 const std::string & whichF,
306 const unsigned int WhichDimension,
307 const CoefficientImageSpacingType & spacing) const;
308
310 void
311 CreateNDOperator(NeighborhoodType & F, const std::string & whichF, const CoefficientImageSpacingType & spacing) const;
312
315 FilterSeparable(const CoefficientImageType *, const std::vector<NeighborhoodType> & Operators) const;
316
322
323 mutable MeasureType m_RigidityPenaltyTermValue{};
324 mutable MeasureType m_LinearityConditionValue{};
325 mutable MeasureType m_OrthonormalityConditionValue{};
326 mutable MeasureType m_PropernessConditionValue{};
330
337
339 CoordinateRepresentationType m_DilationRadiusMultiplier{};
345 std::vector<DilateFilterPointer> m_FixedRigidityImageDilation{};
346 std::vector<DilateFilterPointer> m_MovingRigidityImageDilation{};
351};
352
353} // end namespace itk
354
355#ifndef ITK_MANUAL_INSTANTIATION
356# include "itkTransformRigidityPenaltyTerm.hxx"
357#endif
358
359#endif // #ifndef itkTransformRigidityPenaltyTerm_h
typename BSplineOrder1TransformType::Pointer BSplineOrder1TransformPointer
typename ImageSamplerType::OutputVectorContainerPointer ImageSampleContainerPointer
AdvancedBSplineDeformableTransform< ScalarType, FixedImageDimension, 3 > BSplineOrder3TransformType
typename ImageSamplerType::OutputVectorContainerType ImageSampleContainerType
ImageMaskSpatialObject< Self::FixedImageDimension > FixedImageMaskType
typename BSplineOrder3TransformType::Pointer BSplineOrder3TransformPointer
typename BSplineOrder2TransformType::Pointer BSplineOrder2TransformPointer
AdvancedBSplineDeformableTransform< ScalarType, FixedImageDimension, 1 > BSplineOrder1TransformType
AdvancedCombinationTransform< ScalarType, FixedImageDimension > CombinationTransformType
AdvancedBSplineDeformableTransform< ScalarType, FixedImageDimension, 2 > BSplineOrder2TransformType
ImageMaskSpatialObject< Self::MovingImageDimension > MovingImageMaskType
typename TransformType::JacobianOfSpatialJacobianType JacobianOfSpatialJacobianType
typename Superclass::AdvancedTransformType TransformType
typename TransformType::SpatialHessianType SpatialHessianType
typename TransformType::SpatialJacobianType SpatialJacobianType
typename TransformType::InternalMatrixType InternalMatrixType
typename TransformType::JacobianOfSpatialHessianType JacobianOfSpatialHessianType
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
void FillRigidityCoefficientImage(const ParametersType &parameters) const
NeighborhoodOperatorImageFilter< CoefficientImageType, CoefficientImageType > NOIFType
CoefficientImagePointer FilterSeparable(const CoefficientImageType *, const std::vector< NeighborhoodType > &Operators) const
MeasureType GetValue(const ParametersType &parameters) const override
itkStaticConstMacro(ImageDimension, unsigned int, FixedImageType::ImageDimension)
itkStaticConstMacro(MovingImageDimension, unsigned int, FixedImageType::ImageDimension)
GrayscaleDilateImageFilter< RigidityImageType, RigidityImageType, StructuringElementType > DilateFilterType
void Create1DOperator(NeighborhoodType &F, const std::string &whichF, const unsigned int WhichDimension, const CoefficientImageSpacingType &spacing) const
void CreateNDOperator(NeighborhoodType &F, const std::string &whichF, const CoefficientImageSpacingType &spacing) const
void BeforeThreadedGetValueAndDerivative(const ParametersType &parameters) const override
void GetDerivative(const ParametersType &parameters, DerivativeType &derivative) const override
itkOverrideGetNameOfClassMacro(TransformRigidityPenaltyTerm)
BinaryBallStructuringElement< RigidityPixelType, Self::FixedImageDimension > StructuringElementType
void GetValueAndDerivative(const ParametersType &parameters, MeasureType &value, DerivativeType &derivative) const override
void PrintSelf(std::ostream &os, Indent indent) const override
ITK_DISALLOW_COPY_AND_MOVE(TransformRigidityPenaltyTerm)
TransformPenaltyTerm< typename MetricBase< TElastix >::FixedImageType, double > Superclass
~TransformRigidityPenaltyTerm() override=default


Generated on 1774142652 for elastix by doxygen 1.15.0 elastix logo