ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkScalarImageToHistogramGenerator.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkScalarImageToHistogramGenerator_h
00019 #define __itkScalarImageToHistogramGenerator_h
00020 
00021 #include "itkImageToListSampleAdaptor.h"
00022 #include "itkSampleToHistogramFilter.h"
00023 #include "itkHistogram.h"
00024 #include "itkObject.h"
00025 
00026 namespace itk
00027 {
00028 namespace Statistics
00029 {
00035 template< class TImageType >
00036 class ScalarImageToHistogramGenerator:public Object
00037 {
00038 public:
00040   typedef ScalarImageToHistogramGenerator Self;
00041   typedef Object                          Superclass;
00042   typedef SmartPointer< Self >            Pointer;
00043   typedef SmartPointer< const Self >      ConstPointer;
00044 
00046   itkTypeMacro(ScalarImageToHistogramGenerator, Object);
00047 
00049   itkNewMacro(Self);
00050 
00051   typedef TImageType                                             ImageType;
00052   typedef itk::Statistics::ImageToListSampleAdaptor< ImageType > AdaptorType;
00053   typedef typename AdaptorType::Pointer                          AdaptorPointer;
00054   typedef typename ImageType::PixelType                          PixelType;
00055   typedef typename NumericTraits< PixelType >::RealType          RealPixelType;
00056 
00057   typedef itk::Statistics::Histogram< double >                                   HistogramType;
00058   typedef itk::Statistics::SampleToHistogramFilter< AdaptorType, HistogramType > GeneratorType;
00059 
00060   typedef typename GeneratorType::Pointer GeneratorPointer;
00061 
00062   typedef typename HistogramType::Pointer      HistogramPointer;
00063   typedef typename HistogramType::ConstPointer HistogramConstPointer;
00064 public:
00065 
00067   void Compute(void);
00068 
00071   void SetInput(const ImageType *);
00072 
00076   const HistogramType * GetOutput() const;
00077 
00079   void SetNumberOfBins(unsigned int numberOfBins);
00080 
00082   void SetMarginalScale(double marginalScale);
00083 
00085   void SetHistogramMin(RealPixelType minimumValue);
00086 
00088   void SetHistogramMax(RealPixelType maximumValue);
00089 
00090 protected:
00091   ScalarImageToHistogramGenerator();
00092   virtual ~ScalarImageToHistogramGenerator() {}
00093   void PrintSelf(std::ostream & os, Indent indent) const;
00094 
00095 private:
00096 
00097   AdaptorPointer m_ImageToListSampleAdaptor;
00098 
00099   GeneratorPointer m_HistogramGenerator;
00100 
00101   ScalarImageToHistogramGenerator(const Self &); //purposely not implemented
00102   void operator=(const Self &);                  //purposely not implemented
00103 };
00104 } // end of namespace Statistics
00105 } // end of namespace itk
00106 
00107 #ifndef ITK_MANUAL_INSTANTIATION
00108 #include "itkScalarImageToHistogramGenerator.hxx"
00109 #endif
00110 
00111 #endif
00112