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   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00039 #ifndef __vtkWindowLevelLookupTable_h
00040 #define __vtkWindowLevelLookupTable_h
00041 
00042 #include "vtkLookupTable.h"
00043 
00044 class VTK_COMMON_EXPORT vtkWindowLevelLookupTable : public vtkLookupTable
00045 {
00046 public:
00047   static vtkWindowLevelLookupTable *New();
00048   vtkTypeRevisionMacro(vtkWindowLevelLookupTable,vtkLookupTable);
00049   void PrintSelf(ostream& os, vtkIndent indent);
00050 
00053   void Build();
00054 
00056 
00058   void SetWindow(float window) {
00059     if (window < 1e-5f) { window = 1e-5f; }
00060     this->Window = window;
00061     this->SetTableRange(this->Level - this->Window/2.0f,
00062                         this->Level + this->Window/2.0f); };
00063   vtkGetMacro(Window,float);
00065 
00067 
00069   void SetLevel(float level) {
00070     this->Level = level;
00071     this->SetTableRange(this->Level - this->Window/2.0f,
00072                         this->Level + this->Window/2.0f); };
00073   vtkGetMacro(Level,float);
00075 
00077 
00079   void SetInverseVideo(int iv);
00080   vtkGetMacro(InverseVideo,int);
00081   vtkBooleanMacro(InverseVideo,int);
00083 
00085 
00088   vtkSetVector4Macro(MinimumTableValue,float);
00089   vtkGetVector4Macro(MinimumTableValue,float);
00091 
00093 
00096   vtkSetVector4Macro(MaximumTableValue,float);
00097   vtkGetVector4Macro(MaximumTableValue,float);
00099 
00101 
00103   void SetMinimumColor(int r, int g, int b, int a) {
00104     this->SetMinimumTableValue(r*255.0f,g*255.0f,b*255.0f,a*255.0f); };
00105   void SetMinimumColor(const unsigned char rgba[4]) {
00106     this->SetMinimumColor(rgba[0],rgba[1],rgba[2],rgba[3]); };
00107   void GetMinimumColor(unsigned char rgba[4]) {
00108     rgba[0] = int(this->MinimumColor[0]*255);
00109     rgba[1] = int(this->MinimumColor[1]*255);
00110     rgba[2] = int(this->MinimumColor[2]*255);
00111     rgba[3] = int(this->MinimumColor[3]*255); };
00112   unsigned char *GetMinimumColor() {
00113     this->GetMinimumColor(this->MinimumColor); 
00114     return this->MinimumColor; };
00116 
00118 
00120   void SetMaximumColor(int r, int g, int b, int a) {
00121     this->SetMaximumTableValue(r*255.0f,g*255.0f,b*255.0f,a*255.0f); };
00122   void SetMaximumColor(const unsigned char rgba[4]) {
00123     this->SetMaximumColor(rgba[0],rgba[1],rgba[2],rgba[3]); };
00124   void GetMaximumColor(unsigned char rgba[4]) {
00125     rgba[0] = int(this->MaximumColor[0]*255);
00126     rgba[1] = int(this->MaximumColor[1]*255);
00127     rgba[2] = int(this->MaximumColor[2]*255);
00128     rgba[3] = int(this->MaximumColor[3]*255); };
00129   unsigned char *GetMaximumColor() {
00130     this->GetMaximumColor(this->MaximumColor); 
00131     return this->MaximumColor; };
00133 
00134 protected:
00135   vtkWindowLevelLookupTable(int sze=256, int ext=256);
00136   ~vtkWindowLevelLookupTable() {};
00137 
00138   float Window;
00139   float Level;
00140   int InverseVideo;
00141   float MaximumTableValue[4];
00142   float MinimumTableValue[4];
00143   unsigned char MinimumColor[4];
00144   unsigned char MaximumColor[4];
00145 private:
00146   vtkWindowLevelLookupTable(const vtkWindowLevelLookupTable&);  // Not implemented.
00147   void operator=(const vtkWindowLevelLookupTable&);  // Not implemented.
00148 };
00149 
00150 #endif
00151 
00152