ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkVectorResampleImageFilter.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 __itkVectorResampleImageFilter_h
00019 #define __itkVectorResampleImageFilter_h
00020 
00021 #include "itkTransform.h"
00022 #include "itkImageRegionIterator.h"
00023 #include "itkImageToImageFilter.h"
00024 #include "itkVectorInterpolateImageFunction.h"
00025 #include "itkSize.h"
00026 
00027 namespace itk
00028 {
00058 template< class TInputImage, class TOutputImage, class TInterpolatorPrecisionType = double >
00059 class ITK_EXPORT VectorResampleImageFilter:
00060   public ImageToImageFilter< TInputImage, TOutputImage >
00061 {
00062 public:
00064   typedef VectorResampleImageFilter                       Self;
00065   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00066   typedef SmartPointer< Self >                            Pointer;
00067   typedef SmartPointer< const Self >                      ConstPointer;
00068 
00069   typedef TInputImage                           InputImageType;
00070   typedef TOutputImage                          OutputImageType;
00071   typedef typename InputImageType::Pointer      InputImagePointer;
00072   typedef typename InputImageType::ConstPointer InputImageConstPointer;
00073   typedef typename OutputImageType::Pointer     OutputImagePointer;
00074   typedef typename InputImageType::RegionType   InputImageRegionType;
00075 
00077   itkNewMacro(Self);
00078 
00080   itkTypeMacro(VectorResampleImageFilter, ImageToImageFilter);
00081 
00083   itkStaticConstMacro(ImageDimension, unsigned int,
00084                       TOutputImage::ImageDimension);
00085 
00091   typedef Transform< TInterpolatorPrecisionType, itkGetStaticConstMacro(ImageDimension),
00092                      itkGetStaticConstMacro(ImageDimension) > TransformType;
00093   typedef typename TransformType::ConstPointer
00094   TransformPointerType;
00096 
00098   typedef VectorInterpolateImageFunction< InputImageType, TInterpolatorPrecisionType > InterpolatorType;
00099   typedef typename InterpolatorType::Pointer                                           InterpolatorPointerType;
00100 
00102   typedef Size< itkGetStaticConstMacro(ImageDimension) > SizeType;
00103 
00105   typedef typename TOutputImage::IndexType IndexType;
00106 
00108   typedef typename InterpolatorType::PointType PointType;
00109 
00111   typedef typename TOutputImage::PixelType PixelType;
00112   typedef typename PixelType::ValueType    PixelComponentType;
00113 
00115   typedef typename TOutputImage::RegionType OutputImageRegionType;
00116 
00118   typedef typename TOutputImage::SpacingType   SpacingType;
00119   typedef typename TOutputImage::PointType     OriginPointType;
00120   typedef typename TOutputImage::DirectionType DirectionType;
00121 
00127   itkSetConstObjectMacro(Transform, TransformType);
00128 
00130   itkGetConstObjectMacro(Transform, TransformType);
00131 
00134   itkSetObjectMacro(Interpolator, InterpolatorType);
00135 
00137   itkGetConstObjectMacro(Interpolator, InterpolatorType);
00138 
00140   itkSetMacro(Size, SizeType);
00141 
00143   itkGetConstReferenceMacro(Size, SizeType);
00144 
00147   itkSetMacro(DefaultPixelValue, PixelType);
00148 
00150   itkGetConstMacro(DefaultPixelValue, PixelType);
00151 
00153   itkSetMacro(OutputSpacing, SpacingType);
00154   virtual void SetOutputSpacing(const double *values);
00156 
00158   itkGetConstReferenceMacro(OutputSpacing, SpacingType);
00159 
00161   itkSetMacro(OutputOrigin, PointType);
00162   virtual void SetOutputOrigin(const double *values);
00164 
00166   itkGetConstReferenceMacro(OutputOrigin, PointType);
00167 
00169   itkSetMacro(OutputDirection, DirectionType);
00170   itkGetConstReferenceMacro(OutputDirection, DirectionType);
00172 
00175   itkSetMacro(OutputStartIndex, IndexType);
00176 
00178   itkGetConstReferenceMacro(OutputStartIndex, IndexType);
00179 
00185   virtual void GenerateOutputInformation();
00186 
00192   virtual void GenerateInputRequestedRegion();
00193 
00196   virtual void BeforeThreadedGenerateData();
00197 
00200   virtual void AfterThreadedGenerateData();
00201 
00203   unsigned long GetMTime(void) const;
00204 
00205 #ifdef ITK_USE_CONCEPT_CHECKING
00206 
00207   itkConceptMacro( InputHasNumericTraitsCheck,
00208                    ( Concept::HasNumericTraits< typename TInputImage::PixelType::ValueType > ) );
00209   itkConceptMacro( OutputHasNumericTraitsCheck,
00210                    ( Concept::HasNumericTraits< PixelComponentType > ) );
00211 
00213 #endif
00214 protected:
00215   VectorResampleImageFilter();
00216   ~VectorResampleImageFilter() {}
00217   void PrintSelf(std::ostream & os, Indent indent) const;
00219 
00228   void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
00229                             ThreadIdType threadId);
00230 
00231 private:
00232   VectorResampleImageFilter(const Self &); //purposely not implemented
00233   void operator=(const Self &);            //purposely not implemented
00234 
00235   SizeType                m_Size;       // Size of the output image
00236   TransformPointerType    m_Transform;  // Coordinate transform to use
00237   InterpolatorPointerType m_Interpolator;
00238   // Image function for interpolation
00239   PixelType m_DefaultPixelValue;
00240   // default pixel value if the point
00241   // is outside the image
00242   SpacingType   m_OutputSpacing;           // output image spacing
00243   PointType     m_OutputOrigin;            // output image origin
00244   DirectionType m_OutputDirection;         // output image direction cosines
00245   IndexType     m_OutputStartIndex;        // output start index
00246 };
00247 } // end namespace itk
00248 
00249 #ifndef ITK_MANUAL_INSTANTIATION
00250 #include "itkVectorResampleImageFilter.hxx"
00251 #endif
00252 
00253 #endif
00254