ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkHistogramToIntensityImageFilter.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 __itkHistogramToIntensityImageFilter_h
00019 #define __itkHistogramToIntensityImageFilter_h
00020 
00021 #include "itkHistogramToImageFilter.h"
00022 
00023 namespace itk
00024 {
00039 namespace Function
00040 {
00041 template< class TInput, class TOutput = SizeValueType >
00042 class HistogramIntensityFunction
00043 {
00044 public:
00045 
00046   //Intensity function returns pixels of SizeValueType.
00047   typedef TOutput OutputPixelType;
00048 
00049   HistogramIntensityFunction():
00050     m_TotalFrequency(1) {}
00051 
00052   ~HistogramIntensityFunction() {}
00053 
00054   inline OutputPixelType operator()(const TInput & A) const
00055   {
00056     return static_cast< OutputPixelType >( A );
00057   }
00058 
00059   void SetTotalFrequency(SizeValueType n)
00060   {
00061     m_TotalFrequency = n;
00062   }
00063 
00064   SizeValueType GetTotalFrequency() const
00065   {
00066     return m_TotalFrequency;
00067   }
00068 
00069 private:
00070   SizeValueType m_TotalFrequency;
00071 };
00072 }
00073 
00074 template< class THistogram, class TImage=Image< SizeValueType, 3 > >
00075 class ITK_EXPORT HistogramToIntensityImageFilter:
00076   public HistogramToImageFilter< THistogram, TImage,
00077                                  Function::HistogramIntensityFunction< SizeValueType, typename TImage::PixelType > >
00078 {
00079 public:
00080 
00082   typedef HistogramToIntensityImageFilter Self;
00083 
00085   typedef HistogramToImageFilter< THistogram, TImage,
00086                                  Function::HistogramIntensityFunction< SizeValueType, typename TImage::PixelType > >
00087   Superclass;
00088 
00089   //typedef typename Function::HistogramIntensityFunction  FunctorType;
00090   typedef SmartPointer< Self >       Pointer;
00091   typedef SmartPointer< const Self > ConstPointer;
00092 
00094   itkTypeMacro(HistogramToIntensityImageFilter, HistogramToImageFilter);
00095 
00097   itkNewMacro(Self);
00098 protected:
00099   HistogramToIntensityImageFilter() {}
00100   virtual ~HistogramToIntensityImageFilter() {}
00101 private:
00102   HistogramToIntensityImageFilter(const Self &); //purposely not implemented
00103   void operator=(const Self &);                  //purposely not implemented
00104 };
00105 } // end namespace itk
00107 
00108 #endif
00109