ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkObjectToObjectMetric.h
Go to the documentation of this file.
1  /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 __itkObjectToObjectMetric_h
19 #define __itkObjectToObjectMetric_h
20 
21 #include "itkTransform.h"
23 #include "itkImage.h"
25 #include "itkPointSet.h"
26 
27 namespace itk
28 {
29 
84 template<unsigned int TFixedDimension, unsigned int TMovingDimension, typename TVirtualImage = Image<double, TFixedDimension>, class TInternalComputationValueType=double>
86  public ObjectToObjectMetricBaseTemplate< TInternalComputationValueType >
87 {
88 public:
94 
97 
99  typedef TInternalComputationValueType CoordinateRepresentationType;
100 
102  typedef TInternalComputationValueType InternalComputationValueType;
103 
106 
110 
114 
116 
119 
121  itkStaticConstMacro(FixedDimension, DimensionType, TFixedDimension);
122  itkStaticConstMacro(MovingDimension, DimensionType, TMovingDimension);
123  itkStaticConstMacro(VirtualDimension, DimensionType, TVirtualImage::ImageDimension);
125 
127  typedef TVirtualImage VirtualImageType;
132  typedef typename VirtualRegionType::SizeType VirtualSizeType;
139 
143 
147 
152 
157 
162 
165 
166  virtual void Initialize(void) throw ( ExceptionObject );
167 
170  virtual void SetParameters( ParametersType & params );
171  virtual const ParametersType & GetParameters() const;
172  virtual bool HasLocalSupport() const;
173  virtual void UpdateTransformParameters( const DerivativeType & derivative, TInternalComputationValueType factor);
174 
176  itkSetObjectMacro(FixedTransform, FixedTransformType);
177 
179  itkGetModifiableObjectMacro(FixedTransform, FixedTransformType);
180 
182  itkSetObjectMacro(MovingTransform, MovingTransformType);
183 
185  itkGetModifiableObjectMacro(MovingTransform, MovingTransformType);
186 
189  void SetTransform( MovingTransformType* transform );
190 
192  const MovingTransformType * GetTransform();
193 
196  itkGetConstMacro(NumberOfValidPoints, SizeValueType)
197 
214  void SetVirtualDomain( const VirtualSpacingType & spacing, const VirtualOriginType & origin,
215  const VirtualDirectionType & direction, const VirtualRegionType & region );
216 
219  void SetVirtualDomainFromImage( VirtualImageType * virtualImage);
220  void SetVirtualDomainFromImage( const VirtualImageType * virtualImage);
222 
227  virtual bool SupportsArbitraryVirtualDomainSamples( void ) const = 0;
228 
234  virtual const TimeStamp& GetVirtualDomainTimeStamp( void ) const;
235 
239 
242  VirtualOriginType GetVirtualOrigin( void ) const;
243 
247 
250  const VirtualRegionType & GetVirtualRegion( void ) const;
251 
252  itkGetModifiableObjectMacro(VirtualImage, VirtualImageType );
253 
263  OffsetValueType ComputeParameterOffsetFromVirtualIndex( const VirtualIndexType & index, const NumberOfParametersType &numberOfLocalParameters ) const;
264 
274  OffsetValueType ComputeParameterOffsetFromVirtualPoint( const VirtualPointType & point, const NumberOfParametersType & numberOfLocalParameters ) const;
275 
280  bool IsInsideVirtualDomain( const VirtualPointType & point ) const;
281  bool IsInsideVirtualDomain( const VirtualIndexType & index ) const;
283 
284 protected:
286  virtual ~ObjectToObjectMetric();
287 
288  void PrintSelf(std::ostream & os, Indent indent) const;
289 
293 
295  void TransformVirtualIndexToPhysicalPoint( const VirtualIndexType &, VirtualPointType & ) const;
296 
302 
309  bool VerifyNumberOfValidPoints( MeasureType & value, DerivativeType & derivative ) const;
310 
314 
316 
320 
325 
326 private:
327  ObjectToObjectMetric(const Self &); //purposely not implemented
328  void operator=(const Self &); //purposely not implemented
329 
330 };
331 } // end namespace itk
332 
333 #ifndef ITK_MANUAL_INSTANTIATION
334 #include "itkObjectToObjectMetric.hxx"
335 #endif
336 
337 #endif
VirtualOriginType GetVirtualOrigin(void) const
VirtualImageType::SizeType VirtualRadiusType
Superclass::RegionType RegionType
Definition: itkImage.h:140
void SetVirtualDomainFromImage(VirtualImageType *virtualImage)
virtual bool HasLocalSupport() const
FixedTransformType::ParametersType FixedTransformParametersType
Light weight base class for most itk classes.
OffsetValueType ComputeParameterOffsetFromVirtualIndex(const VirtualIndexType &index, const NumberOfParametersType &numberOfLocalParameters) const
virtual NumberOfParametersType GetNumberOfParameters() const
Superclass::NumberOfParametersType NumberOfParametersType
VirtualImageType::SpacingType VirtualSpacingType
Transform< TInternalComputationValueType, TVirtualImage::ImageDimension, TFixedDimension > FixedTransformType
virtual void Initialize(void)
VirtualRegionType::SizeType VirtualSizeType
Represent the size (bounds) of a n-dimensional image.
Definition: itkSize.h:52
signed long OffsetValueType
Definition: itkIntTypes.h:154
Provides local/dense/high-dimensionaltiy transformation via a a displacement field.
bool VerifyNumberOfValidPoints(MeasureType &value, DerivativeType &derivative) const
virtual void VerifyDisplacementFieldSizeAndPhysicalSpace()
Superclass::DerivativeValueType DerivativeValueType
const MovingTransformType * GetTransform()
OffsetValueType ComputeParameterOffsetFromVirtualPoint(const VirtualPointType &point, const NumberOfParametersType &numberOfLocalParameters) const
Computes similarity between regions of two objects.
Superclass::ParametersType ParametersType
Definition: itkTransform.h:118
DisplacementFieldTransform< CoordinateRepresentationType, itkGetStaticConstMacro(MovingDimension) > MovingDisplacementFieldTransformType
Base class for all object-to-object similarlity metrics added in ITKv4.
unsigned long SizeValueType
Definition: itkIntTypes.h:143
FixedTransformType::OutputPointType FixedOutputPointType
TPixel PixelType
Definition: itkImage.h:89
virtual const ParametersType & GetParameters() const
Superclass::MeasureType MeasureType
virtual NumberOfParametersType GetNumberOfLocalParameters() const
Superclass::ParametersType ParametersType
FixedTransformType::JacobianType JacobianType
Superclass::DerivativeType DerivativeType
MovingTransformPointer m_MovingTransform
VirtualImageType::PointType VirtualOriginType
const MovingDisplacementFieldTransformType * GetMovingDisplacementFieldTransform() const
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
FixedTransformType::InputPointType FixedInputPointType
Array2D class representing a 2D array with size defined at construction time.
Definition: itkArray2D.h:44
VirtualDirectionType GetVirtualDirection(void) const
VirtualImageType::IndexType VirtualIndexType
VirtualImageType::PixelType VirtualPixelType
Transform< TInternalComputationValueType, TVirtualImage::ImageDimension, TMovingDimension > MovingTransformType
VirtualImageType::Pointer VirtualImagePointer
Superclass::IndexType IndexType
Definition: itkImage.h:122
virtual const TimeStamp & GetVirtualDomainTimeStamp(void) const
MovingTransformType::OutputPointType MovingOutputPointType
bool TransformPhysicalPointToVirtualIndex(const VirtualPointType &, VirtualIndexType &) const
A superclass of the N-dimensional mesh structure; supports point (geometric coordinate and attribute)...
Definition: itkPointSet.h:84
virtual void UpdateTransformParameters(const DerivativeType &derivative, TInternalComputationValueType factor)
Standard exception handling object.
Generate a unique, increasing time value.
Definition: itkTimeStamp.h:58
static const DimensionType MovingDimension
VirtualImageType::PointType VirtualPointType
SmartPointer< const Self > ConstPointer
VirtualImageType::DirectionType VirtualDirectionType
virtual void SetParameters(ParametersType &params)
Superclass::GradientSourceType GradientSourceType
VirtualImageType::ConstPointer VirtualImageConstPointer
TInternalComputationValueType CoordinateRepresentationType
void PrintSelf(std::ostream &os, Indent indent) const
void SetTransform(MovingTransformType *transform)
const VirtualRegionType & GetVirtualRegion(void) const
FixedTransformPointer m_FixedTransform
FixedTransformType::JacobianType FixedTransformJacobianType
MovingTransformType::Pointer MovingTransformPointer
MovingTransformType::InputPointType MovingInputPointType
VirtualPointSetType::Pointer VirtualPointSetPointer
void TransformVirtualIndexToPhysicalPoint(const VirtualIndexType &, VirtualPointType &) const
FixedTransformType::Pointer FixedTransformPointer
static const DimensionType VirtualDimension
ObjectToObjectMetricBaseTemplate< TInternalComputationValueType > Superclass
PointSet< VirtualPixelType, itkGetStaticConstMacro(VirtualDimension)> VirtualPointSetType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
MovingTransformType::ParametersType MovingTransformParametersType
VirtualImageType::RegionType VirtualRegionType
bool IsInsideVirtualDomain(const VirtualPointType &point) const
TInternalComputationValueType InternalComputationValueType
void SetVirtualDomain(const VirtualSpacingType &spacing, const VirtualOriginType &origin, const VirtualDirectionType &direction, const VirtualRegionType &region)
virtual bool SupportsArbitraryVirtualDomainSamples(void) const =0
MovingTransformType::JacobianType MovingTransformJacobianType
Templated n-dimensional image class.
Definition: itkImage.h:75
VirtualSpacingType GetVirtualSpacing(void) const
static const DimensionType FixedDimension