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 
128  typedef typename Superclass
131  typedef typename Superclass
134 
136  itkStaticConstMacro( FixedImageDimension, unsigned int, FixedImageType::ImageDimension );
137  itkStaticConstMacro( MovingImageDimension, unsigned int, FixedImageType::ImageDimension );
138  itkStaticConstMacro( ImageDimension, unsigned int, FixedImageType::ImageDimension );
139 
141  virtual void Initialize( void ) throw ( ExceptionObject );
142 
144  typedef AdvancedBSplineDeformableTransform< ScalarType,
145  FixedImageDimension, 3 > BSplineTransformType;
147  typedef typename BSplineTransformType::SpacingType GridSpacingType;
148  typedef typename BSplineTransformType::ImageType CoefficientImageType;
149  typedef typename CoefficientImageType::Pointer CoefficientImagePointer;
150  typedef typename CoefficientImageType::SpacingType CoefficientImageSpacingType;
151  typedef AdvancedCombinationTransform< ScalarType,
152  FixedImageDimension > CombinationTransformType;
153 
155  typedef Neighborhood< ScalarType,
156  itkGetStaticConstMacro( FixedImageDimension ) > NeighborhoodType;
157  typedef typename NeighborhoodType::SizeType NeighborhoodSizeType;
158  typedef ImageRegionIterator< CoefficientImageType > CoefficientImageIteratorType;
159  typedef NeighborhoodOperatorImageFilter<
160  CoefficientImageType, CoefficientImageType > NOIFType;
161  typedef NeighborhoodIterator< CoefficientImageType > NeighborhoodIteratorType;
162  typedef typename NeighborhoodIteratorType::RadiusType RadiusType;
163 
165  typedef CoefficientImageType RigidityImageType;
166  typedef typename RigidityImageType::Pointer RigidityImagePointer;
167  typedef typename RigidityImageType::PixelType RigidityPixelType;
168  typedef typename RigidityImageType::RegionType RigidityImageRegionType;
169  typedef typename RigidityImageType::IndexType RigidityImageIndexType;
170  typedef typename RigidityImageType::PointType RigidityImagePointType;
171  typedef ImageRegionIterator< RigidityImageType > RigidityImageIteratorType;
172  typedef BinaryBallStructuringElement<
173  RigidityPixelType,
174  itkGetStaticConstMacro( FixedImageDimension ) > StructuringElementType;
175  typedef typename StructuringElementType::RadiusType SERadiusType;
176  typedef GrayscaleDilateImageFilter<
177  RigidityImageType, RigidityImageType,
178  StructuringElementType > DilateFilterType;
179  typedef typename DilateFilterType::Pointer DilateFilterPointer;
180 
182  void CheckUseAndCalculationBooleans( void );
183 
185  virtual MeasureType GetValue(
186  const ParametersType & parameters ) const;
187 
189  virtual void GetDerivative(
190  const ParametersType & parameters,
191  DerivativeType & derivative ) const;
192 
195  const TransformParametersType & parameters ) const;
196 
198  virtual void GetValueAndDerivative(
199  const ParametersType & parameters,
200  MeasureType & value,
201  DerivativeType & derivative ) const;
202 
206  itkSetObjectMacro( BSplineTransform, BSplineTransformType );
207 
209  //itkSetObjectMacro( RigidityCoefficientImage, RigidityImageType );
210 
212  itkSetClampMacro( LinearityConditionWeight, ScalarType,
213  0.0, NumericTraits< ScalarType >::max() );
214  itkGetMacro( LinearityConditionWeight, ScalarType );
215 
217  itkSetClampMacro( OrthonormalityConditionWeight, ScalarType,
218  0.0, NumericTraits< ScalarType >::max() );
219  itkGetMacro( OrthonormalityConditionWeight, ScalarType );
220 
222  itkSetClampMacro( PropernessConditionWeight, ScalarType,
223  0.0, NumericTraits< ScalarType >::max() );
224  itkGetMacro( PropernessConditionWeight, ScalarType );
225 
227  itkSetMacro( UseLinearityCondition, bool );
228 
230  itkSetMacro( UseOrthonormalityCondition, bool );
231 
233  itkSetMacro( UsePropernessCondition, bool );
234 
238  itkSetMacro( CalculateLinearityCondition, bool );
239 
243  itkSetMacro( CalculateOrthonormalityCondition, bool );
244 
248  itkSetMacro( CalculatePropernessCondition, bool );
249 
251  itkGetConstReferenceMacro( LinearityConditionValue, MeasureType );
252 
254  itkGetConstReferenceMacro( OrthonormalityConditionValue, MeasureType );
255 
257  itkGetConstReferenceMacro( PropernessConditionValue, MeasureType );
258 
260  itkGetConstReferenceMacro( LinearityConditionGradientMagnitude, MeasureType );
261 
263  itkGetConstReferenceMacro( OrthonormalityConditionGradientMagnitude, MeasureType );
264 
266  itkGetConstReferenceMacro( PropernessConditionGradientMagnitude, MeasureType );
267 
269  //itkGetConstReferenceMacro( RigidityPenaltyTermValue, MeasureType );
270 
272  itkSetMacro( DilateRigidityImages, bool );
273 
275  itkSetClampMacro( DilationRadiusMultiplier, CoordinateRepresentationType,
276  0.1, NumericTraits< CoordinateRepresentationType >::max() );
277 
279  itkSetObjectMacro( FixedRigidityImage, RigidityImageType );
280 
282  itkSetObjectMacro( MovingRigidityImage, RigidityImageType );
283 
285  itkSetMacro( UseFixedRigidityImage, bool );
286 
288  itkSetMacro( UseMovingRigidityImage, bool );
289 
291  void FillRigidityCoefficientImage( const ParametersType & parameters ) const;
292 
293 protected:
294 
298  virtual ~TransformRigidityPenaltyTerm() {}
299 
301  void PrintSelf( std::ostream & os, Indent indent ) const;
302 
303 private:
304 
306  TransformRigidityPenaltyTerm( const Self & ); // purposely not implemented
308  void operator=( const Self & ); // purposely not implemented
309 
311  virtual void DilateRigidityImages( void );
312 
314  void Create1DOperator( NeighborhoodType & F, const std::string & whichF,
315  const unsigned int WhichDimension, const CoefficientImageSpacingType & spacing ) const;
316 
318  void CreateNDOperator( NeighborhoodType & F, const std::string & whichF,
319  const CoefficientImageSpacingType & spacing ) const;
320 
323  const std::vector< NeighborhoodType > & Operators ) const;
324 
330 
331  mutable MeasureType m_RigidityPenaltyTermValue;
332  mutable MeasureType m_LinearityConditionValue;
333  mutable MeasureType m_OrthonormalityConditionValue;
334  mutable MeasureType m_PropernessConditionValue;
338 
345 
347  CoordinateRepresentationType m_DilationRadiusMultiplier;
353  std::vector< DilateFilterPointer > m_FixedRigidityImageDilation;
354  std::vector< DilateFilterPointer > m_MovingRigidityImageDilation;
359 
360 };
361 
362 } // end namespace itk
363 
364 #ifndef ITK_MANUAL_INSTANTIATION
365 #include "itkTransformRigidityPenaltyTerm.hxx"
366 #endif
367 
368 #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
Superclass::MeasureType MeasureType
void PrintSelf(std::ostream &os, Indent indent) const
virtual void DilateRigidityImages(void)
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
void CreateNDOperator(NeighborhoodType &F, const std::string &whichF, const CoefficientImageSpacingType &spacing) const
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
void Create1DOperator(NeighborhoodType &F, const std::string &whichF, const unsigned int WhichDimension, const CoefficientImageSpacingType &spacing) const
Superclass::FixedImageMaskType FixedImageMaskType
Superclass::MovingImagePointer MovingImagePointer
Superclass::AdvancedTransformType TransformType
BSplineTransformType::ImageType CoefficientImageType
Superclass::MovingImageMaskPointer MovingImageMaskPointer
Superclass::FixedImagePixelType FixedImagePixelType
Superclass::JacobianOfSpatialHessianType JacobianOfSpatialHessianType
Superclass::MovingImageMaskType MovingImageMaskType
Superclass::FixedImageConstPointer FixedImageConstPointer
Superclass::ImageSampleContainerType ImageSampleContainerType
Superclass::FixedImageConstPointer FixedImageConstPointer
GrayscaleDilateImageFilter< RigidityImageType, RigidityImageType, StructuringElementType > DilateFilterType


Generated on 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo