• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/Common/vtkScalarsToColors.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkScalarsToColors.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00030 #ifndef __vtkScalarsToColors_h
00031 #define __vtkScalarsToColors_h
00032 
00033 #include "vtkObject.h"
00034 
00035 class vtkDataArray;
00036 class vtkUnsignedCharArray;
00037 
00038 class VTK_COMMON_EXPORT vtkScalarsToColors : public vtkObject
00039 {
00040 public:
00041   vtkTypeRevisionMacro(vtkScalarsToColors,vtkObject);
00042   void PrintSelf(ostream& os, vtkIndent indent);
00043   
00046   virtual int IsOpaque();
00047   
00049   virtual void Build() {};
00050   
00052 
00053   virtual double *GetRange() = 0;
00054   virtual void SetRange(double min, double max) = 0;
00055   void SetRange(double rng[2]) 
00056     {this->SetRange(rng[0],rng[1]);}
00058   
00061   virtual unsigned char *MapValue(double v) = 0;
00062 
00065   virtual void GetColor(double v, double rgb[3]) = 0;
00066 
00068 
00070   double *GetColor(double v)
00071     {this->GetColor(v,this->RGB); return this->RGB;}
00073  
00075 
00077   virtual double GetOpacity(double vtkNotUsed(v)) 
00078     {return 1.0;}
00080 
00082 
00085   double GetLuminance(double x) 
00086     {double rgb[3]; this->GetColor(x,rgb);
00087     return static_cast<double>(rgb[0]*0.30 + rgb[1]*0.59 + rgb[2]*0.11);}
00089 
00091 
00095   virtual void SetAlpha(double alpha);
00096   vtkGetMacro(Alpha,double);
00098 
00100 
00109   virtual vtkUnsignedCharArray *MapScalars(vtkDataArray *scalars, int colorMode,
00110                                    int component);
00112 
00114 
00115   vtkSetMacro(VectorMode, int);
00116   vtkGetMacro(VectorMode, int);
00117   void SetVectorModeToMagnitude();
00118   void SetVectorModeToComponent();
00120 
00121 //BTX
00122   enum VectorModes {
00123     MAGNITUDE=0,
00124     COMPONENT=1
00125   };
00126 //ETX
00127 
00128 
00130 
00132   vtkSetMacro(VectorComponent, int);
00133   vtkGetMacro(VectorComponent, int);
00135   
00137 
00142   void MapScalarsThroughTable(vtkDataArray *scalars, 
00143                               unsigned char *output,
00144                               int outputFormat);
00145   void MapScalarsThroughTable(vtkDataArray *scalars, 
00146                               unsigned char *output) 
00147     {this->MapScalarsThroughTable(scalars,output,VTK_RGBA);}
00149 
00150 
00152 
00153   virtual void MapScalarsThroughTable2(void *input, unsigned char *output,
00154                                        int inputDataType, int numberOfValues,
00155                                        int inputIncrement, 
00156                                        int outputFormat) = 0;
00158 
00160 
00163   virtual vtkUnsignedCharArray *ConvertUnsignedCharToRGBA(
00164     vtkUnsignedCharArray *colors, int numComp, int numTuples);
00166 
00168 
00170   virtual int UsingLogScale()
00171     { return 0; }
00173 protected:
00174   vtkScalarsToColors();
00175   ~vtkScalarsToColors() {}
00176 
00177   double Alpha;
00178 
00179   // How to map arrays with multiple components.
00180   int VectorMode;
00181   // Internal flag used to togle between vector and component mode.
00182   // We need this flag because the mapper can override our mode, and
00183   // I do not want to change the interface to the map scalars methods.
00184   int UseMagnitude;
00185   int VectorComponent;
00186 
00187 private:
00188   double RGB[3];
00189 
00190   vtkScalarsToColors(const vtkScalarsToColors&);  // Not implemented.
00191   void operator=(const vtkScalarsToColors&);  // Not implemented.
00192 };
00193 
00194 #endif
00195 
00196 
00197 

Generated by  doxygen 1.7.1