ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkEuclideanDistancePointMetric.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 __itkEuclideanDistancePointMetric_h
00019 #define __itkEuclideanDistancePointMetric_h
00020 
00021 #include "itkPointSetToPointSetMetric.h"
00022 #include "itkCovariantVector.h"
00023 #include "itkPointSet.h"
00024 #include "itkImage.h"
00025 
00026 namespace itk
00027 {
00044 template< class TFixedPointSet, class TMovingPointSet,
00045           class TDistanceMap =
00046             ::itk::Image< unsigned short, ::itk::GetPointSetDimension< TMovingPointSet >::PointDimension > >
00047 class ITK_EXPORT EuclideanDistancePointMetric:
00048   public PointSetToPointSetMetric< TFixedPointSet, TMovingPointSet >
00049 {
00050 public:
00051 
00053   typedef EuclideanDistancePointMetric                                Self;
00054   typedef PointSetToPointSetMetric< TFixedPointSet, TMovingPointSet > Superclass;
00055 
00056   typedef SmartPointer< Self >       Pointer;
00057   typedef SmartPointer< const Self > ConstPointer;
00058 
00060   itkNewMacro(Self);
00061 
00063   itkTypeMacro(EuclideanDistancePointMetric, Object);
00064 
00066   typedef typename Superclass::TransformType           TransformType;
00067   typedef typename Superclass::TransformPointer        TransformPointer;
00068   typedef typename Superclass::TransformParametersType TransformParametersType;
00069   typedef typename Superclass::TransformJacobianType   TransformJacobianType;
00070 
00071   typedef typename Superclass::MeasureType                MeasureType;
00072   typedef typename Superclass::DerivativeType             DerivativeType;
00073   typedef typename Superclass::FixedPointSetType          FixedPointSetType;
00074   typedef typename Superclass::MovingPointSetType         MovingPointSetType;
00075   typedef typename Superclass::FixedPointSetConstPointer  FixedPointSetConstPointer;
00076   typedef typename Superclass::MovingPointSetConstPointer MovingPointSetConstPointer;
00077 
00078   typedef typename Superclass::PointIterator     PointIterator;
00079   typedef typename Superclass::PointDataIterator PointDataIterator;
00080 
00081   typedef TDistanceMap                           DistanceMapType;
00082   typedef typename DistanceMapType::ConstPointer DistanceMapPointer;
00083 
00085   unsigned int GetNumberOfValues() const;
00086 
00088   void GetDerivative(const TransformParametersType & parameters,
00089                      DerivativeType & Derivative) const;
00090 
00092   MeasureType GetValue(const TransformParametersType & parameters) const;
00093 
00095   void GetValueAndDerivative(const TransformParametersType & parameters,
00096                              MeasureType & Value, DerivativeType & Derivative) const;
00097 
00099   itkSetConstObjectMacro(DistanceMap, DistanceMapType);
00100   itkGetConstObjectMacro(DistanceMap, DistanceMapType);
00102 
00105   itkSetMacro(ComputeSquaredDistance, bool);
00106   itkGetConstMacro(ComputeSquaredDistance, bool);
00107   itkBooleanMacro(ComputeSquaredDistance);
00108 protected:
00109   EuclideanDistancePointMetric();
00110   virtual ~EuclideanDistancePointMetric() {}
00112 
00114   void PrintSelf(std::ostream & os, Indent indent) const;
00115 
00116 private:
00117   EuclideanDistancePointMetric(const Self &); //purposely not implemented
00118   void operator=(const Self &);               //purposely not implemented
00119 
00120   DistanceMapPointer m_DistanceMap;
00121   bool               m_ComputeSquaredDistance;
00122 };
00123 } // end namespace itk
00124 
00125 #ifndef ITK_MANUAL_INSTANTIATION
00126 #include "itkEuclideanDistancePointMetric.hxx"
00127 #endif
00128 
00129 #endif
00130