VTK
vtkImageCanvasSource2D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageCanvasSource2D.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 =========================================================================*/
30 #ifndef vtkImageCanvasSource2D_h
31 #define vtkImageCanvasSource2D_h
32 
33 #include "vtkImagingSourcesModule.h" // For export macro
34 #include "vtkImageAlgorithm.h"
35 
36 class VTKIMAGINGSOURCES_EXPORT vtkImageCanvasSource2D : public vtkImageAlgorithm
37 {
38 public:
42  static vtkImageCanvasSource2D *New();
43 
45  void PrintSelf(ostream& os, vtkIndent indent);
46 
48 
52  vtkSetVector4Macro(DrawColor, double);
53  vtkGetVector4Macro(DrawColor, double);
55 
59  void SetDrawColor(double a) {this->SetDrawColor(a, 0.0, 0.0, 0.0);}
60 
64  void SetDrawColor(double a,double b) {this->SetDrawColor(a, b, 0.0, 0.0);}
65 
69  void SetDrawColor(double a, double b, double c) {
70  this->SetDrawColor(a, b, c, 0.0);}
71 
75  void InitializeCanvasVolume(vtkImageData *volume);
76 
78 
82  void FillBox(int min0, int max0, int min1, int max1);
83  void FillTube(int x0, int y0, int x1, int y1, double radius);
84  void FillTriangle(int x0, int y0, int x1, int y1, int x2, int y2);
85  void DrawCircle(int c0, int c1, double radius);
86  void DrawPoint(int p0, int p1);
87  void DrawSegment(int x0, int y0, int x1, int y1);
88  void DrawSegment3D(double *p0, double *p1);
89  void DrawSegment3D(double x1, double y1, double z1,
90  double x2, double y2, double z2)
91  { double p1[3], p2[3];
92  p1[0] = x1; p1[1] = y1; p1[2] = z1; p2[0] = x2; p2[1] = y2; p2[2] = z2;
93  this->DrawSegment3D(p1, p2);}
95 
100  void DrawImage(int x0, int y0, vtkImageData* i)
101  { this->DrawImage(x0, y0, i, -1, -1, -1, -1); }
102  void DrawImage(int x0, int y0, vtkImageData*, int sx, int sy,
103  int width, int height);
104 
110  void FillPixel(int x, int y);
111 
113 
118  void SetExtent(int *extent);
119  void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
121 
123 
128  vtkSetMacro(DefaultZ, int);
129  vtkGetMacro(DefaultZ, int);
131 
133 
138  vtkSetVector3Macro(Ratio, double);
139  vtkGetVector3Macro(Ratio, double);
141 
143 
146  virtual void SetNumberOfScalarComponents(int i);
147  virtual int GetNumberOfScalarComponents() const;
149 
151 
158  void SetScalarTypeToFloat(){this->SetScalarType(VTK_FLOAT);};
159  void SetScalarTypeToDouble(){this->SetScalarType(VTK_DOUBLE);};
160  void SetScalarTypeToInt(){this->SetScalarType(VTK_INT);};
162  {this->SetScalarType(VTK_UNSIGNED_INT);};
163  void SetScalarTypeToLong(){this->SetScalarType(VTK_LONG);};
165  {this->SetScalarType(VTK_UNSIGNED_LONG);};
166  void SetScalarTypeToShort(){this->SetScalarType(VTK_SHORT);};
168  {this->SetScalarType(VTK_UNSIGNED_SHORT);};
170  {this->SetScalarType(VTK_UNSIGNED_CHAR);};
172  {this->SetScalarType(VTK_CHAR);};
173  void SetScalarType(int);
174  int GetScalarType() const;
176 
177 protected:
179  // Destructor: Deleting a vtkImageCanvasSource2D automatically deletes the
180  // associated vtkImageData. However, since the data is reference counted,
181  // it may not actually be deleted.
183 
185  int WholeExtent[6];
186  double DrawColor[4];
187  int DefaultZ;
188  double Ratio[3];
189 
190  int ClipSegment(int &a0, int &a1, int &b0, int &b1);
191 
192  virtual int RequestInformation (vtkInformation *,
195  virtual int RequestData (vtkInformation *,
198 
199 private:
200  vtkImageCanvasSource2D(const vtkImageCanvasSource2D&) VTK_DELETE_FUNCTION;
201  void operator=(const vtkImageCanvasSource2D&) VTK_DELETE_FUNCTION;
202 };
203 
204 
205 
206 #endif
207 
208 
void SetScalarTypeToInt()
Set/Get the data scalar type (i.e VTK_DOUBLE).
void SetScalarTypeToUnsignedInt()
Set/Get the data scalar type (i.e VTK_DOUBLE).
#define VTK_UNSIGNED_INT
Definition: vtkType.h:55
Store vtkAlgorithm input/output information.
void SetScalarTypeToDouble()
Set/Get the data scalar type (i.e VTK_DOUBLE).
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:53
void DrawImage(int x0, int y0, vtkImageData *i)
Draw subimage of the input image in the canvas at position x0 and y0.
void SetScalarTypeToUnsignedShort()
Set/Get the data scalar type (i.e VTK_DOUBLE).
#define VTK_DOUBLE
Definition: vtkType.h:59
#define VTK_FLOAT
Definition: vtkType.h:58
void SetScalarTypeToShort()
Set/Get the data scalar type (i.e VTK_DOUBLE).
a simple class to control print indentation
Definition: vtkIndent.h:39
void SetScalarTypeToUnsignedChar()
Set/Get the data scalar type (i.e VTK_DOUBLE).
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Subclasses can reimplement this method to collect information from their inputs and set information f...
#define VTK_SHORT
Definition: vtkType.h:52
#define VTK_CHAR
Definition: vtkType.h:49
#define VTK_LONG
Definition: vtkType.h:56
void SetDrawColor(double a, double b, double c)
Set DrawColor to (a, b, c, 0)
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
void SetScalarTypeToLong()
Set/Get the data scalar type (i.e VTK_DOUBLE).
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:51
void SetDrawColor(double a)
Set DrawColor to (a, 0, 0, 0)
void SetScalarTypeToUnsignedLong()
Set/Get the data scalar type (i.e VTK_DOUBLE).
Generic algorithm superclass for image algs.
Store zero or more vtkInformation instances.
static vtkAlgorithm * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void DrawSegment3D(double x1, double y1, double z1, double x2, double y2, double z2)
Set the pixels inside the box (min0, max0, min1, max1) to the current DrawColor.
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:57
void SetDrawColor(double a, double b)
Set DrawColor to (a, b, 0, 0)
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called in response to a REQUEST_DATA request from the executive.
void SetScalarTypeToFloat()
Set/Get the data scalar type (i.e VTK_DOUBLE).
#define VTK_INT
Definition: vtkType.h:54
void SetScalarTypeToChar()
Set/Get the data scalar type (i.e VTK_DOUBLE).