ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
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 __itkVectorToRGBPixelAccessor_h 00019 #define __itkVectorToRGBPixelAccessor_h 00020 00021 #include "itkRGBPixel.h" 00022 #include "itkVector.h" 00023 00024 namespace itk 00025 { 00026 namespace Accessor 00027 { 00042 template< class T > 00043 class ITK_EXPORT VectorToRGBPixelAccessor 00044 { 00045 public: 00047 typedef VectorToRGBPixelAccessor Self; 00048 00051 typedef RGBPixel< T > ExternalType; 00052 00055 typedef Vector< T, 3 > InternalType; 00056 00058 inline void Set(InternalType & output, const ExternalType & input) const 00059 { 00060 output[0] = input[0]; 00061 output[1] = input[1]; 00062 output[2] = input[2]; 00063 } 00064 00066 inline ExternalType Get(const InternalType & input) const 00067 { 00068 ExternalType rgb( input.GetDataPointer() ); 00069 00070 return rgb; 00071 } 00072 00073 private: 00074 }; 00075 } // end namespace Accessor 00076 } // end namespace itk 00077 00078 #endif 00079