ITK  4.13.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:
51 
53  typedef TImage ImageType;
54  typedef typename ImageType::Pointer ImagePointer;
55  typedef typename ImageType::ConstPointer ImageConstPointer;
56  typedef typename ImageType::PixelType PixelType;
57  typedef typename ImageType::IndexType IndexType;
58  typedef typename ImageType::PointType PointType;
59  typedef typename ImageType::LabelObjectType LabelObjectType;
60  typedef typename LabelObjectType::MatrixType MatrixType;
62 
63  typedef TFeatureImage FeatureImageType;
64  typedef typename FeatureImageType::Pointer FeatureImagePointer;
65  typedef typename FeatureImageType::ConstPointer FeatureImageConstPointer;
66  typedef typename FeatureImageType::PixelType FeatureImagePixelType;
67 
69  itkStaticConstMacro(ImageDimension, unsigned int,
70  TImage::ImageDimension);
71 
73  itkNewMacro(Self);
74 
76  itkTypeMacro(StatisticsLabelMapFilter,
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 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 
99  {
100  return static_cast< FeatureImageType * >( const_cast< DataObject * >( this->ProcessObject::GetInput(1) ) );
101  }
102 
104  void SetInput1(TImage *input)
105  {
106  this->SetInput(input);
107  }
108 
110  void SetInput2(const TFeatureImage *input)
111  {
112  this->SetFeatureImage(input);
113  }
114 
121  itkSetMacro(ComputeHistogram, bool);
122  itkGetConstReferenceMacro(ComputeHistogram, bool);
123  itkBooleanMacro(ComputeHistogram);
125 
131  itkSetMacro(NumberOfBins, unsigned int);
132  itkGetConstReferenceMacro(NumberOfBins, unsigned int);
134 
135 protected:
137  ~StatisticsLabelMapFilter() ITK_OVERRIDE {}
138 
139  virtual void ThreadedProcessLabelObject(LabelObjectType *labelObject) ITK_OVERRIDE;
140 
141  virtual void BeforeThreadedGenerateData() ITK_OVERRIDE;
142 
143  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
144 
145 private:
146  ITK_DISALLOW_COPY_AND_ASSIGN(StatisticsLabelMapFilter);
147 
148  FeatureImagePixelType m_Minimum;
150  unsigned int m_NumberOfBins;
151  bool m_ComputeHistogram;
152 }; // end of class
153 } // end namespace itk
154 
155 #ifndef ITK_MANUAL_INSTANTIATION
156 #include "itkStatisticsLabelMapFilter.hxx"
157 #endif
158 
159 #endif
Light weight base class for most itk classes.
ImageType::LabelObjectType LabelObjectType
SmartPointer< const Self > ConstPointer
FeatureImageType::ConstPointer FeatureImageConstPointer
LabelObjectType::MatrixType MatrixType
LabelObjectType::VectorType VectorType
DataObject * GetInput(const DataObjectIdentifierType &key)
Return an input.
void SetInput2(const TFeatureImage *input)
FeatureImageType::Pointer FeatureImagePointer
FeatureImageType::PixelType FeatureImagePixelType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
ShapeLabelMapFilter< TImage > Superclass
void SetFeatureImage(const TFeatureImage *input)
The valuator class for the StatisticsLabelObject.
The valuator class for the ShapeLabelObject.
Base class for all data objects in ITK.