VTK-m  2.0
ColorTableMap.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 #ifndef vtk_m_cont_ColorTableMap_h
11 #define vtk_m_cont_ColorTableMap_h
12 
15 #include <vtkm/cont/ColorTable.h>
17 
18 #include <vtkm/cont/Invoker.h>
22 
23 #include <vtkm/exec/ColorTable.h>
24 
25 namespace vtkm
26 {
27 namespace cont
28 {
29 
46 template <typename T, typename S>
48  const vtkm::cont::ColorTableSamplesRGBA& samples,
50 {
51  if (samples.NumberOfSamples <= 0)
52  {
53  return false;
54  }
56  vtkm::cont::Invoker invoke(vtkm::cont::DeviceAdapterTagAny{});
57  invoke(lookupTable, values, samples.Samples, rgbaOut);
58  return true;
59 }
60 
77 template <typename T, typename S>
79  const vtkm::cont::ColorTableSamplesRGB& samples,
81 {
82  if (samples.NumberOfSamples <= 0)
83  {
84  return false;
85  }
87  vtkm::cont::Invoker invoke(vtkm::cont::DeviceAdapterTagAny{});
88  invoke(lookupTable, values, samples.Samples, rgbOut);
89  return true;
90 }
91 
94 template <typename T, int N, typename S>
96  const vtkm::cont::ColorTableSamplesRGBA& samples,
98 {
99  using namespace vtkm::worklet::colorconversion;
101  vtkm::cont::make_ArrayHandleTransform(values, MagnitudePortal()), samples, rgbaOut);
102 }
103 
106 template <typename T, int N, typename S>
108  const vtkm::cont::ColorTableSamplesRGB& samples,
110 {
111  using namespace vtkm::worklet::colorconversion;
113  vtkm::cont::make_ArrayHandleTransform(values, MagnitudePortal()), samples, rgbOut);
114 }
115 
118 template <typename T, int N, typename S>
120  vtkm::IdComponent comp,
121  const vtkm::cont::ColorTableSamplesRGBA& samples,
123 {
124  using namespace vtkm::worklet::colorconversion;
126  vtkm::cont::make_ArrayHandleTransform(values, ComponentPortal(comp)), samples, rgbaOut);
127 }
128 
131 template <typename T, int N, typename S>
133  vtkm::IdComponent comp,
134  const vtkm::cont::ColorTableSamplesRGB& samples,
136 {
137  using namespace vtkm::worklet::colorconversion;
139  vtkm::cont::make_ArrayHandleTransform(values, ComponentPortal(comp)), samples, rgbOut);
140 }
141 
148 template <typename T, typename S>
150  const vtkm::cont::ColorTable& table,
152 {
153  vtkm::cont::Invoker invoke;
154  invoke(vtkm::worklet::colorconversion::TransferFunction{}, values, table, rgbaOut);
155  return true;
156 }
157 
164 template <typename T, typename S>
166  const vtkm::cont::ColorTable& table,
168 {
169  vtkm::cont::Invoker invoke;
170  invoke(vtkm::worklet::colorconversion::TransferFunction{}, values, table, rgbOut);
171  return true;
172 }
173 
176 template <typename T, int N, typename S>
178  const vtkm::cont::ColorTable& table,
180 {
181  using namespace vtkm::worklet::colorconversion;
183  vtkm::cont::make_ArrayHandleTransform(values, MagnitudePortal()), table, rgbaOut);
184 }
185 
188 template <typename T, int N, typename S>
190  const vtkm::cont::ColorTable& table,
192 {
193  using namespace vtkm::worklet::colorconversion;
195  vtkm::cont::make_ArrayHandleTransform(values, MagnitudePortal()), table, rgbOut);
196 }
197 
200 template <typename T, int N, typename S>
202  vtkm::IdComponent comp,
203  const vtkm::cont::ColorTable& table,
205 {
206  using namespace vtkm::worklet::colorconversion;
208  vtkm::cont::make_ArrayHandleTransform(values, ComponentPortal(comp)), table, rgbaOut);
209 }
210 
213 template <typename T, int N, typename S>
215  vtkm::IdComponent comp,
216  const vtkm::cont::ColorTable& table,
218 {
219  using namespace vtkm::worklet::colorconversion;
221  vtkm::cont::make_ArrayHandleTransform(values, ComponentPortal(comp)), table, rgbOut);
222 }
223 }
224 }
225 #endif // vtk_m_cont_ColorTableMap_h
vtkm::cont::ArrayHandle< T, S >
vtkm::worklet::colorconversion::TransferFunction
Definition: TransferFunction.h:24
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::cont::ColorTable
Color Table for coloring arbitrary fields.
Definition: cont/ColorTable.h:89
ColorTable.h
vtkm::IdComponent
vtkm::Int32 IdComponent
Represents a component ID (index of component in a vector).
Definition: Types.h:168
vtkm::cont::ColorTableMapMagnitude
bool ColorTableMapMagnitude(const vtkm::cont::ArrayHandle< vtkm::Vec< T, N >, S > &values, const vtkm::cont::ColorTableSamplesRGBA &samples, vtkm::cont::ArrayHandle< vtkm::Vec4ui_8 > &rgbaOut)
Use magnitude of a vector with a sample table to generate RGBA colors.
Definition: ColorTableMap.h:95
ArrayHandleTransform.h
TransferFunction.h
Invoker.h
vtkm::cont::ColorTableMapComponent
bool ColorTableMapComponent(const vtkm::cont::ArrayHandle< vtkm::Vec< T, N >, S > &values, vtkm::IdComponent comp, const vtkm::cont::ColorTableSamplesRGBA &samples, vtkm::cont::ArrayHandle< vtkm::Vec4ui_8 > &rgbaOut)
Use a single component of a vector with a sample table to generate RGBA colors.
Definition: ColorTableMap.h:119
ColorTable.h
vtkm::worklet::colorconversion::LookupTable
Definition: LookupTable.h:30
vtkm::cont::make_ArrayHandleTransform
VTKM_CONT vtkm::cont::ArrayHandleTransform< HandleType, FunctorType > make_ArrayHandleTransform(HandleType handle, FunctorType functor)
make_ArrayHandleTransform is convenience function to generate an ArrayHandleTransform.
Definition: ArrayHandleTransform.h:474
vtkm::cont::ColorTableSamplesRGBA
Color Sample Table used with vtkm::cont::ColorTable for fast coloring.
Definition: ColorTableSamples.h:32
vtkm::cont::Invoker
Allows launching any worklet without a dispatcher.
Definition: Invoker.h:41
vtkm::cont::ColorTableMap
bool ColorTableMap(const vtkm::cont::ArrayHandle< T, S > &values, const vtkm::cont::ColorTableSamplesRGBA &samples, vtkm::cont::ArrayHandle< vtkm::Vec4ui_8 > &rgbaOut)
Sample each value through an intermediate lookup/sample table to generate RGBA colors.
Definition: ColorTableMap.h:47
vtkm::worklet::colorconversion
Definition: Conversions.h:17
vtkm::cont::ColorTableSamplesRGB::NumberOfSamples
vtkm::Int32 NumberOfSamples
Definition: ColorTableSamples.h:55
vtkm::worklet::colorconversion::ComponentPortal
Definition: Portals.h:32
vtkm::Vec< T, N >
vtkm::cont::ColorTableSamplesRGB
Color Sample Table used with vtkm::cont::ColorTable for fast coloring.
Definition: ColorTableSamples.h:51
vtkm::cont::ColorTableSamplesRGBA::Samples
vtkm::cont::ArrayHandle< vtkm::Vec4ui_8 > Samples
Definition: ColorTableSamples.h:37
ArrayHandleCounting.h
vtkm::cont::ColorTableSamplesRGB::Samples
vtkm::cont::ArrayHandle< vtkm::Vec3ui_8 > Samples
Definition: ColorTableSamples.h:56
ColorTableSamples.h
Portals.h
vtkm::cont::ColorTableSamplesRGBA::NumberOfSamples
vtkm::Int32 NumberOfSamples
Definition: ColorTableSamples.h:36
LookupTable.h
vtkm::worklet::colorconversion::MagnitudePortal
Definition: Portals.h:22