Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkIsolatedConnectedImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkIsolatedConnectedImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-10-16 16:45:11 $
00007   Version:   $Revision: 1.16 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkIsolatedConnectedImageFilter_h
00018 #define __itkIsolatedConnectedImageFilter_h
00019 
00020 #include "itkImage.h"
00021 #include "itkImageToImageFilter.h"
00022 
00023 namespace itk {
00024 
00069 template <class TInputImage, class TOutputImage>
00070 class ITK_EXPORT IsolatedConnectedImageFilter:
00071     public ImageToImageFilter<TInputImage,TOutputImage>
00072 {
00073 public:
00075   typedef IsolatedConnectedImageFilter                 Self;
00076   typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00077   typedef SmartPointer<Self>                           Pointer;
00078   typedef SmartPointer<const Self>                     ConstPointer;
00079 
00081   itkNewMacro(Self);
00082 
00084   itkTypeMacro(IsolatedConnectedImageFilter,
00085                ImageToImageFilter);
00086 
00087   typedef TInputImage                           InputImageType;
00088   typedef typename InputImageType::Pointer      InputImagePointer;
00089   typedef typename InputImageType::ConstPointer InputImageConstPointer;
00090   typedef typename InputImageType::RegionType   InputImageRegionType; 
00091   typedef typename InputImageType::PixelType    InputImagePixelType; 
00092   typedef typename InputImageType::IndexType    IndexType;
00093   typedef typename InputImageType::SizeType     SizeType;
00094   
00095   typedef TOutputImage                          OutputImageType;
00096   typedef typename OutputImageType::Pointer     OutputImagePointer;
00097   typedef typename OutputImageType::RegionType  OutputImageRegionType; 
00098   typedef typename OutputImageType::PixelType   OutputImagePixelType; 
00099 
00100   typedef std::vector< IndexType > SeedsContainerType;
00101 
00102   typedef typename NumericTraits< 
00103                 InputImagePixelType >::RealType InputRealType;
00104   
00105 
00106   void PrintSelf ( std::ostream& os, Indent indent ) const;
00107 
00111   void SetSeed1(const IndexType & seed)
00112     {
00113     this->ClearSeeds1();
00114     this->AddSeed1( seed );
00115     }
00117 
00118   
00120   void ClearSeeds1()
00121     {
00122     m_Seeds1.clear();
00123     }
00124 
00125 
00127   void AddSeed1(const IndexType & seed)
00128     {
00129     m_Seeds1.push_back( seed );
00130     this->Modified();
00131     }
00133 
00136   void SetSeed2(const IndexType & seed)
00137     {
00138     this->ClearSeeds2();
00139     this->AddSeed2( seed );
00140     }
00142 
00144   void ClearSeeds2()
00145     {
00146     m_Seeds2.clear();
00147     }
00148 
00150   void AddSeed2(const IndexType & seed)
00151     {
00152     m_Seeds2.push_back( seed );
00153     this->Modified();
00154     }
00156 
00159   itkSetMacro(Lower, InputImagePixelType);
00160   itkGetConstReferenceMacro(Lower, InputImagePixelType);
00162 
00165   itkSetMacro(Upper, InputImagePixelType);
00166   itkGetConstReferenceMacro(Upper, InputImagePixelType);
00168 
00172   void SetUpperValueLimit( InputImagePixelType upperValue)
00173     {
00174     this->SetUpper( upperValue );
00175     }
00176   InputImagePixelType GetUpperValueLimit()
00177     {
00178     return this->GetUpper();
00179     }
00181 
00184   itkSetMacro(IsolatedValueTolerance, InputImagePixelType);
00185   itkGetConstReferenceMacro(IsolatedValueTolerance, InputImagePixelType);
00187 
00191   itkSetMacro(ReplaceValue, OutputImagePixelType);
00192   itkGetConstReferenceMacro(ReplaceValue, OutputImagePixelType);
00194 
00196   itkGetConstReferenceMacro(IsolatedValue, InputImagePixelType);
00197 
00200   itkSetMacro(FindUpperThreshold,bool);
00201   itkBooleanMacro(FindUpperThreshold);
00202   itkGetConstReferenceMacro(FindUpperThreshold,bool);
00204 
00207   itkGetConstReferenceMacro(ThresholdingFailed, bool);
00208 
00209 #ifdef ITK_USE_CONCEPT_CHECKING
00210 
00211   itkConceptMacro(InputHasNumericTraitsCheck,
00212                   (Concept::HasNumericTraits<InputImagePixelType>));
00213 
00215 #endif
00216 
00217 protected:
00218   IsolatedConnectedImageFilter();
00219   ~IsolatedConnectedImageFilter(){};
00220   SeedsContainerType   m_Seeds1;
00221   SeedsContainerType   m_Seeds2;
00222   InputImagePixelType  m_Lower;
00223   InputImagePixelType  m_Upper;
00224   OutputImagePixelType m_ReplaceValue;
00225   InputImagePixelType  m_IsolatedValue;
00226   InputImagePixelType  m_IsolatedValueTolerance;
00227   bool                 m_FindUpperThreshold;
00228   bool                 m_ThresholdingFailed;
00229   
00230   // Override since the filter needs all the data for the algorithm
00231   void GenerateInputRequestedRegion();
00232 
00233   // Override since the filter produces the entire dataset
00234   void EnlargeOutputRequestedRegion(DataObject *output);
00235 
00236   void GenerateData();
00237   
00238 private:
00239   IsolatedConnectedImageFilter(const Self&); //purposely not implemented
00240   void operator=(const Self&); //purposely not implemented
00241 
00242 };
00243 
00244 } // end namespace itk
00245 
00246 #ifndef ITK_MANUAL_INSTANTIATION
00247 #include "itkIsolatedConnectedImageFilter.txx"
00248 #endif
00249 
00250 #endif
00251 

Generated at Wed Nov 5 22:30:18 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000