ITK  5.2.0
Insight Toolkit
itkLabelImageToStatisticsLabelMapFilter.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 itkLabelImageToStatisticsLabelMapFilter_h
19 #define itkLabelImageToStatisticsLabelMapFilter_h
20 
24 
25 namespace itk
26 {
40 template <typename TInputImage,
41  typename TFeatureImage,
42  typename TOutputImage =
43  LabelMap<StatisticsLabelObject<typename TInputImage::PixelType, TInputImage::ImageDimension>>>
44 class ITK_TEMPLATE_EXPORT LabelImageToStatisticsLabelMapFilter : public ImageToImageFilter<TInputImage, TOutputImage>
45 {
46 public:
47  ITK_DISALLOW_COPY_AND_MOVE(LabelImageToStatisticsLabelMapFilter);
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 
88 #ifdef ITK_USE_CONCEPT_CHECKING
89  // Begin concept checking
93  // End concept checking
94 #endif
95 
100  itkSetMacro(BackgroundValue, OutputImagePixelType);
101  itkGetConstMacro(BackgroundValue, OutputImagePixelType);
103 
108  itkSetMacro(ComputeFeretDiameter, bool);
109  itkGetConstReferenceMacro(ComputeFeretDiameter, bool);
110  itkBooleanMacro(ComputeFeretDiameter);
112 
117  itkSetMacro(ComputePerimeter, bool);
118  itkGetConstReferenceMacro(ComputePerimeter, bool);
119  itkBooleanMacro(ComputePerimeter);
121 
123  void
124  SetFeatureImage(const TFeatureImage * input)
125  {
126  // Process object is not const-correct so the const casting is required.
127  this->SetNthInput(1, const_cast<TFeatureImage *>(input));
128  }
129 
131  const FeatureImageType *
133  {
134  return static_cast<FeatureImageType *>(this->ProcessObject::GetInput(1));
135  }
136 
138  void
139  SetInput1(const InputImageType * input)
140  {
141  this->SetInput(input);
142  }
143 
145  void
147  {
148  this->SetFeatureImage(input);
149  }
150 
157  itkSetMacro(ComputeHistogram, bool);
158  itkGetConstReferenceMacro(ComputeHistogram, bool);
159  itkBooleanMacro(ComputeHistogram);
161 
167  itkSetMacro(NumberOfBins, unsigned int);
168  itkGetConstReferenceMacro(NumberOfBins, unsigned int);
170 
171 protected:
173  ~LabelImageToStatisticsLabelMapFilter() override = default;
174  void
175  PrintSelf(std::ostream & os, Indent indent) const override;
176 
180  void
181  GenerateInputRequestedRegion() override;
182 
184  void
185  EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
186 
189  void
190  GenerateData() override;
191 
192 private:
196  unsigned int m_NumberOfBins;
198 }; // end of class
199 } // end namespace itk
200 
201 #ifndef ITK_MANUAL_INSTANTIATION
202 # include "itkLabelImageToStatisticsLabelMapFilter.hxx"
203 #endif
204 
205 #endif
itkLabelImageToLabelMapFilter.h
itk::LabelImageToStatisticsLabelMapFilter::SetInput1
void SetInput1(const InputImageType *input)
Definition: itkLabelImageToStatisticsLabelMapFilter.h:139
itk::Concept::OStreamWritable
Definition: itkConceptChecking.h:636
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::StatisticsLabelMapFilter
The valuator class for the StatisticsLabelObject.
Definition: itkStatisticsLabelMapFilter.h:41
itk::LabelImageToStatisticsLabelMapFilter::m_NumberOfBins
unsigned int m_NumberOfBins
Definition: itkLabelImageToStatisticsLabelMapFilter.h:196
itkStatisticsLabelMapFilter.h
itk::LabelImageToStatisticsLabelMapFilter::FeatureImagePixelType
typename FeatureImageType::PixelType FeatureImagePixelType
Definition: itkLabelImageToStatisticsLabelMapFilter.h:72
itk::LabelImageToLabelMapFilter
convert a labeled image to a label collection image
Definition: itkLabelImageToLabelMapFilter.h:49
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::LabelImageToStatisticsLabelMapFilter::m_ComputeFeretDiameter
bool m_ComputeFeretDiameter
Definition: itkLabelImageToStatisticsLabelMapFilter.h:194
itk::LabelImageToStatisticsLabelMapFilter::m_ComputeHistogram
bool m_ComputeHistogram
Definition: itkLabelImageToStatisticsLabelMapFilter.h:197
itk::ImageToImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkImageToImageFilter.h:133
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::LabelImageToStatisticsLabelMapFilter::FeatureImagePointer
typename FeatureImageType::Pointer FeatureImagePointer
Definition: itkLabelImageToStatisticsLabelMapFilter.h:70
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::LabelImageToStatisticsLabelMapFilter::FeatureImageConstPointer
typename FeatureImageType::ConstPointer FeatureImageConstPointer
Definition: itkLabelImageToStatisticsLabelMapFilter.h:71
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::LabelImageToStatisticsLabelMapFilter::SetFeatureImage
void SetFeatureImage(const TFeatureImage *input)
Definition: itkLabelImageToStatisticsLabelMapFilter.h:124
itk::LabelImageToStatisticsLabelMapFilter
a convenient class to convert a label image to a label map and valuate the statistics attributes at o...
Definition: itkLabelImageToStatisticsLabelMapFilter.h:44
itk::LabelImageToStatisticsLabelMapFilter::m_ComputePerimeter
bool m_ComputePerimeter
Definition: itkLabelImageToStatisticsLabelMapFilter.h:195
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::LabelImageToStatisticsLabelMapFilter::OutputImageConstPointer
typename OutputImageType::ConstPointer OutputImageConstPointer
Definition: itkLabelImageToStatisticsLabelMapFilter.h:64
itk::LabelImageToStatisticsLabelMapFilter::SetInput2
void SetInput2(const FeatureImageType *input)
Definition: itkLabelImageToStatisticsLabelMapFilter.h:146
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itk::LabelImageToStatisticsLabelMapFilter::GetFeatureImage
const FeatureImageType * GetFeatureImage()
Definition: itkLabelImageToStatisticsLabelMapFilter.h:132
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::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:216
itkStatisticsLabelObject.h
itk::LabelImageToStatisticsLabelMapFilter::m_BackgroundValue
OutputImagePixelType m_BackgroundValue
Definition: itkLabelImageToStatisticsLabelMapFilter.h:193
itk::LabelImageToStatisticsLabelMapFilter::FeatureImageType
TFeatureImage FeatureImageType
Definition: itkLabelImageToStatisticsLabelMapFilter.h:69
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itk::LabelImageToStatisticsLabelMapFilter::LabelObjectType
typename OutputImageType::LabelObjectType LabelObjectType
Definition: itkLabelImageToStatisticsLabelMapFilter.h:67
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