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  This file is part of the elastix software.
4 
5  Copyright (c) University Medical Center Utrecht. All rights reserved.
6  See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
7  details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notices for more information.
12 
13 ======================================================================*/
14 #ifndef __itkTransformRigidityPenaltyTerm_h
15 #define __itkTransformRigidityPenaltyTerm_h
16 
18 
22 
24 #include "itkNeighborhood.h"
25 #include "itkImageRegionIterator.h"
26 #include "itkNeighborhoodOperatorImageFilter.h"
27 #include "itkNeighborhoodIterator.h"
28 
30 #include "itkGrayscaleDilateImageFilter.h"
31 #include "itkBinaryBallStructuringElement.h"
32 #include "itkImageRegionIterator.h"
33 
34 namespace itk
35 {
66 template< class TFixedImage, class TScalarType >
68  public TransformPenaltyTerm< TFixedImage, TScalarType >
69 {
70 public:
71 
74  typedef TransformPenaltyTerm<
75  TFixedImage, TScalarType > Superclass;
76  typedef SmartPointer< Self > Pointer;
77  typedef SmartPointer< const Self > ConstPointer;
78 
80  itkNewMacro( Self );
81 
84 
103  typedef typename Superclass::RealType RealType;
121 
124  typedef typename Superclass
127  typedef typename Superclass
130 
132  itkStaticConstMacro( FixedImageDimension, unsigned int, FixedImageType::ImageDimension );
133  itkStaticConstMacro( MovingImageDimension, unsigned int, FixedImageType::ImageDimension );
134  itkStaticConstMacro( ImageDimension, unsigned int, FixedImageType::ImageDimension );
135 
137  virtual void Initialize( void ) throw ( ExceptionObject );
138 
141  FixedImageDimension, 3 > BSplineTransformType;
143  typedef typename BSplineTransformType::SpacingType GridSpacingType;
144  typedef typename BSplineTransformType::ImageType CoefficientImageType;
145  typedef typename CoefficientImageType::Pointer CoefficientImagePointer;
146  typedef typename CoefficientImageType::SpacingType CoefficientImageSpacingType;
147  typedef AdvancedCombinationTransform< ScalarType,
148  FixedImageDimension > CombinationTransformType;
149 
151  typedef Neighborhood< ScalarType,
152  itkGetStaticConstMacro( FixedImageDimension ) > NeighborhoodType;
153  typedef typename NeighborhoodType::SizeType NeighborhoodSizeType;
154  typedef ImageRegionIterator< CoefficientImageType > CoefficientImageIteratorType;
155  typedef NeighborhoodOperatorImageFilter<
156  CoefficientImageType, CoefficientImageType > NOIFType;
157  typedef NeighborhoodIterator< CoefficientImageType > NeighborhoodIteratorType;
158  typedef typename NeighborhoodIteratorType::RadiusType RadiusType;
159 
161  typedef CoefficientImageType RigidityImageType;
162  typedef typename RigidityImageType::Pointer RigidityImagePointer;
163  typedef typename RigidityImageType::PixelType RigidityPixelType;
164  typedef typename RigidityImageType::RegionType RigidityImageRegionType;
165  typedef typename RigidityImageType::IndexType RigidityImageIndexType;
166  typedef typename RigidityImageType::PointType RigidityImagePointType;
167  typedef ImageRegionIterator< RigidityImageType > RigidityImageIteratorType;
168  typedef BinaryBallStructuringElement<
169  RigidityPixelType,
170  itkGetStaticConstMacro( FixedImageDimension ) > StructuringElementType;
171  typedef typename StructuringElementType::RadiusType SERadiusType;
172  typedef GrayscaleDilateImageFilter<
173  RigidityImageType, RigidityImageType,
174  StructuringElementType > DilateFilterType;
175  typedef typename DilateFilterType::Pointer DilateFilterPointer;
176 
178  void CheckUseAndCalculationBooleans( void );
179 
181  virtual MeasureType GetValue(
182  const ParametersType & parameters ) const;
183 
185  virtual void GetDerivative(
186  const ParametersType & parameters,
187  DerivativeType & derivative ) const;
188 
191  const TransformParametersType & parameters ) const;
192 
194  virtual void GetValueAndDerivative(
195  const ParametersType & parameters,
196  MeasureType & value,
197  DerivativeType & derivative ) const;
198 
202  itkSetObjectMacro( BSplineTransform, BSplineTransformType );
203 
205  //itkSetObjectMacro( RigidityCoefficientImage, RigidityImageType );
206 
208  itkSetClampMacro( LinearityConditionWeight, ScalarType,
209  0.0, NumericTraits< ScalarType >::max() );
210  itkGetMacro( LinearityConditionWeight, ScalarType );
211 
213  itkSetClampMacro( OrthonormalityConditionWeight, ScalarType,
214  0.0, NumericTraits< ScalarType >::max() );
215  itkGetMacro( OrthonormalityConditionWeight, ScalarType );
216 
218  itkSetClampMacro( PropernessConditionWeight, ScalarType,
219  0.0, NumericTraits< ScalarType >::max() );
220  itkGetMacro( PropernessConditionWeight, ScalarType );
221 
223  itkSetMacro( UseLinearityCondition, bool );
224 
226  itkSetMacro( UseOrthonormalityCondition, bool );
227 
229  itkSetMacro( UsePropernessCondition, bool );
230 
234  itkSetMacro( CalculateLinearityCondition, bool );
235 
239  itkSetMacro( CalculateOrthonormalityCondition, bool );
240 
244  itkSetMacro( CalculatePropernessCondition, bool );
245 
247  itkGetConstReferenceMacro( LinearityConditionValue, MeasureType );
248 
250  itkGetConstReferenceMacro( OrthonormalityConditionValue, MeasureType );
251 
253  itkGetConstReferenceMacro( PropernessConditionValue, MeasureType );
254 
256  itkGetConstReferenceMacro( LinearityConditionGradientMagnitude, MeasureType );
257 
259  itkGetConstReferenceMacro( OrthonormalityConditionGradientMagnitude, MeasureType );
260 
262  itkGetConstReferenceMacro( PropernessConditionGradientMagnitude, MeasureType );
263 
265  //itkGetConstReferenceMacro( RigidityPenaltyTermValue, MeasureType );
266 
268  itkSetMacro( DilateRigidityImages, bool );
269 
271  itkSetClampMacro( DilationRadiusMultiplier, CoordinateRepresentationType,
272  0.1, NumericTraits< CoordinateRepresentationType >::max() );
273 
275  itkSetObjectMacro( FixedRigidityImage, RigidityImageType );
276 
278  itkSetObjectMacro( MovingRigidityImage, RigidityImageType );
279 
281  itkSetMacro( UseFixedRigidityImage, bool );
282 
284  itkSetMacro( UseMovingRigidityImage, bool );
285 
287  void FillRigidityCoefficientImage( const ParametersType & parameters ) const;
288 
289 protected:
290 
294  virtual ~TransformRigidityPenaltyTerm() {}
295 
297  void PrintSelf( std::ostream & os, Indent indent ) const;
298 
299 private:
300 
302  TransformRigidityPenaltyTerm( const Self & ); // purposely not implemented
304  void operator=( const Self & ); // purposely not implemented
305 
307  virtual void DilateRigidityImages( void );
308 
310  void Create1DOperator( NeighborhoodType & F, const std::string WhichF,
311  const unsigned int WhichDimension, const CoefficientImageSpacingType & spacing ) const;
312 
314  void CreateNDOperator( NeighborhoodType & F, const std::string WhichF,
315  const CoefficientImageSpacingType & spacing ) const;
316 
319  const std::vector< NeighborhoodType > & Operators ) const;
320 
326 
334 
341 
349  std::vector< DilateFilterPointer > m_FixedRigidityImageDilation;
350  std::vector< DilateFilterPointer > m_MovingRigidityImageDilation;
355 
356 };
357 
358 } // end namespace itk
359 
360 #ifndef ITK_MANUAL_INSTANTIATION
361 #include "itkTransformRigidityPenaltyTerm.hxx"
362 #endif
363 
364 #endif // #ifndef __itkTransformRigidityPenaltyTerm_h
A cost function that calculates a penalty term on a transformation.
Superclass::MovingImageMaskType MovingImageMaskType
This class combines two transforms: an 'initial transform' with a 'current transform'.
Superclass::DerivativeValueType DerivativeValueType
Superclass::MovingImageConstPointer MovingImageConstPointer
std::vector< DilateFilterPointer > m_MovingRigidityImageDilation
Superclass::ImageSampleContainerPointer ImageSampleContainerPointer
Deformable transform using a B-spline representation.
virtual void BeforeThreadedGetValueAndDerivative(const TransformParametersType &parameters) const
Superclass::FixedImagePixelType FixedImagePixelType
Superclass::TransformParametersType TransformParametersType
Superclass::SpatialHessianType SpatialHessianType
Neighborhood< ScalarType, itkGetStaticConstMacro(FixedImageDimension) > NeighborhoodType
CoefficientImagePointer FilterSeparable(const CoefficientImageType *, const std::vector< NeighborhoodType > &Operators) const
Superclass::GradientImageType GradientImageType
void Create1DOperator(NeighborhoodType &F, const std::string WhichF, const unsigned int WhichDimension, const CoefficientImageSpacingType &spacing) const
Superclass::MeasureType MeasureType
void PrintSelf(std::ostream &os, Indent indent) const
virtual void DilateRigidityImages(void)
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics...
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::FixedImageRegionType FixedImageRegionType
Superclass::MovingImagePointer MovingImagePointer
Superclass::ImageSampleContainerPointer ImageSampleContainerPointer
Superclass::GradientImagePointer GradientImagePointer
virtual void GetValueAndDerivative(const ParametersType &parameters, MeasureType &value, DerivativeType &derivative) const
BinaryBallStructuringElement< RigidityPixelType, itkGetStaticConstMacro(FixedImageDimension) > StructuringElementType
Superclass::SpatialJacobianType SpatialJacobianType
Superclass::InternalMatrixType InternalMatrixType
NeighborhoodOperatorImageFilter< CoefficientImageType, CoefficientImageType > NOIFType
Superclass::InputPointType InputPointType
Superclass::FixedImageRegionType FixedImageRegionType
CoordinateRepresentationType m_DilationRadiusMultiplier
TransformType::JacobianOfSpatialJacobianType JacobianOfSpatialJacobianType
Superclass::FixedImageMaskPointer FixedImageMaskPointer
void FillRigidityCoefficientImage(const ParametersType &parameters) const
Superclass::TransformJacobianType TransformJacobianType
Superclass::ImageSampleContainerType ImageSampleContainerType
Superclass::GradientImageFilterType GradientImageFilterType
Superclass::FixedImageMaskType FixedImageMaskType
int max(int a, int b)
Superclass::CoordinateRepresentationType CoordinateRepresentationType
Superclass::FixedImageType FixedImageType
Superclass::CoordinateRepresentationType CoordinateRepresentationType
Superclass::GradientImagePointer GradientImagePointer
Superclass::MovingImagePixelType MovingImagePixelType
TransformType::JacobianOfSpatialHessianType JacobianOfSpatialHessianType
Superclass::GradientImageFilterType GradientImageFilterType
Superclass::MovingImagePixelType MovingImagePixelType
std::vector< DilateFilterPointer > m_FixedRigidityImageDilation
Superclass::InterpolatorPointer InterpolatorPointer
Superclass::GradientImageFilterPointer GradientImageFilterPointer
virtual MeasureType GetValue(const ParametersType &parameters) const
Superclass::MovingImageConstPointer MovingImageConstPointer
Superclass::ParametersType ParametersType
TransformPenaltyTerm< TFixedImage, TScalarType > Superclass
Superclass::OutputPointType OutputPointType
Superclass::InterpolatorPointer InterpolatorPointer
virtual void GetDerivative(const ParametersType &parameters, DerivativeType &derivative) const
TransformType::SpatialJacobianType SpatialJacobianType
TransformType::InternalMatrixType InternalMatrixType
Superclass::FixedImagePointer FixedImagePointer
Superclass::FixedImagePointer FixedImagePointer
Superclass::DerivativeType DerivativeType
Superclass::JacobianOfSpatialJacobianType JacobianOfSpatialJacobianType
TransformType::SpatialHessianType SpatialHessianType
Superclass::GradientImageFilterPointer GradientImageFilterPointer
Superclass::GradientPixelType GradientPixelType
Superclass::FixedImageMaskType FixedImageMaskType
Superclass::MovingImagePointer MovingImagePointer
Superclass::AdvancedTransformType TransformType
Superclass::MovingImageMaskPointer MovingImageMaskPointer
Superclass::FixedImagePixelType FixedImagePixelType
void CreateNDOperator(NeighborhoodType &F, const std::string WhichF, const CoefficientImageSpacingType &spacing) const
Superclass::JacobianOfSpatialHessianType JacobianOfSpatialHessianType
Superclass::MovingImageMaskType MovingImageMaskType
Superclass::FixedImageConstPointer FixedImageConstPointer
Superclass::ImageSampleContainerType ImageSampleContainerType
Superclass::FixedImageConstPointer FixedImageConstPointer
GrayscaleDilateImageFilter< RigidityImageType, RigidityImageType, StructuringElementType > DilateFilterType


Generated on 11-03-2014 for elastix by doxygen 1.8.6 elastix logo