VTK
vtkVideoSource.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkVideoSource.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 =========================================================================*/
31 #ifndef vtkVideoSource_h
32 #define vtkVideoSource_h
33 
34 #include "vtkIOVideoModule.h" // For export macro
35 #include "vtkImageAlgorithm.h"
36 
37 class vtkTimerLog;
38 class vtkCriticalSection;
39 class vtkMultiThreader;
40 class vtkScalarsToColors;
41 
43 {
44 public:
45  static vtkVideoSource *New();
47  void PrintSelf(ostream& os, vtkIndent indent);
48 
51  virtual void Record();
52 
55  virtual void Play();
56 
58  virtual void Stop();
59 
64  virtual void Rewind();
65 
68  virtual void FastForward();
69 
72  virtual void Seek(int n);
73 
75  virtual void Grab();
76 
78 
80  vtkGetMacro(Recording,int);
82 
84 
86  vtkGetMacro(Playing,int);
88 
90 
95  virtual void SetFrameSize(int x, int y, int z);
96  virtual void SetFrameSize(int dim[3]) {
97  this->SetFrameSize(dim[0], dim[1], dim[2]); };
98  vtkGetVector3Macro(FrameSize,int);
100 
102 
103  virtual void SetFrameRate(float rate);
104  vtkGetMacro(FrameRate,float);
106 
108 
110  virtual void SetOutputFormat(int format);
111  void SetOutputFormatToLuminance() { this->SetOutputFormat(VTK_LUMINANCE); };
112  void SetOutputFormatToRGB() { this->SetOutputFormat(VTK_RGB); };
113  void SetOutputFormatToRGBA() { this->SetOutputFormat(VTK_RGBA); };
114  vtkGetMacro(OutputFormat,int);
116 
118 
120  virtual void SetFrameBufferSize(int FrameBufferSize);
121  vtkGetMacro(FrameBufferSize,int);
123 
125 
128  vtkSetMacro(NumberOfOutputFrames,int);
129  vtkGetMacro(NumberOfOutputFrames,int);
131 
133 
135  vtkBooleanMacro(AutoAdvance,int);
136  vtkSetMacro(AutoAdvance,int)
137  vtkGetMacro(AutoAdvance,int);
139 
141 
145  virtual void SetClipRegion(int r[6]) {
146  this->SetClipRegion(r[0],r[1],r[2],r[3],r[4],r[5]); };
147  virtual void SetClipRegion(int x0, int x1, int y0, int y1, int z0, int z1);
148  vtkGetVector6Macro(ClipRegion,int);
150 
152 
159  vtkSetVector6Macro(OutputWholeExtent,int);
160  vtkGetVector6Macro(OutputWholeExtent,int);
162 
164 
165  vtkSetVector3Macro(DataSpacing,double);
166  vtkGetVector3Macro(DataSpacing,double);
168 
170 
172  vtkSetVector3Macro(DataOrigin,double);
173  vtkGetVector3Macro(DataOrigin,double);
175 
177 
180  vtkSetMacro(Opacity,float);
181  vtkGetMacro(Opacity,float);
183 
185 
187  vtkGetMacro(FrameCount, int);
188  vtkSetMacro(FrameCount, int);
190 
192 
194  vtkGetMacro(FrameIndex, int);
196 
201  virtual double GetFrameTimeStamp(int frame);
202 
206  double GetFrameTimeStamp() { return this->FrameTimeStamp; };
207 
209 
211  virtual void Initialize();
212  virtual int GetInitialized() { return this->Initialized; };
214 
217  virtual void ReleaseSystemResources();
218 
222  virtual void InternalGrab();
223 
225 
227  void SetStartTimeStamp(double t) { this->StartTimeStamp = t; };
228  double GetStartTimeStamp() { return this->StartTimeStamp; };
230 
231 protected:
232  vtkVideoSource();
233  ~vtkVideoSource();
235 
237 
238  int FrameSize[3];
239  int ClipRegion[6];
240  int OutputWholeExtent[6];
241  double DataSpacing[3];
242  double DataOrigin[3];
244  // set according to the OutputFormat
246  // The FrameOutputExtent is the WholeExtent for a single output frame.
247  // It is initialized in ExecuteInformation.
248  int FrameOutputExtent[6];
249 
250  // save this information from the output so that we can see if the
251  // output scalars have changed
253  int LastOutputExtent[6];
254 
256  int Playing;
257  float FrameRate;
262 
265 
266  float Opacity;
267 
268  // true if Execute() must apply a vertical flip to each frame
270 
271  // set if output needs to be cleared to be cleared before being written
273 
274  // An example of asynchrony
277 
278  // A mutex for the frame buffer: must be applied when any of the
279  // below data is modified.
281 
282  // set according to the needs of the hardware:
283  // number of bits per framebuffer pixel
285  // byte alignment of each row in the framebuffer
287  // FrameBufferExtent is the extent of frame after it has been clipped
288  // with ClipRegion. It is initialized in CheckBuffer().
289  int FrameBufferExtent[6];
290 
293  void **FrameBuffer;
295 
297 
298  virtual void UpdateFrameBuffer();
299  virtual void AdvanceFrameBuffer(int n);
301  // if some component conversion is required, it is done here:
302  virtual void UnpackRasterLine(char *outPtr, char *rowPtr,
303  int start, int count);
305 
306 private:
307  vtkVideoSource(const vtkVideoSource&); // Not implemented.
308  void operator=(const vtkVideoSource&); // Not implemented.
309 };
310 
311 #endif
312 
313 
314 
315 
316 
virtual int GetInitialized()
Store vtkAlgorithm input/output information.
void SetOutputFormatToRGB()
A class for performing multithreaded execution.
int NumberOfScalarComponents
double * FrameBufferTimeStamps
Superclass of video input devices for VTK.
virtual void SetFrameSize(int dim[3])
void SetOutputFormatToRGBA()
#define VTKIOVIDEO_EXPORT
#define VTK_LUMINANCE
Timer support and logging.
Definition: vtkTimerLog.h:81
Superclass for mapping scalar values to colors.
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
double GetStartTimeStamp()
vtkMultiThreader * PlayerThreader
double GetFrameTimeStamp()
void SetOutputFormatToLuminance()
Critical section locking class.
vtkCriticalSection * FrameBufferMutex
#define VTK_RGBA
#define VTK_RGB
int OutputNeedsInitialization
Generic algorithm superclass for image algs.
Store zero or more vtkInformation instances.
void PrintSelf(ostream &os, vtkIndent indent)
static vtkAlgorithm * New()
void SetStartTimeStamp(double t)
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
int LastNumberOfScalarComponents