ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkHistogramThresholdImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 
19 #ifndef __itkHistogramThresholdImageFilter_h
20 #define __itkHistogramThresholdImageFilter_h
21 
22 #include "itkImageToImageFilter.h"
23 #include "itkHistogram.h"
25 
26 namespace itk {
27 
59 template<class TInputImage, class TOutputImage, class TMaskImage=TOutputImage>
61  public ImageToImageFilter<TInputImage, TOutputImage>
62 {
63 public:
69 
71  itkNewMacro(Self);
72 
75 
76  typedef TInputImage InputImageType;
77  typedef TOutputImage OutputImageType;
78  typedef TMaskImage MaskImageType;
79 
81  typedef typename InputImageType::PixelType InputPixelType;
82  typedef typename OutputImageType::PixelType OutputPixelType;
83  typedef typename MaskImageType::PixelType MaskPixelType;
84 
86  typedef typename InputImageType::Pointer InputImagePointer;
87  typedef typename OutputImageType::Pointer OutputImagePointer;
88  typedef typename MaskImageType::Pointer MaskImagePointer;
89 
90  typedef typename InputImageType::SizeType InputSizeType;
91  typedef typename InputImageType::IndexType InputIndexType;
92  typedef typename InputImageType::RegionType InputImageRegionType;
93  typedef typename OutputImageType::SizeType OutputSizeType;
94  typedef typename OutputImageType::IndexType OutputIndexType;
95  typedef typename OutputImageType::RegionType OutputImageRegionType;
96  typedef typename MaskImageType::SizeType MaskSizeType;
97  typedef typename MaskImageType::IndexType MaskIndexType;
98  typedef typename MaskImageType::RegionType MaskImageRegionType;
99 
111 
113  itkStaticConstMacro(InputImageDimension, unsigned int,
114  InputImageType::ImageDimension );
115  itkStaticConstMacro(OutputImageDimension, unsigned int,
116  OutputImageType::ImageDimension );
117  itkStaticConstMacro(MaskImageDimension, unsigned int,
118  MaskImageType::ImageDimension );
120 
124  void SetMaskImage(const TMaskImage *input)
125  {
126  // Process object is not const-correct so the const casting is required.
127  this->SetNthInput( 1, const_cast< TMaskImage * >( input ) );
128  }
129 
131  const MaskImageType * GetMaskImage() const
132  {
133  return static_cast< MaskImageType * >(
134  const_cast< DataObject * >( this->ProcessObject::GetInput(1) ) );
135  }
136 
138  void SetInput1(const TInputImage *input)
139  {
140  this->SetInput(input);
141  }
142 
144  void SetInput2(const TMaskImage *input)
145  {
146  this->SetMaskImage(input);
147  }
148 
151  itkSetMacro(OutsideValue,OutputPixelType);
152 
154  itkGetConstMacro(OutsideValue,OutputPixelType);
155 
158  itkSetMacro(InsideValue,OutputPixelType);
159 
161  itkGetConstMacro(InsideValue,OutputPixelType);
162 
164  itkSetMacro(NumberOfHistogramBins, unsigned int);
165  itkGetConstMacro(NumberOfHistogramBins, unsigned int);
167 
170  itkSetMacro(AutoMinimumMaximum, bool);
171  itkGetConstMacro(AutoMinimumMaximum, bool);
172  itkBooleanMacro(AutoMinimumMaximum);
174 
178  itkSetMacro(MaskOutput, bool);
179  itkGetConstMacro(MaskOutput, bool);
180  itkBooleanMacro(MaskOutput);
182 
186  itkSetMacro(MaskValue, MaskPixelType);
187  itkGetConstMacro(MaskValue, MaskPixelType);
189 
191  itkGetConstMacro(Threshold,InputPixelType);
192 
194  itkSetObjectMacro(Calculator, CalculatorType);
195  itkGetObjectMacro(Calculator, CalculatorType);
197 
198 #ifdef ITK_USE_CONCEPT_CHECKING
199 
200  itkConceptMacro(OutputEqualityComparableCheck,
202  itkConceptMacro(InputOStreamWritableCheck,
204  itkConceptMacro(OutputOStreamWritableCheck,
206 
208 #endif
209 protected:
212  void PrintSelf(std::ostream& os, Indent indent) const;
214 
215  void GenerateInputRequestedRegion();
216  void GenerateData ();
217 
226 
227 private:
228  HistogramThresholdImageFilter(const Self&); //purposely not implemented
229  void operator=(const Self&); //purposely not implemented
230 
231 }; // end of class
232 
233 } // end namespace itk
234 
235 #ifndef ITK_MANUAL_INSTANTIATION
236 #include "itkHistogramThresholdImageFilter.hxx"
237 #endif
238 
239 #endif
240