Viskores  1.0
ColorTableMap.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 #ifndef viskores_cont_ColorTableMap_h
19 #define viskores_cont_ColorTableMap_h
20 
25 
26 #include <viskores/cont/Invoker.h>
27 #include <viskores/worklet/colorconversion/LookupTable.h>
28 #include <viskores/worklet/colorconversion/Portals.h>
29 #include <viskores/worklet/colorconversion/TransferFunction.h>
30 
32 
33 namespace viskores
34 {
35 namespace cont
36 {
37 
54 template <typename T, typename S>
58 {
59  if (samples.NumberOfSamples <= 0)
60  {
61  return false;
62  }
63  viskores::worklet::colorconversion::LookupTable lookupTable(samples);
65  invoke(lookupTable, values, samples.Samples, rgbaOut);
66  return true;
67 }
68 
85 template <typename T, typename S>
89 {
90  if (samples.NumberOfSamples <= 0)
91  {
92  return false;
93  }
94  viskores::worklet::colorconversion::LookupTable lookupTable(samples);
96  invoke(lookupTable, values, samples.Samples, rgbOut);
97  return true;
98 }
99 
102 template <typename T, int N, typename S>
106 {
107  using namespace viskores::worklet::colorconversion;
109  viskores::cont::make_ArrayHandleTransform(values, MagnitudePortal()), samples, rgbaOut);
110 }
111 
114 template <typename T, int N, typename S>
118 {
119  using namespace viskores::worklet::colorconversion;
121  viskores::cont::make_ArrayHandleTransform(values, MagnitudePortal()), samples, rgbOut);
122 }
123 
126 template <typename T, int N, typename S>
131 {
132  using namespace viskores::worklet::colorconversion;
134  viskores::cont::make_ArrayHandleTransform(values, ComponentPortal(comp)), samples, rgbaOut);
135 }
136 
139 template <typename T, int N, typename S>
144 {
145  using namespace viskores::worklet::colorconversion;
147  viskores::cont::make_ArrayHandleTransform(values, ComponentPortal(comp)), samples, rgbOut);
148 }
149 
156 template <typename T, typename S>
158  const viskores::cont::ColorTable& table,
160 {
162  invoke(viskores::worklet::colorconversion::TransferFunction{}, values, table, rgbaOut);
163  return true;
164 }
165 
172 template <typename T, typename S>
174  const viskores::cont::ColorTable& table,
176 {
178  invoke(viskores::worklet::colorconversion::TransferFunction{}, values, table, rgbOut);
179  return true;
180 }
181 
184 template <typename T, int N, typename S>
186  const viskores::cont::ColorTable& table,
188 {
189  using namespace viskores::worklet::colorconversion;
191  viskores::cont::make_ArrayHandleTransform(values, MagnitudePortal()), table, rgbaOut);
192 }
193 
196 template <typename T, int N, typename S>
198  const viskores::cont::ColorTable& table,
200 {
201  using namespace viskores::worklet::colorconversion;
203  viskores::cont::make_ArrayHandleTransform(values, MagnitudePortal()), table, rgbOut);
204 }
205 
208 template <typename T, int N, typename S>
211  const viskores::cont::ColorTable& table,
213 {
214  using namespace viskores::worklet::colorconversion;
216  viskores::cont::make_ArrayHandleTransform(values, ComponentPortal(comp)), table, rgbaOut);
217 }
218 
221 template <typename T, int N, typename S>
224  const viskores::cont::ColorTable& table,
226 {
227  using namespace viskores::worklet::colorconversion;
229  viskores::cont::make_ArrayHandleTransform(values, ComponentPortal(comp)), table, rgbOut);
230 }
231 }
232 }
233 #endif // viskores_cont_ColorTableMap_h
ColorTable.h
viskores::cont::ColorTableSamplesRGBA::Samples
viskores::cont::ArrayHandle< viskores::Vec4ui_8 > Samples
Definition: ColorTableSamples.h:46
ArrayHandleTransform.h
viskores::cont::ColorTableMapComponent
bool ColorTableMapComponent(const viskores::cont::ArrayHandle< viskores::Vec< T, N >, S > &values, viskores::IdComponent comp, const viskores::cont::ColorTableSamplesRGBA &samples, viskores::cont::ArrayHandle< viskores::Vec4ui_8 > &rgbaOut)
Use a single component of a vector with a sample table to generate RGBA colors.
Definition: ColorTableMap.h:127
viskores::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:313
viskores::cont::ColorTableMapMagnitude
bool ColorTableMapMagnitude(const viskores::cont::ArrayHandle< viskores::Vec< T, N >, S > &values, const viskores::cont::ColorTableSamplesRGBA &samples, viskores::cont::ArrayHandle< viskores::Vec4ui_8 > &rgbaOut)
Use magnitude of a vector with a sample table to generate RGBA colors.
Definition: ColorTableMap.h:103
viskores::cont::DeviceAdapterTagAny
Tag for a device adapter used to specify that any device may be used for an operation.
Definition: DeviceAdapterTag.h:194
Invoker.h
viskores::IdComponent
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
ColorTable.h
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::cont::ColorTableSamplesRGB::Samples
viskores::cont::ArrayHandle< viskores::Vec3ui_8 > Samples
Definition: ColorTableSamples.h:66
viskores::cont::ColorTable
Color Table for coloring arbitrary fields.
Definition: cont/ColorTable.h:97
viskores::cont::ColorTableSamplesRGBA::NumberOfSamples
viskores::Int32 NumberOfSamples
Definition: ColorTableSamples.h:44
viskores::cont::ColorTableSamplesRGB::NumberOfSamples
viskores::Int32 NumberOfSamples
Definition: ColorTableSamples.h:64
ArrayHandleCounting.h
viskores::cont::ColorTableMap
bool ColorTableMap(const viskores::cont::ArrayHandle< T, S > &values, const viskores::cont::ColorTableSamplesRGBA &samples, viskores::cont::ArrayHandle< viskores::Vec4ui_8 > &rgbaOut)
Sample each value through an intermediate lookup/sample table to generate RGBA colors.
Definition: ColorTableMap.h:55
viskores::cont::Invoker
Allows launching any worklet without a dispatcher.
Definition: Invoker.h:49
viskores::cont::make_ArrayHandleTransform
viskores::cont::ArrayHandleTransform< HandleType, FunctorType > make_ArrayHandleTransform(HandleType handle, FunctorType functor)
make_ArrayHandleTransform is convenience function to generate an ArrayHandleTransform.
Definition: ArrayHandleTransform.h:495
viskores::cont::ColorTableSamplesRGBA
Color Sample Table used with viskores::cont::ColorTable for fast coloring.
Definition: ColorTableSamples.h:40
ColorTableSamples.h
viskores::worklet::colorconversion
Definition: ScalarsToColors.h:29
viskores::Vec
A short fixed-length array.
Definition: Types.h:365
viskores::cont::ColorTableSamplesRGB
Color Sample Table used with viskores::cont::ColorTable for fast coloring.
Definition: ColorTableSamples.h:60