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 =========================================================================*/
00051 #ifndef __vtkWindowLevelLookupTable_h
00052 #define __vtkWindowLevelLookupTable_h
00053 
00054 #include "vtkLookupTable.h"
00055 
00056 class VTK_COMMON_EXPORT vtkWindowLevelLookupTable : public vtkLookupTable
00057 {
00058 public:
00059   static vtkWindowLevelLookupTable *New();
00060   vtkTypeRevisionMacro(vtkWindowLevelLookupTable,vtkLookupTable);
00061   void PrintSelf(ostream& os, vtkIndent indent);
00062 
00065   void Build();
00066 
00068 
00070   void SetWindow(float window) {
00071     if (window < 1e-5f) { window = 1e-5f; }
00072     this->Window = window;
00073     this->SetTableRange(this->Level - this->Window/2.0f,
00074                         this->Level + this->Window/2.0f); };
00075   vtkGetMacro(Window,float);
00077 
00079 
00081   void SetLevel(float level) {
00082     this->Level = level;
00083     this->SetTableRange(this->Level - this->Window/2.0f,
00084                         this->Level + this->Window/2.0f); };
00085   vtkGetMacro(Level,float);
00087 
00089 
00091   void SetInverseVideo(int iv);
00092   vtkGetMacro(InverseVideo,int);
00093   vtkBooleanMacro(InverseVideo,int);
00095 
00097 
00100   vtkSetVector4Macro(MinimumTableValue,float);
00101   vtkGetVector4Macro(MinimumTableValue,float);
00103 
00105 
00108   vtkSetVector4Macro(MaximumTableValue,float);
00109   vtkGetVector4Macro(MaximumTableValue,float);
00111 
00113 
00115   void SetMinimumColor(int r, int g, int b, int a) {
00116     this->SetMinimumTableValue(r*255.0f,g*255.0f,b*255.0f,a*255.0f); };
00117   void SetMinimumColor(const unsigned char rgba[4]) {
00118     this->SetMinimumColor(rgba[0],rgba[1],rgba[2],rgba[3]); };
00119   void GetMinimumColor(unsigned char rgba[4]) {
00120     rgba[0] = int(this->MinimumColor[0]*255);
00121     rgba[1] = int(this->MinimumColor[1]*255);
00122     rgba[2] = int(this->MinimumColor[2]*255);
00123     rgba[3] = int(this->MinimumColor[3]*255); };
00124   unsigned char *GetMinimumColor() {
00125     this->GetMinimumColor(this->MinimumColor); 
00126     return this->MinimumColor; };
00128 
00130 
00132   void SetMaximumColor(int r, int g, int b, int a) {
00133     this->SetMaximumTableValue(r*255.0f,g*255.0f,b*255.0f,a*255.0f); };
00134   void SetMaximumColor(const unsigned char rgba[4]) {
00135     this->SetMaximumColor(rgba[0],rgba[1],rgba[2],rgba[3]); };
00136   void GetMaximumColor(unsigned char rgba[4]) {
00137     rgba[0] = int(this->MaximumColor[0]*255);
00138     rgba[1] = int(this->MaximumColor[1]*255);
00139     rgba[2] = int(this->MaximumColor[2]*255);
00140     rgba[3] = int(this->MaximumColor[3]*255); };
00141   unsigned char *GetMaximumColor() {
00142     this->GetMaximumColor(this->MaximumColor); 
00143     return this->MaximumColor; };
00145 
00146 protected:
00147   vtkWindowLevelLookupTable(int sze=256, int ext=256);
00148   ~vtkWindowLevelLookupTable() {};
00149 
00150   float Window;
00151   float Level;
00152   int InverseVideo;
00153   float MaximumTableValue[4];
00154   float MinimumTableValue[4];
00155   unsigned char MinimumColor[4];
00156   unsigned char MaximumColor[4];
00157 private:
00158   vtkWindowLevelLookupTable(const vtkWindowLevelLookupTable&);  // Not implemented.
00159   void operator=(const vtkWindowLevelLookupTable&);  // Not implemented.
00160 };
00161 
00162 #endif
00163 
00164