ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkPointSetToPointSetMetricv4.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 __itkPointSetToPointSetMetricv4_h
19 #define __itkPointSetToPointSetMetricv4_h
20 
22 
23 #include "itkFixedArray.h"
24 #include "itkPointsLocator.h"
25 #include "itkPointSet.h"
26 
27 namespace itk
28 {
69 template<typename TFixedPointSet, typename TMovingPointSet,
70  class TInternalComputationValueType = double>
72 : public ObjectToObjectMetric<TFixedPointSet::PointDimension, TMovingPointSet::PointDimension,
73  Image<TInternalComputationValueType, TFixedPointSet::PointDimension>, TInternalComputationValueType>
74 {
75 public:
76 
79  typedef ObjectToObjectMetric<TFixedPointSet::PointDimension,
80  TMovingPointSet::PointDimension,
82  TInternalComputationValueType> Superclass;
85 
88 
90  typedef typename Superclass::MeasureType MeasureType;
91 
96 
99 
106 
112 
116 
118 
119 
122 
124  typedef TFixedPointSet FixedPointSetType;
125  typedef typename TFixedPointSet::PointType FixedPointType;
126  typedef typename TFixedPointSet::PixelType FixedPixelType;
127  typedef typename TFixedPointSet::PointsContainer FixedPointsContainer;
128 
130 
132  typedef TMovingPointSet MovingPointSetType;
133  typedef typename TMovingPointSet::PointType MovingPointType;
134  typedef typename TMovingPointSet::PixelType MovingPixelType;
135  typedef typename TMovingPointSet::PointsContainer MovingPointsContainer;
136 
138 
146 
149  typedef typename PointType::CoordRepType CoordRepType;
151  typedef typename PointsContainer::ConstIterator PointsConstIterator;
152  typedef typename PointsContainer::ElementIdentifier PointIdentifier;
153 
157 
160 
161  typedef typename DerivativeType::ValueType DerivativeValueType;
163 
178 
180  itkSetConstObjectMacro( FixedPointSet, FixedPointSetType );
181  itkGetConstObjectMacro( FixedPointSet, FixedPointSetType );
183 
185  itkGetModifiableObjectMacro( FixedTransformedPointSet, FixedTransformedPointSetType );
186 
188  itkSetConstObjectMacro( MovingPointSet, MovingPointSetType );
189  itkGetConstObjectMacro( MovingPointSet, MovingPointSetType );
191 
193  itkGetModifiableObjectMacro(MovingTransformedPointSet, MovingTransformedPointSetType );
194 
199 
210  virtual MeasureType GetValue() const;
211 
222  virtual void GetDerivative( DerivativeType & ) const;
223 
234  virtual void GetValueAndDerivative( MeasureType &, DerivativeType & ) const;
235 
241  virtual MeasureType GetLocalNeighborhoodValue( const PointType &, const PixelType & pixel = 0 ) const = 0;
242 
247  virtual LocalDerivativeType GetLocalNeighborhoodDerivative( const PointType &, const PixelType & pixel = 0 ) const;
248 
254  MeasureType &, LocalDerivativeType &, const PixelType & pixel = 0 ) const = 0;
255 
261 
266  virtual void Initialize( void ) throw ( ExceptionObject );
267 
268  virtual bool SupportsArbitraryVirtualDomainSamples( void ) const
269  {
270  /* An arbitrary point in the virtual domain will not always
271  * correspond to a point within either point set. */
272  return false;
273  }
274 
275 protected:
277  virtual ~PointSetToPointSetMetricv4();
278  void PrintSelf( std::ostream & os, Indent indent ) const;
279 
280  typename FixedPointSetType::ConstPointer m_FixedPointSet;
282 
284 
285  typename MovingPointSetType::ConstPointer m_MovingPointSet;
287 
289 
292 
298 
301  virtual void InitializePointSets( void ) const;
302 
307  virtual void InitializeForIteration( void ) const;
308 
314  virtual SizeValueType CalculateNumberOfValidFixedPoints( void ) const;
315 
318  void CalculateValueAndDerivative( MeasureType & value, DerivativeType & derivative, bool calculateValue ) const;
319 
327 
334  void TransformMovingPointSet() const;
335 
340  void InitializePointsLocators() const;
341 
346  void StorePointDerivative( const VirtualPointType &, const DerivativeType &, DerivativeType & ) const;
347 
348 private:
349  PointSetToPointSetMetricv4( const Self & ); //purposely not implemented
350  void operator=( const Self & ); //purposely not implemented
351 
354 
355  // Flag to keep track of whether a warning has already been issued
356  // regarding the number of valid points.
358 
361 };
362 } // end namespace itk
363 
364 #ifndef ITK_MANUAL_INSTANTIATION
365 #include "itkPointSetToPointSetMetricv4.hxx"
366 #endif
367 
368 #endif
PointsContainer::ConstIterator PointsConstIterator
virtual MeasureType GetValue() const
Superclass::VirtualImageType VirtualImageType
Light weight base class for most itk classes.
PointSet< FixedPixelType, itkGetStaticConstMacro(PointDimension)> FixedTransformedPointSetType
MovingPointSetType::ConstPointer m_MovingPointSet
PointsContainer::ElementIdentifier PointIdentifier
PointsLocatorType::NeighborsIdentifierType NeighborsIdentifierType
Transform< TInternalComputationValueType, Image< TInternalComputationValueType, TFixedPointSet::PointDimension >::ImageDimension, TFixedDimension > FixedTransformType
FixedPointSetType::ConstPointer m_FixedPointSet
PointSet< MovingPixelType, itkGetStaticConstMacro(PointDimension)> MovingTransformedPointSetType
ObjectToObjectMetric< TFixedPointSet::PointDimension, TMovingPointSet::PointDimension, Image< TInternalComputationValueType, TFixedPointSet::PointDimension >, TInternalComputationValueType > Superclass
Superclass::FixedTransformParametersType FixedTransformParametersType
virtual void InitializePointSets(void) const
Superclass::VirtualPointSetType VirtualPointSetType
SizeValueType GetNumberOfComponents() const
unsigned long ModifiedTimeType
Definition: itkIntTypes.h:164
virtual void GetDerivative(DerivativeType &) const
Computes similarity between two point sets.
Superclass::MovingInputPointType MovingInputPointType
PointsLocator< PointsContainer > PointsLocatorType
TInternalComputationValueType ParametersValueType
Superclass::MovingOutputPointType MovingOutputPointType
Computes similarity between regions of two objects.
Superclass::VirtualPixelType VirtualPixelType
unsigned long SizeValueType
Definition: itkIntTypes.h:143
Superclass::VirtualSpacingType VirtualSpacingType
TFixedPointSet::PointsContainer FixedPointsContainer
Simulate a standard C array with copy semnatics.
Definition: itkFixedArray.h:50
void PrintSelf(std::ostream &os, Indent indent) const
Superclass::VirtualImagePointer VirtualImagePointer
virtual void Initialize(void)
Superclass::VirtualPointType VirtualPointType
void InitializePointsLocators() const
Accelerate geometric searches for points.
PointsLocatorType::Pointer m_MovingTransformedPointsLocator
Superclass::VirtualIndexType VirtualIndexType
FixedArray< DerivativeValueType, itkGetStaticConstMacro(PointDimension)> LocalDerivativeType
void CalculateValueAndDerivative(MeasureType &value, DerivativeType &derivative, bool calculateValue) const
static const DimensionType FixedPointDimension
Superclass::VirtualSizeType VirtualRadiusType
Transform< TInternalComputationValueType, Image< TInternalComputationValueType, TFixedPointSet::PointDimension >::ImageDimension, TMovingDimension > MovingTransformType
virtual void InitializeForIteration(void) const
Superclass::FixedOutputPointType FixedOutputPointType
static const DimensionType MovingPointDimension
A superclass of the N-dimensional mesh structure; supports point (geometric coordinate and attribute)...
Definition: itkPointSet.h:84
Superclass::FixedTransformPointer FixedTransformPointer
virtual bool SupportsArbitraryVirtualDomainSamples(void) const
Standard exception handling object.
Superclass::MovingDisplacementFieldTransformType DisplacementFieldTransformType
Superclass::FixedTransformJacobianType FixedTransformJacobianType
virtual void GetLocalNeighborhoodValueAndDerivative(const PointType &, MeasureType &, LocalDerivativeType &, const PixelType &pixel=0) const =0
TMovingPointSet::PointsContainer MovingPointsContainer
TreeType::InstanceIdentifierVectorType NeighborsIdentifierType
virtual void GetValueAndDerivative(MeasureType &, DerivativeType &) const
Superclass::MovingTransformType MovingTransformType
void TransformFixedAndCreateVirtualPointSet() const
virtual MeasureType GetLocalNeighborhoodValue(const PointType &, const PixelType &pixel=0) const =0
const VirtualPointSetType * GetVirtualTransformedPointSet(void) const
Superclass::VirtualRegionType VirtualRegionType
Superclass::VirtualPointType VirtualOriginType
virtual SizeValueType CalculateNumberOfValidFixedPoints(void) const
PointsLocatorType::Pointer m_FixedTransformedPointsLocator
FixedTransformedPointSetType::Pointer m_FixedTransformedPointSet
Superclass::MovingTransformPointer MovingTransformPointer
Superclass::MovingTransformJacobianType MovingTransformJacobianType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
void StorePointDerivative(const VirtualPointType &, const DerivativeType &, DerivativeType &) const
void operator=(const Self &)
MovingTransformedPointSetType::Pointer m_MovingTransformedPointSet
Superclass::FixedInputPointType FixedInputPointType
Superclass::FixedTransformType FixedTransformType
Superclass::VirtualPointSetPointer VirtualPointSetPointer
virtual LocalDerivativeType GetLocalNeighborhoodDerivative(const PointType &, const PixelType &pixel=0) const
Superclass::ParametersValueType ParametersValueType
Superclass::NumberOfParametersType NumberOfParametersType
Templated n-dimensional image class.
Definition: itkImage.h:75
Superclass::MovingTransformParametersType MovingTransformParametersType
Superclass::VirtualDirectionType VirtualDirectionType