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