ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkTimeVaryingVelocityFieldIntegrationImageFilter.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 __itkTimeVaryingVelocityFieldIntegrationImageFilter_h
00019 #define __itkTimeVaryingVelocityFieldIntegrationImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 
00023 #include "itkVectorInterpolateImageFunction.h"
00024 
00025 namespace itk
00026 {
00052 template<class TTimeVaryingVelocityField, class TDisplacementField =
00053  Image<typename TTimeVaryingVelocityField::PixelType,
00054  GetImageDimension<TTimeVaryingVelocityField>::ImageDimension - 1> >
00055 class ITK_EXPORT TimeVaryingVelocityFieldIntegrationImageFilter :
00056   public ImageToImageFilter<TTimeVaryingVelocityField, TDisplacementField>
00057 {
00058 public:
00059   typedef TimeVaryingVelocityFieldIntegrationImageFilter  Self;
00060   typedef ImageToImageFilter
00061     <TTimeVaryingVelocityField, TDisplacementField>       Superclass;
00062   typedef SmartPointer<Self>                              Pointer;
00063   typedef SmartPointer<const Self>                        ConstPointer;
00064 
00066   itkNewMacro( Self );
00067 
00069   itkTypeMacro( TimeVaryingVelocityFieldIntegrationImageFilter, ImageToImageFilter );
00070 
00074   itkStaticConstMacro( InputImageDimension, unsigned int,
00075     TTimeVaryingVelocityField::ImageDimension );
00076 
00077   itkStaticConstMacro( OutputImageDimension, unsigned int,
00078     TDisplacementField::ImageDimension );
00079 
00080   typedef TTimeVaryingVelocityField                   TimeVaryingVelocityFieldType;
00081   typedef TDisplacementField                          DisplacementFieldType;
00082   typedef typename DisplacementFieldType::Pointer     DisplacementFieldPointer;
00083   typedef typename DisplacementFieldType::PixelType   VectorType;
00084   typedef typename VectorType::RealValueType          RealType;
00085   typedef typename DisplacementFieldType::PointType   PointType;
00086   typedef typename DisplacementFieldType::RegionType  OutputRegionType;
00087 
00088   typedef VectorInterpolateImageFunction
00089     <TimeVaryingVelocityFieldType, RealType>    VelocityFieldInterpolatorType;
00090   typedef typename VelocityFieldInterpolatorType::Pointer
00091                                                 VelocityFieldInterpolatorPointer;
00092 
00093   typedef VectorInterpolateImageFunction<DisplacementFieldType, RealType>   DisplacementFieldInterpolatorType;
00094   typedef typename DisplacementFieldInterpolatorType::Pointer               DisplacementFieldInterpolatorPointer;
00095 
00097   itkSetObjectMacro( VelocityFieldInterpolator, VelocityFieldInterpolatorType );
00098 
00100   itkGetObjectMacro( VelocityFieldInterpolator, VelocityFieldInterpolatorType );
00101 
00106   itkSetObjectMacro( DisplacementFieldInterpolator, DisplacementFieldInterpolatorType );
00107 
00112   itkGetObjectMacro( DisplacementFieldInterpolator, DisplacementFieldInterpolatorType );
00113 
00117   itkSetObjectMacro( InitialDiffeomorphism, DisplacementFieldType );
00118 
00122   itkGetObjectMacro( InitialDiffeomorphism, DisplacementFieldType );
00123 
00128   itkSetClampMacro( LowerTimeBound, RealType, 0, 1 );
00129 
00134   itkGetConstMacro( LowerTimeBound, RealType );
00135 
00140   itkSetClampMacro( UpperTimeBound, RealType, 0, 1 );
00141 
00146   itkGetConstMacro( UpperTimeBound, RealType );
00147 
00152   itkSetMacro( NumberOfIntegrationSteps, unsigned int );
00153 
00158   itkGetConstMacro( NumberOfIntegrationSteps, unsigned int );
00159 
00160 protected:
00161   TimeVaryingVelocityFieldIntegrationImageFilter();
00162   ~TimeVaryingVelocityFieldIntegrationImageFilter();
00163 
00164   void PrintSelf( std::ostream & os, Indent indent ) const;
00165 
00166   virtual void GenerateOutputInformation();
00167 
00168   virtual void BeforeThreadedGenerateData();
00169 
00170   virtual void ThreadedGenerateData( const OutputRegionType &, ThreadIdType );
00171 
00172   VectorType IntegrateVelocityAtPoint( const PointType & );
00173 
00174   RealType                                  m_LowerTimeBound;
00175   RealType                                  m_UpperTimeBound;
00176 
00177   DisplacementFieldPointer                  m_InitialDiffeomorphism;
00178 
00179   unsigned int                              m_NumberOfIntegrationSteps;
00180 
00181   unsigned int                              m_NumberOfTimePoints;
00182 
00183   DisplacementFieldInterpolatorPointer      m_DisplacementFieldInterpolator;
00184 
00185 private:
00186   TimeVaryingVelocityFieldIntegrationImageFilter( const Self & ); //purposely not implemented
00187   void operator=( const Self & );         //purposely not implemented
00188 
00189   VelocityFieldInterpolatorPointer          m_VelocityFieldInterpolator;
00190 };
00191 }
00192 
00193 #ifndef ITK_MANUAL_INSTANTIATION
00194 #include "itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx"
00195 #endif
00196 
00197 #endif
00198