ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkVectorNeighborhoodOperatorImageFilter.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 __itkVectorNeighborhoodOperatorImageFilter_h
00019 #define __itkVectorNeighborhoodOperatorImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 #include "itkNeighborhoodOperator.h"
00023 #include "itkImage.h"
00024 #include "itkImageBoundaryCondition.h"
00025 
00026 namespace itk
00027 {
00057 template< class TInputImage, class TOutputImage >
00058 class ITK_EXPORT VectorNeighborhoodOperatorImageFilter:
00059   public ImageToImageFilter< TInputImage, TOutputImage >
00060 {
00061 public:
00063   typedef VectorNeighborhoodOperatorImageFilter           Self;
00064   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00065   typedef       SmartPointer< Self >                      Pointer;
00066   typedef SmartPointer< const Self >                      ConstPointer;
00067 
00069   itkNewMacro(Self);
00070 
00072   itkTypeMacro(VectorNeighborhoodOperatorImageFilter, ImageToImageFilter);
00073 
00076   typedef typename TInputImage::Pointer            InputImagePointer;
00077   typedef typename TOutputImage::Pointer           OutputImagePointer;
00078   typedef typename TOutputImage::PixelType         OutputPixelType;
00079   typedef typename TOutputImage::InternalPixelType OutputInternalPixelType;
00080   typedef typename  TInputImage::PixelType         InputPixelType;
00081   typedef typename  TInputImage::InternalPixelType InputInternalPixelType;
00082   typedef typename OutputPixelType::ValueType      ScalarValueType;
00083 
00085   itkStaticConstMacro(ImageDimension, unsigned int,
00086                       TOutputImage::ImageDimension);
00087 
00089   typedef TInputImage  InputImageType;
00090   typedef TOutputImage OutputImageType;
00091 
00093   typedef ImageBoundaryCondition< OutputImageType > *ImageBoundaryConditionPointerType;
00094 
00096   typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00097 
00101   void SetOperator(const Neighborhood< ScalarValueType,
00102                                        itkGetStaticConstMacro(ImageDimension) > & p)
00103   {
00104     m_Operator = p;
00105     this->Modified();
00106   }
00108 
00114   void OverrideBoundaryCondition(const ImageBoundaryConditionPointerType i)
00115   { m_BoundsCondition = i; }
00116 
00124   virtual void GenerateInputRequestedRegion()
00125   throw ( InvalidRequestedRegionError );
00126 
00127 #ifdef ITK_USE_CONCEPT_CHECKING
00128 
00129   itkConceptMacro( InputHasNumericTraitsCheck,
00130                    ( Concept::HasNumericTraits< typename TInputImage::PixelType::ValueType > ) );
00131   itkConceptMacro( OutputHasNumericTraitsCheck,
00132                    ( Concept::HasNumericTraits< typename TOutputImage::PixelType::ValueType > ) );
00133 
00135 #endif
00136 protected:
00137   VectorNeighborhoodOperatorImageFilter() {}
00138   virtual ~VectorNeighborhoodOperatorImageFilter() {}
00140 
00151   void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
00152                             ThreadIdType threadId);
00153 
00154   void PrintSelf(std::ostream & os, Indent indent) const
00155   { Superclass::PrintSelf(os, indent);  }
00156 private:
00157   VectorNeighborhoodOperatorImageFilter(const Self &); //purposely not
00158                                                        // implemented
00159   void operator=(const Self &);                        //purposely not
00160 
00161   // implemented
00162 
00164   Neighborhood< ScalarValueType, itkGetStaticConstMacro(ImageDimension) > m_Operator;
00165 
00168   ImageBoundaryConditionPointerType m_BoundsCondition;
00169 };
00170 } // end namespace itk
00171 
00172 #ifndef ITK_MANUAL_INSTANTIATION
00173 #include "itkVectorNeighborhoodOperatorImageFilter.hxx"
00174 #endif
00175 
00176 #endif
00177