go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
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 
38 namespace itk
39 {
70 template< class TFixedImage, class TScalarType >
72  public TransformPenaltyTerm< TFixedImage, TScalarType >
73 {
74 public:
75 
78  typedef TransformPenaltyTerm<
79  TFixedImage, TScalarType > Superclass;
81  typedef SmartPointer< const Self > ConstPointer;
82 
84  itkNewMacro( Self );
85 
88 
107  typedef typename Superclass::RealType RealType;
125 
134 
141 
143  itkStaticConstMacro( FixedImageDimension, unsigned int, FixedImageType::ImageDimension );
144  itkStaticConstMacro( MovingImageDimension, unsigned int, FixedImageType::ImageDimension );
145  itkStaticConstMacro( ImageDimension, unsigned int, FixedImageType::ImageDimension );
146 
148  virtual void Initialize( void ) throw ( ExceptionObject );
149 
151  typedef BSplineOrder3TransformType BSplineTransformType;
155  typedef typename CoefficientImageType::Pointer CoefficientImagePointer;
156  typedef typename CoefficientImageType::SpacingType CoefficientImageSpacingType;
157 
159  typedef Neighborhood< ScalarType,
160  itkGetStaticConstMacro( FixedImageDimension ) > NeighborhoodType;
161  typedef typename NeighborhoodType::SizeType NeighborhoodSizeType;
162  typedef ImageRegionIterator< CoefficientImageType > CoefficientImageIteratorType;
163  typedef NeighborhoodOperatorImageFilter<
164  CoefficientImageType, CoefficientImageType > NOIFType;
165  typedef NeighborhoodIterator< CoefficientImageType > NeighborhoodIteratorType;
166  typedef typename NeighborhoodIteratorType::RadiusType RadiusType;
167 
169  typedef CoefficientImageType RigidityImageType;
170  typedef typename RigidityImageType::Pointer RigidityImagePointer;
171  typedef typename RigidityImageType::PixelType RigidityPixelType;
172  typedef typename RigidityImageType::RegionType RigidityImageRegionType;
173  typedef typename RigidityImageType::IndexType RigidityImageIndexType;
174  typedef typename RigidityImageType::PointType RigidityImagePointType;
175  typedef ImageRegionIterator< RigidityImageType > RigidityImageIteratorType;
176  typedef BinaryBallStructuringElement<
178  itkGetStaticConstMacro( FixedImageDimension ) > StructuringElementType;
179  typedef typename StructuringElementType::RadiusType SERadiusType;
180  typedef GrayscaleDilateImageFilter<
183  typedef typename DilateFilterType::Pointer DilateFilterPointer;
184 
186  void CheckUseAndCalculationBooleans( void );
187 
189  virtual MeasureType GetValue(
190  const ParametersType & parameters ) const;
191 
193  virtual void GetDerivative(
194  const ParametersType & parameters,
195  DerivativeType & derivative ) const;
196 
199  const TransformParametersType & parameters ) const;
200 
202  virtual void GetValueAndDerivative(
203  const ParametersType & parameters,
204  MeasureType & value,
205  DerivativeType & derivative ) const;
206 
210  itkSetObjectMacro( BSplineTransform, BSplineTransformType );
211 
213  //itkSetObjectMacro( RigidityCoefficientImage, RigidityImageType );
214 
216  itkSetClampMacro( LinearityConditionWeight, ScalarType,
217  0.0, NumericTraits< ScalarType >::max() );
218  itkGetMacro( LinearityConditionWeight, ScalarType );
219 
221  itkSetClampMacro( OrthonormalityConditionWeight, ScalarType,
222  0.0, NumericTraits< ScalarType >::max() );
223  itkGetMacro( OrthonormalityConditionWeight, ScalarType );
224 
226  itkSetClampMacro( PropernessConditionWeight, ScalarType,
227  0.0, NumericTraits< ScalarType >::max() );
228  itkGetMacro( PropernessConditionWeight, ScalarType );
229 
231  itkSetMacro( UseLinearityCondition, bool );
232 
234  itkSetMacro( UseOrthonormalityCondition, bool );
235 
237  itkSetMacro( UsePropernessCondition, bool );
238 
242  itkSetMacro( CalculateLinearityCondition, bool );
243 
247  itkSetMacro( CalculateOrthonormalityCondition, bool );
248 
252  itkSetMacro( CalculatePropernessCondition, bool );
253 
255  itkGetConstReferenceMacro( LinearityConditionValue, MeasureType );
256 
258  itkGetConstReferenceMacro( OrthonormalityConditionValue, MeasureType );
259 
261  itkGetConstReferenceMacro( PropernessConditionValue, MeasureType );
262 
264  itkGetConstReferenceMacro( LinearityConditionGradientMagnitude, MeasureType );
265 
267  itkGetConstReferenceMacro( OrthonormalityConditionGradientMagnitude, MeasureType );
268 
270  itkGetConstReferenceMacro( PropernessConditionGradientMagnitude, MeasureType );
271 
273  //itkGetConstReferenceMacro( RigidityPenaltyTermValue, MeasureType );
274 
276  itkSetMacro( DilateRigidityImages, bool );
277 
279  itkSetClampMacro( DilationRadiusMultiplier, CoordinateRepresentationType,
280  0.1, NumericTraits< CoordinateRepresentationType >::max() );
281 
283  itkSetObjectMacro( FixedRigidityImage, RigidityImageType );
284 
286  itkSetObjectMacro( MovingRigidityImage, RigidityImageType );
287 
289  itkSetMacro( UseFixedRigidityImage, bool );
290 
292  itkSetMacro( UseMovingRigidityImage, bool );
293 
295  void FillRigidityCoefficientImage( const ParametersType & parameters ) const;
296 
297 protected:
298 
303 
305  void PrintSelf( std::ostream & os, Indent indent ) const;
306 
307 private:
308 
310  TransformRigidityPenaltyTerm( const Self & ); // purposely not implemented
312  void operator=( const Self & ); // purposely not implemented
313 
315  virtual void DilateRigidityImages( void );
316 
318  void Create1DOperator( NeighborhoodType & F, const std::string & whichF,
319  const unsigned int WhichDimension, const CoefficientImageSpacingType & spacing ) const;
320 
322  void CreateNDOperator( NeighborhoodType & F, const std::string & whichF,
323  const CoefficientImageSpacingType & spacing ) const;
324 
326  CoefficientImagePointer FilterSeparable( const CoefficientImageType *,
327  const std::vector< NeighborhoodType > & Operators ) const;
328 
330  BSplineTransformPointer m_BSplineTransform;
334 
335  mutable MeasureType m_RigidityPenaltyTermValue;
336  mutable MeasureType m_LinearityConditionValue;
337  mutable MeasureType m_OrthonormalityConditionValue;
338  mutable MeasureType m_PropernessConditionValue;
342 
349 
351  CoordinateRepresentationType m_DilationRadiusMultiplier;
354  RigidityImagePointer m_FixedRigidityImage;
355  RigidityImagePointer m_MovingRigidityImage;
356  RigidityImagePointer m_RigidityCoefficientImage;
357  std::vector< DilateFilterPointer > m_FixedRigidityImageDilation;
358  std::vector< DilateFilterPointer > m_MovingRigidityImageDilation;
359  RigidityImagePointer m_FixedRigidityImageDilated;
360  RigidityImagePointer m_MovingRigidityImageDilated;
363 
364 };
365 
366 } // end namespace itk
367 
368 #ifndef ITK_MANUAL_INSTANTIATION
369 #include "itkTransformRigidityPenaltyTerm.hxx"
370 #endif
371 
372 #endif // #ifndef __itkTransformRigidityPenaltyTerm_h
A cost function that calculates a penalty term on a transformation.
Superclass::MovingImageMaskType MovingImageMaskType
CoefficientImageType::Pointer CoefficientImagePointer
Superclass::BSplineOrder3TransformPointer BSplineOrder3TransformPointer
Superclass::DerivativeValueType DerivativeValueType
Superclass::MovingImageConstPointer MovingImageConstPointer
void Create1DOperator(NeighborhoodType &F, const std::string &whichF, const unsigned int WhichDimension, const CoefficientImageSpacingType &spacing) const
virtual void BeforeThreadedGetValueAndDerivative(const TransformParametersType &parameters) const
Superclass::BSplineOrder3TransformPointer BSplineOrder3TransformPointer
std::vector< DilateFilterPointer > m_MovingRigidityImageDilation
Superclass::ImageSampleContainerPointer ImageSampleContainerPointer
void PrintSelf(std::ostream &os, Indent indent) const
Superclass::FixedImagePixelType FixedImagePixelType
Superclass::TransformParametersType TransformParametersType
Superclass::SpatialHessianType SpatialHessianType
CoefficientImageType::SpacingType CoefficientImageSpacingType
Superclass::BSplineOrder2TransformType BSplineOrder2TransformType
Neighborhood< ScalarType, itkGetStaticConstMacro(FixedImageDimension) > NeighborhoodType
Superclass::GradientImageType GradientImageType
Superclass::MeasureType MeasureType
Superclass::BSplineOrder3TransformType BSplineOrder3TransformType
virtual void DilateRigidityImages(void)
Superclass::BSplineOrder3TransformType BSplineOrder3TransformType
TransformType::InternalMatrixType InternalMatrixType
Superclass::MovingImageType MovingImageType
A cost function that calculates a rigidity penalty term.
Superclass::TransformJacobianType TransformJacobianType
Superclass::FixedImageMaskPointer FixedImageMaskPointer
Superclass::TransformParametersType TransformParametersType
Superclass::DerivativeValueType DerivativeValueType
Superclass::InterpolatorType InterpolatorType
Superclass::MovingImageMaskPointer MovingImageMaskPointer
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
Superclass::JacobianOfSpatialJacobianType JacobianOfSpatialJacobianType
Superclass::FixedImageRegionType FixedImageRegionType
Superclass::MovingImagePointer MovingImagePointer
Superclass::BSplineOrder1TransformPointer BSplineOrder1TransformPointer
TransformType::JacobianOfSpatialHessianType JacobianOfSpatialHessianType
Superclass::ImageSampleContainerPointer ImageSampleContainerPointer
Superclass::GradientImagePointer GradientImagePointer
BinaryBallStructuringElement< RigidityPixelType, itkGetStaticConstMacro(FixedImageDimension) > StructuringElementType
Superclass::SpatialJacobianType SpatialJacobianType
Superclass::InternalMatrixType InternalMatrixType
NeighborhoodOperatorImageFilter< CoefficientImageType, CoefficientImageType > NOIFType
Superclass::InputPointType InputPointType
BSplineTransformType::SpacingType GridSpacingType
Superclass::FixedImageRegionType FixedImageRegionType
CoordinateRepresentationType m_DilationRadiusMultiplier
virtual void GetDerivative(const ParametersType &parameters, DerivativeType &derivative) const
Superclass::BSplineOrder2TransformPointer BSplineOrder2TransformPointer
TransformType::JacobianOfSpatialJacobianType JacobianOfSpatialJacobianType
Superclass::BSplineOrder2TransformPointer BSplineOrder2TransformPointer
Superclass::CombinationTransformType CombinationTransformType
Superclass::FixedImageMaskPointer FixedImageMaskPointer
Superclass::BSplineOrder1TransformType BSplineOrder1TransformType
Superclass::CombinationTransformType CombinationTransformType
Superclass::TransformJacobianType TransformJacobianType
virtual MeasureType GetValue(const ParametersType &parameters) const
Superclass::AdvancedTransformType TransformType
Superclass::ImageSampleContainerType ImageSampleContainerType
Superclass::GradientImageFilterType GradientImageFilterType
Superclass::FixedImageMaskType FixedImageMaskType
Superclass::CoordinateRepresentationType CoordinateRepresentationType
Superclass::FixedImageType FixedImageType
TransformType::SpatialJacobianType SpatialJacobianType
Superclass::CoordinateRepresentationType CoordinateRepresentationType
Superclass::GradientImagePointer GradientImagePointer
Superclass::MovingImagePixelType MovingImagePixelType
Superclass::GradientImageFilterType GradientImageFilterType
RigidityImageType::PointType RigidityImagePointType
Superclass::MovingImagePixelType MovingImagePixelType
std::vector< DilateFilterPointer > m_FixedRigidityImageDilation
CoefficientImagePointer FilterSeparable(const CoefficientImageType *, const std::vector< NeighborhoodType > &Operators) const
Superclass::InterpolatorPointer InterpolatorPointer
Superclass::GradientImageFilterPointer GradientImageFilterPointer
ImageRegionIterator< RigidityImageType > RigidityImageIteratorType
void CreateNDOperator(NeighborhoodType &F, const std::string &whichF, const CoefficientImageSpacingType &spacing) const
Superclass::MovingImageConstPointer MovingImageConstPointer
Superclass::ParametersType ParametersType
RigidityImageType::IndexType RigidityImageIndexType
NeighborhoodIterator< CoefficientImageType > NeighborhoodIteratorType
TransformPenaltyTerm< TFixedImage, TScalarType > Superclass
Superclass::BSplineOrder1TransformPointer BSplineOrder1TransformPointer
Superclass::OutputPointType OutputPointType
Superclass::InterpolatorPointer InterpolatorPointer
TransformType::SpatialHessianType SpatialHessianType
BSplineTransformType::Pointer BSplineTransformPointer
Superclass::FixedImagePointer FixedImagePointer
Superclass::FixedImagePointer FixedImagePointer
ImageRegionIterator< CoefficientImageType > CoefficientImageIteratorType
virtual void GetValueAndDerivative(const ParametersType &parameters, MeasureType &value, DerivativeType &derivative) const
Superclass::DerivativeType DerivativeType
Superclass::JacobianOfSpatialHessianType JacobianOfSpatialHessianType
StructuringElementType::RadiusType SERadiusType
Superclass::GradientImageFilterPointer GradientImageFilterPointer
Superclass::GradientPixelType GradientPixelType
RigidityImageType::RegionType RigidityImageRegionType
Superclass::FixedImageMaskType FixedImageMaskType
void FillRigidityCoefficientImage(const ParametersType &parameters) const
Superclass::MovingImagePointer MovingImagePointer
BSplineTransformType::ImageType CoefficientImageType
NeighborhoodIteratorType::RadiusType RadiusType
Superclass::MovingImageMaskPointer MovingImageMaskPointer
Superclass::FixedImagePixelType FixedImagePixelType
Superclass::BSplineOrder2TransformType BSplineOrder2TransformType
Superclass::MovingImageMaskType MovingImageMaskType
Superclass::FixedImageConstPointer FixedImageConstPointer
Superclass::ImageSampleContainerType ImageSampleContainerType
Superclass::FixedImageConstPointer FixedImageConstPointer
Superclass::BSplineOrder1TransformType BSplineOrder1TransformType
GrayscaleDilateImageFilter< RigidityImageType, RigidityImageType, StructuringElementType > DilateFilterType


Generated on OURCE_DATE_EPOCH for elastix by doxygen 1.8.13 elastix logo