00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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 };
00116
00117
00119 void ClearSeeds1()
00120 {
00121 m_Seeds1.clear();
00122 };
00123
00124
00126 void AddSeed1(const IndexType & seed)
00127 {
00128 m_Seeds1.push_back( seed );
00129 this->Modified();
00130 };
00131
00134 void SetSeed2(const IndexType & seed)
00135 {
00136 this->ClearSeeds2();
00137 this->AddSeed2( seed );
00138 };
00139
00140
00142 void ClearSeeds2()
00143 {
00144 m_Seeds2.clear();
00145 };
00146
00147
00149 void AddSeed2(const IndexType & seed)
00150 {
00151 m_Seeds2.push_back( seed );
00152 this->Modified();
00153 };
00154
00156 itkSetMacro(Lower, InputImagePixelType);
00157 itkGetConstReferenceMacro(Lower, InputImagePixelType);
00158
00160 itkSetMacro(Upper, InputImagePixelType);
00161 itkGetConstReferenceMacro(Upper, InputImagePixelType);
00162
00166 void SetUpperValueLimit( InputImagePixelType upperValue)
00167 {
00168 this->SetUpper( upperValue );
00169 };
00170 InputImagePixelType GetUpperValueLimit()
00171 {
00172 return this->GetUpper();
00173 };
00174
00176 itkSetMacro(IsolatedValueTolerance, InputImagePixelType);
00177 itkGetConstReferenceMacro(IsolatedValueTolerance, InputImagePixelType);
00178
00182 itkSetMacro(ReplaceValue, OutputImagePixelType);
00183 itkGetConstReferenceMacro(ReplaceValue, OutputImagePixelType);
00184
00186 itkGetConstReferenceMacro(IsolatedValue, InputImagePixelType);
00187
00190 itkSetMacro(FindUpperThreshold,bool);
00191 itkBooleanMacro(FindUpperThreshold);
00192 itkGetConstReferenceMacro(FindUpperThreshold,bool);
00193
00196 itkGetConstReferenceMacro(ThresholdingFailed, bool);
00197
00198 protected:
00199 IsolatedConnectedImageFilter();
00200 ~IsolatedConnectedImageFilter(){};
00201 SeedsContainerType m_Seeds1;
00202 SeedsContainerType m_Seeds2;
00203 InputImagePixelType m_Lower;
00204 InputImagePixelType m_Upper;
00205 OutputImagePixelType m_ReplaceValue;
00206 InputImagePixelType m_IsolatedValue;
00207 InputImagePixelType m_IsolatedValueTolerance;
00208 bool m_FindUpperThreshold;
00209 bool m_ThresholdingFailed;
00210
00211
00212 void GenerateInputRequestedRegion();
00213
00214
00215 void EnlargeOutputRequestedRegion(DataObject *output);
00216
00217 void GenerateData();
00218
00219 private:
00220 IsolatedConnectedImageFilter(const Self&);
00221 void operator=(const Self&);
00222
00223 };
00224
00225 }
00226
00227 #ifndef ITK_MANUAL_INSTANTIATION
00228 #include "itkIsolatedConnectedImageFilter.txx"
00229 #endif
00230
00231 #endif