ITK  6.0.0
Insight Toolkit
itkCustomColormapFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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  * https://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 itkCustomColormapFunction_h
19 #define itkCustomColormapFunction_h
20 
21 #include "itkColormapFunction.h"
22 
23 #include <vector>
24 
25 namespace itk
26 {
27 namespace Function
28 {
48 template <typename TScalar, typename TRGBPixel>
49 class ITK_TEMPLATE_EXPORT CustomColormapFunction : public ColormapFunction<TScalar, TRGBPixel>
50 {
51 public:
52  ITK_DISALLOW_COPY_AND_MOVE(CustomColormapFunction);
53 
58 
60  itkNewMacro(Self);
61 
62  using typename Superclass::RGBPixelType;
63  using typename Superclass::ScalarType;
64  using typename Superclass::RealType;
65 
66  using ChannelType = std::vector<RealType>;
67 
69  operator()(const TScalar &) const override;
70 
71  void
73  {
74  m_RedChannel = red;
75  }
76 
77  ChannelType
78  GetRedChannel() const
79  {
80  return m_RedChannel;
81  }
82 
83  void
85  {
86  m_GreenChannel = green;
87  }
88 
89  ChannelType
91  {
92  return m_GreenChannel;
93  }
94 
95  void
97  {
98  m_BlueChannel = blue;
99  }
100 
101  ChannelType
103  {
104  return m_BlueChannel;
105  }
106 
107 protected:
108  CustomColormapFunction() = default;
109  ~CustomColormapFunction() override = default;
110 
111 private:
112  ChannelType m_RedChannel{};
113  ChannelType m_GreenChannel{};
114  ChannelType m_BlueChannel{};
115 };
116 } // end namespace Function
117 } // end namespace itk
118 
119 #ifndef ITK_MANUAL_INSTANTIATION
120 # include "itkCustomColormapFunction.hxx"
121 #endif
122 
123 #endif
itk::Function::CustomColormapFunction::GetGreenChannel
ChannelType GetGreenChannel() const
Definition: itkCustomColormapFunction.h:90
itk::Function::CustomColormapFunction::SetGreenChannel
void SetGreenChannel(ChannelType green)
Definition: itkCustomColormapFunction.h:84
itk::SmartPointer< Self >
itk::Function::ColormapFunction
Function object which maps a scalar value into an RGB colormap value.
Definition: itkColormapFunction.h:45
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::Function::CustomColormapFunction::GetRedChannel
ChannelType GetRedChannel() const
Definition: itkCustomColormapFunction.h:78
itk::Function::ColormapFunction::RGBPixelType
TRGBPixel RGBPixelType
Definition: itkColormapFunction.h:58
itk::Function::CustomColormapFunction::SetRedChannel
void SetRedChannel(ChannelType red)
Definition: itkCustomColormapFunction.h:72
itk::Function::CustomColormapFunction::SetBlueChannel
void SetBlueChannel(ChannelType blue)
Definition: itkCustomColormapFunction.h:96
itk::Function::CustomColormapFunction::ChannelType
std::vector< RealType > ChannelType
Definition: itkCustomColormapFunction.h:66
itkColormapFunction.h
itk::Function::CustomColormapFunction::GetBlueChannel
ChannelType GetBlueChannel() const
Definition: itkCustomColormapFunction.h:102
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::Function::CustomColormapFunction
Function object which maps a scalar value into an RGB colormap value.
Definition: itkCustomColormapFunction.h:49