00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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:
00040
00042 typedef ConnectedThresholdImageFilter Self;
00043 typedef ImageToImageFilter<TInputImage,TOutputImage> Superclass;
00044 typedef SmartPointer<Self> Pointer;
00045 typedef SmartPointer<const Self> ConstPointer;
00046
00048 itkNewMacro(Self);
00049
00051 itkTypeMacro(ConnectedThresholdImageFilter,
00052 ImageToImageFilter);
00053
00054 typedef TInputImage InputImageType;
00055 typedef typename InputImageType::Pointer InputImagePointer;
00056 typedef typename InputImageType::ConstPointer InputImageConstPointer;
00057 typedef typename InputImageType::RegionType InputImageRegionType;
00058 typedef typename InputImageType::PixelType InputImagePixelType;
00059 typedef typename InputImageType::IndexType IndexType;
00060 typedef typename InputImageType::SizeType SizeType;
00061
00062 typedef TOutputImage OutputImageType;
00063 typedef typename OutputImageType::Pointer OutputImagePointer;
00064 typedef typename OutputImageType::RegionType OutputImageRegionType;
00065 typedef typename OutputImageType::PixelType OutputImagePixelType;
00066
00067 void PrintSelf ( std::ostream& os, Indent indent ) const;
00068
00069
00071 void SetSeed ( const IndexType & seed )
00072 {
00073 this->ClearSeeds();
00074 this->AddSeed ( seed );
00075 }
00076 void AddSeed(const IndexType & seed)
00077 {
00078 m_SeedList.push_back ( seed );
00079 this->Modified();
00080 };
00082
00084 void ClearSeeds ()
00085 {
00086 if (m_SeedList.size() > 0)
00087 {
00088 m_SeedList.clear();
00089 this->Modified();
00090 }
00091 };
00093
00094
00098 itkSetMacro(ReplaceValue, OutputImagePixelType);
00099 itkGetMacro(ReplaceValue, OutputImagePixelType);
00101
00103 typedef SimpleDataObjectDecorator<InputImagePixelType> InputPixelObjectType;
00104
00106 virtual void SetUpper( InputImagePixelType );
00107 virtual void SetLower( InputImagePixelType );
00109
00111 virtual void SetUpperInput( const InputPixelObjectType *);
00112 virtual void SetLowerInput( const InputPixelObjectType *);
00114
00116 virtual InputImagePixelType GetUpper() const;
00117 virtual InputImagePixelType GetLower() const;
00119
00121 virtual InputPixelObjectType * GetUpperInput();
00122 virtual InputPixelObjectType * GetLowerInput();
00124
00126 itkStaticConstMacro(InputImageDimension, unsigned int,
00127 TInputImage::ImageDimension);
00128 itkStaticConstMacro(OutputImageDimension, unsigned int,
00129 TOutputImage::ImageDimension);
00131
00132 #ifdef ITK_USE_CONCEPT_CHECKING
00133
00134 itkConceptMacro(OutputEqualityComparableCheck,
00135 (Concept::EqualityComparable<OutputImagePixelType>));
00136 itkConceptMacro(InputEqualityComparableCheck,
00137 (Concept::EqualityComparable<InputImagePixelType>));
00138 itkConceptMacro(InputConvertibleToOutputCheck,
00139 (Concept::Convertible<InputImagePixelType, OutputImagePixelType>));
00140 itkConceptMacro(SameDimensionCheck,
00141 (Concept::SameDimension<InputImageDimension, OutputImageDimension>));
00142 itkConceptMacro(IntConvertibleToInputCheck,
00143 (Concept::Convertible<int, InputImagePixelType>));
00144 itkConceptMacro(OutputOStreamWritableCheck,
00145 (Concept::OStreamWritable<OutputImagePixelType>));
00146
00148 #endif
00149
00150 protected:
00151 ConnectedThresholdImageFilter();
00152 ~ConnectedThresholdImageFilter(){};
00153 std::vector<IndexType> m_SeedList;
00154 InputImagePixelType m_Lower;
00155 InputImagePixelType m_Upper;
00156 OutputImagePixelType m_ReplaceValue;
00157
00158
00159 void GenerateInputRequestedRegion();
00160
00161
00162 void EnlargeOutputRequestedRegion(DataObject *output);
00163
00164 void GenerateData();
00165
00166 private:
00167 ConnectedThresholdImageFilter(const Self&);
00168 void operator=(const Self&);
00169
00170 };
00171
00172 }
00173
00174 #ifndef ITK_MANUAL_INSTANTIATION
00175 #include "itkConnectedThresholdImageFilter.txx"
00176 #endif
00177
00178 #endif
00179