ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkShrinkImageFilter.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 __itkShrinkImageFilter_h
00029 #define __itkShrinkImageFilter_h
00030 
00031 #include "itkImageToImageFilter.h"
00032 
00033 namespace itk
00034 {
00066 template< class TInputImage, class TOutputImage >
00067 class ITK_EXPORT ShrinkImageFilter:
00068   public ImageToImageFilter< TInputImage, TOutputImage >
00069 {
00070 public:
00072   typedef ShrinkImageFilter                               Self;
00073   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00074   typedef SmartPointer< Self >                            Pointer;
00075   typedef SmartPointer< const Self >                      ConstPointer;
00076 
00078   itkNewMacro(Self);
00079 
00081   itkTypeMacro(ShrinkImageFilter, ImageToImageFilter);
00082 
00084   typedef TOutputImage                          OutputImageType;
00085   typedef TInputImage                           InputImageType;
00086   typedef typename OutputImageType::Pointer     OutputImagePointer;
00087   typedef typename InputImageType::Pointer      InputImagePointer;
00088   typedef typename InputImageType::ConstPointer InputImageConstPointer;
00089 
00090   typedef typename TOutputImage::IndexType  OutputIndexType;
00091   typedef typename TInputImage::IndexType   InputIndexType;
00092   typedef typename TOutputImage::OffsetType OutputOffsetType;
00093 
00095   typedef typename TOutputImage::RegionType OutputImageRegionType;
00096 
00098   itkStaticConstMacro(ImageDimension, unsigned int,
00099                       TInputImage::ImageDimension);
00100   itkStaticConstMacro(OutputImageDimension, unsigned int,
00101                       TOutputImage::ImageDimension);
00103 
00104   typedef FixedArray< unsigned int, ImageDimension > ShrinkFactorsType;
00105 
00108   itkSetMacro(ShrinkFactors, ShrinkFactorsType);
00109   void SetShrinkFactors(unsigned int factor);
00110   void SetShrinkFactor(unsigned int i, unsigned int factor)
00111   {
00112     m_ShrinkFactors[i] = factor;
00113   }
00115 
00117   itkGetConstReferenceMacro(ShrinkFactors, ShrinkFactorsType);
00118 
00126   virtual void GenerateOutputInformation();
00127 
00133   virtual void GenerateInputRequestedRegion();
00134 
00135 #ifdef ITK_USE_CONCEPT_CHECKING
00136 
00137   itkConceptMacro( InputConvertibleToOutputCheck,
00138                    ( Concept::Convertible< typename TInputImage::PixelType, typename TOutputImage::PixelType > ) );
00139   itkConceptMacro( SameDimensionCheck,
00140                    ( Concept::SameDimension< ImageDimension, OutputImageDimension > ) );
00141 
00143 #endif
00144 protected:
00145   ShrinkImageFilter();
00146   ~ShrinkImageFilter() {}
00147   void PrintSelf(std::ostream & os, Indent indent) const;
00149 
00160   void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
00161                             ThreadIdType threadId);
00162 
00163 private:
00164   ShrinkImageFilter(const Self &); //purposely not implemented
00165   void operator=(const Self &);    //purposely not implemented
00166 
00167   ShrinkFactorsType m_ShrinkFactors;
00168 };
00169 } // end namespace itk
00170 
00171 #ifndef ITK_MANUAL_INSTANTIATION
00172 #include "itkShrinkImageFilter.hxx"
00173 #endif
00174 
00175 #endif
00176