ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkIterativeInverseDisplacementFieldImageFilter.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 __itkIterativeInverseDisplacementFieldImageFilter_h
00019 #define __itkIterativeInverseDisplacementFieldImageFilter_h
00020 
00021 
00022 #include "itkWarpVectorImageFilter.h"
00023 #include "itkImageRegionIterator.h"
00024 #include "itkTimeProbe.h"
00025 
00026 namespace itk
00027 {
00051 template< class TInputImage, class TOutputImage >
00052 class ITK_EXPORT IterativeInverseDisplacementFieldImageFilter:
00053   public ImageToImageFilter< TInputImage, TOutputImage >
00054 {
00055 public:
00057   typedef IterativeInverseDisplacementFieldImageFilter    Self;
00058   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00059   typedef SmartPointer< Self >                            Pointer;
00060   typedef SmartPointer< const Self >                      ConstPointer;
00061 
00063   itkNewMacro(Self);
00064 
00066   itkTypeMacro(IterativeInverseDisplacementFieldImageFilter, ImageToImageFilter);
00067 
00069   typedef TInputImage                              InputImageType;
00070   typedef typename InputImageType::ConstPointer    InputImageConstPointer;
00071   typedef typename InputImageType::Pointer         InputImagePointer;
00072   typedef typename InputImageType::PointType       InputImagePointType;
00073   typedef typename InputImageType::RegionType      InputImageRegionType;
00074   typedef typename InputImageType::SpacingType     InputImageSpacingType;
00075   typedef TOutputImage                             OutputImageType;
00076   typedef typename OutputImageType::Pointer        OutputImagePointer;
00077   typedef typename OutputImageType::PixelType      OutputImagePixelType;
00078   typedef typename OutputImageType::PointType      OutputImagePointType;
00079   typedef typename OutputImageType::IndexType      OutputImageIndexType;
00080   typedef typename OutputImagePixelType::ValueType OutputImageValueType;
00081 
00082   typedef TimeProbe TimeType;
00083 
00084   typedef ImageRegionConstIterator< InputImageType > InputConstIterator;
00085   typedef ImageRegionIterator< InputImageType >      InputIterator;
00086   typedef ImageRegionIterator< OutputImageType >     OutputIterator;
00087 
00088   typedef WarpVectorImageFilter< TOutputImage, TInputImage, TOutputImage > VectorWarperType;
00089 
00090   typedef VectorLinearInterpolateImageFunction< TInputImage, double > FieldInterpolatorType;
00091   typedef typename FieldInterpolatorType::Pointer                     FieldInterpolatorPointer;
00092   typedef typename FieldInterpolatorType::OutputType                  FieldInterpolatorOutputType;
00093 
00094   itkSetMacro(NumberOfIterations, unsigned int);
00095   itkGetConstMacro(NumberOfIterations, unsigned int);
00096 
00097   // If the error (in mm) between forward and backward mapping is smaller than
00098   // the StopValue,
00099   // the algorithm stops.
00100   // This value can be used to speed up the calculation.
00101   itkSetMacro(StopValue, double);
00102   itkGetConstMacro(StopValue, double);
00103 
00104 #ifdef ITK_USE_CONCEPT_CHECKING
00105 
00106   itkConceptMacro( OutputHasNumericTraitsCheck,
00107                    ( Concept::HasNumericTraits< OutputImageValueType > ) );
00108 
00110 #endif
00111 protected:
00112   IterativeInverseDisplacementFieldImageFilter();
00113   ~IterativeInverseDisplacementFieldImageFilter() {}
00114 
00115   void PrintSelf(std::ostream & os, Indent indent) const;
00116 
00117   void GenerateData();
00118 
00119   unsigned int m_NumberOfIterations;
00120 
00121   double m_StopValue;
00122   double m_Time;
00123 private:
00124   IterativeInverseDisplacementFieldImageFilter(const Self &); //purposely not implemented
00125   void operator=(const Self &);                              //purposely not implemented
00126 };
00127 } // end namespace itk
00128 
00129 #ifndef ITK_MANUAL_INSTANTIATION
00130 #include "itkIterativeInverseDisplacementFieldImageFilter.hxx"
00131 #endif
00132 
00133 #endif
00134