ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkComposeRGBImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkComposeRGBImageFilter_h
19 #define __itkComposeRGBImageFilter_h
20 
22 #include "itkRGBPixel.h"
23 
24 namespace itk
25 {
26 namespace Functor
27 {
28 template< class TInput >
30 {
31 public:
35  bool operator!=(const ComposeRGB &) const
36  {
37  return false;
38  }
39 
40  bool operator==(const ComposeRGB & other) const
41  {
42  return !( *this != other );
43  }
44 
45  inline OutputType operator()(const TInput & R,
46  const TInput & G,
47  const TInput & B) const
48  {
49  OutputType rgbPixel;
50 
51  rgbPixel.Set(R, G, B);
52  return rgbPixel;
53  }
54 };
55 }
56 
69 template< typename TInputImage,
70  typename TOutputImage =
71  Image< RGBPixel< typename TInputImage::PixelType >,
73 class ITK_EXPORT ComposeRGBImageFilter:
74  public
75  TernaryFunctorImageFilter< TInputImage, TInputImage,
76  TInputImage, TOutputImage,
77  Functor::ComposeRGB< typename TInputImage::PixelType > >
78 {
79 public:
83  TInputImage, TInputImage,
84  TInputImage, TOutputImage,
86  typename TInputImage::PixelType > > Superclass;
87 
90 
91  typedef typename Superclass::OutputImageType OutputImageType;
92 
94  itkNewMacro(Self);
95 
97  itkTypeMacro(ComposeRGBImageFilter,
99 protected:
102 private:
103  ComposeRGBImageFilter(const Self &); //purposely not implemented
104  void operator=(const Self &); //purposely not implemented
105 };
106 } // end namespace itk
108 
109 #endif
110