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: 2006/03/29 14:53:40 $
00007   Version:   $Revision: 1.15 $
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:
00074 
00076   typedef IsolatedConnectedImageFilter Self;
00077   typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00078   typedef SmartPointer<Self> Pointer;
00079   typedef SmartPointer<const Self> ConstPointer;
00080 
00082   itkNewMacro(Self);
00083 
00085   itkTypeMacro(IsolatedConnectedImageFilter,
00086                ImageToImageFilter);
00087 
00088   typedef TInputImage InputImageType;
00089   typedef typename InputImageType::Pointer InputImagePointer;
00090   typedef typename InputImageType::ConstPointer InputImageConstPointer;
00091   typedef typename InputImageType::RegionType InputImageRegionType; 
00092   typedef typename InputImageType::PixelType InputImagePixelType; 
00093   typedef typename InputImageType::IndexType IndexType;
00094   typedef typename InputImageType::SizeType SizeType;
00095   
00096   typedef TOutputImage OutputImageType;
00097   typedef typename OutputImageType::Pointer OutputImagePointer;
00098   typedef typename OutputImageType::RegionType OutputImageRegionType; 
00099   typedef typename OutputImageType::PixelType OutputImagePixelType; 
00100 
00101   typedef std::vector< IndexType > SeedsContainerType;
00102 
00103   typedef typename NumericTraits< 
00104                 InputImagePixelType >::RealType InputRealType;
00105   
00106 
00107   void PrintSelf ( std::ostream& os, Indent indent ) const;
00108 
00112   void SetSeed1(const IndexType & seed)
00113   {
00114     this->ClearSeeds1();
00115     this->AddSeed1( seed );
00116   };
00118 
00119   
00121   void ClearSeeds1()
00122   {
00123     m_Seeds1.clear();
00124   };
00126 
00127 
00129   void AddSeed1(const IndexType & seed)
00130   {
00131     m_Seeds1.push_back( seed );
00132     this->Modified();
00133   };
00135 
00138   void SetSeed2(const IndexType & seed)
00139   {
00140     this->ClearSeeds2();
00141     this->AddSeed2( seed );
00142   };
00144 
00145   
00147   void ClearSeeds2()
00148   {
00149     m_Seeds2.clear();
00150   };
00152 
00153 
00155   void AddSeed2(const IndexType & seed)
00156   {
00157     m_Seeds2.push_back( seed );
00158     this->Modified();
00159   };
00161 
00163   itkSetMacro(Lower, InputImagePixelType);
00164   itkGetConstReferenceMacro(Lower, InputImagePixelType);
00166 
00168   itkSetMacro(Upper, InputImagePixelType);
00169   itkGetConstReferenceMacro(Upper, InputImagePixelType);
00171 
00175   void SetUpperValueLimit( InputImagePixelType upperValue)
00176     {
00177       this->SetUpper( upperValue );
00178     };
00179   InputImagePixelType GetUpperValueLimit()
00180     {
00181       return this->GetUpper();
00182     };
00184 
00186   itkSetMacro(IsolatedValueTolerance, InputImagePixelType);
00187   itkGetConstReferenceMacro(IsolatedValueTolerance, InputImagePixelType);
00189 
00193   itkSetMacro(ReplaceValue, OutputImagePixelType);
00194   itkGetConstReferenceMacro(ReplaceValue, OutputImagePixelType);
00196 
00198   itkGetConstReferenceMacro(IsolatedValue, InputImagePixelType);
00199 
00202   itkSetMacro(FindUpperThreshold,bool);
00203   itkBooleanMacro(FindUpperThreshold);
00204   itkGetConstReferenceMacro(FindUpperThreshold,bool);
00206 
00209   itkGetConstReferenceMacro(ThresholdingFailed, bool);
00210 
00211 #ifdef ITK_USE_CONCEPT_CHECKING
00212 
00213   itkConceptMacro(InputHasNumericTraitsCheck,
00214                   (Concept::HasNumericTraits<InputImagePixelType>));
00215 
00217 #endif
00218 
00219 protected:
00220   IsolatedConnectedImageFilter();
00221   ~IsolatedConnectedImageFilter(){};
00222   SeedsContainerType m_Seeds1;
00223   SeedsContainerType m_Seeds2;
00224   InputImagePixelType m_Lower;
00225   InputImagePixelType m_Upper;
00226   OutputImagePixelType m_ReplaceValue;
00227   InputImagePixelType m_IsolatedValue;
00228   InputImagePixelType m_IsolatedValueTolerance;
00229   bool m_FindUpperThreshold;
00230   bool m_ThresholdingFailed;
00231   
00232   // Override since the filter needs all the data for the algorithm
00233   void GenerateInputRequestedRegion();
00234 
00235   // Override since the filter produces the entire dataset
00236   void EnlargeOutputRequestedRegion(DataObject *output);
00237 
00238   void GenerateData();
00239   
00240 private:
00241   IsolatedConnectedImageFilter(const Self&); //purposely not implemented
00242   void operator=(const Self&); //purposely not implemented
00243 
00244 };
00245 
00246 } // end namespace itk
00247 
00248 #ifndef ITK_MANUAL_INSTANTIATION
00249 #include "itkIsolatedConnectedImageFilter.txx"
00250 #endif
00251 
00252 #endif
00253 

Generated at Tue Jul 29 20:57:04 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000