ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkValuedRegionalExtremaImageFilter.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 __itkValuedRegionalExtremaImageFilter_h
00019 #define __itkValuedRegionalExtremaImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 #include "itkShapedNeighborhoodIterator.h"
00023 #include "itkConstantBoundaryCondition.h"
00024 #include <stack>
00025 
00026 namespace itk
00027 {
00075 template< class TInputImage, class TOutputImage,
00076           class TFunction1, class TFunction2 >
00077 class ITK_EXPORT ValuedRegionalExtremaImageFilter:
00078   public ImageToImageFilter< TInputImage, TOutputImage >
00079 {
00080 public:
00082   typedef ValuedRegionalExtremaImageFilter Self;
00083 
00084   typedef ImageToImageFilter< TInputImage, TOutputImage >
00085   Superclass;
00086 
00087   typedef SmartPointer< Self >       Pointer;
00088   typedef SmartPointer< const Self > ConstPointer;
00089 
00091   typedef TInputImage                            InputImageType;
00092   typedef TOutputImage                           OutputImageType;
00093   typedef typename InputImageType::Pointer       InputImagePointer;
00094   typedef typename InputImageType::ConstPointer  InputImageConstPointer;
00095   typedef typename InputImageType::RegionType    InputImageRegionType;
00096   typedef typename InputImageType::PixelType     InputImagePixelType;
00097   typedef typename InputImageType::SizeType      ISizeType;
00098   typedef typename OutputImageType::Pointer      OutputImagePointer;
00099   typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
00100   typedef typename OutputImageType::RegionType   OutputImageRegionType;
00101   typedef typename OutputImageType::PixelType    OutputImagePixelType;
00102 
00104   itkStaticConstMacro(InputImageDimension, unsigned int,
00105                       TInputImage::ImageDimension);
00106   itkStaticConstMacro(OutputImageDimension, unsigned int,
00107                       TOutputImage::ImageDimension);
00109 
00111   itkNewMacro(Self);
00112 
00114   itkTypeMacro(ValuedRegionalExtremaImageFilter,
00115                ImageToImageFilter);
00116 
00123   itkSetMacro(FullyConnected, bool);
00124   itkGetConstReferenceMacro(FullyConnected, bool);
00125   itkBooleanMacro(FullyConnected);
00127 
00131   itkSetMacro(MarkerValue, typename TInputImage::PixelType);
00132   itkGetConstReferenceMacro(MarkerValue, typename TInputImage::PixelType);
00134 
00138   itkGetConstMacro(Flat, bool);
00139 
00140 #ifdef ITK_USE_CONCEPT_CHECKING
00141 
00142   itkConceptMacro( InputHasPixelTraitsCheck,
00143                    ( Concept::HasPixelTraits< InputImagePixelType > ) );
00144   itkConceptMacro( InputHasNumericTraitsCheck,
00145                    ( Concept::HasNumericTraits< InputImagePixelType > ) );
00146 
00148 #endif
00149 protected:
00150   ValuedRegionalExtremaImageFilter();
00151   ~ValuedRegionalExtremaImageFilter() {}
00152   void PrintSelf(std::ostream & os, Indent indent) const;
00154 
00158   void GenerateInputRequestedRegion();
00159 
00161   void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) );
00162 
00163   void GenerateData();
00164 
00165 private:
00166   ValuedRegionalExtremaImageFilter(const Self &); //purposely not implemented
00167   void operator=(const Self &);                   //purposely not implemented
00168 
00169   typename TInputImage::PixelType m_MarkerValue;
00170 
00171   bool m_FullyConnected;
00172   bool m_Flat;
00173 
00174   typedef typename OutputImageType::IndexType               OutIndexType;
00175   typedef typename InputImageType::IndexType                InIndexType;
00176   typedef ConstShapedNeighborhoodIterator< InputImageType > ConstInputIterator;
00177   typedef ShapedNeighborhoodIterator< OutputImageType >     NOutputIterator;
00178   typedef std::stack< OutIndexType >                        IndexStack;
00179 }; // end of class
00180 } // end namespace itk
00181 
00182 #ifndef ITK_MANUAL_INSTANTIATION
00183 #include "itkValuedRegionalExtremaImageFilter.hxx"
00184 #endif
00185 
00186 #endif
00187