ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkBinaryStatisticsOpeningImageFilter.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 itkBinaryStatisticsOpeningImageFilter_h
19 #define itkBinaryStatisticsOpeningImageFilter_h
20 
25 
26 namespace itk
27 {
45 template< typename TInputImage, typename TFeatureImage >
46 class ITK_TEMPLATE_EXPORT BinaryStatisticsOpeningImageFilter:
47  public ImageToImageFilter< TInputImage, TInputImage >
48 {
49 public:
55 
57  typedef TInputImage InputImageType;
58  typedef TInputImage OutputImageType;
59  typedef typename InputImageType::Pointer InputImagePointer;
60  typedef typename InputImageType::ConstPointer InputImageConstPointer;
61  typedef typename InputImageType::RegionType InputImageRegionType;
62  typedef typename InputImageType::PixelType InputImagePixelType;
63  typedef typename OutputImageType::Pointer OutputImagePointer;
64  typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
65  typedef typename OutputImageType::RegionType OutputImageRegionType;
66  typedef typename OutputImageType::PixelType OutputImagePixelType;
67 
68  typedef TFeatureImage FeatureImageType;
69  typedef typename FeatureImageType::Pointer FeatureImagePointer;
70  typedef typename FeatureImageType::ConstPointer FeatureImageConstPointer;
71  typedef typename FeatureImageType::PixelType FeatureImagePixelType;
72 
74  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
75  itkStaticConstMacro(OutputImageDimension, unsigned int, TInputImage::ImageDimension);
76  itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension);
78 
80 
88 
90  itkNewMacro(Self);
91 
94 
101  itkSetMacro(FullyConnected, bool);
102  itkGetConstReferenceMacro(FullyConnected, bool);
103  itkBooleanMacro(FullyConnected);
105 
106 #ifdef ITK_USE_CONCEPT_CHECKING
107  // Begin concept checking
108  itkConceptMacro( InputEqualityComparableCheck,
110  itkConceptMacro( IntConvertibleToInputCheck,
112  itkConceptMacro( InputOStreamWritableCheck,
114  // End concept checking
115 #endif
116 
121  itkSetMacro(BackgroundValue, OutputImagePixelType);
122  itkGetConstMacro(BackgroundValue, OutputImagePixelType);
124 
129  itkSetMacro(ForegroundValue, OutputImagePixelType);
130  itkGetConstMacro(ForegroundValue, OutputImagePixelType);
132 
136  itkGetConstMacro(Lambda, double);
137  itkSetMacro(Lambda, double);
139 
146  itkGetConstMacro(ReverseOrdering, bool);
147  itkSetMacro(ReverseOrdering, bool);
148  itkBooleanMacro(ReverseOrdering);
150 
155  itkGetConstMacro(Attribute, AttributeType);
156  itkSetMacro(Attribute, AttributeType);
157  void SetAttribute(const std::string & s)
158  {
159  this->SetAttribute( LabelObjectType::GetAttributeFromName(s) );
160  }
162 
164  void SetFeatureImage(const TFeatureImage *input)
165  {
166  // Process object is not const-correct so the const casting is required.
167  this->SetNthInput( 1, const_cast< TFeatureImage * >( input ) );
168  }
169 
172  {
173  return static_cast< const FeatureImageType * >( this->ProcessObject::GetInput(1) );
174  }
175 
177  void SetInput1(const InputImageType *input)
178  {
179  this->SetInput(input);
180  }
181 
183  void SetInput2(const FeatureImageType *input)
184  {
185  this->SetFeatureImage(input);
186  }
187 
188 protected:
191  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
192 
195  void GenerateInputRequestedRegion() ITK_OVERRIDE;
196 
198  void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) ) ITK_OVERRIDE;
199 
202  void GenerateData() ITK_OVERRIDE;
203 
204 private:
205  ITK_DISALLOW_COPY_AND_ASSIGN(BinaryStatisticsOpeningImageFilter);
206 
207  bool m_FullyConnected;
208  OutputImagePixelType m_BackgroundValue;
209  OutputImagePixelType m_ForegroundValue;
210  double m_Lambda;
211  bool m_ReverseOrdering;
212  AttributeType m_Attribute;
213 }; // end of class
214 } // end namespace itk
215 
216 #ifndef ITK_MANUAL_INSTANTIATION
217 #include "itkBinaryStatisticsOpeningImageFilter.hxx"
218 #endif
219 
220 #endif
StatisticsOpeningLabelMapFilter< LabelMapType > OpeningType
Light weight base class for most itk classes.
Superclass::AttributeType AttributeType
Remove objects based on the value of their Statistics attribute.
BinaryImageToLabelMapFilter< InputImageType, LabelMapType > LabelizerType
unsigned long SizeValueType
Definition: itkIntTypes.h:143
A Label object to store the common attributes related to the statistics of the object.
StatisticsLabelObject< LabelType, itkGetStaticConstMacro(ImageDimension) > LabelObjectType
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
Label the connected components in a binary image and produce a collection of label objects...
StatisticsLabelMapFilter< LabelMapType, FeatureImageType > LabelObjectValuatorType
ImageToImageFilter< TInputImage, TInputImage > Superclass
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Templated n-dimensional image to store labeled objects.
Definition: itkLabelMap.h:70
LabelMapToBinaryImageFilter< LabelMapType, OutputImageType > BinarizerType
The valuator class for the StatisticsLabelObject.
#define itkConceptMacro(name, concept)
remove the objects according to the value of their statistics attribute
Base class for all data objects in ITK.
Convert a LabelMap to a binary image.