ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkHistogramToImageFilter.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 itkHistogramToImageFilter_h
19 #define itkHistogramToImageFilter_h
20 
21 #include "itkImageSource.h"
22 #include "itkConceptChecking.h"
23 #include "itkHistogram.h"
26 
27 namespace itk
28 {
49 template< typename THistogram, typename TImage, typename TFunction >
50 class ITK_TEMPLATE_EXPORT HistogramToImageFilter:
51  public ImageSource< TImage >
52 {
53 public:
54  ITK_DISALLOW_COPY_AND_ASSIGN(HistogramToImageFilter);
55 
57  using FunctorType = TFunction;
62 
63  using OutputImageType = TImage;
65  using SpacingType = typename OutputImageType::SpacingType;
67  using OutputPixelType = typename OutputImageType::PixelType;
68 
69  // Define an iterator to iterate through the image
71 
73  itkNewMacro(Self);
74 
76  itkTypeMacro(HistogramToImageFilter, ImageSource);
77 
79  using OutputImageRegionType = typename Superclass::OutputImageRegionType;
80 
82  using HistogramType = THistogram;
83  using MeasurementVectorType = typename HistogramType::MeasurementVectorType;
86 
88  static constexpr unsigned int ImageDimension = OutputImageType::ImageDimension;
89 
91  using Superclass::SetInput;
92  virtual void SetInput(const HistogramType *histogram);
93 
94  const HistogramType * GetInput();
95 
102  void SetFunctor(const FunctorType & functor)
103  {
104  m_Functor = functor;
105  this->Modified();
106  }
108 
113  FunctorType & GetFunctor() { return m_Functor; }
114  const FunctorType & GetFunctor() const { return m_Functor; }
116 
117  void SetTotalFrequency(SizeValueType n);
118 
119 protected:
121  ~HistogramToImageFilter() override = default;
122 
123  void GenerateOutputInformation() override;
124 
125  void GenerateData() override;
126 
128 
129  void PrintSelf(std::ostream & os, Indent indent) const override;
130 };
131 } // end namespace itk
132 
133 #ifndef ITK_MANUAL_INSTANTIATION
134 #include "itkHistogramToImageFilter.hxx"
135 #endif
136 
137 #endif
void SetFunctor(const FunctorType &functor)
typename OutputImageType::Pointer OutputImagePointer
Light weight base class for most itk classes.
unsigned long SizeValueType
Definition: itkIntTypes.h:83
Base class for all process objects that output image data.
typename OutputImageType::RegionType OutputImageRegionType
A multi-dimensional iterator templated over image type that walks pixels within a region and is speci...
This class takes a histogram as an input and returns an image of type specified by the functor...
Control indentation during Print() invocation.
Definition: itkIndent.h:49
const FunctorType & GetFunctor() const