ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkNeighborhoodConnectedImageFilter.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 __itkNeighborhoodConnectedImageFilter_h
00019 #define __itkNeighborhoodConnectedImageFilter_h
00020 
00021 #include "itkImageToImageFilter.h"
00022 
00023 namespace itk
00024 {
00035 template< class TInputImage, class TOutputImage >
00036 class ITK_EXPORT NeighborhoodConnectedImageFilter:
00037   public ImageToImageFilter< TInputImage, TOutputImage >
00038 {
00039 public:
00041   typedef NeighborhoodConnectedImageFilter                Self;
00042   typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00043   typedef SmartPointer< Self >                            Pointer;
00044   typedef SmartPointer< const Self >                      ConstPointer;
00045 
00047   itkNewMacro(Self);
00048 
00050   itkTypeMacro(NeighborhoodConnectedImageFilter,
00051                ImageToImageFilter);
00052 
00053   typedef TInputImage                         InputImageType;
00054   typedef typename InputImageType::Pointer    InputImagePointer;
00055   typedef typename InputImageType::RegionType InputImageRegionType;
00056   typedef typename InputImageType::PixelType  InputImagePixelType;
00057   typedef typename InputImageType::IndexType  IndexType;
00058   typedef typename InputImageType::SizeType   InputImageSizeType;
00059 
00060   typedef TOutputImage                         OutputImageType;
00061   typedef typename OutputImageType::Pointer    OutputImagePointer;
00062   typedef typename OutputImageType::RegionType OutputImageRegionType;
00063   typedef typename OutputImageType::PixelType  OutputImagePixelType;
00064 
00065   void PrintSelf(std::ostream & os, Indent indent) const;
00066 
00068   void ClearSeeds();
00069 
00071   void SetSeed(const IndexType & seed);
00072 
00074   void AddSeed(const IndexType & seed);
00075 
00077   itkSetMacro(Lower, InputImagePixelType);
00078   itkGetConstMacro(Lower, InputImagePixelType);
00080 
00083   itkSetMacro(Upper, InputImagePixelType);
00084   itkGetConstMacro(Upper, InputImagePixelType);
00086 
00090   itkSetMacro(ReplaceValue, OutputImagePixelType);
00091   itkGetConstMacro(ReplaceValue, OutputImagePixelType);
00093 
00095   itkSetMacro(Radius, InputImageSizeType);
00096 
00098   itkGetConstReferenceMacro(Radius, InputImageSizeType);
00099 
00101   itkStaticConstMacro(InputImageDimension, unsigned int,
00102                       TInputImage::ImageDimension);
00103   itkStaticConstMacro(OutputImageDimension, unsigned int,
00104                       TOutputImage::ImageDimension);
00106 
00107 #ifdef ITK_USE_CONCEPT_CHECKING
00108 
00109   itkConceptMacro( InputEqualityComparableCheck,
00110                    ( Concept::EqualityComparable< InputImagePixelType > ) );
00111   itkConceptMacro( OutputEqualityComparableCheck,
00112                    ( Concept::EqualityComparable< OutputImagePixelType > ) );
00113   itkConceptMacro( SameDimensionCheck,
00114                    ( Concept::SameDimension< InputImageDimension, OutputImageDimension > ) );
00115   itkConceptMacro( InputOStreamWritableCheck,
00116                    ( Concept::OStreamWritable< InputImagePixelType > ) );
00117   itkConceptMacro( OutputOStreamWritableCheck,
00118                    ( Concept::OStreamWritable< OutputImagePixelType > ) );
00119 
00121 #endif
00122 protected:
00123   NeighborhoodConnectedImageFilter();
00124   ~NeighborhoodConnectedImageFilter(){}
00125   std::vector< IndexType > m_Seeds;
00127 
00128   InputImagePixelType m_Lower;
00129   InputImagePixelType m_Upper;
00130 
00131   OutputImagePixelType m_ReplaceValue;
00132 
00133   InputImageSizeType m_Radius;
00134 
00135   // Override since the filter needs all the data for the algorithm
00136   void GenerateInputRequestedRegion();
00137 
00138   // Override since the filter produces the entire dataset
00139   void EnlargeOutputRequestedRegion(DataObject *output);
00140 
00141   void GenerateData();
00142 
00143 private:
00144   NeighborhoodConnectedImageFilter(const Self &); //purposely not implemented
00145   void operator=(const Self &);                   //purposely not implemented
00146 };
00147 } // end namespace itk
00148 
00149 #ifndef ITK_MANUAL_INSTANTIATION
00150 #include "itkNeighborhoodConnectedImageFilter.hxx"
00151 #endif
00152 
00153 #endif
00154