ITK  4.5.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>
71 : public ObjectToObjectMetric<TFixedPointSet::PointDimension, TMovingPointSet::PointDimension>
72 {
73 public:
74 
80 
83 
85  typedef typename Superclass::MeasureType MeasureType;
86 
91 
94 
101 
107 
111 
113 
114 
117 
119  typedef TFixedPointSet FixedPointSetType;
120  typedef typename TFixedPointSet::PointType FixedPointType;
121  typedef typename TFixedPointSet::PixelType FixedPixelType;
122  typedef typename TFixedPointSet::PointsContainer FixedPointsContainer;
123 
125 
127  typedef TMovingPointSet MovingPointSetType;
128  typedef typename TMovingPointSet::PointType MovingPointType;
129  typedef typename TMovingPointSet::PixelType MovingPixelType;
130  typedef typename TMovingPointSet::PointsContainer MovingPointsContainer;
131 
133 
141 
144  typedef typename PointType::CoordRepType CoordRepType;
146  typedef typename PointsContainer::ConstIterator PointsConstIterator;
147  typedef typename PointsContainer::ElementIdentifier PointIdentifier;
148 
152 
155 
156  typedef typename DerivativeType::ValueType DerivativeValueType;
158 
173 
175  itkSetConstObjectMacro( FixedPointSet, FixedPointSetType );
176  itkGetConstObjectMacro(FixedPointSet, FixedPointSetType );
178 
180  itkGetModifiableObjectMacro(FixedTransformedPointSet, FixedTransformedPointSetType );
181 
183  itkSetConstObjectMacro( MovingPointSet, MovingPointSetType );
184 
186  itkGetModifiableObjectMacro(MovingTransformedPointSet, MovingTransformedPointSetType );
187 
192 
203  virtual MeasureType GetValue() const;
204 
215  virtual void GetDerivative( DerivativeType & ) const;
216 
227  virtual void GetValueAndDerivative( MeasureType &, DerivativeType & ) const;
228 
234  virtual MeasureType GetLocalNeighborhoodValue( const PointType &, const PixelType & pixel = 0 ) const = 0;
235 
240  virtual LocalDerivativeType GetLocalNeighborhoodDerivative( const PointType &, const PixelType & pixel = 0 ) const;
241 
247  MeasureType &, LocalDerivativeType &, const PixelType & pixel = 0 ) const = 0;
248 
254 
259  virtual void Initialize( void ) throw ( ExceptionObject );
260 
261  virtual bool SupportsArbitraryVirtualDomainSamples( void ) const
262  {
263  /* An arbitrary point in the virtual domain will not always
264  * correspond to a point within either point set. */
265  return false;
266  }
267 
268 protected:
270  virtual ~PointSetToPointSetMetricv4();
271  void PrintSelf( std::ostream & os, Indent indent ) const;
272 
273  typename FixedPointSetType::ConstPointer m_FixedPointSet;
275 
277 
278  typename MovingPointSetType::ConstPointer m_MovingPointSet;
280 
282 
285 
291 
294  virtual void InitializePointSets( void ) const;
295 
300  virtual void InitializeForIteration( void ) const;
301 
307  virtual SizeValueType CalculateNumberOfValidFixedPoints( void ) const;
308 
311  void CalculateValueAndDerivative( MeasureType & value, DerivativeType & derivative, bool calculateValue ) const;
312 
320 
327  void TransformMovingPointSet() const;
328 
333  void InitializePointsLocators() const;
334 
339  void StorePointDerivative( const VirtualPointType &, const DerivativeType &, DerivativeType & ) const;
340 
341 private:
342  PointSetToPointSetMetricv4( const Self & ); //purposely not implemented
343  void operator=( const Self & ); //purposely not implemented
344 
347 
348  // Flag to keep track of whether a warning has already been issued
349  // regarding the number of valid points.
351 
354 };
355 } // end namespace itk
356 
357 #ifndef ITK_MANUAL_INSTANTIATION
358 #include "itkPointSetToPointSetMetricv4.hxx"
359 #endif
360 
361 #endif
Superclass::VirtualSizeType VirtualRadiusType
Superclass::MovingTransformParametersType MovingTransformParametersType
virtual void Initialize(void)
TMovingPointSet::PointsContainer MovingPointsContainer
Light weight base class for most itk classes.
Transform< double, Image< double, TFixedDimension >::ImageDimension, TFixedDimension > FixedTransformType
void CalculateValueAndDerivative(MeasureType &value, DerivativeType &derivative, bool calculateValue) const
void InitializePointsLocators() const
FixedTransformedPointSetType::Pointer m_FixedTransformedPointSet
virtual LocalDerivativeType GetLocalNeighborhoodDerivative(const PointType &, const PixelType &pixel=0) const
unsigned long ModifiedTimeType
Definition: itkIntTypes.h:164
Computes similarity between two point sets.
virtual SizeValueType CalculateNumberOfValidFixedPoints(void) const
Superclass::VirtualSpacingType VirtualSpacingType
PointsContainer::ElementIdentifier PointIdentifier
Superclass::FixedTransformPointer FixedTransformPointer
virtual MeasureType GetValue() const
void StorePointDerivative(const VirtualPointType &, const DerivativeType &, DerivativeType &) const
Superclass::MovingTransformJacobianType MovingTransformJacobianType
Computes similarity between regions of two objects.
virtual void InitializePointSets(void) const
Superclass::MovingTransformPointer MovingTransformPointer
FixedPointSetType::ConstPointer m_FixedPointSet
Superclass::FixedInputPointType FixedInputPointType
DisplacementFieldTransform< CoordinateRepresentationType, itkGetStaticConstMacro(MovingDimension) > MovingDisplacementFieldTransformType
Superclass::FixedTransformJacobianType FixedTransformJacobianType
unsigned long SizeValueType
Definition: itkIntTypes.h:143
SizeValueType GetNumberOfComponents() const
Simulate a standard C array with copy semnatics.
Definition: itkFixedArray.h:50
virtual void InitializeForIteration(void) const
const VirtualPointSetType * GetVirtualTransformedPointSet(void) const
Accelerate geometric searches for points.
void operator=(const Self &)
virtual bool SupportsArbitraryVirtualDomainSamples(void) const
Superclass::MovingInputPointType MovingInputPointType
Superclass::VirtualPointSetPointer VirtualPointSetPointer
Transform< double, Image< double, TFixedDimension >::ImageDimension, TMovingDimension > MovingTransformType
PointsLocatorType::NeighborsIdentifierType NeighborsIdentifierType
virtual MeasureType GetLocalNeighborhoodValue(const PointType &, const PixelType &pixel=0) const =0
PointsLocatorType::Pointer m_FixedTransformedPointsLocator
TFixedPointSet::PointsContainer FixedPointsContainer
A superclass of the N-dimensional mesh structure; supports point (geometric coordinate and attribute)...
Definition: itkPointSet.h:84
Superclass::FixedTransformParametersType FixedTransformParametersType
Standard exception handling object.
Superclass::VirtualImagePointer VirtualImagePointer
Superclass::VirtualImageType VirtualImageType
PointSet< MovingPixelType, itkGetStaticConstMacro(PointDimension)> MovingTransformedPointSetType
Superclass::NumberOfParametersType NumberOfParametersType
Superclass::MovingDisplacementFieldTransformType DisplacementFieldTransformType
TreeType::InstanceIdentifierVectorType NeighborsIdentifierType
PointsLocator< PointsContainer > PointsLocatorType
Superclass::ParametersValueType ParametersValueType
Superclass::VirtualPointSetType VirtualPointSetType
PointsLocatorType::Pointer m_MovingTransformedPointsLocator
PointsContainer::ConstIterator PointsConstIterator
FixedArray< DerivativeValueType, itkGetStaticConstMacro(PointDimension)> LocalDerivativeType
MovingPointSetType::ConstPointer m_MovingPointSet
void PrintSelf(std::ostream &os, Indent indent) const
Superclass::VirtualPointType VirtualOriginType
virtual void GetLocalNeighborhoodValueAndDerivative(const PointType &, MeasureType &, LocalDerivativeType &, const PixelType &pixel=0) const =0
Superclass::MovingTransformType MovingTransformType
PointSet< VirtualPixelType, itkGetStaticConstMacro(VirtualDimension)> VirtualPointSetType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Superclass::VirtualIndexType VirtualIndexType
virtual void GetValueAndDerivative(MeasureType &, DerivativeType &) const
virtual void GetDerivative(DerivativeType &) const
static const DimensionType FixedPointDimension
Superclass::FixedTransformType FixedTransformType
PointSet< FixedPixelType, itkGetStaticConstMacro(PointDimension)> FixedTransformedPointSetType
Superclass::VirtualPointType VirtualPointType
Superclass::VirtualPixelType VirtualPixelType
Superclass::MovingOutputPointType MovingOutputPointType
Superclass::VirtualRegionType VirtualRegionType
static const DimensionType MovingPointDimension
Superclass::VirtualDirectionType VirtualDirectionType
Superclass::FixedOutputPointType FixedOutputPointType
ObjectToObjectMetric< TFixedPointSet::PointDimension, TMovingPointSet::PointDimension > Superclass
MovingTransformedPointSetType::Pointer m_MovingTransformedPointSet
void TransformFixedAndCreateVirtualPointSet() const