]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Algorithms/RGBExtractFunction.h
...
[cpPlugins.git] / lib / cpExtensions / Algorithms / RGBExtractFunction.h
index 9dd11b54cd79cd21d042728957b5f087107bcb91..ec7126b12ed720e986f30faf47f7cc0dbbb2fb4c 100644 (file)
@@ -10,7 +10,6 @@
 #include <vnl/vnl_math.h>
 
 #include <itkRGBPixel.h>
-#include <itkVector.h>
 
 namespace cpExtensions
 {
@@ -18,20 +17,21 @@ namespace cpExtensions
   {
     /**
      */
-    template< class O >
+    template< class P >
     struct RGBExtractFunction
     {
-      typedef RGBExtractFunction  Self;
-      typedef itk::Vector< O, 3 > TOutPixel;
+      typedef RGBExtractFunction    Self;
+      typedef P                     TOutPixel;
+      typedef typename P::ValueType TValue;
 
       template< class Tr, class Tg, class Tb >
-      TOutPixel operator()( const Tr& r, const Tg& g, const Tb& b ) const
+      P operator()( const Tr& r, const Tg& g, const Tb& b ) const
         {
-          TOutPixel rgb;
-          rgb[ 0 ] = O( r );
-          rgb[ 1 ] = O( g );
-          rgb[ 2 ] = O( b );
-          return( rgb );
+          P out;
+          out[ 0 ] = TValue( r );
+          out[ 1 ] = TValue( g );
+          out[ 2 ] = TValue( b );
+          return( out );
         }
 
       template< class C >