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 RigidityImageIteratorType = ImageRegionIterator<RigidityImageType>;
171 using StructuringElementType = BinaryBallStructuringElement<RigidityPixelType, Self::FixedImageDimension>;
172 using SERadiusType = typename StructuringElementType::RadiusType;
173 using DilateFilterType = GrayscaleDilateImageFilter<RigidityImageType, RigidityImageType, StructuringElementType>;
174 using DilateFilterPointer = typename DilateFilterType::Pointer;
175
177 void
179
181 MeasureType
182 GetValue(const ParametersType & parameters) const override;
183
185 void
186 GetDerivative(const ParametersType & parameters, DerivativeType & derivative) const override;
187
189 void
190 BeforeThreadedGetValueAndDerivative(const ParametersType & parameters) const override;
191
193 void
194 GetValueAndDerivative(const ParametersType & parameters,
195 MeasureType & value,
196 DerivativeType & derivative) const override;
197
202
204 // itkSetObjectMacro( RigidityCoefficientImage, RigidityImageType );
205
207 itkSetClampMacro(LinearityConditionWeight, ScalarType, 0.0, NumericTraits<ScalarType>::max());
208 itkGetConstMacro(LinearityConditionWeight, ScalarType);
209
211 itkSetClampMacro(OrthonormalityConditionWeight, ScalarType, 0.0, NumericTraits<ScalarType>::max());
212 itkGetConstMacro(OrthonormalityConditionWeight, ScalarType);
213
215 itkSetClampMacro(PropernessConditionWeight, ScalarType, 0.0, NumericTraits<ScalarType>::max());
216 itkGetConstMacro(PropernessConditionWeight, ScalarType);
217
219 itkSetMacro(UseLinearityCondition, bool);
220
222 itkSetMacro(UseOrthonormalityCondition, bool);
223
225 itkSetMacro(UsePropernessCondition, bool);
226
230 itkSetMacro(CalculateLinearityCondition, bool);
231
235 itkSetMacro(CalculateOrthonormalityCondition, bool);
236
240 itkSetMacro(CalculatePropernessCondition, bool);
241
243 itkGetConstReferenceMacro(LinearityConditionValue, MeasureType);
244
246 itkGetConstReferenceMacro(OrthonormalityConditionValue, MeasureType);
247
249 itkGetConstReferenceMacro(PropernessConditionValue, MeasureType);
250
252 itkGetConstReferenceMacro(LinearityConditionGradientMagnitude, MeasureType);
253
255 itkGetConstReferenceMacro(OrthonormalityConditionGradientMagnitude, MeasureType);
256
258 itkGetConstReferenceMacro(PropernessConditionGradientMagnitude, MeasureType);
259
261 // itkGetConstReferenceMacro( RigidityPenaltyTermValue, MeasureType );
262
264 itkSetMacro(DilateRigidityImages, bool);
265
267 itkSetClampMacro(DilationRadiusMultiplier,
268 CoordinateRepresentationType,
269 0.1,
270 NumericTraits<CoordinateRepresentationType>::max());
271
273 itkSetObjectMacro(FixedRigidityImage, RigidityImageType);
274
276 itkSetObjectMacro(MovingRigidityImage, RigidityImageType);
277
279 itkSetMacro(UseFixedRigidityImage, bool);
280
282 itkSetMacro(UseMovingRigidityImage, bool);
283
285 void
286 FillRigidityCoefficientImage(const ParametersType & parameters) const;
287
288protected:
292 ~TransformRigidityPenaltyTerm() override = default;
293
295 void
296 PrintSelf(std::ostream & os, Indent indent) const override;
297
298private:
300 virtual void
302
304 void
306 const std::string & whichF,
307 const unsigned int WhichDimension,
308 const CoefficientImageSpacingType & spacing) const;
309
311 void
312 CreateNDOperator(NeighborhoodType & F, const std::string & whichF, const CoefficientImageSpacingType & spacing) const;
313
316 FilterSeparable(const CoefficientImageType *, const std::vector<NeighborhoodType> & Operators) const;
317
323
324 mutable MeasureType m_RigidityPenaltyTermValue{};
325 mutable MeasureType m_LinearityConditionValue{};
326 mutable MeasureType m_OrthonormalityConditionValue{};
327 mutable MeasureType m_PropernessConditionValue{};
331
338
340 CoordinateRepresentationType m_DilationRadiusMultiplier{};
346 std::vector<DilateFilterPointer> m_FixedRigidityImageDilation{};
347 std::vector<DilateFilterPointer> m_MovingRigidityImageDilation{};
352};
353
354} // end namespace itk
355
356#ifndef ITK_MANUAL_INSTANTIATION
357# include "itkTransformRigidityPenaltyTerm.hxx"
358#endif
359
360#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 1773719373 for elastix by doxygen 1.15.0 elastix logo