ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkPointSetToPointSetMetric.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkPointSetToPointSetMetric_h
00019 #define __itkPointSetToPointSetMetric_h
00020 
00021 #include "itkImageBase.h"
00022 #include "itkTransform.h"
00023 #include "itkMultipleValuedCostFunction.h"
00024 #include "itkMacro.h"
00025 #include "itkGradientRecursiveGaussianImageFilter.h"
00026 
00027 namespace itk
00028 {
00044 template< class TFixedPointSet,  class TMovingPointSet >
00045 class ITK_EXPORT PointSetToPointSetMetric:public MultipleValuedCostFunction
00046 {
00047 public:
00048 
00050   typedef PointSetToPointSetMetric   Self;
00051   typedef MultipleValuedCostFunction Superclass;
00052   typedef SmartPointer< Self >       Pointer;
00053   typedef SmartPointer< const Self > ConstPointer;
00054 
00056   typedef Superclass::ParametersValueType CoordinateRepresentationType;
00057 
00059   itkTypeMacro(PointSetToPointSetMetric, MultipleValuedCostFunction);
00060 
00062   typedef TMovingPointSet                           MovingPointSetType;
00063   typedef typename TMovingPointSet::PixelType       MovingPointSetPixelType;
00064   typedef typename MovingPointSetType::ConstPointer MovingPointSetConstPointer;
00065 
00067   typedef TFixedPointSet                           FixedPointSetType;
00068   typedef typename FixedPointSetType::ConstPointer FixedPointSetConstPointer;
00069 
00071   itkStaticConstMacro(MovingPointSetDimension, unsigned int,
00072                       TMovingPointSet::PointDimension);
00073   itkStaticConstMacro(FixedPointSetDimension, unsigned int,
00074                       TFixedPointSet::PointDimension);
00076 
00077   typedef typename FixedPointSetType::PointsContainer::ConstIterator    PointIterator;
00078   typedef typename FixedPointSetType::PointDataContainer::ConstIterator PointDataIterator;
00079 
00081   typedef Transform< CoordinateRepresentationType,
00082                      itkGetStaticConstMacro(MovingPointSetDimension),
00083                      itkGetStaticConstMacro(FixedPointSetDimension) > TransformType;
00084 
00085   typedef typename TransformType::Pointer         TransformPointer;
00086   typedef typename TransformType::InputPointType  InputPointType;
00087   typedef typename TransformType::OutputPointType OutputPointType;
00088   typedef typename TransformType::ParametersType  TransformParametersType;
00089   typedef typename TransformType::JacobianType    TransformJacobianType;
00090 
00092   typedef Superclass::MeasureType MeasureType;
00093 
00095   typedef Superclass::DerivativeType DerivativeType;
00096 
00098   typedef Superclass::ParametersType ParametersType;
00099 
00101   itkSetConstObjectMacro(FixedPointSet, FixedPointSetType);
00102 
00104   itkGetConstObjectMacro(FixedPointSet, FixedPointSetType);
00105 
00107   itkSetConstObjectMacro(MovingPointSet, MovingPointSetType);
00108 
00110   itkGetConstObjectMacro(MovingPointSet, MovingPointSetType);
00111 
00113   itkSetObjectMacro(Transform, TransformType);
00114 
00116   itkGetObjectMacro(Transform, TransformType);
00117 
00119   void SetTransformParameters(const ParametersType & parameters) const;
00120 
00122   unsigned int GetNumberOfParameters(void) const
00123   { return m_Transform->GetNumberOfParameters(); }
00124 
00127   virtual void Initialize(void)
00128   throw ( ExceptionObject );
00129 
00130 protected:
00131   PointSetToPointSetMetric();
00132   virtual ~PointSetToPointSetMetric() {}
00133   void PrintSelf(std::ostream & os, Indent indent) const;
00134 
00135   FixedPointSetConstPointer m_FixedPointSet;
00136 
00137   MovingPointSetConstPointer m_MovingPointSet;
00138 
00139   mutable TransformPointer m_Transform;
00140 private:
00141   PointSetToPointSetMetric(const Self &); //purposely not implemented
00142   void operator=(const Self &);           //purposely not implemented
00143 };
00144 } // end namespace itk
00145 
00146 #ifndef ITK_MANUAL_INSTANTIATION
00147 #include "itkPointSetToPointSetMetric.hxx"
00148 #endif
00149 
00150 #endif
00151