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:
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
00233 void GenerateInputRequestedRegion();
00234
00235
00236 void EnlargeOutputRequestedRegion(DataObject *output);
00237
00238 void GenerateData();
00239
00240 private:
00241 IsolatedConnectedImageFilter(const Self&);
00242 void operator=(const Self&);
00243
00244 };
00245
00246 }
00247
00248 #ifndef ITK_MANUAL_INSTANTIATION
00249 #include "itkIsolatedConnectedImageFilter.txx"
00250 #endif
00251
00252 #endif
00253