ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkCustomColormapFunction.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 __itkCustomColormapFunction_h
00019 #define __itkCustomColormapFunction_h
00020 
00021 #include "itkColormapFunction.h"
00022 
00023 #include <vector>
00024 
00025 namespace itk
00026 {
00027 namespace Function
00028 {
00044 template< class TScalar, class TRGBPixel >
00045 class ITK_EXPORT CustomColormapFunction:
00046   public ColormapFunction< TScalar, TRGBPixel >
00047 {
00048 public:
00049 
00050   typedef CustomColormapFunction                 Self;
00051   typedef ColormapFunction< TScalar, TRGBPixel > Superclass;
00052   typedef SmartPointer< Self >                   Pointer;
00053   typedef SmartPointer< const Self >             ConstPointer;
00054 
00056   itkNewMacro(Self);
00057 
00058   typedef typename Superclass::RGBPixelType RGBPixelType;
00059   typedef typename Superclass::ScalarType   ScalarType;
00060   typedef typename Superclass::RealType     RealType;
00061 
00062   typedef std::vector< RealType > ChannelType;
00063 
00064   virtual RGBPixelType operator()(const TScalar &) const;
00065 
00066   void SetRedChannel(ChannelType red)
00067     {
00068     m_RedChannel = red;
00069     }
00070 
00071   ChannelType GetRedChannel() const
00072     {
00073     return m_RedChannel;
00074     }
00075 
00076   void SetGreenChannel(ChannelType green)
00077     {
00078     m_GreenChannel = green;
00079     }
00080 
00081   ChannelType GetGreenChannel() const
00082     {
00083     return m_GreenChannel;
00084     }
00085 
00086   void SetBlueChannel(ChannelType blue)
00087     {
00088     m_BlueChannel = blue;
00089     }
00090 
00091   ChannelType GetBlueChannel() const
00092     {
00093     return m_BlueChannel;
00094     }
00095 
00096 protected:
00097   CustomColormapFunction() {}
00098   ~CustomColormapFunction() {}
00099 private:
00100   CustomColormapFunction(const Self &); //purposely not implemented
00101   void operator=(const Self &);        //purposely not implemented
00102 
00103   ChannelType m_RedChannel;
00104   ChannelType m_GreenChannel;
00105   ChannelType m_BlueChannel;
00106 };
00107 } // end namespace functor
00108 } // end namespace itk
00109 
00110 #ifndef ITK_MANUAL_INSTANTIATION
00111 #include "itkCustomColormapFunction.hxx"
00112 #endif
00113 
00114 #endif
00115