ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkBinaryImageToStatisticsLabelMapFilter.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 itkBinaryImageToStatisticsLabelMapFilter_h
19 #define itkBinaryImageToStatisticsLabelMapFilter_h
20 
24 
25 namespace itk
26 {
40 template< typename TInputImage, typename TFeatureImage, typename TOutputImage =
41  LabelMap< StatisticsLabelObject< SizeValueType, TInputImage::ImageDimension > > >
42 class ITK_TEMPLATE_EXPORT BinaryImageToStatisticsLabelMapFilter:
43  public ImageToImageFilter< TInputImage, TOutputImage >
44 {
45 public:
46  ITK_DISALLOW_COPY_AND_ASSIGN(BinaryImageToStatisticsLabelMapFilter);
47 
53 
55  using InputImageType = TInputImage;
56  using InputImagePointer = typename InputImageType::Pointer;
57  using InputImageConstPointer = typename InputImageType::ConstPointer;
59  using InputImagePixelType = typename InputImageType::PixelType;
60 
61  using OutputImageType = TOutputImage;
62  using OutputImagePointer = typename OutputImageType::Pointer;
63  using OutputImageConstPointer = typename OutputImageType::ConstPointer;
65  using OutputImagePixelType = typename OutputImageType::PixelType;
66  using LabelObjectType = typename OutputImageType::LabelObjectType;
67 
68  using FeatureImageType = TFeatureImage;
69  using FeatureImagePointer = typename FeatureImageType::Pointer;
70  using FeatureImageConstPointer = typename FeatureImageType::ConstPointer;
71  using FeatureImagePixelType = typename FeatureImageType::PixelType;
72 
74  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
75  static constexpr unsigned int OutputImageDimension = TInputImage::ImageDimension;
76  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
77 
80 
82  itkNewMacro(Self);
83 
87 
94  itkSetMacro(FullyConnected, bool);
95  itkGetConstReferenceMacro(FullyConnected, bool);
96  itkBooleanMacro(FullyConnected);
98 
99 #ifdef ITK_USE_CONCEPT_CHECKING
100  // Begin concept checking
101  itkConceptMacro( InputEqualityComparableCheck,
103  itkConceptMacro( IntConvertibleToInputCheck,
105  itkConceptMacro( InputOStreamWritableCheck,
107  // End concept checking
108 #endif
109 
114  itkSetMacro(OutputBackgroundValue, OutputImagePixelType);
115  itkGetConstMacro(OutputBackgroundValue, OutputImagePixelType);
117 
122  itkSetMacro(InputForegroundValue, InputImagePixelType);
123  itkGetConstMacro(InputForegroundValue, InputImagePixelType);
125 
130  itkSetMacro(ComputeFeretDiameter, bool);
131  itkGetConstReferenceMacro(ComputeFeretDiameter, bool);
132  itkBooleanMacro(ComputeFeretDiameter);
134 
139  itkSetMacro(ComputePerimeter, bool);
140  itkGetConstReferenceMacro(ComputePerimeter, bool);
141  itkBooleanMacro(ComputePerimeter);
143 
145  void SetFeatureImage(const TFeatureImage *input)
146  {
147  // Process object is not const-correct so the const casting is required.
148  this->SetNthInput( 1, const_cast< TFeatureImage * >( input ) );
149  }
150 
153  {
154  return static_cast< const FeatureImageType * >( this->ProcessObject::GetInput(1) );
155  }
156 
158  void SetInput1(const InputImageType *input)
159  {
160  this->SetInput(input);
161  }
162 
164  void SetInput2(const FeatureImageType *input)
165  {
166  this->SetFeatureImage(input);
167  }
168 
175  itkSetMacro(ComputeHistogram, bool);
176  itkGetConstReferenceMacro(ComputeHistogram, bool);
177  itkBooleanMacro(ComputeHistogram);
179 
185  itkSetMacro(NumberOfBins, unsigned int);
186  itkGetConstReferenceMacro(NumberOfBins, unsigned int);
188 
189 protected:
191  ~BinaryImageToStatisticsLabelMapFilter() override = default;
192  void PrintSelf(std::ostream & os, Indent indent) const override;
193 
197  void GenerateInputRequestedRegion() override;
198 
200  void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) ) override;
201 
204  void GenerateData() override;
205 
206 private:
212  unsigned int m_NumberOfBins;
214 }; // end of class
215 } // end namespace itk
216 
217 #ifndef ITK_MANUAL_INSTANTIATION
218 #include "itkBinaryImageToStatisticsLabelMapFilter.hxx"
219 #endif
220 
221 #endif
typename OutputImageType::Pointer OutputImagePointer
typename FeatureImageType::ConstPointer FeatureImageConstPointer
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
typename OutputImageType::PixelType OutputImagePixelType
typename InputImageType::PixelType InputImagePixelType
typename InputImageType::Pointer InputImagePointer
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
typename InputImageType::RegionType InputImageRegionType
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
a convenient class to convert a binary image to a label map and valuate the statistics attributes at ...
The valuator class for the StatisticsLabelObject.
#define itkConceptMacro(name, concept)
typename InputImageType::ConstPointer InputImageConstPointer
Base class for all data objects in ITK.