ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkKappaSigmaThresholdImageFilter.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 #ifndef itkKappaSigmaThresholdImageFilter_h
19 #define itkKappaSigmaThresholdImageFilter_h
20 
21 #include "itkImageToImageFilter.h"
23 
24 namespace itk
25 {
50 template< typename TInputImage,
51  typename TMaskImage = Image< unsigned char, TInputImage::ImageDimension >,
52  class TOutputImage = TInputImage >
54  public ImageToImageFilter< TInputImage, TOutputImage >
55 {
56 public:
62 
64  itkNewMacro(Self);
65 
68 
70  typedef TInputImage InputImageType;
71  typedef TMaskImage MaskImageType;
72 
74  typedef typename TInputImage::PixelType InputPixelType;
75  typedef typename TOutputImage::PixelType OutputPixelType;
76  typedef typename TMaskImage::PixelType MaskPixelType;
77 
79  typedef typename TInputImage::Pointer InputImagePointer;
80  typedef typename TOutputImage::Pointer OutputImagePointer;
81  typedef typename TMaskImage::Pointer MaskImagePointer;
82 
85  itkSetMacro(OutsideValue, OutputPixelType);
86 
88  itkGetConstMacro(OutsideValue, OutputPixelType);
89 
92  itkSetMacro(InsideValue, OutputPixelType);
93 
95  itkGetConstMacro(InsideValue, OutputPixelType);
96 
98  itkGetConstMacro(Threshold, InputPixelType);
99 
100  itkSetMacro(MaskValue, MaskPixelType);
101  itkGetConstMacro(MaskValue, MaskPixelType);
102 
103  itkSetMacro(SigmaFactor, double);
104  itkGetConstMacro(SigmaFactor, double);
105 
106  itkSetMacro(NumberOfIterations, unsigned int);
107  itkGetConstMacro(NumberOfIterations, unsigned int);
108 
109 #ifdef ITK_USE_CONCEPT_CHECKING
110  // Begin concept checking
111  itkConceptMacro( OutputComparableCheck,
113  itkConceptMacro( OutputOStreamWritableCheck,
115  // End concept checking
116 #endif
117 
119  void SetMaskImage(const MaskImageType *input)
120  {
121  // Process object is not const-correct so the const casting is required.
122  this->SetNthInput( 1, const_cast< MaskImageType * >( input ) );
123  }
124 
126  const MaskImageType * GetMaskImage() const
127  {
128  return static_cast< MaskImageType * >( const_cast< DataObject * >( this->ProcessObject::GetInput(1) ) );
129  }
130 
132  void SetInput1(const TInputImage *input)
133  {
134  this->SetInput(input);
135  }
136 
138  void SetInput2(const MaskImageType *input)
139  {
140  this->SetMaskImage(input);
141  }
142 
143 protected:
146  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
147 
148  void GenerateInputRequestedRegion() ITK_OVERRIDE;
149 
150  void GenerateData() ITK_OVERRIDE;
151 
152  typedef typename TInputImage::SizeType InputSizeType;
153  typedef typename TInputImage::IndexType InputIndexType;
154  typedef typename TInputImage::RegionType InputImageRegionType;
155  typedef typename TOutputImage::SizeType OutputSizeType;
156  typedef typename TOutputImage::IndexType OutputIndexType;
157  typedef typename TOutputImage::RegionType OutputImageRegionType;
158 
160 
162  itkStaticConstMacro(InputImageDimension, unsigned int,
163  TInputImage::ImageDimension);
164  itkStaticConstMacro(OutputImageDimension, unsigned int,
165  TOutputImage::ImageDimension);
167 
168 private:
169  KappaSigmaThresholdImageFilter(const Self &) ITK_DELETE_FUNCTION;
170  void operator=(const Self &) ITK_DELETE_FUNCTION;
171 
174  unsigned int m_NumberOfIterations;
178 }; // end of class
179 } // end namespace itk
180 
181 #ifndef ITK_MANUAL_INSTANTIATION
182 #include "itkKappaSigmaThresholdImageFilter.hxx"
183 #endif
184 
185 #endif
typedef(Concept::Comparable< OutputPixelType >) OutputComparableCheck
Base class for all process objects that output image data.
ImageToImageFilter< TInputImage, TOutputImage > Superclass
void GenerateInputRequestedRegion() override
virtual void SetInput(const InputImageType *image)
void PrintSelf(std::ostream &os, Indent indent) const override
InputImageType::RegionType InputImageRegionType
Compute moments of an n-dimensional image.
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
Threshold an image using multiple Otsu Thresholds.
Base class for filters that take an image as input and produce an image as output.
OutputImageType::RegionType OutputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual void SetNthInput(DataObjectPointerArraySizeType num, DataObject *input)
#define itkConceptMacro(name, concept)
Base class for all data objects in ITK.