ITK  5.0.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:
50  ITK_DISALLOW_COPY_AND_ASSIGN(BinaryStatisticsOpeningImageFilter);
51 
57 
59  using InputImageType = TInputImage;
60  using OutputImageType = TInputImage;
61  using InputImagePointer = typename InputImageType::Pointer;
62  using InputImageConstPointer = typename InputImageType::ConstPointer;
64  using InputImagePixelType = typename InputImageType::PixelType;
65  using OutputImagePointer = typename OutputImageType::Pointer;
66  using OutputImageConstPointer = typename OutputImageType::ConstPointer;
68  using OutputImagePixelType = typename OutputImageType::PixelType;
69 
70  using FeatureImageType = TFeatureImage;
71  using FeatureImagePointer = typename FeatureImageType::Pointer;
72  using FeatureImageConstPointer = typename FeatureImageType::ConstPointer;
73  using FeatureImagePixelType = typename FeatureImageType::PixelType;
74 
76  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
77  static constexpr unsigned int OutputImageDimension = TInputImage::ImageDimension;
78  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
79 
81 
89 
91  itkNewMacro(Self);
92 
95 
102  itkSetMacro(FullyConnected, bool);
103  itkGetConstReferenceMacro(FullyConnected, bool);
104  itkBooleanMacro(FullyConnected);
106 
107 #ifdef ITK_USE_CONCEPT_CHECKING
108  // Begin concept checking
109  itkConceptMacro( InputEqualityComparableCheck,
111  itkConceptMacro( IntConvertibleToInputCheck,
113  itkConceptMacro( InputOStreamWritableCheck,
115  // End concept checking
116 #endif
117 
122  itkSetMacro(BackgroundValue, OutputImagePixelType);
123  itkGetConstMacro(BackgroundValue, OutputImagePixelType);
125 
130  itkSetMacro(ForegroundValue, OutputImagePixelType);
131  itkGetConstMacro(ForegroundValue, OutputImagePixelType);
133 
137  itkGetConstMacro(Lambda, double);
138  itkSetMacro(Lambda, double);
140 
147  itkGetConstMacro(ReverseOrdering, bool);
148  itkSetMacro(ReverseOrdering, bool);
149  itkBooleanMacro(ReverseOrdering);
151 
156  itkGetConstMacro(Attribute, AttributeType);
157  itkSetMacro(Attribute, AttributeType);
158  void SetAttribute(const std::string & s)
159  {
160  this->SetAttribute( LabelObjectType::GetAttributeFromName(s) );
161  }
163 
165  void SetFeatureImage(const TFeatureImage *input)
166  {
167  // Process object is not const-correct so the const casting is required.
168  this->SetNthInput( 1, const_cast< TFeatureImage * >( input ) );
169  }
170 
173  {
174  return static_cast< const FeatureImageType * >( this->ProcessObject::GetInput(1) );
175  }
176 
178  void SetInput1(const InputImageType *input)
179  {
180  this->SetInput(input);
181  }
182 
184  void SetInput2(const FeatureImageType *input)
185  {
186  this->SetFeatureImage(input);
187  }
188 
189 protected:
191  ~BinaryStatisticsOpeningImageFilter() override = default;
192  void PrintSelf(std::ostream & os, Indent indent) const override;
193 
196  void GenerateInputRequestedRegion() override;
197 
199  void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) ) override;
200 
203  void GenerateData() override;
204 
205 private:
209  double m_Lambda;
212 }; // end of class
213 } // end namespace itk
214 
215 #ifndef ITK_MANUAL_INSTANTIATION
216 #include "itkBinaryStatisticsOpeningImageFilter.hxx"
217 #endif
218 
219 #endif
typename FeatureImageType::ConstPointer FeatureImageConstPointer
Light weight base class for most itk classes.
typename Superclass::AttributeType AttributeType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
Remove objects based on the value of their Statistics attribute.
typename OutputImageType::RegionType OutputImageRegionType
typename OutputImageType::ConstPointer OutputImageConstPointer
A Label object to store the common attributes related to the statistics of the object.
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
Label the connected components in a binary image and produce a collection of label objects...
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
typename InputImageType::ConstPointer InputImageConstPointer
The valuator class for the StatisticsLabelObject.
typename FeatureImageType::PixelType FeatureImagePixelType
#define itkConceptMacro(name, concept)
typename LabelObjectType::AttributeType AttributeType
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.