ITK
4.0.0
Insight Segmentation and Registration Toolkit
|
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 __itkPointSetToPointSetMetricv4_h 00019 #define __itkPointSetToPointSetMetricv4_h 00020 00021 #include "itkObjectToObjectMetric.h" 00022 00023 #include "itkFixedArray.h" 00024 #include "itkPointsLocator.h" 00025 #include "itkPointSet.h" 00026 #include "itkTransform.h" 00027 00028 namespace itk 00029 { 00043 template<class TFixedPointSet, class TMovingPointSet> 00044 class ITK_EXPORT PointSetToPointSetMetricv4 00045 : public ObjectToObjectMetric 00046 { 00047 public: 00048 00050 typedef PointSetToPointSetMetricv4 Self; 00051 typedef ObjectToObjectMetric Superclass; 00052 typedef SmartPointer<Self> Pointer; 00053 typedef SmartPointer<const Self> ConstPointer; 00054 00056 itkTypeMacro( PointSetToPointSetMetricv4, ObjectToObjectMetric ); 00057 00059 typedef TFixedPointSet FixedPointSetType; 00060 typedef typename TFixedPointSet::PointType FixedPointType; 00061 typedef typename TFixedPointSet::PixelType FixedPixelType; 00062 typedef typename TFixedPointSet::PointsContainer FixedPointsContainer; 00063 00064 itkStaticConstMacro( FixedPointDimension, unsigned int, 00065 TFixedPointSet::PointDimension ); 00066 00068 typedef TMovingPointSet MovingPointSetType; 00069 typedef typename TMovingPointSet::PointType MovingPointType; 00070 typedef typename TMovingPointSet::PixelType MovingPixelType; 00071 typedef typename TMovingPointSet::PointsContainer MovingPointsContainer; 00072 00073 itkStaticConstMacro( MovingPointDimension, unsigned int, 00074 TFixedPointSet::PointDimension ); 00075 00082 itkStaticConstMacro( PointDimension, unsigned int, 00083 TFixedPointSet::PointDimension ); 00084 00085 typedef FixedPointType PointType; 00086 typedef typename PointType::CoordRepType CoordRepType; 00087 typedef FixedPointsContainer PointsContainer; 00088 typedef typename PointsContainer::ConstIterator PointsConstIterator; 00089 typedef typename PointsContainer::ElementIdentifier PointIdentifier; 00090 00092 typedef PointsLocator<PointIdentifier, 00093 itkGetStaticConstMacro( PointDimension ), 00094 CoordRepType, PointsContainer> PointsLocatorType; 00095 typedef typename PointsLocatorType:: 00096 NeighborsIdentifierType NeighborsIdentifierType; 00097 00099 typedef Transform<CoordRepType, 00100 itkGetStaticConstMacro( FixedPointDimension ), 00101 itkGetStaticConstMacro( PointDimension )> FixedTransformType; 00102 typedef typename FixedTransformType::Pointer FixedTransformPointer; 00103 typedef PointSet<FixedPixelType, 00104 itkGetStaticConstMacro( PointDimension )> FixedTransformedPointSetType; 00106 00107 typedef Transform<CoordRepType, 00108 itkGetStaticConstMacro( MovingPointDimension ), 00109 itkGetStaticConstMacro( PointDimension )> MovingTransformType; 00110 typedef typename MovingTransformType::Pointer MovingTransformPointer; 00111 typedef PointSet<MovingPixelType, 00112 itkGetStaticConstMacro( PointDimension )> MovingTransformedPointSetType; 00113 00115 typedef typename Superclass::MeasureType MeasureType; 00116 00118 typedef typename Superclass::ParametersType ParametersType; 00119 00121 typedef typename Superclass::DerivativeType DerivativeType; 00122 00123 typedef typename DerivativeType::ValueType DerivativeValueType; 00124 typedef FixedArray<DerivativeValueType, 00125 itkGetStaticConstMacro( PointDimension )> LocalDerivativeType; 00126 00128 itkSetConstObjectMacro( FixedPointSet, FixedPointSetType ); 00129 00131 itkGetConstObjectMacro( FixedPointSet, FixedPointSetType ); 00132 00134 itkGetConstObjectMacro( FixedTransformedPointSet, FixedTransformedPointSetType ); 00135 00137 itkSetObjectMacro( FixedTransform, FixedTransformType ); 00138 00140 itkGetConstObjectMacro( FixedTransform, FixedTransformType ); 00141 00143 itkSetObjectMacro( MovingPointSet, MovingPointSetType ); 00144 00146 itkGetConstObjectMacro( MovingPointSet, MovingPointSetType ); 00147 00149 itkGetConstObjectMacro( MovingTransformedPointSet, MovingTransformedPointSetType ); 00150 00152 itkSetObjectMacro( MovingTransform, MovingTransformType ); 00153 00155 itkGetConstObjectMacro( MovingTransform, MovingTransformType ); 00156 00160 unsigned int GetNumberOfComponents() const; 00161 00172 virtual MeasureType GetValue() const; 00173 00184 virtual void GetDerivative( DerivativeType & ) const; 00185 00196 virtual void GetValueAndDerivative( MeasureType &, DerivativeType & ) const; 00197 00202 virtual MeasureType GetLocalNeighborhoodValue( const PointType & ) const = 0; 00203 00207 virtual LocalDerivativeType GetLocalNeighborhoodDerivative( const PointType & ) const; 00208 00212 virtual void GetLocalNeighborhoodValueAndDerivative( const PointType &, 00213 MeasureType &, LocalDerivativeType & ) const = 0; 00214 00219 virtual void Initialize( void ) throw ( ExceptionObject ); 00220 00224 virtual unsigned int GetNumberOfParameters() const; 00225 00229 virtual unsigned int GetNumberOfLocalParameters() const; 00230 00234 virtual const ParametersType & GetParameters() const; 00235 00239 virtual bool HasLocalSupport() const; 00240 00247 virtual void UpdateTransformParameters( DerivativeType & derivative, ParametersValueType factor = 1.0 ); 00248 00249 protected: 00250 PointSetToPointSetMetricv4(); 00251 virtual ~PointSetToPointSetMetricv4(); 00252 void PrintSelf( std::ostream & os, Indent indent ) const; 00253 00254 typename FixedPointSetType::ConstPointer m_FixedPointSet; 00255 typename FixedTransformedPointSetType::Pointer m_FixedTransformedPointSet; 00256 00257 FixedTransformPointer m_FixedTransform; 00258 typename PointsLocatorType::Pointer m_FixedTransformedPointsLocator; 00259 00260 typename MovingPointSetType::ConstPointer m_MovingPointSet; 00261 typename MovingTransformedPointSetType::Pointer m_MovingTransformedPointSet; 00262 00263 MovingTransformPointer m_MovingTransform; 00264 typename PointsLocatorType::Pointer m_MovingTransformedPointsLocator; 00265 00271 void TransformFixedPointSet(); 00272 00278 void TransformMovingPointSet(); 00279 00284 void InitializePointsLocators(); 00285 00286 private: 00287 PointSetToPointSetMetricv4( const Self & ); //purposely not implemented 00288 void operator=( const Self & ); //purposely not implemented 00289 }; 00290 } // end namespace itk 00291 00292 #ifndef ITK_MANUAL_INSTANTIATION 00293 #include "itkPointSetToPointSetMetricv4.hxx" 00294 #endif 00295 00296 #endif 00297