ITK  6.0.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  * https://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,
41  typename TFeatureImage,
42  typename TOutputImage = LabelMap<StatisticsLabelObject<SizeValueType, TInputImage::ImageDimension>>>
43 class ITK_TEMPLATE_EXPORT BinaryImageToStatisticsLabelMapFilter : public ImageToImageFilter<TInputImage, TOutputImage>
44 {
45 public:
46  ITK_DISALLOW_COPY_AND_MOVE(BinaryImageToStatisticsLabelMapFilter);
47 
53 
55  using InputImageType = TInputImage;
59  using InputImagePixelType = typename InputImageType::PixelType;
60 
61  using OutputImageType = TOutputImage;
65  using OutputImagePixelType = typename OutputImageType::PixelType;
66  using LabelObjectType = typename OutputImageType::LabelObjectType;
67 
68  using FeatureImageType = TFeatureImage;
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 
85  itkOverrideGetNameOfClassMacro(BinaryImageToStatisticsLabelMapFilter);
86 
93  itkSetMacro(FullyConnected, bool);
94  itkGetConstReferenceMacro(FullyConnected, bool);
95  itkBooleanMacro(FullyConnected);
98 #ifdef ITK_USE_CONCEPT_CHECKING
99  // Begin concept checking
100  itkConceptMacro(InputEqualityComparableCheck, (Concept::EqualityComparable<InputImagePixelType>));
103  // End concept checking
104 #endif
105 
110  itkSetMacro(OutputBackgroundValue, OutputImagePixelType);
111  itkGetConstMacro(OutputBackgroundValue, OutputImagePixelType);
118  itkSetMacro(InputForegroundValue, InputImagePixelType);
119  itkGetConstMacro(InputForegroundValue, InputImagePixelType);
126  itkSetMacro(ComputeFeretDiameter, bool);
127  itkGetConstReferenceMacro(ComputeFeretDiameter, bool);
128  itkBooleanMacro(ComputeFeretDiameter);
135  itkSetMacro(ComputePerimeter, bool);
136  itkGetConstReferenceMacro(ComputePerimeter, bool);
137  itkBooleanMacro(ComputePerimeter);
141  void
142  SetFeatureImage(const TFeatureImage * input)
143  {
144  // Process object is not const-correct so the const casting is required.
145  this->SetNthInput(1, const_cast<TFeatureImage *>(input));
146  }
147 
149  const FeatureImageType *
151  {
152  return static_cast<const FeatureImageType *>(this->ProcessObject::GetInput(1));
153  }
154 
156  void
157  SetInput1(const InputImageType * input)
158  {
159  this->SetInput(input);
160  }
161 
163  void
165  {
166  this->SetFeatureImage(input);
167  }
168 
175  itkSetMacro(ComputeHistogram, bool);
176  itkGetConstReferenceMacro(ComputeHistogram, bool);
177  itkBooleanMacro(ComputeHistogram);
185  itkSetMacro(NumberOfBins, unsigned int);
186  itkGetConstReferenceMacro(NumberOfBins, unsigned int);
189 protected:
191  ~BinaryImageToStatisticsLabelMapFilter() override = default;
192  void
193  PrintSelf(std::ostream & os, Indent indent) const override;
194 
198  void
199  GenerateInputRequestedRegion() override;
200 
202  void
203  EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
204 
207  void
208  GenerateData() override;
209 
210 private:
211  bool m_FullyConnected{};
212  OutputImagePixelType m_OutputBackgroundValue{};
213  InputImagePixelType m_InputForegroundValue{};
214  bool m_ComputeFeretDiameter{};
215  bool m_ComputePerimeter{};
216  unsigned int m_NumberOfBins{};
217  bool m_ComputeHistogram{};
218 }; // end of class
219 } // end namespace itk
220 
221 #ifndef ITK_MANUAL_INSTANTIATION
222 # include "itkBinaryImageToStatisticsLabelMapFilter.hxx"
223 #endif
224 
225 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::BinaryImageToStatisticsLabelMapFilter::FeatureImageConstPointer
typename FeatureImageType::ConstPointer FeatureImageConstPointer
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:70
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::Concept::OStreamWritable
Definition: itkConceptChecking.h:638
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::StatisticsLabelMapFilter
The valuator class for the StatisticsLabelObject.
Definition: itkStatisticsLabelMapFilter.h:41
itkStatisticsLabelMapFilter.h
itk::BinaryImageToStatisticsLabelMapFilter::SetInput1
void SetInput1(const InputImageType *input)
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:157
itk::BinaryImageToStatisticsLabelMapFilter
a convenient class to convert a binary image to a label map and valuate the statistics attributes at ...
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:43
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::BinaryImageToLabelMapFilter
Label the connected components in a binary image and produce a collection of label objects.
Definition: itkBinaryImageToLabelMapFilter.h:55
itk::ImageToImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkImageToImageFilter.h:133
itk::BinaryImageToStatisticsLabelMapFilter::SetFeatureImage
void SetFeatureImage(const TFeatureImage *input)
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:142
itk::BinaryImageToStatisticsLabelMapFilter::FeatureImagePixelType
typename FeatureImageType::PixelType FeatureImagePixelType
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:71
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:150
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::BinaryImageToStatisticsLabelMapFilter::OutputImageConstPointer
typename OutputImageType::ConstPointer OutputImageConstPointer
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:63
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkBinaryImageToLabelMapFilter.h
itk::BinaryImageToStatisticsLabelMapFilter::SetInput2
void SetInput2(const FeatureImageType *input)
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:164
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::BinaryImageToStatisticsLabelMapFilter::FeatureImageType
TFeatureImage FeatureImageType
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:68
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itk::Concept::Convertible
Definition: itkConceptChecking.h:216
itk::BinaryImageToStatisticsLabelMapFilter::FeatureImagePointer
typename FeatureImageType::Pointer FeatureImagePointer
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:69
itkStatisticsLabelObject.h
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itk::BinaryImageToStatisticsLabelMapFilter::LabelObjectType
typename OutputImageType::LabelObjectType LabelObjectType
Definition: itkBinaryImageToStatisticsLabelMapFilter.h:66
itk::ProcessObject::GetInput
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
itk::Concept::EqualityComparable
Definition: itkConceptChecking.h:306
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