ITK
4.1.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 __itkTimeVaryingVelocityFieldTransform_h 00019 #define __itkTimeVaryingVelocityFieldTransform_h 00020 00021 #include "itkDisplacementFieldTransform.h" 00022 00023 #include "itkImageVectorOptimizerParametersHelper.h" 00024 00025 namespace itk 00026 { 00027 00055 template<class TScalar, unsigned int NDimensions> 00056 class ITK_EXPORT TimeVaryingVelocityFieldTransform : 00057 public DisplacementFieldTransform<TScalar, NDimensions> 00058 { 00059 public: 00061 typedef TimeVaryingVelocityFieldTransform Self; 00062 typedef DisplacementFieldTransform<TScalar, NDimensions> Superclass; 00063 typedef SmartPointer<Self> Pointer; 00064 typedef SmartPointer<const Self> ConstPointer; 00065 00067 itkTypeMacro( TimeVaryingVelocityFieldTransform, DisplacementFieldTransform ); 00068 00070 itkNewMacro( Self ); 00071 00073 typedef typename Superclass:: InverseTransformBasePointer InverseTransformBasePointer; 00074 00076 typedef typename Superclass::ScalarType ScalarType; 00077 00079 typedef typename Superclass::ParametersType ParametersType; 00080 typedef typename ParametersType::ValueType ParametersValueType; 00081 typedef typename Superclass::NumberOfParametersType NumberOfParametersType; 00082 00084 typedef typename Superclass::JacobianType JacobianType; 00085 00087 typedef typename Superclass::InputPointType InputPointType; 00088 typedef typename Superclass::OutputPointType OutputPointType; 00089 00091 typedef typename Superclass::InputVectorType InputVectorType; 00092 typedef typename Superclass::OutputVectorType OutputVectorType; 00093 00095 typedef typename Superclass::DerivativeType DerivativeType; 00096 00097 typedef typename Transform<TScalar,NDimensions,NDimensions>::Pointer TransformPointer; 00098 00100 itkStaticConstMacro( Dimension, unsigned int, NDimensions ); 00101 00103 itkStaticConstMacro( TimeVaryingVelocityFieldDimension, unsigned int, NDimensions+1 ); 00104 00109 typedef Image<OutputVectorType, TimeVaryingVelocityFieldDimension> TimeVaryingVelocityFieldType; 00110 typedef typename TimeVaryingVelocityFieldType::Pointer TimeVaryingVelocityFieldPointer; 00111 typedef typename TimeVaryingVelocityFieldType::PointType TimeVaryingVelocityFieldPointType; 00112 typedef typename TimeVaryingVelocityFieldType::SpacingType TimeVaryingVelocityFieldSpacingType; 00113 typedef typename TimeVaryingVelocityFieldType::DirectionType TimeVaryingVelocityFieldDirectionType; 00114 00115 typedef VectorInterpolateImageFunction<TimeVaryingVelocityFieldType, ScalarType> TimeVaryingVelocityFieldInterpolatorType; 00116 typedef typename TimeVaryingVelocityFieldInterpolatorType::Pointer TimeVaryingVelocityFieldInterpolatorPointer; 00117 00118 typedef typename TimeVaryingVelocityFieldType::SizeType SizeType; 00119 typedef typename TimeVaryingVelocityFieldType::PointType PointType; 00120 typedef typename TimeVaryingVelocityFieldType::SpacingType SpacingType; 00121 typedef typename TimeVaryingVelocityFieldType::DirectionType DirectionType; 00122 00123 typedef typename Superclass::DisplacementFieldType DisplacementFieldType; 00124 typedef typename DisplacementFieldType::PixelType DisplacementVectorType; 00125 00127 typedef ImageVectorOptimizerParametersHelper 00128 <ScalarType, OutputVectorType::Dimension, 00129 itkGetStaticConstMacro( Dimension ) + 1> OptimizerParametersHelperType; 00130 00132 itkGetObjectMacro( TimeVaryingVelocityField, TimeVaryingVelocityFieldType ); 00133 00135 virtual void SetTimeVaryingVelocityField( TimeVaryingVelocityFieldType * ); 00136 00138 itkSetObjectMacro( TimeVaryingVelocityFieldInterpolator, 00139 TimeVaryingVelocityFieldInterpolatorType ); 00140 00142 itkGetConstObjectMacro( TimeVaryingVelocityFieldInterpolator, 00143 TimeVaryingVelocityFieldInterpolatorType ); 00144 00150 itkSetObjectMacro( DisplacementField, DisplacementFieldType ); 00151 00156 virtual void SetParameters( const ParametersType & ); 00157 00160 virtual void IntegrateVelocityField(); 00161 00163 virtual void SetFixedParameters( const ParametersType & ); 00164 00167 virtual void UpdateTransformParameters( DerivativeType &, 00168 ScalarType factor = 1.0 ); 00169 00171 bool GetInverse( Self *inverse ) const; 00172 00174 virtual InverseTransformBasePointer GetInverseTransform() const; 00175 00177 virtual bool IsLinear() const { return false; } 00178 00180 NumberOfParametersType GetNumberOfLocalParameters() const 00181 { 00182 return Dimension; 00183 } 00184 00186 virtual bool HasLocalSupport() const 00187 { 00188 return true; 00189 } 00190 00195 itkSetClampMacro( LowerTimeBound, ScalarType, 0, 1 ); 00196 00201 itkGetConstMacro( LowerTimeBound, ScalarType ); 00202 00207 itkSetClampMacro( UpperTimeBound, ScalarType, 0, 1 ); 00208 00213 itkGetConstMacro( UpperTimeBound, ScalarType ); 00214 00219 itkSetMacro( NumberOfIntegrationSteps, unsigned int ); 00220 00225 itkGetConstMacro( NumberOfIntegrationSteps, unsigned int ); 00226 00227 protected: 00228 TimeVaryingVelocityFieldTransform(); 00229 virtual ~TimeVaryingVelocityFieldTransform(); 00230 void PrintSelf( std::ostream& os, Indent indent ) const; 00231 00232 ScalarType m_LowerTimeBound; 00233 ScalarType m_UpperTimeBound; 00234 00236 virtual typename LightObject::Pointer InternalClone() const; 00237 00238 typename DisplacementFieldType::Pointer 00239 CopyDisplacementField(const DisplacementFieldType *toCopy) const; 00244 virtual void SetFixedParametersFromTimeVaryingVelocityField(); 00245 00247 typename TimeVaryingVelocityFieldType::Pointer m_TimeVaryingVelocityField; 00248 TimeVaryingVelocityFieldInterpolatorPointer m_TimeVaryingVelocityFieldInterpolator; 00249 unsigned int m_NumberOfIntegrationSteps; 00250 00251 private: 00252 TimeVaryingVelocityFieldTransform( const Self& ); //purposely not implemented 00253 void operator=( const Self& ); //purposely not implemented 00254 }; 00255 00256 } // end namespace itk 00257 00258 #if ITK_TEMPLATE_EXPLICIT 00259 # include "Templates/itkTimeVaryingVelocityFieldTransform+-.h" 00260 #endif 00261 00262 #if ITK_TEMPLATE_TXX 00263 # include "itkTimeVaryingVelocityFieldTransform.hxx" 00264 #endif 00265 00266 #endif // __itkTimeVaryingVelocityFieldTransform_h 00267