ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkRedPixelAccessor.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 __itkRedPixelAccessor_h
00019 #define __itkRedPixelAccessor_h
00020 
00021 #include "itkRGBPixel.h"
00022 
00023 namespace itk
00024 {
00037 template< class T >
00038 class ITK_EXPORT RedPixelAccessor
00039 {
00040 public:
00042   typedef   RedPixelAccessor Self;
00043 
00046   typedef T ExternalType;
00047 
00050   typedef     RGBPixel< T > InternalType;
00051 
00053   inline void Set(InternalType & output, const ExternalType & input) const
00054   {
00055     output.SetRed(input);
00056   }
00057 
00059   inline const ExternalType & Get(const InternalType & input) const
00060   {
00061     return input.GetRed();
00062   }
00063 
00064   bool operator!=(const Self &) const
00065   {
00066     return false;
00067   }
00068 
00069   bool operator==(const Self & other) const
00070   {
00071     return !( *this != other );
00072   }
00073 };
00074 }  // end namespace itk
00075 
00076 #endif
00077