itkConnectedThresholdImageFilter.h
Go to the documentation of this file.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:
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 }
00081
00083 void ClearSeeds ()
00084 {
00085 if (m_SeedList.size() > 0)
00086 {
00087 m_SeedList.clear();
00088 this->Modified();
00089 }
00090 }
00092
00093
00097 itkSetMacro(ReplaceValue, OutputImagePixelType);
00098 itkGetMacro(ReplaceValue, OutputImagePixelType);
00100
00102 typedef SimpleDataObjectDecorator<InputImagePixelType> InputPixelObjectType;
00103
00105 virtual void SetUpper( InputImagePixelType );
00106 virtual void SetLower( InputImagePixelType );
00108
00110 virtual void SetUpperInput( const InputPixelObjectType *);
00111 virtual void SetLowerInput( const InputPixelObjectType *);
00113
00115 virtual InputImagePixelType GetUpper() const;
00116 virtual InputImagePixelType GetLower() const;
00118
00120 virtual InputPixelObjectType * GetUpperInput();
00121 virtual InputPixelObjectType * GetLowerInput();
00123
00125 itkStaticConstMacro(InputImageDimension, unsigned int,
00126 TInputImage::ImageDimension);
00127 itkStaticConstMacro(OutputImageDimension, unsigned int,
00128 TOutputImage::ImageDimension);
00130
00131 #ifdef ITK_USE_CONCEPT_CHECKING
00132
00133 itkConceptMacro(OutputEqualityComparableCheck,
00134 (Concept::EqualityComparable<OutputImagePixelType>));
00135 itkConceptMacro(InputEqualityComparableCheck,
00136 (Concept::EqualityComparable<InputImagePixelType>));
00137 itkConceptMacro(InputConvertibleToOutputCheck,
00138 (Concept::Convertible<InputImagePixelType, OutputImagePixelType>));
00139 itkConceptMacro(SameDimensionCheck,
00140 (Concept::SameDimension<InputImageDimension, OutputImageDimension>));
00141 itkConceptMacro(IntConvertibleToInputCheck,
00142 (Concept::Convertible<int, InputImagePixelType>));
00143 itkConceptMacro(OutputOStreamWritableCheck,
00144 (Concept::OStreamWritable<OutputImagePixelType>));
00145
00147 #endif
00148
00152 typedef enum { FaceConnectivity, FullConnectivity } ConnectivityEnumType;
00153
00154 #ifdef ITK_USE_REVIEW
00155
00157 itkSetMacro( Connectivity, ConnectivityEnumType );
00158 itkGetMacro( Connectivity, ConnectivityEnumType );
00159 #endif
00160
00161
00162 protected:
00163 ConnectedThresholdImageFilter();
00164 ~ConnectedThresholdImageFilter(){};
00165 std::vector<IndexType> m_SeedList;
00166 InputImagePixelType m_Lower;
00167 InputImagePixelType m_Upper;
00168 OutputImagePixelType m_ReplaceValue;
00169
00170
00171 void GenerateInputRequestedRegion();
00172
00173
00174 void EnlargeOutputRequestedRegion(DataObject *output);
00175
00176 void GenerateData();
00177
00178
00179 ConnectivityEnumType m_Connectivity;
00180
00181 private:
00182 ConnectedThresholdImageFilter(const Self&);
00183 void operator=(const Self&);
00184
00185 };
00186
00187 }
00188
00189 #ifndef ITK_MANUAL_INSTANTIATION
00190 #include "itkConnectedThresholdImageFilter.txx"
00191 #endif
00192
00193 #endif
00194