ITK  4.13.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< typename TImage >
43 class ITK_TEMPLATE_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:
124  virtual ~ImageToHistogramFilter() ITK_OVERRIDE {}
125  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
126 
127  void BeforeThreadedGenerateData(void) ITK_OVERRIDE;
128  void ThreadedGenerateData(const RegionType & inputRegionForThread, ThreadIdType threadId) ITK_OVERRIDE;
129  void AfterThreadedGenerateData(void) ITK_OVERRIDE;
130 
133  using Superclass::MakeOutput;
134  DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType) ITK_OVERRIDE;
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  ITK_DISALLOW_COPY_AND_ASSIGN(ImageToHistogramFilter);
145 
146  void ApplyMarginalScale( HistogramMeasurementVectorType & min, HistogramMeasurementVectorType & max, HistogramSizeType & size );
147  typename Barrier::Pointer m_Barrier;
148 
149 };
150 } // end of namespace Statistics
151 } // end of namespace itk
152 
153 #ifndef ITK_MANUAL_INSTANTIATION
154 #include "itkImageToHistogramFilter.hxx"
155 #endif
156 
157 #endif
Light weight base class for most itk classes.
This class stores measurement vectors in the context of n-dimensional histogram.
Definition: itkHistogram.h:77
This class generates an histogram from an image.
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
SimpleDataObjectDecorator< HistogramSizeType > InputHistogramSizeObjectType
SimpleDataObjectDecorator< HistogramMeasurementVectorType > InputHistogramMeasurementVectorObjectType
SimpleDataObjectDecorator< HistogramMeasurementType > InputHistogramMeasurementObjectType
Decorates any &quot;simple&quot; data type (data types without smart pointers) with a DataObject API...
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Superclass::MeasurementVectorType MeasurementVectorType
Definition: itkHistogram.h:101
HistogramType::MeasurementVectorType HistogramMeasurementVectorType
SimpleDataObjectDecorator< bool > InputBooleanObjectType
TMeasurement MeasurementType
Definition: itkHistogram.h:95
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
Implements progress tracking for a filter.
HistogramType::MeasurementType HistogramMeasurementType
Base class for all process objects that transform an image into something else.
NumericTraits< PixelType >::ValueType ValueType
NumericTraits< ValueType >::RealType ValueRealType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Define additional traits for native types such as int or float.
Base class for all data objects in ITK.
Standard barrier class implementation for synchronizing the execution of threads. ...
Definition: itkBarrier.h:41