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