ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkExponentialDisplacementFieldImageFilter.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 __itkExponentialDisplacementFieldImageFilter_h
00019 #define __itkExponentialDisplacementFieldImageFilter_h
00020 
00021 #include "itkDivideImageFilter.h"
00022 #include "itkCastImageFilter.h"
00023 #include "itkWarpVectorImageFilter.h"
00024 #include "itkVectorLinearInterpolateNearestNeighborExtrapolateImageFunction.h"
00025 #include "itkAddImageFilter.h"
00026 
00027 namespace itk
00028 {
00062 template< class TInputImage, class TOutputImage >
00063 class ITK_EXPORT ExponentialDisplacementFieldImageFilter:
00064   public ImageToImageFilter< TInputImage, TOutputImage >
00065 {
00066 public:
00068   typedef ExponentialDisplacementFieldImageFilter         Self;
00069   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00070   typedef SmartPointer< Self >                            Pointer;
00071   typedef SmartPointer< const Self >                      ConstPointer;
00072 
00074   itkNewMacro(Self);
00075 
00077   itkTypeMacro(ExponentialDisplacementFieldImageFilter, ImageToImageFilter);
00078 
00080   typedef TInputImage                            InputImageType;
00081   typedef typename InputImageType::Pointer       InputImagePointer;
00082   typedef typename InputImageType::ConstPointer  InputImageConstPointer;
00083   typedef typename InputImageType::PixelType     InputPixelType;
00084   typedef typename InputPixelType::RealValueType InputPixelRealValueType;
00085 
00086   typedef TOutputImage                        OutputImageType;
00087   typedef typename OutputImageType::Pointer   OutputImagePointer;
00088   typedef typename OutputImageType::PixelType OutputPixelType;
00089 
00091   itkSetMacro(MaximumNumberOfIterations, unsigned int);
00092   itkGetConstMacro(MaximumNumberOfIterations, unsigned int);
00094 
00099   itkSetMacro(AutomaticNumberOfIterations, bool);
00100   itkGetConstMacro(AutomaticNumberOfIterations, bool);
00101   itkBooleanMacro(AutomaticNumberOfIterations);
00103 
00109   itkSetMacro(ComputeInverse, bool);
00110   itkGetConstMacro(ComputeInverse, bool);
00111   itkBooleanMacro(ComputeInverse);
00113 
00115   itkStaticConstMacro(ImageDimension, unsigned int,
00116                       TInputImage::ImageDimension);
00117   itkStaticConstMacro(OutputImageDimension, unsigned int,
00118                       TInputImage::ImageDimension);
00119   itkStaticConstMacro(PixelDimension, unsigned int,
00120                       InputPixelType::Dimension);
00121   itkStaticConstMacro(OutputPixelDimension, unsigned int,
00122                       OutputPixelType::Dimension);
00124 
00125 #ifdef ITK_USE_CONCEPT_CHECKING
00126 
00127   itkConceptMacro( OutputHasNumericTraitsCheck,
00128                    ( Concept::HasNumericTraits< typename OutputPixelType::ValueType > ) );
00129   itkConceptMacro( SameDimensionCheck1,
00130                    ( Concept::SameDimension< ImageDimension, OutputImageDimension > ) );
00131   itkConceptMacro( SameDimensionCheck2,
00132                    ( Concept::SameDimension< ImageDimension, PixelDimension > ) );
00133   itkConceptMacro( SameDimensionCheck3,
00134                    ( Concept::SameDimension< ImageDimension, OutputPixelDimension > ) );
00135 
00137 #endif
00138 protected:
00139   ExponentialDisplacementFieldImageFilter();
00140   virtual ~ExponentialDisplacementFieldImageFilter() {}
00141 
00142   void PrintSelf(std::ostream & os, Indent indent) const;
00143 
00147   void GenerateData();
00148 
00149   typedef typename InputImageType::RegionType RegionType;
00150 
00151   typedef DivideImageFilter<
00152     InputImageType,
00153     itk::Image<InputPixelRealValueType, ImageDimension>,
00154     OutputImageType >                                   DivideByConstantType;
00155 
00156   typedef CastImageFilter<
00157     InputImageType, OutputImageType >                   CasterType;
00158 
00159   typedef WarpVectorImageFilter<
00160     OutputImageType,
00161     OutputImageType, OutputImageType >                  VectorWarperType;
00162 
00163   typedef VectorLinearInterpolateNearestNeighborExtrapolateImageFunction<
00164     OutputImageType, double >                            FieldInterpolatorType;
00165 
00166   typedef AddImageFilter<
00167     OutputImageType, OutputImageType, OutputImageType > AdderType;
00168 
00169   typedef typename DivideByConstantType::Pointer     DivideByConstantPointer;
00170   typedef typename CasterType::Pointer               CasterPointer;
00171   typedef typename VectorWarperType::Pointer         VectorWarperPointer;
00172   typedef typename FieldInterpolatorType::Pointer    FieldInterpolatorPointer;
00173   typedef typename FieldInterpolatorType::OutputType FieldInterpolatorOutputType;
00174   typedef typename AdderType::Pointer                AdderPointer;
00175 private:
00176   ExponentialDisplacementFieldImageFilter(const Self &); //purposely not
00177                                                         // implemented
00178   void operator=(const Self &);                         //purposely not
00179                                                         // implemented
00180 
00181   bool         m_AutomaticNumberOfIterations;
00182   unsigned int m_MaximumNumberOfIterations;
00183 
00184   bool m_ComputeInverse;
00185 
00186   DivideByConstantPointer m_Divider;
00187   CasterPointer           m_Caster;
00188   VectorWarperPointer     m_Warper;
00189   AdderPointer            m_Adder;
00190 };
00191 } // end namespace itk
00192 
00193 #ifndef ITK_MANUAL_INSTANTIATION
00194 #include "itkExponentialDisplacementFieldImageFilter.hxx"
00195 #endif
00196 
00197 #endif
00198