ITK  4.9.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 #if !defined( ITK_LEGACY_REMOVE )
21 
23 #include "itkRGBPixel.h"
24 
25 namespace itk
26 {
27 namespace Functor
28 {
29 template< typename TInput >
30 class ComposeRGB
31 {
32 public:
33  typedef RGBPixel< TInput > OutputType;
34  ComposeRGB() {}
35  ~ComposeRGB() {}
36  bool operator!=(const ComposeRGB &) const
37  {
38  return false;
39  }
40 
41  bool operator==(const ComposeRGB & other) const
42  {
43  return !( *this != other );
44  }
45 
46  inline OutputType operator()(const TInput & R,
47  const TInput & G,
48  const TInput & B) const
49  {
50  OutputType rgbPixel;
51 
52  rgbPixel.Set(R, G, B);
53  return rgbPixel;
54  }
55 };
56 }
57 
70 template< typename TInputImage,
71  typename TOutputImage =
72  Image< RGBPixel< typename TInputImage::PixelType >,
73  TInputImage::ImageDimension > >
74 class ComposeRGBImageFilter:
75  public
76  TernaryFunctorImageFilter< TInputImage, TInputImage,
77  TInputImage, TOutputImage,
78  Functor::ComposeRGB< typename TInputImage::PixelType > >
79 {
80 public:
82  typedef ComposeRGBImageFilter Self;
83  typedef TernaryFunctorImageFilter<
84  TInputImage, TInputImage,
85  TInputImage, TOutputImage,
86  Functor::ComposeRGB<
87  typename TInputImage::PixelType > > Superclass;
88 
89  typedef SmartPointer< Self > Pointer;
90  typedef SmartPointer< const Self > ConstPointer;
91 
92  typedef typename Superclass::OutputImageType OutputImageType;
93 
95  itkNewMacro(Self);
96 
98  itkTypeMacro(ComposeRGBImageFilter,
99  TernaryFunctorImageFilter);
100 
101 protected:
102  ComposeRGBImageFilter() {}
103  virtual ~ComposeRGBImageFilter() {}
104 
105 private:
106  ComposeRGBImageFilter(const Self &) ITK_DELETE_FUNCTION;
107  void operator=(const Self &) ITK_DELETE_FUNCTION;
108 };
109 } // end namespace itk
110 
111 #endif //#if !defined( ITK_LEGACY_REMOVE )
112 #endif
bool operator!=(const ImageRegionCopier< D1, D2 > &c1, const ImageRegionCopier< D1, D2 > &c2)
bool ITKIOXML_EXPORT operator==(itk::FancyString &s, const std::string &)