Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

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   
00045   virtual void Build() {};
00046   
00048 
00049   virtual double *GetRange() = 0;
00050   virtual void SetRange(double min, double max) = 0;
00051   void SetRange(double rng[2]) 
00052     {this->SetRange(rng[0],rng[1]);}
00054   
00057   virtual unsigned char *MapValue(double v) = 0;
00058 
00061   virtual void GetColor(double v, double rgb[3]) = 0;
00062 
00064 
00066   double *GetColor(double v)
00067     {this->GetColor(v,this->RGB); return this->RGB;}
00069  
00071 
00073   virtual double GetOpacity(double vtkNotUsed(v)) 
00074     {return 1.0;}
00076 
00078 
00081   double GetLuminance(double x) 
00082     {double rgb[3]; this->GetColor(x,rgb);
00083     return static_cast<double>(rgb[0]*0.30 + rgb[1]*0.59 + rgb[2]*0.11);}
00085 
00087 
00091   void SetAlpha(double alpha);
00092   vtkGetMacro(Alpha,double);
00094 
00096 
00105   vtkUnsignedCharArray *MapScalars(vtkDataArray *scalars, int colorMode,
00106                                    int component);
00108 
00110 
00111   vtkSetMacro(VectorMode, int);
00112   vtkGetMacro(VectorMode, int);
00113   void SetVectorModeToMagnitude();
00114   void SetVectorModeToComponent();
00116 
00117 //BTX
00118   enum VectorModes {
00119     MAGNITUDE=0,
00120     COMPONENT=1
00121   };
00122 //ETX
00123 
00124 
00126 
00128   vtkSetMacro(VectorComponent, int);
00129   vtkGetMacro(VectorComponent, int);
00131   
00133 
00138   void MapScalarsThroughTable(vtkDataArray *scalars, 
00139                               unsigned char *output,
00140                               int outputFormat);
00141   void MapScalarsThroughTable(vtkDataArray *scalars, 
00142                               unsigned char *output) 
00143     {this->MapScalarsThroughTable(scalars,output,VTK_RGBA);}
00145 
00146 
00148 
00149   virtual void MapScalarsThroughTable2(void *input, unsigned char *output,
00150                                        int inputDataType, int numberOfValues,
00151                                        int inputIncrement, 
00152                                        int outputFormat) = 0;
00154 
00156 
00159   virtual vtkUnsignedCharArray *ConvertUnsignedCharToRGBA(
00160     vtkUnsignedCharArray *colors, int numComp, int numTuples);
00162 
00163 protected:
00164   vtkScalarsToColors();
00165   ~vtkScalarsToColors() {}
00166 
00167   double Alpha;
00168 
00169   // How to map arrays with multiple components.
00170   int VectorMode;
00171   // Internal flag used to togle between vector and component mode.
00172   // We need this flag because the mapper can override our mode, and
00173   // I do not want to change the interface to the map scalars methods.
00174   int UseMagnitude;
00175   int VectorComponent;
00176 
00177 private:
00178   double RGB[3];
00179 
00180   vtkScalarsToColors(const vtkScalarsToColors&);  // Not implemented.
00181   void operator=(const vtkScalarsToColors&);  // Not implemented.
00182 };
00183 
00184 #endif
00185 
00186 
00187 

Generated on Mon Jan 21 23:07:18 2008 for VTK by  doxygen 1.4.3-20050530