go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkCombinationImageToImageMetric.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 __itkCombinationImageToImageMetric_h
19#define __itkCombinationImageToImageMetric_h
20
23
24namespace itk
25{
26
58template< class TFixedImage, class TMovingImage >
60 public AdvancedImageToImageMetric< TFixedImage, TMovingImage >
61{
62public:
63
67 TFixedImage, TMovingImage > Superclass;
69 typedef SmartPointer< const Self > ConstPointer;
70
73
75 itkNewMacro( Self );
76
78 itkStaticConstMacro( MovingImageDimension, unsigned int,
79 TMovingImage::ImageDimension );
80 itkStaticConstMacro( FixedImageDimension, unsigned int,
81 TFixedImage::ImageDimension );
82
87 //typedef typename Superclass::MovingImagePointer MovingImagePointer;
90 //typedef typename Superclass::FixedImagePointer FixedImagePointer;
94 typedef typename TransformType::Pointer TransformPointer;
115
119
135 typedef typename ImageMetricType::Pointer ImageMetricPointer;
136 typedef SingleValuedCostFunction SingleValuedCostFunctionType;
137 typedef typename SingleValuedCostFunctionType::Pointer SingleValuedCostFunctionPointer;
138
139 typedef typename FixedImageType::PixelType FixedImagePixelType;
140 typedef typename MovingImageType::RegionType MovingImageRegionType;
141 typedef FixedArray< double,
142 itkGetStaticConstMacro( MovingImageDimension ) > MovingImageDerivativeScalesType;
143
145 typedef PointSet< CoordinateRepresentationType,
146 TFixedImage::ImageDimension,
147 DefaultStaticMeshTraits<
149 TFixedImage::ImageDimension,
150 TFixedImage::ImageDimension,
153 typedef PointSet< CoordinateRepresentationType,
154 TMovingImage::ImageDimension,
155 DefaultStaticMeshTraits<
157 TMovingImage::ImageDimension,
158 TMovingImage::ImageDimension,
163
167
173 void SetNumberOfMetrics( unsigned int count );
174
176 itkGetConstMacro( NumberOfMetrics, unsigned int );
177
182 void SetMetric( SingleValuedCostFunctionType * metric, unsigned int pos );
183
185 SingleValuedCostFunctionType * GetMetric( unsigned int count ) const;
186
188 void SetMetricWeight( double weight, unsigned int pos );
189
191 double GetMetricWeight( unsigned int pos ) const;
192
194 void SetMetricRelativeWeight( double weight, unsigned int pos );
195
197 double GetMetricRelativeWeight( unsigned int pos ) const;
198
200 itkSetMacro( UseRelativeWeights, bool );
201 itkGetMacro( UseRelativeWeights, bool );
202
208 void SetUseMetric( const bool use, const unsigned int pos );
209
211 void SetUseAllMetrics( void );
212
214 bool GetUseMetric( const unsigned int pos ) const;
215
217 MeasureType GetMetricValue( unsigned int pos ) const;
218
220 const DerivativeType & GetMetricDerivative( unsigned int pos ) const;
221
223 double GetMetricDerivativeMagnitude( unsigned int pos ) const;
224
226 double GetMetricComputationTime( unsigned int pos ) const;
227
233 void SetTransform( TransformType * _arg ) override;
234
245 virtual void SetTransform( TransformType * _arg, unsigned int pos );
246
250 virtual const TransformType * GetTransform( unsigned int pos ) const;
251
253 const TransformType * GetTransform( void ) const override
254 {
255 return this->GetTransform( 0 );
256 }
257
258
260 void SetInterpolator( InterpolatorType * _arg ) override;
261
263 virtual void SetInterpolator( InterpolatorType * _arg, unsigned int pos );
264
268 virtual const InterpolatorType * GetInterpolator( unsigned int pos ) const;
269
271 const InterpolatorType * GetInterpolator( void ) const override
272 {
273 return this->GetInterpolator( 0 );
274 }
275
276
278 void SetFixedImage( const FixedImageType * _arg ) override;
279
281 virtual void SetFixedImage( const FixedImageType * _arg, unsigned int pos );
282
286 virtual const FixedImageType * GetFixedImage( unsigned int pos ) const;
287
289 const FixedImageType * GetFixedImage( void ) const override
290 {
291 return this->GetFixedImage( 0 );
292 }
293
294
296 void SetFixedImageMask( FixedImageMaskType * _arg ) override;
297
299 virtual void SetFixedImageMask( FixedImageMaskType * _arg, unsigned int pos );
300
304 virtual const FixedImageMaskType * GetFixedImageMask( unsigned int pos ) const;
305
307 const FixedImageMaskType * GetFixedImageMask( void ) const override
308 {
309 return this->GetFixedImageMask( 0 );
310 }
311
312
314 void SetFixedImageRegion( const FixedImageRegionType _arg ) override;
315
317 virtual void SetFixedImageRegion( const FixedImageRegionType _arg, unsigned int pos );
318
322 virtual const FixedImageRegionType & GetFixedImageRegion( unsigned int pos ) const;
323
325 const FixedImageRegionType & GetFixedImageRegion( void ) const override
326 {
327 return this->GetFixedImageRegion( 0 );
328 }
329
330
332 void SetMovingImage( const MovingImageType * _arg ) override;
333
335 virtual void SetMovingImage( const MovingImageType * _arg, unsigned int pos );
336
340 virtual const MovingImageType * GetMovingImage( unsigned int pos ) const;
341
343 const MovingImageType * GetMovingImage( void ) const override
344 {
345 return this->GetMovingImage( 0 );
346 }
347
348
350 void SetMovingImageMask( MovingImageMaskType * _arg ) override;
351
353 virtual void SetMovingImageMask( MovingImageMaskType * _arg, unsigned int pos );
354
358 virtual const MovingImageMaskType * GetMovingImageMask( unsigned int pos ) const;
359
361 const MovingImageMaskType * GetMovingImageMask( void ) const override
362 {
363 return this->GetMovingImageMask( 0 );
364 }
365
366
370 const SizeValueType & GetNumberOfPixelsCounted( void ) const override;
371
373 void Initialize( void ) override;
374
380 MeasureType GetValue( const ParametersType & parameters ) const override;
381
384 const ParametersType & parameters,
385 DerivativeType & derivative ) const override;
386
389 const ParametersType & parameters,
390 MeasureType & value,
391 DerivativeType & derivative ) const override;
392
395 const TransformParametersType & parameters,
396 HessianType & H ) const override;
397
401 ModifiedTimeType GetMTime() const override;
402
403protected:
404
407 void PrintSelf( std::ostream & os, Indent indent ) const override;
408
410 unsigned int m_NumberOfMetrics;
411 std::vector< SingleValuedCostFunctionPointer > m_Metrics;
412 std::vector< double > m_MetricWeights;
413 std::vector< double > m_MetricRelativeWeights;
415 std::vector< bool > m_UseMetric;
416 mutable std::vector< MeasureType > m_MetricValues;
417 mutable std::vector< DerivativeType > m_MetricDerivatives;
418 mutable std::vector< double > m_MetricDerivativesMagnitude;
419 mutable std::vector< double > m_MetricComputationTime;
420
424
425private:
426
427 CombinationImageToImageMetric( const Self & ); // purposely not implemented
428 void operator=( const Self & ); // purposely not implemented
429
434 void InitializeThreadingParameters( void ) const override;
435
439 double GetFinalMetricWeight( unsigned int pos ) const;
440
441};
442
443} // end namespace itk
444
445#ifndef ITK_MANUAL_INSTANTIATION
446#include "itkCombinationImageToImageMetric.hxx"
447#endif
448
449#endif // end #ifndef __itkCombinationImageToImageMetric_h
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics.
Superclass::FixedImageConstPointer FixedImageConstPointer
Superclass::TransformParametersType TransformParametersType
Superclass::MovingImageConstPointer MovingImageConstPointer
Superclass::FixedImageMaskPointer FixedImageMaskPointer
Superclass::GradientImageFilterPointer GradientImageFilterPointer
Superclass::GradientImageFilterType GradientImageFilterType
Superclass::TransformJacobianType TransformJacobianType
Superclass::GradientImagePointer GradientImagePointer
AdvancedTransform< ScalarType, FixedImageDimension, MovingImageDimension > AdvancedTransformType
Superclass::CoordinateRepresentationType CoordinateRepresentationType
Superclass::InterpolatorPointer InterpolatorPointer
Superclass::MovingImageMaskPointer MovingImageMaskPointer
Superclass::MovingImageMaskType MovingImageMaskType
Superclass::GradientPixelType GradientPixelType
ImageToImageMetric< TFixedImage, TMovingImage > Superclass
Superclass::MovingImagePixelType MovingImagePixelType
Superclass::FixedImageMaskType FixedImageMaskType
Superclass::GradientImageType GradientImageType
Superclass::InterpolatorType InterpolatorType
vnl_sparse_matrix< HessianValueType > HessianType
Superclass::FixedImageRegionType FixedImageRegionType
virtual const FixedImageRegionType & GetFixedImageRegion(unsigned int pos) const
const InterpolatorType * GetInterpolator(void) const override
Superclass::AdvancedTransformType TransformType
AdvancedImageToImageMetric< TFixedImage, TMovingImage > Superclass
const TransformType * GetTransform(void) const override
Superclass::DerivativeValueType DerivativeValueType
double GetFinalMetricWeight(unsigned int pos) const
PointSet< CoordinateRepresentationType, TFixedImage::ImageDimension, DefaultStaticMeshTraits< CoordinateRepresentationType, TFixedImage::ImageDimension, TFixedImage::ImageDimension, CoordinateRepresentationType, CoordinateRepresentationType, CoordinateRepresentationType > > FixedPointSetType
Superclass::FixedImageMaskPointer FixedImageMaskPointer
void SetFixedImage(const FixedImageType *_arg) override
void GetDerivative(const ParametersType &parameters, DerivativeType &derivative) const override
void SetMovingImageMask(MovingImageMaskType *_arg) override
double GetMetricRelativeWeight(unsigned int pos) const
void SetInterpolator(InterpolatorType *_arg) override
virtual const FixedImageType * GetFixedImage(unsigned int pos) const
const MovingImageType * GetMovingImage(void) const override
itkStaticConstMacro(MovingImageDimension, unsigned int, TMovingImage::ImageDimension)
Superclass::MovingImageConstPointer MovingImageConstPointer
void SetTransform(TransformType *_arg) override
Superclass::FixedImageRegionType FixedImageRegionType
MeasureType GetMetricValue(unsigned int pos) const
const FixedImageMaskType * GetFixedImageMask(void) const override
double GetMetricWeight(unsigned int pos) const
virtual const MovingImageType * GetMovingImage(unsigned int pos) const
Superclass::CoordinateRepresentationType CoordinateRepresentationType
void PrintSelf(std::ostream &os, Indent indent) const override
Superclass::GradientImageFilterPointer GradientImageFilterPointer
void SetFixedImageMask(FixedImageMaskType *_arg) override
const SizeValueType & GetNumberOfPixelsCounted(void) const override
Superclass::TransformParametersType TransformParametersType
MeasureType GetValue(const ParametersType &parameters) const override
const MovingImageMaskType * GetMovingImageMask(void) const override
void SetMetric(SingleValuedCostFunctionType *metric, unsigned int pos)
virtual void SetMovingImageMask(MovingImageMaskType *_arg, unsigned int pos)
void SetFixedImageRegion(const FixedImageRegionType _arg) override
ModifiedTimeType GetMTime() const override
SingleValuedPointSetToPointSetMetric< FixedPointSetType, MovingPointSetType > PointSetMetricType
virtual const MovingImageMaskType * GetMovingImageMask(unsigned int pos) const
PointSet< CoordinateRepresentationType, TMovingImage::ImageDimension, DefaultStaticMeshTraits< CoordinateRepresentationType, TMovingImage::ImageDimension, TMovingImage::ImageDimension, CoordinateRepresentationType, CoordinateRepresentationType, CoordinateRepresentationType > > MovingPointSetType
const FixedImageRegionType & GetFixedImageRegion(void) const override
double GetMetricDerivativeMagnitude(unsigned int pos) const
void SetUseMetric(const bool use, const unsigned int pos)
virtual void SetTransform(TransformType *_arg, unsigned int pos)
const DerivativeType & GetMetricDerivative(unsigned int pos) const
virtual const InterpolatorType * GetInterpolator(unsigned int pos) const
void SetMetricWeight(double weight, unsigned int pos)
FixedArray< double, itkGetStaticConstMacro(MovingImageDimension) > MovingImageDerivativeScalesType
Superclass::TransformJacobianType TransformJacobianType
Superclass::GradientImagePointer GradientImagePointer
virtual void SetFixedImage(const FixedImageType *_arg, unsigned int pos)
void GetValueAndDerivative(const ParametersType &parameters, MeasureType &value, DerivativeType &derivative) const override
Superclass::InterpolatorPointer InterpolatorPointer
SingleValuedCostFunctionType * GetMetric(unsigned int count) const
bool GetUseMetric(const unsigned int pos) const
virtual void SetFixedImageMask(FixedImageMaskType *_arg, unsigned int pos)
Superclass::MovingImagePixelType MovingImagePixelType
void SetMovingImage(const MovingImageType *_arg) override
void SetNumberOfMetrics(unsigned int count)
virtual const FixedImageMaskType * GetFixedImageMask(unsigned int pos) const
Superclass::GradientImageFilterType GradientImageFilterType
virtual const TransformType * GetTransform(unsigned int pos) const
virtual void SetFixedImageRegion(const FixedImageRegionType _arg, unsigned int pos)
virtual void SetInterpolator(InterpolatorType *_arg, unsigned int pos)
void GetSelfHessian(const TransformParametersType &parameters, HessianType &H) const override
std::vector< SingleValuedCostFunctionPointer > m_Metrics
Superclass::FixedImageConstPointer FixedImageConstPointer
const FixedImageType * GetFixedImage(void) const override
double GetMetricComputationTime(unsigned int pos) const
Superclass::MovingImageMaskPointer MovingImageMaskPointer
Superclass::MovingImageMaskType MovingImageMaskType
void InitializeThreadingParameters(void) const override
SingleValuedCostFunctionType::Pointer SingleValuedCostFunctionPointer
virtual void SetMovingImage(const MovingImageType *_arg, unsigned int pos)
itkStaticConstMacro(FixedImageDimension, unsigned int, TFixedImage::ImageDimension)
void SetMetricRelativeWeight(double weight, unsigned int pos)


Generated on 1667476801 for elastix by doxygen 1.9.4 elastix logo