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

Common/vtkWindowLevelLookupTable.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkWindowLevelLookupTable.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 =========================================================================*/
00035 #ifndef __vtkWindowLevelLookupTable_h
00036 #define __vtkWindowLevelLookupTable_h
00037 
00038 #include "vtkLookupTable.h"
00039 
00040 class VTK_COMMON_EXPORT vtkWindowLevelLookupTable : public vtkLookupTable
00041 {
00042 public:
00043   static vtkWindowLevelLookupTable *New();
00044   vtkTypeRevisionMacro(vtkWindowLevelLookupTable,vtkLookupTable);
00045   void PrintSelf(ostream& os, vtkIndent indent);
00046 
00049   void Build();
00050 
00052 
00054   void SetWindow(double window) {
00055     if (window < 1e-5f) { window = 1e-5f; }
00056     this->Window = window;
00057     this->SetTableRange(this->Level - this->Window/2.0f,
00058                         this->Level + this->Window/2.0f); };
00059   vtkGetMacro(Window,double);
00061 
00063 
00065   void SetLevel(double level) {
00066     this->Level = level;
00067     this->SetTableRange(this->Level - this->Window/2.0f,
00068                         this->Level + this->Window/2.0f); };
00069   vtkGetMacro(Level,double);
00071 
00073 
00075   void SetInverseVideo(int iv);
00076   vtkGetMacro(InverseVideo,int);
00077   vtkBooleanMacro(InverseVideo,int);
00079 
00081 
00084   vtkSetVector4Macro(MinimumTableValue,double);
00085   vtkGetVector4Macro(MinimumTableValue,double);
00087 
00089 
00092   vtkSetVector4Macro(MaximumTableValue,double);
00093   vtkGetVector4Macro(MaximumTableValue,double);
00095 
00097 
00099   void SetMinimumColor(int r, int g, int b, int a) {
00100     this->SetMinimumTableValue(r*255.0f,g*255.0f,b*255.0f,a*255.0f); };
00101   void SetMinimumColor(const unsigned char rgba[4]) {
00102     this->SetMinimumColor(rgba[0],rgba[1],rgba[2],rgba[3]); };
00103   void GetMinimumColor(unsigned char rgba[4]) {
00104     rgba[0] = int(this->MinimumColor[0]*255);
00105     rgba[1] = int(this->MinimumColor[1]*255);
00106     rgba[2] = int(this->MinimumColor[2]*255);
00107     rgba[3] = int(this->MinimumColor[3]*255); };
00108   unsigned char *GetMinimumColor() {
00109     this->GetMinimumColor(this->MinimumColor); 
00110     return this->MinimumColor; };
00112 
00114 
00116   void SetMaximumColor(int r, int g, int b, int a) {
00117     this->SetMaximumTableValue(r*255.0f,g*255.0f,b*255.0f,a*255.0f); };
00118   void SetMaximumColor(const unsigned char rgba[4]) {
00119     this->SetMaximumColor(rgba[0],rgba[1],rgba[2],rgba[3]); };
00120   void GetMaximumColor(unsigned char rgba[4]) {
00121     rgba[0] = int(this->MaximumColor[0]*255);
00122     rgba[1] = int(this->MaximumColor[1]*255);
00123     rgba[2] = int(this->MaximumColor[2]*255);
00124     rgba[3] = int(this->MaximumColor[3]*255); };
00125   unsigned char *GetMaximumColor() {
00126     this->GetMaximumColor(this->MaximumColor); 
00127     return this->MaximumColor; };
00129 
00130 protected:
00131   vtkWindowLevelLookupTable(int sze=256, int ext=256);
00132   ~vtkWindowLevelLookupTable() {};
00133 
00134   double Window;
00135   double Level;
00136   int InverseVideo;
00137   double MaximumTableValue[4];
00138   double MinimumTableValue[4];
00139   unsigned char MinimumColor[4];
00140   unsigned char MaximumColor[4];
00141 private:
00142   vtkWindowLevelLookupTable(const vtkWindowLevelLookupTable&);  // Not implemented.
00143   void operator=(const vtkWindowLevelLookupTable&);  // Not implemented.
00144 };
00145 
00146 #endif
00147 
00148