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 =========================================================================*/
29 #ifndef vtkImageCanvasSource2D_h
30 #define vtkImageCanvasSource2D_h
31 
32 #include "vtkImagingSourcesModule.h" // For export macro
33 #include "vtkImageAlgorithm.h"
34 
36 {
37 public:
39  static vtkImageCanvasSource2D *New();
40 
42  void PrintSelf(ostream& os, vtkIndent indent);
43 
45 
47  vtkSetVector4Macro(DrawColor, double);
48  vtkGetVector4Macro(DrawColor, double);
50 
52  void SetDrawColor(double a) {this->SetDrawColor(a, 0.0, 0.0, 0.0);}
53 
55  void SetDrawColor(double a,double b) {this->SetDrawColor(a, b, 0.0, 0.0);}
56 
58 
59  void SetDrawColor(double a, double b, double c) {
60  this->SetDrawColor(a, b, c, 0.0);}
62 
64  void InitializeCanvasVolume(vtkImageData *volume);
65 
67 
69  void FillBox(int min0, int max0, int min1, int max1);
70  void FillTube(int x0, int y0, int x1, int y1, double radius);
71  void FillTriangle(int x0, int y0, int x1, int y1, int x2, int y2);
72  void DrawCircle(int c0, int c1, double radius);
73  void DrawPoint(int p0, int p1);
74  void DrawSegment(int x0, int y0, int x1, int y1);
75  void DrawSegment3D(double *p0, double *p1);
76  void DrawSegment3D(double x1, double y1, double z1,
77  double x2, double y2, double z2)
78  { double p1[3], p2[3];
79  p1[0] = x1; p1[1] = y1; p1[2] = z1; p2[0] = x2; p2[1] = y2; p2[2] = z2;
80  this->DrawSegment3D(p1, p2);}
82 
84 
86  void DrawImage(int x0, int y0, vtkImageData* i)
87  { this->DrawImage(x0, y0, i, -1, -1, -1, -1); }
88  void DrawImage(int x0, int y0, vtkImageData*, int sx, int sy,
89  int width, int height);
91 
95  void FillPixel(int x, int y);
96 
98 
101  void SetExtent(int *extent);
102  void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
104 
106 
109  vtkSetMacro(DefaultZ, int);
110  vtkGetMacro(DefaultZ, int);
112 
114 
117  vtkSetVector3Macro(Ratio, double);
118  vtkGetVector3Macro(Ratio, double);
120 
122 
123  virtual void SetNumberOfScalarComponents(int i);
124  virtual int GetNumberOfScalarComponents() const;
126 
128 
133  void SetScalarTypeToFloat(){this->SetScalarType(VTK_FLOAT);};
134  void SetScalarTypeToDouble(){this->SetScalarType(VTK_DOUBLE);};
135  void SetScalarTypeToInt(){this->SetScalarType(VTK_INT);};
137  {this->SetScalarType(VTK_UNSIGNED_INT);};
138  void SetScalarTypeToLong(){this->SetScalarType(VTK_LONG);};
140  {this->SetScalarType(VTK_UNSIGNED_LONG);};
141  void SetScalarTypeToShort(){this->SetScalarType(VTK_SHORT);};
143  {this->SetScalarType(VTK_UNSIGNED_SHORT);};
145  {this->SetScalarType(VTK_UNSIGNED_CHAR);};
147  {this->SetScalarType(VTK_CHAR);};
148  void SetScalarType(int);
149  int GetScalarType() const;
151 
152 protected:
154  // Destructor: Deleting a vtkImageCanvasSource2D automatically deletes the
155  // associated vtkImageData. However, since the data is reference counted,
156  // it may not actually be deleted.
158 
160  int WholeExtent[6];
161  double DrawColor[4];
162  int DefaultZ;
163  double Ratio[3];
164 
165  int ClipSegment(int &a0, int &a1, int &b0, int &b1);
166 
167  virtual int RequestInformation (vtkInformation *,
170  virtual int RequestData (vtkInformation *,
173 
174 private:
175  vtkImageCanvasSource2D(const vtkImageCanvasSource2D&); // Not implemented.
176  void operator=(const vtkImageCanvasSource2D&); // Not implemented.
177 };
178 
179 
180 
181 #endif
182 
183 
#define VTK_UNSIGNED_INT
Definition: vtkType.h:32
Store vtkAlgorithm input/output information.
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:30
void DrawImage(int x0, int y0, vtkImageData *i)
#define VTK_DOUBLE
Definition: vtkType.h:36
#define VTK_FLOAT
Definition: vtkType.h:35
a simple class to control print indentation
Definition: vtkIndent.h:38
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
#define VTK_SHORT
Definition: vtkType.h:29
#define VTK_CHAR
Definition: vtkType.h:26
#define VTK_LONG
Definition: vtkType.h:33
void SetDrawColor(double a, double b, double c)
#define VTKIMAGINGSOURCES_EXPORT
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:28
Generic algorithm superclass for image algs.
Store zero or more vtkInformation instances.
void PrintSelf(ostream &os, vtkIndent indent)
static vtkAlgorithm * New()
void DrawSegment3D(double x1, double y1, double z1, double x2, double y2, double z2)
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:34
void SetDrawColor(double a, double b)
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
#define VTK_INT
Definition: vtkType.h:31