ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkImageToImageFilter.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 /*=========================================================================
00019  *
00020  *  Portions of this file are subject to the VTK Toolkit Version 3 copyright.
00021  *
00022  *  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00023  *
00024  *  For complete copyright, license and disclaimer of warranty information
00025  *  please refer to the NOTICE file at the top of the ITK source tree.
00026  *
00027  *=========================================================================*/
00028 #ifndef __itkImageToImageFilter_h
00029 #define __itkImageToImageFilter_h
00030 
00031 #include "itkImageSource.h"
00032 #include "itkConceptChecking.h"
00033 #include "itkImageToImageFilterDetail.h"
00034 
00035 namespace itk
00036 {
00079 template< class TInputImage, class TOutputImage >
00080 class ITK_EXPORT ImageToImageFilter:public ImageSource< TOutputImage >
00081 {
00082 public:
00084   typedef ImageToImageFilter          Self;
00085   typedef ImageSource< TOutputImage > Superclass;
00086   typedef SmartPointer< Self >        Pointer;
00087   typedef SmartPointer< const Self >  ConstPointer;
00088 
00090   itkTypeMacro(ImageToImageFilter, ImageSource);
00091 
00093   typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00094   typedef typename Superclass::OutputImagePixelType  OutputImagePixelType;
00095 
00097   typedef TInputImage                           InputImageType;
00098   typedef typename InputImageType::Pointer      InputImagePointer;
00099   typedef typename InputImageType::ConstPointer InputImageConstPointer;
00100   typedef typename InputImageType::RegionType   InputImageRegionType;
00101   typedef typename InputImageType::PixelType    InputImagePixelType;
00102 
00104   itkStaticConstMacro(InputImageDimension, unsigned int,
00105                       TInputImage::ImageDimension);
00106   itkStaticConstMacro(OutputImageDimension, unsigned int,
00107                       TOutputImage::ImageDimension);
00109 
00111   using Superclass::SetInput;
00112   virtual void SetInput(const InputImageType *image);
00113 
00114   virtual void SetInput(unsigned int, const TInputImage *image);
00115 
00116   const InputImageType * GetInput(void) const;
00117 
00118   const InputImageType * GetInput(unsigned int idx) const;
00119 
00139   virtual void PushBackInput(const InputImageType *image);
00140 
00141   virtual void PopBackInput();
00142 
00143   virtual void PushFrontInput(const InputImageType *image);
00144 
00145   virtual void PopFrontInput();
00146 
00147 protected:
00148   ImageToImageFilter();
00149   ~ImageToImageFilter();
00150 
00151   virtual void PrintSelf(std::ostream & os, Indent indent) const;
00152 
00172   virtual void VerifyInputInformation();
00173 
00198   virtual void GenerateInputRequestedRegion();
00199 
00202   typedef ImageToImageFilterDetail::ImageRegionCopier< itkGetStaticConstMacro(OutputImageDimension),
00203                                                        itkGetStaticConstMacro(InputImageDimension) >
00204   InputToOutputRegionCopierType;
00205 
00208   typedef ImageToImageFilterDetail::ImageRegionCopier< itkGetStaticConstMacro(InputImageDimension),
00209                                                        itkGetStaticConstMacro(OutputImageDimension) >
00210   OutputToInputRegionCopierType;
00211 
00247   virtual void CallCopyOutputRegionToInputRegion(InputImageRegionType & destRegion,
00248                                                  const OutputImageRegionType & srcRegion);
00249 
00280   virtual void CallCopyInputRegionToOutputRegion(OutputImageRegionType & destRegion,
00281                                                  const InputImageRegionType & srcRegion);
00282 
00291   void PushBackInput(const DataObject *input)
00292   { Superclass::PushBackInput(input); }
00293   void PushFrontInput(const DataObject *input)
00294   { Superclass::PushFrontInput(input); }
00295 private:
00296   ImageToImageFilter(const Self &); //purposely not implemented
00297   void operator=(const Self &);     //purposely not implemented
00298 };
00299 } // end namespace itk
00301 
00302 // Define instantiation macro for this template.
00303 #define ITK_TEMPLATE_ImageToImageFilter(_, EXPORT, TypeX, TypeY)                  \
00304   namespace itk                                                                   \
00305   {                                                                               \
00306   _( 2 ( class EXPORT ImageToImageFilter< ITK_TEMPLATE_2 TypeX > ) )              \
00307   namespace Templates                                                             \
00308   {                                                                               \
00309   typedef ImageToImageFilter< ITK_TEMPLATE_2 TypeX > ImageToImageFilter##TypeY; \
00310   }                                                                               \
00311   }
00312 
00313 #if ITK_TEMPLATE_EXPLICIT
00314 #include "Templates/itkImageToImageFilter+-.h"
00315 #endif
00316 
00317 #if ITK_TEMPLATE_TXX
00318 #include "itkImageToImageFilter.hxx"
00319 #endif
00320 
00321 #endif
00322