ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkImageToHistogramFilter.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 __itkImageToHistogramFilter_h
19 #define __itkImageToHistogramFilter_h
20 
21 #include "itkHistogram.h"
22 #include "itkImageTransformer.h"
23 #include "itkBarrier.h"
25 #include "itkProgressReporter.h"
26 
27 namespace itk
28 {
29 namespace Statistics
30 {
42 template< class TImage >
43 class ITK_EXPORT ImageToHistogramFilter:public ImageTransformer<TImage>
44 {
45 public:
51 
54 
56  itkNewMacro(Self);
57 
58  typedef TImage ImageType;
59  typedef typename ImageType::PixelType PixelType;
60  typedef typename ImageType::RegionType RegionType;
63 
70 
71 public:
72 
74  const HistogramType * GetOutput() const;
75  HistogramType * GetOutput();
77 
81 
85 
90 
93 
100  itkSetGetDecoratedInputMacro(HistogramSize, HistogramSizeType);
101 
105  itkSetGetDecoratedInputMacro(MarginalScale, HistogramMeasurementType);
106 
109  itkSetGetDecoratedInputMacro(HistogramBinMinimum, HistogramMeasurementVectorType);
110  itkSetGetDecoratedInputMacro(HistogramBinMaximum, HistogramMeasurementVectorType);
112 
116  itkSetGetDecoratedInputMacro(AutoMinimumMaximum, bool);
117 
120  virtual void GraftOutput(DataObject *output);
121 
122 protected:
125  void PrintSelf(std::ostream & os, Indent indent) const;
126 
127  void BeforeThreadedGenerateData(void);
128  void ThreadedGenerateData(const RegionType & inputRegionForThread, ThreadIdType threadId);
129  void AfterThreadedGenerateData(void);
130 
133  using Superclass::MakeOutput;
135 
136  virtual void ThreadedComputeMinimumAndMaximum( const RegionType & inputRegionForThread, ThreadIdType threadId, ProgressReporter & progress );
137  virtual void ThreadedComputeHistogram( const RegionType & inputRegionForThread, ThreadIdType threadId, ProgressReporter & progress );
138 
139  std::vector< HistogramPointer > m_Histograms;
140  std::vector< HistogramMeasurementVectorType > m_Minimums;
141  std::vector< HistogramMeasurementVectorType > m_Maximums;
142 
143 private:
144  ImageToHistogramFilter(const Self &); //purposely not implemented
145  void operator=(const Self &); //purposely not implemented
146 
147  void ApplyMarginalScale( HistogramMeasurementVectorType & min, HistogramMeasurementVectorType & max, HistogramSizeType & size );
149 
150 };
151 } // end of namespace Statistics
152 } // end of namespace itk
153 
154 #ifndef ITK_MANUAL_INSTANTIATION
155 #include "itkImageToHistogramFilter.hxx"
156 #endif
157 
158 #endif
159