00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00062 #ifndef __vtkWindowLevelLookupTable_h
00063 #define __vtkWindowLevelLookupTable_h
00064 
00065 #include "vtkObject.h"
00066 #include "vtkLookupTable.h"
00067 
00068 class VTK_COMMON_EXPORT vtkWindowLevelLookupTable : public vtkLookupTable
00069 {
00070 public:
00071   static vtkWindowLevelLookupTable *New();
00072   vtkTypeMacro(vtkWindowLevelLookupTable,vtkLookupTable);
00073   void PrintSelf(ostream& os, vtkIndent indent);
00074 
00077   void Build();
00078 
00080 
00082   void SetWindow(float window) {
00083     if (window < 1e-5) { window = 1e-5; }
00084     this->Window = window;
00085     this->SetTableRange(this->Level - this->Window/2.0,
00086                         this->Level + this->Window/2.0); };
00087   vtkGetMacro(Window,float);
00089 
00091 
00093   void SetLevel(float level) {
00094     this->Level = level;
00095     this->SetTableRange(this->Level - this->Window/2.0,
00096                         this->Level + this->Window/2.0); };
00097   vtkGetMacro(Level,float);
00099 
00101 
00103   void SetInverseVideo(int iv);
00104   vtkGetMacro(InverseVideo,int);
00105   vtkBooleanMacro(InverseVideo,int);
00107 
00109 
00112   vtkSetVector4Macro(MinimumTableValue,float);
00113   vtkGetVector4Macro(MinimumTableValue,float);
00115 
00117 
00120   vtkSetVector4Macro(MaximumTableValue,float);
00121   vtkGetVector4Macro(MaximumTableValue,float);
00123 
00125 
00127   void SetMinimumColor(int r, int g, int b, int a) {
00128     this->SetMinimumTableValue(r*255.0,g*255.0,b*255.0,a*255.0); };
00129   void SetMinimumColor(const unsigned char rgba[4]) {
00130     this->SetMinimumColor(rgba[0],rgba[1],rgba[2],rgba[3]); };
00131   void GetMinimumColor(unsigned char rgba[4]) {
00132     rgba[0] = int(this->MinimumColor[0]*255);
00133     rgba[1] = int(this->MinimumColor[1]*255);
00134     rgba[2] = int(this->MinimumColor[2]*255);
00135     rgba[3] = int(this->MinimumColor[3]*255); };
00136   unsigned char *GetMinimumColor() {
00137     this->GetMinimumColor(this->MinimumColor); 
00138     return this->MinimumColor; };
00140 
00142 
00144   void SetMaximumColor(int r, int g, int b, int a) {
00145     this->SetMaximumTableValue(r*255.0,g*255.0,b*255.0,a*255.0); };
00146   void SetMaximumColor(const unsigned char rgba[4]) {
00147     this->SetMaximumColor(rgba[0],rgba[1],rgba[2],rgba[3]); };
00148   void GetMaximumColor(unsigned char rgba[4]) {
00149     rgba[0] = int(this->MaximumColor[0]*255);
00150     rgba[1] = int(this->MaximumColor[1]*255);
00151     rgba[2] = int(this->MaximumColor[2]*255);
00152     rgba[3] = int(this->MaximumColor[3]*255); };
00153   unsigned char *GetMaximumColor() {
00154     this->GetMaximumColor(this->MaximumColor); 
00155     return this->MaximumColor; };
00157 
00158 protected:
00159   vtkWindowLevelLookupTable(int sze=256, int ext=256);
00160   ~vtkWindowLevelLookupTable() {};
00161 
00162   float Window;
00163   float Level;
00164   int InverseVideo;
00165   float MaximumTableValue[4];
00166   float MinimumTableValue[4];
00167   unsigned char MinimumColor[4];
00168   unsigned char MaximumColor[4];
00169 private:
00170   vtkWindowLevelLookupTable(const vtkWindowLevelLookupTable&);  
00171   void operator=(const vtkWindowLevelLookupTable&);  
00172 };
00173 
00174 #endif
00175 
00176