00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkConnectedThresholdImageFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2005/06/15 03:57:23 $ 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 __itkConnectedThresholdImageFilter_h 00018 #define __itkConnectedThresholdImageFilter_h 00019 00020 #include "itkImage.h" 00021 #include "itkImageToImageFilter.h" 00022 #include "itkSimpleDataObjectDecorator.h" 00023 00024 namespace itk{ 00025 00035 template <class TInputImage, class TOutputImage> 00036 class ITK_EXPORT ConnectedThresholdImageFilter: 00037 public ImageToImageFilter<TInputImage,TOutputImage> 00038 { 00039 public: 00041 typedef ConnectedThresholdImageFilter 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(ConnectedThresholdImageFilter, 00051 ImageToImageFilter); 00052 00053 typedef TInputImage InputImageType; 00054 typedef typename InputImageType::Pointer InputImagePointer; 00055 typedef typename InputImageType::ConstPointer InputImageConstPointer; 00056 typedef typename InputImageType::RegionType InputImageRegionType; 00057 typedef typename InputImageType::PixelType InputImagePixelType; 00058 typedef typename InputImageType::IndexType IndexType; 00059 typedef typename InputImageType::SizeType SizeType; 00060 00061 typedef TOutputImage OutputImageType; 00062 typedef typename OutputImageType::Pointer OutputImagePointer; 00063 typedef typename OutputImageType::RegionType OutputImageRegionType; 00064 typedef typename OutputImageType::PixelType OutputImagePixelType; 00065 00066 void PrintSelf ( std::ostream& os, Indent indent ) const; 00067 00068 00070 void SetSeed ( const IndexType & seed ) 00071 { 00072 this->ClearSeeds(); 00073 this->AddSeed ( seed ); 00074 } 00075 void AddSeed(const IndexType & seed) 00076 { 00077 m_SeedList.push_back ( seed ); 00078 this->Modified(); 00079 }; 00080 00082 void ClearSeeds () 00083 { 00084 if (m_SeedList.size() > 0) 00085 { 00086 m_SeedList.clear(); 00087 this->Modified(); 00088 } 00089 }; 00090 00091 00095 itkSetMacro(ReplaceValue, OutputImagePixelType); 00096 itkGetMacro(ReplaceValue, OutputImagePixelType); 00097 00099 typedef SimpleDataObjectDecorator<InputImagePixelType> InputPixelObjectType; 00100 00102 virtual void SetUpper( InputImagePixelType ); 00103 virtual void SetLower( InputImagePixelType ); 00104 00106 virtual void SetUpperInput( const InputPixelObjectType *); 00107 virtual void SetLowerInput( const InputPixelObjectType *); 00108 00110 virtual InputImagePixelType GetUpper() const; 00111 virtual InputImagePixelType GetLower() const; 00112 00114 virtual InputPixelObjectType * GetUpperInput(); 00115 virtual InputPixelObjectType * GetLowerInput(); 00116 00117 protected: 00118 ConnectedThresholdImageFilter(); 00119 ~ConnectedThresholdImageFilter(){}; 00120 std::vector<IndexType> m_SeedList; 00121 InputImagePixelType m_Lower; 00122 InputImagePixelType m_Upper; 00123 OutputImagePixelType m_ReplaceValue; 00124 00125 // Override since the filter needs all the data for the algorithm 00126 void GenerateInputRequestedRegion(); 00127 00128 // Override since the filter produces the entire dataset 00129 void EnlargeOutputRequestedRegion(DataObject *output); 00130 00131 void GenerateData(); 00132 00133 private: 00134 ConnectedThresholdImageFilter(const Self&); //purposely not implemented 00135 void operator=(const Self&); //purposely not implemented 00136 00137 }; 00138 00139 } // end namespace itk 00140 00141 #ifndef ITK_MANUAL_INSTANTIATION 00142 #include "itkConnectedThresholdImageFilter.txx" 00143 #endif 00144 00145 #endif