1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: vtkPistonScalarsColors.h 5 6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 7 All rights reserved. 8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 9 10 This software is distributed WITHOUT ANY WARRANTY; without even 11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 12 PURPOSE. See the above copyright notice for more information. 13 14 =========================================================================*/ 15 // .NAME vtkPistonScalarsColors - Color Mapping for piston results. 16 // 17 // .SECTION Description 18 // vtkPistonMapper uses this class to interface vtkScalarsToColors to GPU 19 // side code that implements color mapping. 20 21 #ifndef vtkPistonScalarsColors_h 22 #define vtkPistonScalarsColors_h 23 24 #include "vtkAcceleratorsPistonModule.h" // For export macro 25 #include "vtkObject.h" 26 27 #include <vector> // vector is required 28 29 class vtkScalarsToColors; 30 31 class VTKACCELERATORSPISTON_EXPORT vtkPistonScalarsColors : public vtkObject 32 { 33 public: 34 vtkTypeMacro(vtkPistonScalarsColors, vtkObject); 35 36 // Description: 37 // Create an object with Debug turned off, modified time initialized 38 // to zero, and reference counting on. 39 static vtkPistonScalarsColors *New(); 40 41 // Description: 42 // Methods invoked by print to print information about the object 43 // including superclasses. Typically not called by the user (use 44 // Print() instead) but used in the hierarchical print process to 45 // combine the output of several classes. 46 virtual void PrintSelf(ostream &os, vtkIndent indent); 47 48 // Description: 49 // Set number of distinct color values 50 vtkSetMacro(NumberOfValues, int); 51 // Get number of distinct color values 52 vtkGetMacro(NumberOfValues, int); 53 54 // Description: 55 // Set/Get the minimum/maximum scalar values for scalar mapping. Scalar 56 // values less than minimum range value are clamped to minimum range value. 57 // Scalar values greater than maximum range value are clamped to maximum 58 // range value. 59 void SetTableRange(double range[2]); 60 virtual void SetTableRange(double rmin, double rmax); 61 vtkGetVectorMacro(TableRange, double, 2); 62 63 // Description: 64 // Set lookup table to be used to map scalars to colors 65 virtual void SetLookupTable(vtkScalarsToColors *); 66 vtkGetObjectMacro(LookupTable, vtkScalarsToColors); 67 68 // Description: 69 // Compute scalars to colors as unsigned char. Size of the vector returned 70 // will be NumberOfValues * numberOfChanels 71 virtual std::vector<unsigned char>* ComputeScalarsColors( 72 int numberOfChanels); 73 74 // Description: 75 // Compute scalars to colors as floats. Size of the vector returned 76 // will be NumberOfValues * numberOfChanels 77 virtual std::vector<float>* ComputeScalarsColorsf(int numberOfChanels); 78 79 80 protected: 81 vtkPistonScalarsColors(); 82 ~vtkPistonScalarsColors(); 83 84 // Description: 85 // Internal helper method 86 void ComputeValues(float *values); 87 88 double TableRange[2]; 89 int NumberOfValues; 90 91 vtkTimeStamp ComputeColorsTime; 92 std::vector<unsigned char> ScalarsColors; 93 94 vtkTimeStamp ComputeColorsfTime; 95 std::vector<float> ScalarsColorsf; 96 97 vtkScalarsToColors *LookupTable; 98 99 private: 100 vtkPistonScalarsColors(const vtkPistonScalarsColors&); // Not implemented. 101 void operator=(const vtkPistonScalarsColors&); // Not implemented. 102 }; 103 104 #endif // vtkPistonScalarsColors_h 105