1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://www.centreleonberard.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================*/
18 #ifndef __clitkExplosionControlledThresholdConnectedImageFilter_h
19 #define __clitkExplosionControlledThresholdConnectedImageFilter_h
22 #include "itkImageToImageFilter.h"
26 /** \class ExplosionControlledThresholdConnectedImageFilter
27 * \brief Label pixels that are connected to a seed and lie within a neighborhood
29 * ExplosionControlledThresholdConnectedImageFilter labels pixels with ReplaceValue that
30 * are connected to an initial Seed AND whose neighbors all lie within a
31 * Lower and Upper threshold range.
33 * \ingroup RegionGrowingSegmentation
35 template <class TInputImage, class TOutputImage>
36 class ITK_EXPORT ExplosionControlledThresholdConnectedImageFilter:
37 public itk::ImageToImageFilter<TInputImage,TOutputImage>
40 /** Standard class typedefs. */
41 typedef ExplosionControlledThresholdConnectedImageFilter Self;
42 typedef itk::ImageToImageFilter<TInputImage,TOutputImage> Superclass;
43 typedef itk::SmartPointer<Self> Pointer;
44 typedef itk::SmartPointer<const Self> ConstPointer;
46 /** Method for creation through the object factory. */
49 /** Run-time type information (and related methods). */
50 itkTypeMacro(ExplosionControlledThresholdConnectedImageFilter,
53 typedef TInputImage InputImageType;
54 typedef typename InputImageType::Pointer InputImagePointer;
55 typedef typename InputImageType::RegionType InputImageRegionType;
56 typedef typename InputImageType::PixelType InputImagePixelType;
57 typedef typename InputImageType::IndexType IndexType;
58 typedef typename InputImageType::SizeType InputImageSizeType;
60 typedef TOutputImage OutputImageType;
61 typedef typename OutputImageType::Pointer OutputImagePointer;
62 typedef typename OutputImageType::RegionType OutputImageRegionType;
63 typedef typename OutputImageType::PixelType OutputImagePixelType;
65 void PrintSelf ( std::ostream& os, itk::Indent indent ) const;
67 /** Clear the seeds */
70 /** Set seed point. */
71 void SetSeed(const IndexType & seed);
73 /** Add a seed point */
74 void AddSeed ( const IndexType & seed );
76 // Set/Get the lower threshold. The default is 0.
77 itkSetMacro(Lower, InputImagePixelType);
78 itkGetConstMacro(Lower, InputImagePixelType);
80 // Set/Get the upper threshold. The default is the largest possible value for the InputPixelType.
81 itkSetMacro(Upper, InputImagePixelType);
82 itkGetConstMacro(Upper, InputImagePixelType);
84 /** Set/Get value to replace thresholded pixels. Pixels that lie *
85 * within Lower and Upper (inclusive) will be replaced with this
86 * value. The default is 1. */
87 itkSetMacro(ReplaceValue, OutputImagePixelType);
88 itkGetConstMacro(ReplaceValue, OutputImagePixelType);
90 // /** Set the radius of the neighborhood used for a mask. */
91 // itkSetMacro(Radius, InputImageSizeType);
93 // /** Get the radius of the neighborhood used to compute the median */
94 // itkGetConstReferenceMacro(Radius, InputImageSizeType);
96 /** ImageDimension constants */
97 itkStaticConstMacro(InputImageDimension, unsigned int,
98 TInputImage::ImageDimension);
99 itkStaticConstMacro(OutputImageDimension, unsigned int,
100 TOutputImage::ImageDimension);
102 #ifdef ITK_USE_CONCEPT_CHECKING
103 /** Begin concept checking */
104 itkConceptMacro(InputEqualityComparableCheck,
105 (itk::Concept::EqualityComparable<InputImagePixelType>));
106 itkConceptMacro(OutputEqualityComparableCheck,
107 (itk::Concept::EqualityComparable<OutputImagePixelType>));
108 itkConceptMacro(SameDimensionCheck,
109 (itk::Concept::SameDimension<InputImageDimension, OutputImageDimension>));
110 itkConceptMacro(InputOStreamWritableCheck,
111 (itk::Concept::OStreamWritable<InputImagePixelType>));
112 itkConceptMacro(OutputOStreamWritableCheck,
113 (itk::Concept::OStreamWritable<OutputImagePixelType>));
114 /** End concept checking */
118 itkBooleanMacro(Verbose);
119 itkSetMacro( Verbose, bool);
120 itkGetConstReferenceMacro( Verbose, bool);
122 itkBooleanMacro(FullyConnected);
123 itkSetMacro( FullyConnected, bool);
124 itkGetConstReferenceMacro( FullyConnected, bool);
126 itkSetMacro( FinalLower, InputImagePixelType);
127 itkGetConstMacro( FinalLower, InputImagePixelType);
129 itkSetMacro( FinalUpper, InputImagePixelType);
130 itkGetConstMacro( FinalUpper, InputImagePixelType);
132 itkBooleanMacro(AdaptLowerBorder);
133 itkSetMacro( AdaptLowerBorder, bool);
134 itkGetConstReferenceMacro( AdaptLowerBorder, bool);
136 itkBooleanMacro(AdaptUpperBorder);
137 itkSetMacro( AdaptUpperBorder, bool);
138 itkGetConstReferenceMacro( AdaptUpperBorder, bool);
140 itkSetMacro( Multiplier, double);
141 itkGetConstMacro( Multiplier, double);
143 itkSetMacro( MaximumUpperThreshold, InputImagePixelType);
144 itkGetConstMacro( MaximumUpperThreshold, InputImagePixelType);
146 itkSetMacro( MinimumLowerThreshold, InputImagePixelType);
147 itkGetConstMacro( MinimumLowerThreshold, InputImagePixelType);
149 itkSetMacro(ThresholdStepSize, InputImagePixelType);
150 itkGetConstMacro( ThresholdStepSize, InputImagePixelType);
152 itkSetMacro( MinimumThresholdStepSize, InputImagePixelType);
153 itkGetConstMacro( MinimumThresholdStepSize, InputImagePixelType);
155 itkSetMacro( MinimumSize, unsigned int);
156 itkGetConstMacro( MinimumSize,unsigned int);
159 ExplosionControlledThresholdConnectedImageFilter();
160 ~ExplosionControlledThresholdConnectedImageFilter(){};
161 std::vector<IndexType> m_Seeds;
162 InputImagePixelType m_Lower;
163 InputImagePixelType m_Upper;
164 OutputImagePixelType m_ReplaceValue;
168 bool m_FullyConnected;
169 bool m_AdaptLowerBorder;
170 bool m_AdaptUpperBorder;
171 InputImagePixelType m_FinalLower;
172 InputImagePixelType m_FinalUpper;
174 InputImagePixelType m_MaximumUpperThreshold;
175 InputImagePixelType m_MinimumLowerThreshold;
176 InputImagePixelType m_MinimumThresholdStepSize;
177 InputImagePixelType m_ThresholdStepSize;
178 unsigned int m_MinimumSize;
180 // Override since the filter needs all the data for the algorithm
181 void GenerateInputRequestedRegion();
183 // Override since the filter produces the entire dataset
184 void EnlargeOutputRequestedRegion(itk::DataObject *output);
188 ExplosionControlledThresholdConnectedImageFilter(const Self&); //purposely not implemented
189 void operator=(const Self&); //purposely not implemented
193 } // end namespace clitk
195 #ifndef ITK_MANUAL_INSTANTIATION
196 #include "clitkExplosionControlledThresholdConnectedImageFilter.txx"