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 =========================================================================*/
24 #ifndef vtkImageCanvasSource2D_h
25 #define vtkImageCanvasSource2D_h
26 
27 #include "vtkImagingSourcesModule.h" // For export macro
28 #include "vtkImageAlgorithm.h"
29 
30 class VTKIMAGINGSOURCES_EXPORT vtkImageCanvasSource2D : public vtkImageAlgorithm
31 {
32 public:
36  static vtkImageCanvasSource2D *New();
37 
39  void PrintSelf(ostream& os, vtkIndent indent) override;
40 
42 
46  vtkSetVector4Macro(DrawColor, double);
47  vtkGetVector4Macro(DrawColor, double);
49 
53  void SetDrawColor(double a) {this->SetDrawColor(a, 0.0, 0.0, 0.0);}
54 
58  void SetDrawColor(double a,double b) {this->SetDrawColor(a, b, 0.0, 0.0);}
59 
63  void SetDrawColor(double a, double b, double c) {
64  this->SetDrawColor(a, b, c, 0.0);}
65 
69  void InitializeCanvasVolume(vtkImageData *volume);
70 
72 
76  void FillBox(int min0, int max0, int min1, int max1);
77  void FillTube(int x0, int y0, int x1, int y1, double radius);
78  void FillTriangle(int x0, int y0, int x1, int y1, int x2, int y2);
79  void DrawCircle(int c0, int c1, double radius);
80  void DrawPoint(int p0, int p1);
81  void DrawSegment(int x0, int y0, int x1, int y1);
82  void DrawSegment3D(double *p0, double *p1);
83  void DrawSegment3D(double x1, double y1, double z1,
84  double x2, double y2, double z2)
85  { double p1[3], p2[3];
86  p1[0] = x1; p1[1] = y1; p1[2] = z1; p2[0] = x2; p2[1] = y2; p2[2] = z2;
87  this->DrawSegment3D(p1, p2);}
89 
94  void DrawImage(int x0, int y0, vtkImageData* i)
95  { this->DrawImage(x0, y0, i, -1, -1, -1, -1); }
96  void DrawImage(int x0, int y0, vtkImageData*, int sx, int sy,
97  int width, int height);
98 
104  void FillPixel(int x, int y);
105 
107 
112  void SetExtent(int *extent);
113  void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
115 
117 
122  vtkSetMacro(DefaultZ, int);
123  vtkGetMacro(DefaultZ, int);
125 
127 
132  vtkSetVector3Macro(Ratio, double);
133  vtkGetVector3Macro(Ratio, double);
135 
137 
140  virtual void SetNumberOfScalarComponents(int i);
141  virtual int GetNumberOfScalarComponents() const;
143 
145 
152  void SetScalarTypeToFloat(){this->SetScalarType(VTK_FLOAT);};
153  void SetScalarTypeToDouble(){this->SetScalarType(VTK_DOUBLE);};
154  void SetScalarTypeToInt(){this->SetScalarType(VTK_INT);};
156  {this->SetScalarType(VTK_UNSIGNED_INT);};
157  void SetScalarTypeToLong(){this->SetScalarType(VTK_LONG);};
159  {this->SetScalarType(VTK_UNSIGNED_LONG);};
160  void SetScalarTypeToShort(){this->SetScalarType(VTK_SHORT);};
162  {this->SetScalarType(VTK_UNSIGNED_SHORT);};
164  {this->SetScalarType(VTK_UNSIGNED_CHAR);};
166  {this->SetScalarType(VTK_CHAR);};
167  void SetScalarType(int);
168  int GetScalarType() const;
170 
171 protected:
173  // Destructor: Deleting a vtkImageCanvasSource2D automatically deletes the
174  // associated vtkImageData. However, since the data is reference counted,
175  // it may not actually be deleted.
176  ~vtkImageCanvasSource2D() override;
177 
179  int WholeExtent[6];
180  double DrawColor[4];
181  int DefaultZ;
182  double Ratio[3];
183 
184  int ClipSegment(int &a0, int &a1, int &b0, int &b1);
185 
188  vtkInformationVector *) override;
191  vtkInformationVector *) override;
192 
193 private:
195  void operator=(const vtkImageCanvasSource2D&) = delete;
196 };
197 
198 
199 
200 #endif
201 
202 
vtkImageCanvasSource2D::SetDrawColor
void SetDrawColor(double a, double b, double c)
Set DrawColor to (a, b, c, 0)
Definition: vtkImageCanvasSource2D.h:63
vtkImageAlgorithm::RequestData
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called in response to a REQUEST_DATA request from the executive.
vtkImageCanvasSource2D::SetDrawColor
void SetDrawColor(double a)
Set DrawColor to (a, 0, 0, 0)
Definition: vtkImageCanvasSource2D.h:53
VTK_UNSIGNED_INT
#define VTK_UNSIGNED_INT
Definition: vtkType.h:55
vtkImageCanvasSource2D::SetScalarTypeToUnsignedChar
void SetScalarTypeToUnsignedChar()
Definition: vtkImageCanvasSource2D.h:163
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
VTK_UNSIGNED_SHORT
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:53
vtkImageCanvasSource2D::SetScalarTypeToLong
void SetScalarTypeToLong()
Definition: vtkImageCanvasSource2D.h:157
vtkImageCanvasSource2D::SetScalarTypeToUnsignedLong
void SetScalarTypeToUnsignedLong()
Definition: vtkImageCanvasSource2D.h:158
vtkImageAlgorithm.h
vtkImageCanvasSource2D::DrawSegment3D
void DrawSegment3D(double x1, double y1, double z1, double x2, double y2, double z2)
Definition: vtkImageCanvasSource2D.h:83
vtkImageAlgorithm
Generic algorithm superclass for image algs.
Definition: vtkImageAlgorithm.h:37
vtkImageCanvasSource2D::SetScalarTypeToFloat
void SetScalarTypeToFloat()
Set/Get the data scalar type (i.e VTK_DOUBLE).
Definition: vtkImageCanvasSource2D.h:152
vtkImageCanvasSource2D::ImageData
vtkImageData * ImageData
Definition: vtkImageCanvasSource2D.h:178
vtkImageCanvasSource2D::DefaultZ
int DefaultZ
Definition: vtkImageCanvasSource2D.h:181
vtkX3D::height
Definition: vtkX3D.h:254
vtkImageAlgorithm::RequestInformation
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Subclasses can reimplement this method to collect information from their inputs and set information f...
vtkImageCanvasSource2D::SetDrawColor
void SetDrawColor(double a, double b)
Set DrawColor to (a, b, 0, 0)
Definition: vtkImageCanvasSource2D.h:58
VTK_CHAR
#define VTK_CHAR
Definition: vtkType.h:49
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
VTK_FLOAT
#define VTK_FLOAT
Definition: vtkType.h:58
VTK_DOUBLE
#define VTK_DOUBLE
Definition: vtkType.h:59
VTK_UNSIGNED_CHAR
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:51
VTK_LONG
#define VTK_LONG
Definition: vtkType.h:56
vtkImageCanvasSource2D::SetScalarTypeToUnsignedInt
void SetScalarTypeToUnsignedInt()
Definition: vtkImageCanvasSource2D.h:155
vtkImageCanvasSource2D::SetScalarTypeToChar
void SetScalarTypeToChar()
Definition: vtkImageCanvasSource2D.h:165
vtkImageCanvasSource2D
Paints on a canvas.
Definition: vtkImageCanvasSource2D.h:30
VTK_UNSIGNED_LONG
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:57
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:80
vtkImageAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkImageCanvasSource2D::SetScalarTypeToInt
void SetScalarTypeToInt()
Definition: vtkImageCanvasSource2D.h:154
VTK_SHORT
#define VTK_SHORT
Definition: vtkType.h:52
vtkImageCanvasSource2D::DrawImage
void DrawImage(int x0, int y0, vtkImageData *i)
Draw subimage of the input image in the canvas at position x0 and y0.
Definition: vtkImageCanvasSource2D.h:94
vtkImageCanvasSource2D::SetScalarTypeToDouble
void SetScalarTypeToDouble()
Definition: vtkImageCanvasSource2D.h:153
vtkImageCanvasSource2D::SetScalarTypeToUnsignedShort
void SetScalarTypeToUnsignedShort()
Definition: vtkImageCanvasSource2D.h:161
vtkImageCanvasSource2D::SetScalarTypeToShort
void SetScalarTypeToShort()
Definition: vtkImageCanvasSource2D.h:160
vtkX3D::extent
Definition: vtkX3D.h:345
VTK_INT
#define VTK_INT
Definition: vtkType.h:54
vtkX3D::radius
Definition: vtkX3D.h:252