ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkInverseDisplacementFieldImageFilter.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 __itkInverseDisplacementFieldImageFilter_h
00019 #define __itkInverseDisplacementFieldImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 #include "itkKernelTransform.h"
00023 #include "itkImageRegionConstIteratorWithIndex.h"
00024 
00025 namespace itk
00026 {
00064 template< class TInputImage, class TOutputImage >
00065 class ITK_EXPORT InverseDisplacementFieldImageFilter:
00066   public ImageToImageFilter< TInputImage, TOutputImage >
00067 {
00068 public:
00070   typedef InverseDisplacementFieldImageFilter             Self;
00071   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00072   typedef SmartPointer< Self >                            Pointer;
00073   typedef SmartPointer< const Self >                      ConstPointer;
00074 
00075   typedef TInputImage                           InputImageType;
00076   typedef typename InputImageType::Pointer      InputImagePointer;
00077   typedef typename InputImageType::ConstPointer InputImageConstPointer;
00078   typedef typename InputImageType::RegionType   InputImageRegionType;
00079   typedef TOutputImage                          OutputImageType;
00080   typedef typename OutputImageType::Pointer     OutputImagePointer;
00081 
00083   itkNewMacro(Self);
00084 
00086   itkTypeMacro(InverseDisplacementFieldImageFilter, ImageToImageFilter);
00087 
00089   itkStaticConstMacro(ImageDimension, unsigned int,
00090                       TOutputImage::ImageDimension);
00091 
00096   typedef KernelTransform<
00097     double, itkGetStaticConstMacro(ImageDimension) > KernelTransformType;
00098   typedef typename KernelTransformType::Pointer KernelTransformPointerType;
00099 
00101   typedef typename OutputImageType::SizeType SizeType;
00102 
00104   typedef typename OutputImageType::IndexType IndexType;
00105 
00107   typedef typename TOutputImage::PixelType    OutputPixelType;
00108   typedef typename OutputPixelType::ValueType OutputPixelComponentType;
00109 
00111   typedef typename TOutputImage::RegionType OutputImageRegionType;
00112 
00114   typedef typename TOutputImage::SpacingType SpacingType;
00115   typedef typename TOutputImage::PointType   OriginPointType;
00116 
00120   itkSetObjectMacro(KernelTransform, KernelTransformType);
00121 
00123   itkGetObjectMacro(KernelTransform, KernelTransformType);
00124 
00126   itkSetMacro(Size, SizeType);
00127 
00129   itkGetConstReferenceMacro(Size, SizeType);
00130 
00132   itkSetMacro(OutputSpacing, SpacingType);
00133   virtual void SetOutputSpacing(const double *values);
00135 
00137   itkGetConstReferenceMacro(OutputSpacing, SpacingType);
00138 
00140   itkSetMacro(OutputOrigin, OriginPointType);
00141   virtual void SetOutputOrigin(const double *values);
00143 
00145   itkGetConstReferenceMacro(OutputOrigin, OriginPointType);
00146 
00152   itkSetMacro(SubsamplingFactor, unsigned int);
00153   itkGetConstMacro(SubsamplingFactor, unsigned int);
00155 
00161   virtual void GenerateOutputInformation();
00162 
00168   virtual void GenerateInputRequestedRegion();
00169 
00171   unsigned long GetMTime(void) const;
00172 
00173 #ifdef ITK_USE_CONCEPT_CHECKING
00174 
00175   itkConceptMacro( OutputHasNumericTraitsCheck,
00176                    ( Concept::HasNumericTraits< OutputPixelComponentType > ) );
00177 
00179 #endif
00180 protected:
00181   InverseDisplacementFieldImageFilter();
00182   ~InverseDisplacementFieldImageFilter() {}
00183   void PrintSelf(std::ostream & os, Indent indent) const;
00185 
00190   void GenerateData();
00191 
00195   void PrepareKernelBaseSpline();
00196 
00197 private:
00198   InverseDisplacementFieldImageFilter(const Self &); //purposely not implemented
00199   void operator=(const Self &);                     //purposely not implemented
00200 
00201   SizeType                   m_Size;                 // Size of the output image
00202   KernelTransformPointerType m_KernelTransform;      // Coordinate transform to
00203                                                      // use
00204   SpacingType     m_OutputSpacing;                   // output image spacing
00205   OriginPointType m_OutputOrigin;                    // output image origin
00206 
00207   unsigned int m_SubsamplingFactor;                  // factor to subsample the
00208                                                      // input field.
00209 };
00210 } // end namespace itk
00211 
00212 #ifndef ITK_MANUAL_INSTANTIATION
00213 #include "itkInverseDisplacementFieldImageFilter.hxx"
00214 #endif
00215 
00216 #endif
00217