ITK  4.3.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< class TImage, class TFeatureImage >
41 class ITK_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;
61  typedef typename LabelObjectType::VectorType VectorType;
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 
81 /* itkConceptMacro(InputEqualityComparableCheck,
82  (Concept::EqualityComparable<InputImagePixelType>));
83  itkConceptMacro(IntConvertibleToInputCheck,
84  (Concept::Convertible<int, InputImagePixelType>));
85  itkConceptMacro(InputOStreamWritableCheck,
86  (Concept::OStreamWritable<InputImagePixelType>));*/
87 
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 
99  FeatureImageType * GetFeatureImage()
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:
139 
140  virtual void ThreadedProcessLabelObject(LabelObjectType *labelObject);
141 
142  virtual void BeforeThreadedGenerateData();
143 
144  void PrintSelf(std::ostream & os, Indent indent) const;
145 
146 private:
147  StatisticsLabelMapFilter(const Self &); //purposely not implemented
148  void operator=(const Self &); //purposely not implemented
149 
152  unsigned int m_NumberOfBins;
154 }; // end of class
155 } // end namespace itk
156 
157 #ifndef ITK_MANUAL_INSTANTIATION
158 #include "itkStatisticsLabelMapFilter.hxx"
159 #endif
160 
161 #endif
162