ITK  5.2.0
Insight Toolkit
itkBinaryImageToStatisticsLabelMapFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 {
41 template <typename TInputImage,
42  typename TFeatureImage,
43  typename TOutputImage = LabelMap<StatisticsLabelObject<SizeValueType, TInputImage::ImageDimension>>>
44 class ITK_TEMPLATE_EXPORT BinaryImageToStatisticsLabelMapFilter : public ImageToImageFilter<TInputImage, TOutputImage>
45 {
46 public:
47  ITK_DISALLOW_COPY_AND_ASSIGN(BinaryImageToStatisticsLabelMapFilter);
48 
54 
56  using InputImageType = TInputImage;
57  using InputImagePointer = typename InputImageType::Pointer;
58  using InputImageConstPointer = typename InputImageType::ConstPointer;
60  using InputImagePixelType = typename InputImageType::PixelType;
61 
62  using OutputImageType = TOutputImage;
63  using OutputImagePointer = typename OutputImageType::Pointer;
64  using OutputImageConstPointer = typename OutputImageType::ConstPointer;
66  using OutputImagePixelType = typename OutputImageType::PixelType;
67  using LabelObjectType = typename OutputImageType::LabelObjectType;
68 
69  using FeatureImageType = TFeatureImage;
70  using FeatureImagePointer = typename FeatureImageType::Pointer;
71  using FeatureImageConstPointer = typename FeatureImageType::ConstPointer;
72  using FeatureImagePixelType = typename FeatureImageType::PixelType;
73 
75  static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
76  static constexpr unsigned int OutputImageDimension = TInputImage::ImageDimension;
77  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
78 
81 
83  itkNewMacro(Self);
84 
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, (Concept::EqualityComparable<InputImagePixelType>));
104  // End concept checking
105 #endif
106 
111  itkSetMacro(OutputBackgroundValue, OutputImagePixelType);
112  itkGetConstMacro(OutputBackgroundValue, OutputImagePixelType);
114 
119  itkSetMacro(InputForegroundValue, InputImagePixelType);
120  itkGetConstMacro(InputForegroundValue, InputImagePixelType);
122 
127  itkSetMacro(ComputeFeretDiameter, bool);
128  itkGetConstReferenceMacro(ComputeFeretDiameter, bool);
129  itkBooleanMacro(ComputeFeretDiameter);
131 
136  itkSetMacro(ComputePerimeter, bool);
137  itkGetConstReferenceMacro(ComputePerimeter, bool);
138  itkBooleanMacro(ComputePerimeter);
140 
142  void
143  SetFeatureImage(const TFeatureImage * input)
144  {
145  // Process object is not const-correct so the const casting is required.
146  this->SetNthInput(1, const_cast<TFeatureImage *>(input));
147  }
148 
150  const FeatureImageType *
152  {
153  return static_cast<const FeatureImageType *>(this->ProcessObject::GetInput(1));
154  }
155 
157  void
158  SetInput1(const InputImageType * input)
159  {
160  this->SetInput(input);
161  }
162 
164  void
166  {
167  this->SetFeatureImage(input);
168  }
169 
176  itkSetMacro(ComputeHistogram, bool);
177  itkGetConstReferenceMacro(ComputeHistogram, bool);
178  itkBooleanMacro(ComputeHistogram);
180 
186  itkSetMacro(NumberOfBins, unsigned int);
187  itkGetConstReferenceMacro(NumberOfBins, unsigned int);
189 
190 protected:
192  ~BinaryImageToStatisticsLabelMapFilter() override = default;
193  void
194  PrintSelf(std::ostream & os, Indent indent) const override;
195 
199  void
200  GenerateInputRequestedRegion() override;
201 
203  void
204  EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
205 
208  void
209  GenerateData() override;
210 
211 private:
217  unsigned int m_NumberOfBins;
219 }; // end of class
220 } // end namespace itk
221 
222 #ifndef ITK_MANUAL_INSTANTIATION
223 # include "itkBinaryImageToStatisticsLabelMapFilter.hxx"
224 #endif
225 
226 #endif
itk::BinaryImageToStatisticsLabelMapFilter::FeatureImageConstPointer
typename FeatureImageType::ConstPointer FeatureImageConstPointer
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:71
itk::Concept::OStreamWritable
Definition: itkConceptChecking.h:634
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::StatisticsLabelMapFilter
The valuator class for the StatisticsLabelObject.
Definition: itkStatisticsLabelMapFilter.h:42
itkStatisticsLabelMapFilter.h
itk::BinaryImageToStatisticsLabelMapFilter::SetInput1
void SetInput1(const InputImageType *input)
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:158
itk::BinaryImageToStatisticsLabelMapFilter
a convenient class to convert a binary image to a label map and valuate the statistics attributes at ...
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:44
itk::BinaryImageToStatisticsLabelMapFilter::m_OutputBackgroundValue
OutputImagePixelType m_OutputBackgroundValue
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:213
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::BinaryImageToStatisticsLabelMapFilter::m_InputForegroundValue
InputImagePixelType m_InputForegroundValue
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:214
itk::BinaryImageToLabelMapFilter
Label the connected components in a binary image and produce a collection of label objects.
Definition: itkBinaryImageToLabelMapFilter.h:56
itk::ImageToImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkImageToImageFilter.h:133
itk::BinaryImageToStatisticsLabelMapFilter::SetFeatureImage
void SetFeatureImage(const TFeatureImage *input)
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:143
itk::BinaryImageToStatisticsLabelMapFilter::FeatureImagePixelType
typename FeatureImageType::PixelType FeatureImagePixelType
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:72
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::BinaryImageToStatisticsLabelMapFilter::GetFeatureImage
const FeatureImageType * GetFeatureImage()
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:151
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::BinaryImageToStatisticsLabelMapFilter::OutputImageConstPointer
typename OutputImageType::ConstPointer OutputImageConstPointer
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:64
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::BinaryImageToStatisticsLabelMapFilter::m_FullyConnected
bool m_FullyConnected
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:212
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkBinaryImageToLabelMapFilter.h
itk::BinaryImageToStatisticsLabelMapFilter::m_ComputeFeretDiameter
bool m_ComputeFeretDiameter
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:215
itk::BinaryImageToStatisticsLabelMapFilter::m_NumberOfBins
unsigned int m_NumberOfBins
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:217
itk::BinaryImageToStatisticsLabelMapFilter::SetInput2
void SetInput2(const FeatureImageType *input)
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:165
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:64
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::BinaryImageToStatisticsLabelMapFilter::m_ComputeHistogram
bool m_ComputeHistogram
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:218
itk::BinaryImageToStatisticsLabelMapFilter::FeatureImageType
TFeatureImage FeatureImageType
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:69
itk::BinaryImageToStatisticsLabelMapFilter::m_ComputePerimeter
bool m_ComputePerimeter
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:216
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itk::Concept::Convertible
Definition: itkConceptChecking.h:214
itk::BinaryImageToStatisticsLabelMapFilter::FeatureImagePointer
typename FeatureImageType::Pointer FeatureImagePointer
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:70
itkStatisticsLabelObject.h
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itk::BinaryImageToStatisticsLabelMapFilter::LabelObjectType
typename OutputImageType::LabelObjectType LabelObjectType
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:67
itk::ProcessObject::GetInput
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
itk::Concept::EqualityComparable
Definition: itkConceptChecking.h:304
itk::ImageToImageFilter::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkImageToImageFilter.h:131
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293