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 {
41 template <typename TInputImage,
42  typename TFeatureImage,
43  typename TOutputImage =
44  LabelMap<StatisticsLabelObject<typename TInputImage::PixelType, TInputImage::ImageDimension>>>
45 class ITK_TEMPLATE_EXPORT LabelImageToStatisticsLabelMapFilter : public ImageToImageFilter<TInputImage, TOutputImage>
46 {
47 public:
48  ITK_DISALLOW_COPY_AND_ASSIGN(LabelImageToStatisticsLabelMapFilter);
49 
55 
57  using InputImageType = TInputImage;
58  using InputImagePointer = typename InputImageType::Pointer;
59  using InputImageConstPointer = typename InputImageType::ConstPointer;
61  using InputImagePixelType = typename InputImageType::PixelType;
62 
63  using OutputImageType = TOutputImage;
64  using OutputImagePointer = typename OutputImageType::Pointer;
65  using OutputImageConstPointer = typename OutputImageType::ConstPointer;
67  using OutputImagePixelType = typename OutputImageType::PixelType;
68  using LabelObjectType = typename OutputImageType::LabelObjectType;
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 
82 
84  itkNewMacro(Self);
85 
88 
89 #ifdef ITK_USE_CONCEPT_CHECKING
90  // Begin concept checking
94  // End concept checking
95 #endif
96 
101  itkSetMacro(BackgroundValue, OutputImagePixelType);
102  itkGetConstMacro(BackgroundValue, OutputImagePixelType);
104 
109  itkSetMacro(ComputeFeretDiameter, bool);
110  itkGetConstReferenceMacro(ComputeFeretDiameter, bool);
111  itkBooleanMacro(ComputeFeretDiameter);
113 
118  itkSetMacro(ComputePerimeter, bool);
119  itkGetConstReferenceMacro(ComputePerimeter, bool);
120  itkBooleanMacro(ComputePerimeter);
122 
124  void
125  SetFeatureImage(const TFeatureImage * input)
126  {
127  // Process object is not const-correct so the const casting is required.
128  this->SetNthInput(1, const_cast<TFeatureImage *>(input));
129  }
130 
132  const FeatureImageType *
134  {
135  return static_cast<FeatureImageType *>(this->ProcessObject::GetInput(1));
136  }
137 
139  void
140  SetInput1(const InputImageType * input)
141  {
142  this->SetInput(input);
143  }
144 
146  void
148  {
149  this->SetFeatureImage(input);
150  }
151 
158  itkSetMacro(ComputeHistogram, bool);
159  itkGetConstReferenceMacro(ComputeHistogram, bool);
160  itkBooleanMacro(ComputeHistogram);
162 
168  itkSetMacro(NumberOfBins, unsigned int);
169  itkGetConstReferenceMacro(NumberOfBins, unsigned int);
171 
172 protected:
174  ~LabelImageToStatisticsLabelMapFilter() override = default;
175  void
176  PrintSelf(std::ostream & os, Indent indent) const override;
177 
181  void
182  GenerateInputRequestedRegion() override;
183 
185  void
186  EnlargeOutputRequestedRegion(DataObject * itkNotUsed(output)) override;
187 
190  void
191  GenerateData() override;
192 
193 private:
197  unsigned int m_NumberOfBins;
199 }; // end of class
200 } // end namespace itk
201 
202 #ifndef ITK_MANUAL_INSTANTIATION
203 # include "itkLabelImageToStatisticsLabelMapFilter.hxx"
204 #endif
205 
206 #endif
itkLabelImageToLabelMapFilter.h
itk::LabelImageToStatisticsLabelMapFilter::SetInput1
void SetInput1(const InputImageType *input)
Definition: itkLabelImageToStatisticsLabelMapFilter.h:140
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
itk::LabelImageToStatisticsLabelMapFilter::m_NumberOfBins
unsigned int m_NumberOfBins
Definition: itkLabelImageToStatisticsLabelMapFilter.h:197
itkStatisticsLabelMapFilter.h
itk::LabelImageToStatisticsLabelMapFilter::FeatureImagePixelType
typename FeatureImageType::PixelType FeatureImagePixelType
Definition: itkLabelImageToStatisticsLabelMapFilter.h:73
itk::LabelImageToLabelMapFilter
convert a labeled image to a label collection image
Definition: itkLabelImageToLabelMapFilter.h:50
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::LabelImageToStatisticsLabelMapFilter::m_ComputeFeretDiameter
bool m_ComputeFeretDiameter
Definition: itkLabelImageToStatisticsLabelMapFilter.h:195
itk::LabelImageToStatisticsLabelMapFilter::m_ComputeHistogram
bool m_ComputeHistogram
Definition: itkLabelImageToStatisticsLabelMapFilter.h:198
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:71
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::LabelImageToStatisticsLabelMapFilter::FeatureImageConstPointer
typename FeatureImageType::ConstPointer FeatureImageConstPointer
Definition: itkLabelImageToStatisticsLabelMapFilter.h:72
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::LabelImageToStatisticsLabelMapFilter::SetFeatureImage
void SetFeatureImage(const TFeatureImage *input)
Definition: itkLabelImageToStatisticsLabelMapFilter.h:125
itk::LabelImageToStatisticsLabelMapFilter
a convenient class to convert a label image to a label map and valuate the statistics attributes at o...
Definition: itkLabelImageToStatisticsLabelMapFilter.h:45
itk::LabelImageToStatisticsLabelMapFilter::m_ComputePerimeter
bool m_ComputePerimeter
Definition: itkLabelImageToStatisticsLabelMapFilter.h:196
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::LabelImageToStatisticsLabelMapFilter::OutputImageConstPointer
typename OutputImageType::ConstPointer OutputImageConstPointer
Definition: itkLabelImageToStatisticsLabelMapFilter.h:65
itk::LabelImageToStatisticsLabelMapFilter::SetInput2
void SetInput2(const FeatureImageType *input)
Definition: itkLabelImageToStatisticsLabelMapFilter.h:147
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itk::LabelImageToStatisticsLabelMapFilter::GetFeatureImage
const FeatureImageType * GetFeatureImage()
Definition: itkLabelImageToStatisticsLabelMapFilter.h:133
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::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
itkStatisticsLabelObject.h
itk::LabelImageToStatisticsLabelMapFilter::m_BackgroundValue
OutputImagePixelType m_BackgroundValue
Definition: itkLabelImageToStatisticsLabelMapFilter.h:194
itk::LabelImageToStatisticsLabelMapFilter::FeatureImageType
TFeatureImage FeatureImageType
Definition: itkLabelImageToStatisticsLabelMapFilter.h:70
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itk::LabelImageToStatisticsLabelMapFilter::LabelObjectType
typename OutputImageType::LabelObjectType LabelObjectType
Definition: itkLabelImageToStatisticsLabelMapFilter.h:68
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