ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkRegionOfInterestImageFilter.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 __itkRegionOfInterestImageFilter_h
00019 #define __itkRegionOfInterestImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 #include "itkSmartPointer.h"
00023 
00024 namespace itk
00025 {
00052 template< class TInputImage, class TOutputImage >
00053 class ITK_EXPORT RegionOfInterestImageFilter:
00054   public ImageToImageFilter< TInputImage, TOutputImage >
00055 {
00056 public:
00058   typedef RegionOfInterestImageFilter                     Self;
00059   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00060   typedef SmartPointer< Self >                            Pointer;
00061   typedef SmartPointer< const Self >                      ConstPointer;
00062   typedef typename Superclass::InputImageRegionType       InputImageRegionType;
00063 
00065   itkNewMacro(Self);
00066 
00068   itkTypeMacro(RegionOfInterestImageFilter, ImageToImageFilter);
00069 
00071   typedef typename TInputImage::RegionType RegionType;
00072   typedef typename TInputImage::IndexType  IndexType;
00073   typedef typename TInputImage::SizeType   SizeType;
00074 
00076   typedef typename TOutputImage::PixelType OutputImagePixelType;
00077   typedef typename TInputImage::PixelType  InputImagePixelType;
00078 
00080   itkSetMacro(RegionOfInterest, RegionType);
00081   itkGetConstMacro(RegionOfInterest, RegionType);
00083 
00085   itkStaticConstMacro(ImageDimension, unsigned int,
00086                       TInputImage::ImageDimension);
00087   itkStaticConstMacro(OutputImageDimension, unsigned int,
00088                       TOutputImage::ImageDimension);
00090 
00091 #ifdef ITK_USE_CONCEPT_CHECKING
00092 
00093   itkConceptMacro( SameDimensionCheck,
00094                    ( Concept::SameDimension< ImageDimension, OutputImageDimension > ) );
00095   itkConceptMacro( InputConvertibleToOutputCheck,
00096                    ( Concept::Convertible< InputImagePixelType, OutputImagePixelType > ) );
00097 
00099 #endif
00100 protected:
00101   RegionOfInterestImageFilter();
00102   ~RegionOfInterestImageFilter() {}
00103   void PrintSelf(std::ostream & os, Indent indent) const;
00105 
00106   virtual void GenerateInputRequestedRegion();
00107 
00108   virtual void EnlargeOutputRequestedRegion(DataObject *output);
00109 
00118   virtual void GenerateOutputInformation();
00119 
00129   void ThreadedGenerateData(const RegionType & outputRegionForThread,
00130                             ThreadIdType threadId);
00131 
00132 private:
00133   RegionOfInterestImageFilter(const Self &); //purposely not implemented
00134   void operator=(const Self &);              //purposely not implemented
00135 
00136   RegionType m_RegionOfInterest;
00137 };
00138 } // end namespace itk
00139 
00140 #ifndef ITK_MANUAL_INSTANTIATION
00141 #include "itkRegionOfInterestImageFilter.hxx"
00142 #endif
00143 
00144 #endif
00145