1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkBooleanTexture.h
5 
6   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7   All rights reserved.
8   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10      This software is distributed WITHOUT ANY WARRANTY; without even
11      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12      PURPOSE.  See the above copyright notice for more information.
13 
14 =========================================================================*/
15 // .NAME vtkBooleanTexture - generate 2D texture map based on combinations of inside, outside, and on region boundary
16 
17 // .SECTION Description
18 // vtkBooleanTexture is a filter to generate a 2D texture map based on
19 // combinations of inside, outside, and on region boundary. The "region" is
20 // implicitly represented via 2D texture coordinates. These texture
21 // coordinates are normally generated using a filter like
22 // vtkImplicitTextureCoords, which generates the texture coordinates for
23 // any implicit function.
24 //
25 // vtkBooleanTexture generates the map according to the s-t texture
26 // coordinates plus the notion of being in, on, or outside of a
27 // region. An in region is when the texture coordinate is between
28 // (0,0.5-thickness/2).  An out region is where the texture coordinate
29 // is (0.5+thickness/2). An on region is between
30 // (0.5-thickness/2,0.5+thickness/2). The combination in, on, and out
31 // for each of the s-t texture coordinates results in 16 possible
32 // combinations (see text). For each combination, a different value of
33 // intensity and transparency can be assigned. To assign maximum intensity
34 // and/or opacity use the value 255. A minimum value of 0 results in
35 // a black region (for intensity) and a fully transparent region (for
36 // transparency).
37 
38 // .SECTION See Also
39 // vtkImplicitTextureCoords vtkThresholdTextureCoords
40 
41 #ifndef vtkBooleanTexture_h
42 #define vtkBooleanTexture_h
43 
44 #include "vtkImagingHybridModule.h" // For export macro
45 #include "vtkImageAlgorithm.h"
46 
47 class VTKIMAGINGHYBRID_EXPORT vtkBooleanTexture : public vtkImageAlgorithm
48 {
49 public:
50   static vtkBooleanTexture *New();
51 
52   vtkTypeMacro(vtkBooleanTexture,vtkImageAlgorithm);
53   void PrintSelf(ostream& os, vtkIndent indent);
54 
55   // Description:
56   // Set the X texture map dimension.
57   vtkSetMacro(XSize,int);
58   vtkGetMacro(XSize,int);
59 
60   // Description:
61   // Set the Y texture map dimension.
62   vtkSetMacro(YSize,int);
63   vtkGetMacro(YSize,int);
64 
65   // Description:
66   // Set the thickness of the "on" region.
67   vtkSetMacro(Thickness,int);
68   vtkGetMacro(Thickness,int);
69 
70   // Description:
71   // Specify intensity/transparency for "in/in" region.
72   vtkSetVector2Macro(InIn,unsigned char);
73   vtkGetVectorMacro(InIn,unsigned char,2);
74 
75   // Description:
76   // Specify intensity/transparency for "in/out" region.
77   vtkSetVector2Macro(InOut,unsigned char);
78   vtkGetVectorMacro(InOut,unsigned char,2);
79 
80   // Description:
81   // Specify intensity/transparency for "out/in" region.
82   vtkSetVector2Macro(OutIn,unsigned char);
83   vtkGetVectorMacro(OutIn,unsigned char,2);
84 
85   // Description:
86   // Specify intensity/transparency for "out/out" region.
87   vtkSetVector2Macro(OutOut,unsigned char);
88   vtkGetVectorMacro(OutOut,unsigned char,2);
89 
90   // Description:
91   // Specify intensity/transparency for "on/on" region.
92   vtkSetVector2Macro(OnOn,unsigned char);
93   vtkGetVectorMacro(OnOn,unsigned char,2);
94 
95   // Description:
96   // Specify intensity/transparency for "on/in" region.
97   vtkSetVector2Macro(OnIn,unsigned char);
98   vtkGetVectorMacro(OnIn,unsigned char,2);
99 
100   // Description:
101   // Specify intensity/transparency for "on/out" region.
102   vtkSetVector2Macro(OnOut,unsigned char);
103   vtkGetVectorMacro(OnOut,unsigned char,2);
104 
105   // Description:
106   // Specify intensity/transparency for "in/on" region.
107   vtkSetVector2Macro(InOn,unsigned char);
108   vtkGetVectorMacro(InOn,unsigned char,2);
109 
110   // Description:
111   // Specify intensity/transparency for "out/on" region.
112   vtkSetVector2Macro(OutOn,unsigned char);
113   vtkGetVectorMacro(OutOn,unsigned char,2);
114 
115 protected:
116   vtkBooleanTexture();
~vtkBooleanTexture()117   ~vtkBooleanTexture() {}
118 
119   virtual int RequestInformation (vtkInformation *, vtkInformationVector**, vtkInformationVector *);
120   virtual void ExecuteDataWithInformation(vtkDataObject *data, vtkInformation* outInfo);
121 
122   int XSize;
123   int YSize;
124 
125   int Thickness;
126   unsigned char InIn[2];
127   unsigned char InOut[2];
128   unsigned char OutIn[2];
129   unsigned char OutOut[2];
130   unsigned char OnOn[2];
131   unsigned char OnIn[2];
132   unsigned char OnOut[2];
133   unsigned char InOn[2];
134   unsigned char OutOn[2];
135 
136 private:
137   vtkBooleanTexture(const vtkBooleanTexture&);  // Not implemented.
138   void operator=(const vtkBooleanTexture&);  // Not implemented.
139 };
140 
141 #endif
142 
143 
144