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 =========================================================================*/
27 #ifndef vtkImageCanvasSource2D_h
28 #define vtkImageCanvasSource2D_h
29 
30 #include "vtkImagingSourcesModule.h" // For export macro
31 #include "vtkImageAlgorithm.h"
32 
33 class VTKIMAGINGSOURCES_EXPORT vtkImageCanvasSource2D : public vtkImageAlgorithm
34 {
35 public:
40 
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
45 
49  vtkSetVector4Macro(DrawColor, double);
50  vtkGetVector4Macro(DrawColor, double);
52 
56  void SetDrawColor(double a) {this->SetDrawColor(a, 0.0, 0.0, 0.0);}
57 
61  void SetDrawColor(double a,double b) {this->SetDrawColor(a, b, 0.0, 0.0);}
62 
66  void SetDrawColor(double a, double b, double c) {
67  this->SetDrawColor(a, b, c, 0.0);}
68 
73 
75 
79  void FillBox(int min0, int max0, int min1, int max1);
80  void FillTube(int x0, int y0, int x1, int y1, double radius);
81  void FillTriangle(int x0, int y0, int x1, int y1, int x2, int y2);
82  void DrawCircle(int c0, int c1, double radius);
83  void DrawPoint(int p0, int p1);
84  void DrawSegment(int x0, int y0, int x1, int y1);
85  void DrawSegment3D(double *p0, double *p1);
86  void DrawSegment3D(double x1, double y1, double z1,
87  double x2, double y2, double z2)
88  { double p1[3], p2[3];
89  p1[0] = x1; p1[1] = y1; p1[2] = z1; p2[0] = x2; p2[1] = y2; p2[2] = z2;
90  this->DrawSegment3D(p1, p2);}
92 
97  void DrawImage(int x0, int y0, vtkImageData* i)
98  { this->DrawImage(x0, y0, i, -1, -1, -1, -1); }
99  void DrawImage(int x0, int y0, vtkImageData*, int sx, int sy,
100  int width, int height);
101 
107  void FillPixel(int x, int y);
108 
110 
115  void SetExtent(int *extent);
116  void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
118 
120 
125  vtkSetMacro(DefaultZ, int);
126  vtkGetMacro(DefaultZ, int);
128 
130 
135  vtkSetVector3Macro(Ratio, double);
136  vtkGetVector3Macro(Ratio, double);
138 
140 
143  virtual void SetNumberOfScalarComponents(int i);
144  virtual int GetNumberOfScalarComponents() const;
146 
148 
155  void SetScalarTypeToFloat(){this->SetScalarType(VTK_FLOAT);};
156  void SetScalarTypeToDouble(){this->SetScalarType(VTK_DOUBLE);};
157  void SetScalarTypeToInt(){this->SetScalarType(VTK_INT);};
159  {this->SetScalarType(VTK_UNSIGNED_INT);};
160  void SetScalarTypeToLong(){this->SetScalarType(VTK_LONG);};
162  {this->SetScalarType(VTK_UNSIGNED_LONG);};
163  void SetScalarTypeToShort(){this->SetScalarType(VTK_SHORT);};
165  {this->SetScalarType(VTK_UNSIGNED_SHORT);};
167  {this->SetScalarType(VTK_UNSIGNED_CHAR);};
169  {this->SetScalarType(VTK_CHAR);};
170  void SetScalarType(int);
171  int GetScalarType() const;
173 
174 protected:
176  // Destructor: Deleting a vtkImageCanvasSource2D automatically deletes the
177  // associated vtkImageData. However, since the data is reference counted,
178  // it may not actually be deleted.
180 
182  int WholeExtent[6];
183  double DrawColor[4];
184  int DefaultZ;
185  double Ratio[3];
186 
187  int ClipSegment(int &a0, int &a1, int &b0, int &b1);
188 
191  vtkInformationVector *) override;
194  vtkInformationVector *) override;
195 
196 private:
198  void operator=(const vtkImageCanvasSource2D&) = delete;
199 };
200 
201 
202 
203 #endif
204 
205 
vtkImageCanvasSource2D::SetDrawColor
void SetDrawColor(double a, double b, double c)
Set DrawColor to (a, b, c, 0)
Definition: vtkImageCanvasSource2D.h:66
vtkImageCanvasSource2D::ClipSegment
int ClipSegment(int &a0, int &a1, int &b0, int &b1)
vtkImageCanvasSource2D::DrawImage
void DrawImage(int x0, int y0, vtkImageData *, int sx, int sy, int width, int height)
vtkImageCanvasSource2D::SetDrawColor
void SetDrawColor(double a)
Set DrawColor to (a, 0, 0, 0)
Definition: vtkImageCanvasSource2D.h:56
vtkImageCanvasSource2D::SetExtent
void SetExtent(int *extent)
These methods set the WholeExtent of the output It sets the size of the canvas.
vtkImageCanvasSource2D::SetScalarType
void SetScalarType(int)
vtkImageCanvasSource2D::RequestData
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called in response to a REQUEST_DATA request from the executive.
vtkImageCanvasSource2D::RequestInformation
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Subclasses can reimplement this method to collect information from their inputs and set information f...
vtkImageCanvasSource2D::SetExtent
void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2)
VTK_UNSIGNED_INT
#define VTK_UNSIGNED_INT
Definition: vtkType.h:55
vtkImageCanvasSource2D::SetScalarTypeToUnsignedChar
void SetScalarTypeToUnsignedChar()
Definition: vtkImageCanvasSource2D.h:166
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:42
VTK_UNSIGNED_SHORT
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:53
vtkImageCanvasSource2D::SetScalarTypeToLong
void SetScalarTypeToLong()
Definition: vtkImageCanvasSource2D.h:160
vtkImageCanvasSource2D::SetScalarTypeToUnsignedLong
void SetScalarTypeToUnsignedLong()
Definition: vtkImageCanvasSource2D.h:161
vtkImageAlgorithm.h
vtkImageCanvasSource2D::GetNumberOfScalarComponents
virtual int GetNumberOfScalarComponents() const
vtkImageCanvasSource2D::DrawSegment3D
void DrawSegment3D(double x1, double y1, double z1, double x2, double y2, double z2)
Definition: vtkImageCanvasSource2D.h:86
vtkImageAlgorithm
Generic algorithm superclass for image algs.
Definition: vtkImageAlgorithm.h:41
vtkImageCanvasSource2D::InitializeCanvasVolume
void InitializeCanvasVolume(vtkImageData *volume)
Initialize the canvas with a given volume.
vtkImageCanvasSource2D::SetNumberOfScalarComponents
virtual void SetNumberOfScalarComponents(int i)
Set the number of scalar components.
vtkImageCanvasSource2D::SetScalarTypeToFloat
void SetScalarTypeToFloat()
Set/Get the data scalar type (i.e VTK_DOUBLE).
Definition: vtkImageCanvasSource2D.h:155
vtkImageCanvasSource2D::ImageData
vtkImageData * ImageData
Definition: vtkImageCanvasSource2D.h:181
vtkImageCanvasSource2D::FillPixel
void FillPixel(int x, int y)
Fill a colored area with another color.
vtkImageCanvasSource2D::GetScalarType
int GetScalarType() const
vtkImageCanvasSource2D::DefaultZ
int DefaultZ
Definition: vtkImageCanvasSource2D.h:184
vtkX3D::height
@ height
Definition: vtkX3D.h:254
vtkImageCanvasSource2D::SetDrawColor
void SetDrawColor(double a, double b)
Set DrawColor to (a, b, 0, 0)
Definition: vtkImageCanvasSource2D.h:61
VTK_CHAR
#define VTK_CHAR
Definition: vtkType.h:49
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
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::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkImageCanvasSource2D::SetScalarTypeToUnsignedInt
void SetScalarTypeToUnsignedInt()
Definition: vtkImageCanvasSource2D.h:158
vtkImageCanvasSource2D::~vtkImageCanvasSource2D
~vtkImageCanvasSource2D() override
vtkImageCanvasSource2D::vtkImageCanvasSource2D
vtkImageCanvasSource2D()
vtkImageCanvasSource2D::SetScalarTypeToChar
void SetScalarTypeToChar()
Definition: vtkImageCanvasSource2D.h:168
vtkImageCanvasSource2D::FillBox
void FillBox(int min0, int max0, int min1, int max1)
Set the pixels inside the box (min0, max0, min1, max1) to the current DrawColor.
vtkImageCanvasSource2D::DrawPoint
void DrawPoint(int p0, int p1)
vtkImageCanvasSource2D
Paints on a canvas.
Definition: vtkImageCanvasSource2D.h:34
VTK_UNSIGNED_LONG
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:57
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:87
vtkImageCanvasSource2D::SetScalarTypeToInt
void SetScalarTypeToInt()
Definition: vtkImageCanvasSource2D.h:157
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:97
vtkImageCanvasSource2D::SetScalarTypeToDouble
void SetScalarTypeToDouble()
Definition: vtkImageCanvasSource2D.h:156
vtkImageCanvasSource2D::SetScalarTypeToUnsignedShort
void SetScalarTypeToUnsignedShort()
Definition: vtkImageCanvasSource2D.h:164
vtkImageCanvasSource2D::SetScalarTypeToShort
void SetScalarTypeToShort()
Definition: vtkImageCanvasSource2D.h:163
vtkX3D::extent
@ extent
Definition: vtkX3D.h:345
VTK_INT
#define VTK_INT
Definition: vtkType.h:54
vtkImageCanvasSource2D::DrawCircle
void DrawCircle(int c0, int c1, double radius)
vtkImageCanvasSource2D::New
static vtkImageCanvasSource2D * New()
Construct an instance of vtkImageCanvasSource2D with no data.
vtkX3D::radius
@ radius
Definition: vtkX3D.h:252
vtkImageCanvasSource2D::FillTriangle
void FillTriangle(int x0, int y0, int x1, int y1, int x2, int y2)
vtkImageCanvasSource2D::DrawSegment
void DrawSegment(int x0, int y0, int x1, int y1)
vtkImageCanvasSource2D::DrawSegment3D
void DrawSegment3D(double *p0, double *p1)
vtkImageCanvasSource2D::FillTube
void FillTube(int x0, int y0, int x1, int y1, double radius)