ITK  5.4.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
25namespace itk
26{
27namespace Function
28{
48template <typename TScalar, typename TRGBPixel>
49class ITK_TEMPLATE_EXPORT CustomColormapFunction : public ColormapFunction<TScalar, TRGBPixel>
50{
51public:
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
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
107protected:
109 ~CustomColormapFunction() override = default;
110
111private:
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
Function object which maps a scalar value into an RGB colormap value.
Function object which maps a scalar value into an RGB colormap value.
RGBPixelType operator()(const TScalar &) const override
~CustomColormapFunction() override=default
Light weight base class for most itk classes.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....