OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / SGI / util / SGI / include / vtk / vtkWindowLevelLookupTable.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    %M%
5   Language:  C++
6   Date:      %D%
7   Version:   %V%
8
9 Copyright (c) 1993-1998 Ken Martin, Will Schroeder, Bill Lorensen.
10
11 This software is copyrighted by Ken Martin, Will Schroeder and Bill Lorensen.
12 The following terms apply to all files associated with the software unless
13 explicitly disclaimed in individual files. This copyright specifically does
14 not apply to the related textbook "The Visualization Toolkit" ISBN
15 013199837-4 published by Prentice Hall which is covered by its own copyright.
16
17 The authors hereby grant permission to use, copy, and distribute this
18 software and its documentation for any purpose, provided that existing
19 copyright notices are retained in all copies and that this notice is included
20 verbatim in any distributions. Additionally, the authors grant permission to
21 modify this software and its documentation for any purpose, provided that
22 such modifications are not distributed without the explicit consent of the
23 authors and that existing copyright notices are retained in all copies. Some
24 of the algorithms implemented by this software are patented, observe all
25 applicable patent law.
26
27 IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
28 DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
29 OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
30 EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32 THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
33 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
34 PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE IS PROVIDED ON AN
35 "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
36 MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
37
38
39 =========================================================================*/
40 // .NAME vtkWindowLevelLookupTable - map scalar values into colors or colors to scalars; generate color table
41 // .SECTION Description
42 // vtkWindowLevelLookupTable is an object that is used by mapper objects
43 // to map scalar values into rgba (red-green-blue-alpha transparency)
44 // color specification, or rgba into scalar values. The color table can
45 // be created by direct insertion of color values, or by specifying a
46 // window and level. Window / Level is used in medical imaging to specify
47 // a lienar greyscale ramp. The Level is the center of the ramp.  The
48 // Window is the width of the ramp.
49 // .SECTION Caveats
50 // vtkWindowLevelLookupTable is a reference counted object. Therefore, you should 
51 // always use operator "new" to construct new objects. This procedure will
52 // avoid memory problems (see text).
53 // .SECTION See Also
54 // vtkLogLookupTable
55
56 #ifndef __vtkWindowLevelLookupTable_h
57 #define __vtkWindowLevelLookupTable_h
58
59 #include "vtkReferenceCount.h"
60 #include "vtkLookupTable.h"
61
62 class VTK_EXPORT vtkWindowLevelLookupTable : public vtkLookupTable
63 {
64 public:
65   vtkWindowLevelLookupTable(int sze=256, int ext=256);
66   void Build();
67   static vtkWindowLevelLookupTable *New() {return new vtkWindowLevelLookupTable;};
68   const char *GetClassName() {return "vtkWindowLevelLookupTable";};
69   void PrintSelf(ostream& os, vtkIndent indent);
70
71   // Description:
72   // Set the Window for the lookuptable. Window is the width of the lookuptable
73   // ramp.
74   vtkSetClampMacro(Window,float,1.0,65536.0);
75   vtkGetMacro(Window,float);
76
77   // Description:
78   // Set the Level for the lookuptable. Level is the center of the ramp of the
79   // lookuptable.
80   // ramp.
81   vtkSetMacro(Level,float);
82   vtkGetMacro(Level,float);
83
84   // Description:
85   // Set inverse video on or off.
86   vtkSetMacro(InverseVideo,int);
87   vtkGetMacro(InverseVideo,int);
88   vtkBooleanMacro(InverseVideo,int);
89
90   // Description:
91   // Set the Minimum color. All lookup table entries below the start of the ramp
92   // will be set to this color.
93   vtkSetVector4Macro(MinimumColor,unsigned char);
94   vtkGetVectorMacro(MinimumColor,unsigned char,4);
95
96   // Description:
97   // Set the Maximum color. All lookup table entries above the end of the ramp
98   // will be set to this color.
99   vtkSetVector4Macro(MaximumColor,unsigned char);
100   vtkGetVectorMacro(MaximumColor,unsigned char,4);
101
102 protected:
103   float Window;
104   float Level;
105   int MapScalarToIndex (float scalar);
106   int InverseVideo;
107   unsigned char MinimumColor[4];
108   unsigned char MaximumColor[4];
109 };
110
111 #endif
112
113