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:    %M%
00005   Language:  C++
00006 
00007 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00008 All rights reserved.
00009 
00010 Redistribution and use in source and binary forms, with or without
00011 modification, are permitted provided that the following conditions are met:
00012 
00013  * Redistributions of source code must retain the above copyright notice,
00014    this list of conditions and the following disclaimer.
00015 
00016  * Redistributions in binary form must reproduce the above copyright notice,
00017    this list of conditions and the following disclaimer in the documentation
00018    and/or other materials provided with the distribution.
00019 
00020  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00021    of any contributors may be used to endorse or promote products derived
00022    from this software without specific prior written permission.
00023 
00024  * Modified source versions must be plainly marked as such, and must not be
00025    misrepresented as being the original software.
00026 
00027 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00028 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00029 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00030 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00031 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00032 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00033 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00034 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00035 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00036 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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&);  // Not implemented.
00171   void operator=(const vtkWindowLevelLookupTable&);  // Not implemented.
00172 };
00173 
00174 #endif
00175 
00176 

Generated on Thu Mar 28 14:19:18 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001