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 __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 itkSimpleNewMacro( 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 00098 itkStaticConstMacro( Dimension, unsigned int, NDimensions ); 00099 00101 itkStaticConstMacro( TimeVaryingVelocityFieldDimension, unsigned int, NDimensions+1 ); 00102 00107 typedef Image<OutputVectorType, TimeVaryingVelocityFieldDimension> TimeVaryingVelocityFieldType; 00108 typedef typename TimeVaryingVelocityFieldType::Pointer TimeVaryingVelocityFieldPointer; 00109 00110 typedef VectorInterpolateImageFunction<TimeVaryingVelocityFieldType, ScalarType> TimeVaryingVelocityFieldInterpolatorType; 00111 typedef typename TimeVaryingVelocityFieldInterpolatorType::Pointer TimeVaryingVelocityFieldInterpolatorPointer; 00112 00113 typedef typename TimeVaryingVelocityFieldType::SizeType SizeType; 00114 typedef typename TimeVaryingVelocityFieldType::PointType PointType; 00115 typedef typename TimeVaryingVelocityFieldType::SpacingType SpacingType; 00116 typedef typename TimeVaryingVelocityFieldType::DirectionType DirectionType; 00117 00118 typedef typename Superclass::DisplacementFieldType DisplacementFieldType; 00119 typedef typename DisplacementFieldType::PixelType DisplacementVectorType; 00120 00122 typedef ImageVectorOptimizerParametersHelper 00123 <ScalarType, OutputVectorType::Dimension, 00124 itkGetStaticConstMacro( Dimension ) + 1> OptimizerParametersHelperType; 00125 00127 itkGetObjectMacro( TimeVaryingVelocityField, TimeVaryingVelocityFieldType ); 00128 00130 virtual void SetTimeVaryingVelocityField( TimeVaryingVelocityFieldType * ); 00131 00133 itkSetObjectMacro( TimeVaryingVelocityFieldInterpolator, 00134 TimeVaryingVelocityFieldInterpolatorType ); 00135 00137 itkGetConstObjectMacro( TimeVaryingVelocityFieldInterpolator, 00138 TimeVaryingVelocityFieldInterpolatorType ); 00139 00141 itkGetConstMacro( TimeVaryingVelocityFieldSetTime, unsigned long ); 00142 00148 itkSetObjectMacro( DisplacementField, DisplacementFieldType ); 00149 00155 itkSetMacro( IntegrateTimeVaryingVelocityField, bool ); 00156 00162 itkGetConstMacro( IntegrateTimeVaryingVelocityField, bool ); 00163 00169 itkBooleanMacro( IntegrateTimeVaryingVelocityField ); 00170 00175 virtual void SetParameters( const ParametersType & ); 00176 00179 virtual void IntegrateVelocityField(); 00180 00182 virtual void SetFixedParameters( const ParametersType & ); 00183 00186 virtual void UpdateTransformParameters( DerivativeType &, 00187 ScalarType factor = 1.0 ); 00188 00190 bool GetInverse( Self *inverse ) const; 00191 00193 virtual InverseTransformBasePointer GetInverseTransform() const; 00194 00196 virtual bool IsLinear() const { return false; } 00197 00199 NumberOfParametersType GetNumberOfLocalParameters() const 00200 { 00201 return Dimension; 00202 } 00203 00205 virtual bool HasLocalSupport() const 00206 { 00207 return true; 00208 } 00209 00214 itkSetClampMacro( LowerTimeBound, ScalarType, 0, 1 ); 00215 00220 itkGetConstMacro( LowerTimeBound, ScalarType ); 00221 00226 itkSetClampMacro( UpperTimeBound, ScalarType, 0, 1 ); 00227 00232 itkGetConstMacro( UpperTimeBound, ScalarType ); 00233 00238 itkSetMacro( NumberOfIntegrationSteps, unsigned int ); 00239 00244 itkGetConstMacro( NumberOfIntegrationSteps, unsigned int ); 00245 00246 protected: 00247 TimeVaryingVelocityFieldTransform(); 00248 virtual ~TimeVaryingVelocityFieldTransform(); 00249 void PrintSelf( std::ostream& os, Indent indent ) const; 00250 00251 private: 00252 TimeVaryingVelocityFieldTransform( const Self& ); //purposely not implemented 00253 void operator=( const Self& ); //purposely not implemented 00254 00256 typename TimeVaryingVelocityFieldType::Pointer m_TimeVaryingVelocityField; 00257 00258 TimeVaryingVelocityFieldInterpolatorPointer 00259 m_TimeVaryingVelocityFieldInterpolator; 00260 00261 ScalarType m_LowerTimeBound; 00262 ScalarType m_UpperTimeBound; 00263 00264 unsigned int m_NumberOfIntegrationSteps; 00265 bool m_IntegrateTimeVaryingVelocityField; 00266 unsigned long m_TimeVaryingVelocityFieldSetTime; 00267 }; 00268 00269 } // end namespace itk 00270 00271 #if ITK_TEMPLATE_EXPLICIT 00272 # include "Templates/itkTimeVaryingVelocityFieldTransform+-.h" 00273 #endif 00274 00275 #if ITK_TEMPLATE_TXX 00276 # include "itkTimeVaryingVelocityFieldTransform.hxx" 00277 #endif 00278 00279 #endif // __itkTimeVaryingVelocityFieldTransform_h 00280