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

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 =========================================================================*/
00048 #ifndef __vtkWindowLevelLookupTable_h
00049 #define __vtkWindowLevelLookupTable_h
00050 
00051 #include "vtkLookupTable.h"
00052 
00053 class VTK_COMMON_EXPORT vtkWindowLevelLookupTable : public vtkLookupTable
00054 {
00055 public:
00056   static vtkWindowLevelLookupTable *New();
00057   vtkTypeRevisionMacro(vtkWindowLevelLookupTable,vtkLookupTable);
00058   void PrintSelf(ostream& os, vtkIndent indent);
00059 
00062   void Build();
00063 
00065 
00067   void SetWindow(double window) {
00068     if (window < 1e-5) { window = 1e-5; }
00069     this->Window = window;
00070     this->SetTableRange(this->Level - this->Window/2.0,
00071                         this->Level + this->Window/2.0); };
00072   vtkGetMacro(Window,double);
00074 
00076 
00078   void SetLevel(double level) {
00079     this->Level = level;
00080     this->SetTableRange(this->Level - this->Window/2.0,
00081                         this->Level + this->Window/2.0); };
00082   vtkGetMacro(Level,double);
00084 
00086 
00088   void SetInverseVideo(int iv);
00089   vtkGetMacro(InverseVideo,int);
00090   vtkBooleanMacro(InverseVideo,int);
00092 
00094 
00097   vtkSetVector4Macro(MinimumTableValue,double);
00098   vtkGetVector4Macro(MinimumTableValue,double);
00100 
00102 
00105   vtkSetVector4Macro(MaximumTableValue,double);
00106   vtkGetVector4Macro(MaximumTableValue,double);
00108 
00110 
00112   void SetMinimumColor(int r, int g, int b, int a) {
00113     this->SetMinimumTableValue(r*255.0,g*255.0,b*255.0,a*255.0); };
00114   void SetMinimumColor(const unsigned char rgba[4]) {
00115     this->SetMinimumColor(rgba[0],rgba[1],rgba[2],rgba[3]); };
00116   void GetMinimumColor(unsigned char rgba[4]) {
00117     rgba[0] = int(this->MinimumColor[0]*255);
00118     rgba[1] = int(this->MinimumColor[1]*255);
00119     rgba[2] = int(this->MinimumColor[2]*255);
00120     rgba[3] = int(this->MinimumColor[3]*255); };
00121   unsigned char *GetMinimumColor() {
00122     this->GetMinimumColor(this->MinimumColor); 
00123     return this->MinimumColor; };
00125 
00127 
00129   void SetMaximumColor(int r, int g, int b, int a) {
00130     this->SetMaximumTableValue(r*255.0,g*255.0,b*255.0,a*255.0); };
00131   void SetMaximumColor(const unsigned char rgba[4]) {
00132     this->SetMaximumColor(rgba[0],rgba[1],rgba[2],rgba[3]); };
00133   void GetMaximumColor(unsigned char rgba[4]) {
00134     rgba[0] = int(this->MaximumColor[0]*255);
00135     rgba[1] = int(this->MaximumColor[1]*255);
00136     rgba[2] = int(this->MaximumColor[2]*255);
00137     rgba[3] = int(this->MaximumColor[3]*255); };
00138   unsigned char *GetMaximumColor() {
00139     this->GetMaximumColor(this->MaximumColor); 
00140     return this->MaximumColor; };
00142 
00143 protected:
00144   vtkWindowLevelLookupTable(int sze=256, int ext=256);
00145   ~vtkWindowLevelLookupTable() {};
00146 
00147   double Window;
00148   double Level;
00149   int InverseVideo;
00150   double MaximumTableValue[4];
00151   double MinimumTableValue[4];
00152   unsigned char MinimumColor[4];
00153   unsigned char MaximumColor[4];
00154 private:
00155   vtkWindowLevelLookupTable(const vtkWindowLevelLookupTable&);  // Not implemented.
00156   void operator=(const vtkWindowLevelLookupTable&);  // Not implemented.
00157 };
00158 
00159 #endif
00160 
00161