1 #ifndef __clitkExplosionControlledThresholdConnectedImageFilter_h
2 #define __clitkExplosionControlledThresholdConnectedImageFilter_h
5 #include "itkImageToImageFilter.h"
9 /** \class ExplosionControlledThresholdConnectedImageFilter
10 * \brief Label pixels that are connected to a seed and lie within a neighborhood
12 * ExplosionControlledThresholdConnectedImageFilter labels pixels with ReplaceValue that
13 * are connected to an initial Seed AND whose neighbors all lie within a
14 * Lower and Upper threshold range.
16 * \ingroup RegionGrowingSegmentation
18 template <class TInputImage, class TOutputImage>
19 class ITK_EXPORT ExplosionControlledThresholdConnectedImageFilter:
20 public itk::ImageToImageFilter<TInputImage,TOutputImage>
23 /** Standard class typedefs. */
24 typedef ExplosionControlledThresholdConnectedImageFilter Self;
25 typedef itk::ImageToImageFilter<TInputImage,TOutputImage> Superclass;
26 typedef itk::SmartPointer<Self> Pointer;
27 typedef itk::SmartPointer<const Self> ConstPointer;
29 /** Method for creation through the object factory. */
32 /** Run-time type information (and related methods). */
33 itkTypeMacro(ExplosionControlledThresholdConnectedImageFilter,
36 typedef TInputImage InputImageType;
37 typedef typename InputImageType::Pointer InputImagePointer;
38 typedef typename InputImageType::RegionType InputImageRegionType;
39 typedef typename InputImageType::PixelType InputImagePixelType;
40 typedef typename InputImageType::IndexType IndexType;
41 typedef typename InputImageType::SizeType InputImageSizeType;
43 typedef TOutputImage OutputImageType;
44 typedef typename OutputImageType::Pointer OutputImagePointer;
45 typedef typename OutputImageType::RegionType OutputImageRegionType;
46 typedef typename OutputImageType::PixelType OutputImagePixelType;
48 void PrintSelf ( std::ostream& os, itk::Indent indent ) const;
50 /** Clear the seeds */
53 /** Set seed point. */
54 void SetSeed(const IndexType & seed);
56 /** Add a seed point */
57 void AddSeed ( const IndexType & seed );
59 // Set/Get the lower threshold. The default is 0.
60 itkSetMacro(Lower, InputImagePixelType);
61 itkGetConstMacro(Lower, InputImagePixelType);
63 // Set/Get the upper threshold. The default is the largest possible value for the InputPixelType.
64 itkSetMacro(Upper, InputImagePixelType);
65 itkGetConstMacro(Upper, InputImagePixelType);
67 /** Set/Get value to replace thresholded pixels. Pixels that lie *
68 * within Lower and Upper (inclusive) will be replaced with this
69 * value. The default is 1. */
70 itkSetMacro(ReplaceValue, OutputImagePixelType);
71 itkGetConstMacro(ReplaceValue, OutputImagePixelType);
73 // /** Set the radius of the neighborhood used for a mask. */
74 // itkSetMacro(Radius, InputImageSizeType);
76 // /** Get the radius of the neighborhood used to compute the median */
77 // itkGetConstReferenceMacro(Radius, InputImageSizeType);
79 /** ImageDimension constants */
80 itkStaticConstMacro(InputImageDimension, unsigned int,
81 TInputImage::ImageDimension);
82 itkStaticConstMacro(OutputImageDimension, unsigned int,
83 TOutputImage::ImageDimension);
85 #ifdef ITK_USE_CONCEPT_CHECKING
86 /** Begin concept checking */
87 itkConceptMacro(InputEqualityComparableCheck,
88 (itk::Concept::EqualityComparable<InputImagePixelType>));
89 itkConceptMacro(OutputEqualityComparableCheck,
90 (itk::Concept::EqualityComparable<OutputImagePixelType>));
91 itkConceptMacro(SameDimensionCheck,
92 (itk::Concept::SameDimension<InputImageDimension, OutputImageDimension>));
93 itkConceptMacro(InputOStreamWritableCheck,
94 (itk::Concept::OStreamWritable<InputImagePixelType>));
95 itkConceptMacro(OutputOStreamWritableCheck,
96 (itk::Concept::OStreamWritable<OutputImagePixelType>));
97 /** End concept checking */
101 itkBooleanMacro(Verbose);
102 itkSetMacro( Verbose, bool);
103 itkGetConstReferenceMacro( Verbose, bool);
105 itkBooleanMacro(FullyConnected);
106 itkSetMacro( FullyConnected, bool);
107 itkGetConstReferenceMacro( FullyConnected, bool);
109 itkSetMacro( FinalLower, InputImagePixelType);
110 itkGetConstMacro( FinalLower, InputImagePixelType);
112 itkSetMacro( FinalUpper, InputImagePixelType);
113 itkGetConstMacro( FinalUpper, InputImagePixelType);
115 itkBooleanMacro(AdaptLowerBorder);
116 itkSetMacro( AdaptLowerBorder, bool);
117 itkGetConstReferenceMacro( AdaptLowerBorder, bool);
119 itkBooleanMacro(AdaptUpperBorder);
120 itkSetMacro( AdaptUpperBorder, bool);
121 itkGetConstReferenceMacro( AdaptUpperBorder, bool);
123 itkSetMacro( Multiplier, double);
124 itkGetConstMacro( Multiplier, double);
126 itkSetMacro( MaximumUpperThreshold, InputImagePixelType);
127 itkGetConstMacro( MaximumUpperThreshold, InputImagePixelType);
129 itkSetMacro( MinimumLowerThreshold, InputImagePixelType);
130 itkGetConstMacro( MinimumLowerThreshold, InputImagePixelType);
132 itkSetMacro(ThresholdStepSize, InputImagePixelType);
133 itkGetConstMacro( ThresholdStepSize, InputImagePixelType);
135 itkSetMacro( MinimumThresholdStepSize, InputImagePixelType);
136 itkGetConstMacro( MinimumThresholdStepSize, InputImagePixelType);
138 itkSetMacro( MinimumSize, unsigned int);
139 itkGetConstMacro( MinimumSize,unsigned int);
142 ExplosionControlledThresholdConnectedImageFilter();
143 ~ExplosionControlledThresholdConnectedImageFilter(){};
144 std::vector<IndexType> m_Seeds;
145 InputImagePixelType m_Lower;
146 InputImagePixelType m_Upper;
147 OutputImagePixelType m_ReplaceValue;
151 bool m_FullyConnected;
152 bool m_AdaptLowerBorder;
153 bool m_AdaptUpperBorder;
154 InputImagePixelType m_FinalLower;
155 InputImagePixelType m_FinalUpper;
157 InputImagePixelType m_MaximumUpperThreshold;
158 InputImagePixelType m_MinimumLowerThreshold;
159 InputImagePixelType m_MinimumThresholdStepSize;
160 InputImagePixelType m_ThresholdStepSize;
161 unsigned int m_MinimumSize;
163 // Override since the filter needs all the data for the algorithm
164 void GenerateInputRequestedRegion();
166 // Override since the filter produces the entire dataset
167 void EnlargeOutputRequestedRegion(itk::DataObject *output);
171 ExplosionControlledThresholdConnectedImageFilter(const Self&); //purposely not implemented
172 void operator=(const Self&); //purposely not implemented
176 } // end namespace clitk
178 #ifndef ITK_MANUAL_INSTANTIATION
179 #include "clitkExplosionControlledThresholdConnectedImageFilter.txx"