ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkStatisticsLabelMapFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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,
43  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 
77  itkTypeMacro(StatisticsLabelMapFilter,
79 
80 #ifdef ITK_USE_CONCEPT_CHECKING
81  // Begin concept checking
82 /* itkConceptMacro(InputEqualityComparableCheck,
83  (Concept::EqualityComparable<InputImagePixelType>));
84  itkConceptMacro(IntConvertibleToInputCheck,
85  (Concept::Convertible<int, InputImagePixelType>));
86  itkConceptMacro(InputOStreamWritableCheck,
87  (Concept::OStreamWritable<InputImagePixelType>));*/
88 // End concept checking
89 #endif
90 
92  void 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 
100  {
101  return static_cast< FeatureImageType * >( const_cast< DataObject * >( this->ProcessObject::GetInput(1) ) );
102  }
103 
105  void SetInput1(TImage *input)
106  {
107  this->SetInput(input);
108  }
109 
111  void SetInput2(const TFeatureImage *input)
112  {
113  this->SetFeatureImage(input);
114  }
115 
122  itkSetMacro(ComputeHistogram, bool);
123  itkGetConstReferenceMacro(ComputeHistogram, bool);
124  itkBooleanMacro(ComputeHistogram);
126 
132  itkSetMacro(NumberOfBins, unsigned int);
133  itkGetConstReferenceMacro(NumberOfBins, unsigned int);
135 
136 protected:
138  ~StatisticsLabelMapFilter() override = default;
139 
140  void ThreadedProcessLabelObject(LabelObjectType *labelObject) override;
141 
142  void BeforeThreadedGenerateData() override;
143 
144  void PrintSelf(std::ostream & os, Indent indent) const override;
145 
146 private:
149  unsigned int m_NumberOfBins;
151 }; // end of class
152 } // end namespace itk
153 
154 #ifndef ITK_MANUAL_INSTANTIATION
155 #include "itkStatisticsLabelMapFilter.hxx"
156 #endif
157 
158 #endif
Light weight base class for most itk classes.
typename FeatureImageType::Pointer FeatureImagePointer
typename ImageType::IndexType IndexType
typename FeatureImageType::PixelType FeatureImagePixelType
typename LabelObjectType::MatrixType MatrixType
typename ImageType::PixelType PixelType
typename LabelObjectType::VectorType VectorType
typename ImageType::LabelObjectType LabelObjectType
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
void SetInput2(const TFeatureImage *input)
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename FeatureImageType::ConstPointer FeatureImageConstPointer
void SetFeatureImage(const TFeatureImage *input)
The valuator class for the StatisticsLabelObject.
typename ImageType::Pointer ImagePointer
The valuator class for the ShapeLabelObject.
Base class for all data objects in ITK.
typename ImageType::PointType PointType
typename ImageType::ConstPointer ImageConstPointer