ITK  5.2.0
Insight Toolkit
itkStatisticsLabelMapFilter.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 itkStatisticsLabelMapFilter_h
19 #define itkStatisticsLabelMapFilter_h
20 
21 #include "itkShapeLabelMapFilter.h"
22 
23 namespace itk
24 {
40 template <typename TImage, typename TFeatureImage>
41 class ITK_TEMPLATE_EXPORT StatisticsLabelMapFilter
42  : public ShapeLabelMapFilter<TImage, Image<typename TImage::PixelType, TImage::ImageDimension>>
43 {
44 public:
45  ITK_DISALLOW_COPY_AND_MOVE(StatisticsLabelMapFilter);
46 
52 
54  using ImageType = TImage;
55  using ImagePointer = typename ImageType::Pointer;
56  using ImageConstPointer = typename ImageType::ConstPointer;
57  using PixelType = typename ImageType::PixelType;
58  using IndexType = typename ImageType::IndexType;
59  using PointType = typename ImageType::PointType;
60  using LabelObjectType = typename ImageType::LabelObjectType;
61  using MatrixType = typename LabelObjectType::MatrixType;
63 
64  using FeatureImageType = TFeatureImage;
65  using FeatureImagePointer = typename FeatureImageType::Pointer;
66  using FeatureImageConstPointer = typename FeatureImageType::ConstPointer;
67  using FeatureImagePixelType = typename FeatureImageType::PixelType;
68 
70  static constexpr unsigned int ImageDimension = TImage::ImageDimension;
71 
73  itkNewMacro(Self);
74 
77 
78 #ifdef ITK_USE_CONCEPT_CHECKING
79  // Begin concept checking
80 /* itkConceptMacro(InputEqualityComparableCheck,
81  (Concept::EqualityComparable<InputImagePixelType>));
82  itkConceptMacro(IntConvertibleToInputCheck,
83  (Concept::Convertible<int, InputImagePixelType>));
84  itkConceptMacro(InputOStreamWritableCheck,
85  (Concept::OStreamWritable<InputImagePixelType>));*/
86 // End concept checking
87 #endif
88 
90  void
91  SetFeatureImage(const TFeatureImage * input)
92  {
93  // Process object is not const-correct so the const casting is required.
94  this->SetNthInput(1, const_cast<TFeatureImage *>(input));
95  }
96 
98  FeatureImageType *
100  {
101  return static_cast<FeatureImageType *>(const_cast<DataObject *>(this->ProcessObject::GetInput(1)));
102  }
103 
105  void
106  SetInput1(TImage * input)
107  {
108  this->SetInput(input);
109  }
110 
112  void
113  SetInput2(const TFeatureImage * input)
114  {
115  this->SetFeatureImage(input);
116  }
117 
124  itkSetMacro(ComputeHistogram, bool);
125  itkGetConstReferenceMacro(ComputeHistogram, bool);
126  itkBooleanMacro(ComputeHistogram);
128 
134  itkSetMacro(NumberOfBins, unsigned int);
135  itkGetConstReferenceMacro(NumberOfBins, unsigned int);
137 
138 protected:
140  ~StatisticsLabelMapFilter() override = default;
141 
142  void
143  ThreadedProcessLabelObject(LabelObjectType * labelObject) override;
144 
145  void
146  BeforeThreadedGenerateData() override;
147 
148  void
149  PrintSelf(std::ostream & os, Indent indent) const override;
150 
151 private:
154  unsigned int m_NumberOfBins;
156 }; // end of class
157 } // end namespace itk
158 
159 #ifndef ITK_MANUAL_INSTANTIATION
160 # include "itkStatisticsLabelMapFilter.hxx"
161 #endif
162 
163 #endif
itk::StatisticsLabelMapFilter
The valuator class for the StatisticsLabelObject.
Definition: itkStatisticsLabelMapFilter.h:41
itk::StatisticsLabelMapFilter::ImageType
TImage ImageType
Definition: itkStatisticsLabelMapFilter.h:54
itk::StatisticsLabelMapFilter::m_Maximum
FeatureImagePixelType m_Maximum
Definition: itkStatisticsLabelMapFilter.h:153
itk::StatisticsLabelMapFilter::ImageConstPointer
typename ImageType::ConstPointer ImageConstPointer
Definition: itkStatisticsLabelMapFilter.h:56
itk::StatisticsLabelMapFilter::SetInput2
void SetInput2(const TFeatureImage *input)
Definition: itkStatisticsLabelMapFilter.h:113
itk::GTest::TypedefsAndConstructors::Dimension2::VectorType
ImageBaseType::SpacingType VectorType
Definition: itkGTestTypedefsAndConstructors.h:53
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::StatisticsLabelMapFilter::PointType
typename ImageType::PointType PointType
Definition: itkStatisticsLabelMapFilter.h:59
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::StatisticsLabelMapFilter::m_ComputeHistogram
bool m_ComputeHistogram
Definition: itkStatisticsLabelMapFilter.h:155
itk::ShapeLabelMapFilter
The valuator class for the ShapeLabelObject.
Definition: itkShapeLabelMapFilter.h:53
itk::StatisticsLabelMapFilter::FeatureImageConstPointer
typename FeatureImageType::ConstPointer FeatureImageConstPointer
Definition: itkStatisticsLabelMapFilter.h:66
itk::StatisticsLabelMapFilter::GetFeatureImage
FeatureImageType * GetFeatureImage()
Definition: itkStatisticsLabelMapFilter.h:99
itk::StatisticsLabelMapFilter::FeatureImagePixelType
typename FeatureImageType::PixelType FeatureImagePixelType
Definition: itkStatisticsLabelMapFilter.h:67
itkShapeLabelMapFilter.h
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::StatisticsLabelMapFilter::IndexType
typename ImageType::IndexType IndexType
Definition: itkStatisticsLabelMapFilter.h:58
itk::StatisticsLabelMapFilter::m_NumberOfBins
unsigned int m_NumberOfBins
Definition: itkStatisticsLabelMapFilter.h:154
itk::StatisticsLabelMapFilter::SetInput1
void SetInput1(TImage *input)
Definition: itkStatisticsLabelMapFilter.h:106
itk::StatisticsLabelMapFilter::VectorType
typename LabelObjectType::VectorType VectorType
Definition: itkStatisticsLabelMapFilter.h:62
itk::StatisticsLabelMapFilter::ImagePointer
typename ImageType::Pointer ImagePointer
Definition: itkStatisticsLabelMapFilter.h:55
itk::StatisticsLabelMapFilter::LabelObjectType
typename ImageType::LabelObjectType LabelObjectType
Definition: itkStatisticsLabelMapFilter.h:60
itk::StatisticsLabelMapFilter::MatrixType
typename LabelObjectType::MatrixType MatrixType
Definition: itkStatisticsLabelMapFilter.h:61
itk::StatisticsLabelMapFilter::FeatureImageType
TFeatureImage FeatureImageType
Definition: itkStatisticsLabelMapFilter.h:64
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::StatisticsLabelMapFilter::m_Minimum
FeatureImagePixelType m_Minimum
Definition: itkStatisticsLabelMapFilter.h:152
itk::StatisticsLabelMapFilter::PixelType
typename ImageType::PixelType PixelType
Definition: itkStatisticsLabelMapFilter.h:57
itk::StatisticsLabelMapFilter::FeatureImagePointer
typename FeatureImageType::Pointer FeatureImagePointer
Definition: itkStatisticsLabelMapFilter.h:65
itk::StatisticsLabelMapFilter::SetFeatureImage
void SetFeatureImage(const TFeatureImage *input)
Definition: itkStatisticsLabelMapFilter.h:91
itk::ProcessObject::GetInput
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.