ITK  5.0.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 <mutex>
22 
23 #include "itkHistogram.h"
24 #include "itkImageTransformer.h"
26 #include "itkProgressReporter.h"
27 
28 namespace itk
29 {
30 namespace Statistics
31 {
43 template< typename TImage >
44 class ITK_TEMPLATE_EXPORT ImageToHistogramFilter:public ImageTransformer<TImage>
45 {
46 public:
47  ITK_DISALLOW_COPY_AND_ASSIGN(ImageToHistogramFilter);
48 
54 
57 
59  itkNewMacro(Self);
60 
61  using ImageType = TImage;
62  using PixelType = typename ImageType::PixelType;
66 
73 
74 public:
75 
77  const HistogramType * GetOutput() const;
78  HistogramType * GetOutput();
80 
83 
86 
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  ~ImageToHistogramFilter() override = default;
125  void PrintSelf(std::ostream & os, Indent indent) const override;
126 
127  void GenerateData() override;
128  void BeforeThreadedGenerateData() override;
129  void AfterThreadedGenerateData() override;
130 
133  using Superclass::MakeOutput;
135 
136  virtual void ThreadedComputeHistogram(const RegionType &);
137  virtual void ThreadedComputeMinimumAndMaximum( const RegionType & inputRegionForThread );
138 
139 
140  virtual void ThreadedMergeHistogram( HistogramPointer &&histogram );
141 
142  std::mutex m_Mutex;
143 
145 
148 
149 private:
150  void ApplyMarginalScale( HistogramMeasurementVectorType & min, HistogramMeasurementVectorType & max, HistogramSizeType & size );
151 
152 
153 };
154 } // end of namespace Statistics
155 } // end of namespace itk
156 
157 #ifndef ITK_MANUAL_INSTANTIATION
158 #include "itkImageToHistogramFilter.hxx"
159 #endif
160 
161 #endif
typename HistogramType::MeasurementType HistogramMeasurementType
Light weight base class for most itk classes.
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
typename NumericTraits< ValueType >::RealType ValueRealType
Define numeric traits for std::vector.
typename HistogramType::SizeType HistogramSizeType
This class stores measurement vectors in the context of n-dimensional histogram.
Definition: itkHistogram.h:77
This class generates an histogram from an image.
typename NumericTraits< PixelType >::ValueType ValueType
typename HistogramType::Pointer HistogramPointer
TMeasurement MeasurementType
Definition: itkHistogram.h:99
typename HistogramType::ConstPointer HistogramConstPointer
Decorates any &quot;simple&quot; data type (data types without smart pointers) with a DataObject API...
Base class for all process objects that transform an image into something else.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename Superclass::MeasurementVectorType MeasurementVectorType
Definition: itkHistogram.h:102
typename HistogramType::MeasurementVectorType HistogramMeasurementVectorType
Base class for all data objects in ITK.