ITK  4.13.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 
56  typedef TFunction FunctorType;
61 
62  typedef TImage OutputImageType;
64  typedef typename OutputImageType::SpacingType SpacingType;
66  typedef typename OutputImageType::PixelType OutputPixelType;
67 
68  // Define an iterator to iterate through the image
70 
72  itkNewMacro(Self);
73 
76 
78  typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
79 
81  typedef THistogram HistogramType;
82  typedef typename HistogramType::MeasurementVectorType MeasurementVectorType;
85 
87  itkStaticConstMacro(ImageDimension, unsigned int, OutputImageType::ImageDimension);
88 
90  using Superclass::SetInput;
91  virtual void SetInput(const HistogramType *histogram);
92 
93  const HistogramType * GetInput();
94 
101  void SetFunctor(const FunctorType & functor)
102  {
103  m_Functor = functor;
104  this->Modified();
105  }
107 
112  FunctorType & GetFunctor() { return m_Functor; }
113  const FunctorType & GetFunctor() const { return m_Functor; }
115 
116  void SetTotalFrequency(SizeValueType n);
117 
118 protected:
120  ~HistogramToImageFilter() ITK_OVERRIDE;
121 
122  virtual void GenerateOutputInformation() ITK_OVERRIDE;
123 
124  virtual void GenerateData() ITK_OVERRIDE;
125 
126  FunctorType m_Functor;
127 
128  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
129 
130 private:
131  ITK_DISALLOW_COPY_AND_ASSIGN(HistogramToImageFilter);
132 };
133 } // end namespace itk
134 
135 #ifndef ITK_MANUAL_INSTANTIATION
136 #include "itkHistogramToImageFilter.hxx"
137 #endif
138 
139 #endif
void SetFunctor(const FunctorType &functor)
Light weight base class for most itk classes.
OutputImageType::SizeType SizeType
OutputImageType::PixelType OutputPixelType
Base class for all process objects that output image data.
unsigned long SizeValueType
Definition: itkIntTypes.h:143
SmartPointer< const Self > ConstPointer
OutputImageType::SpacingType SpacingType
A multi-dimensional iterator templated over image type that walks pixels within a region and is speci...
HistogramType::MeasurementVectorType MeasurementVectorType
OutputImageType::PointType PointType
This class takes a histogram as an input and returns an image of type specified by the functor...
Superclass::OutputImageRegionType OutputImageRegionType
HistogramType::SizeType HistogramSizeType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ImageRegionIteratorWithIndex< OutputImageType > ImageIteratorType
const FunctorType & GetFunctor() const