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 "vtkImageAlgorithm.h"
35 
36 class vtkTimerLog;
37 class vtkCriticalSection;
38 class vtkMultiThreader;
39 class vtkScalarsToColors;
40 
42 {
43 public:
44  static vtkVideoSource *New();
46  void PrintSelf(ostream& os, vtkIndent indent);
47 
50  virtual void Record();
51 
54  virtual void Play();
55 
57  virtual void Stop();
58 
63  virtual void Rewind();
64 
67  virtual void FastForward();
68 
71  virtual void Seek(int n);
72 
74  virtual void Grab();
75 
77 
79  vtkGetMacro(Recording,int);
81 
83 
85  vtkGetMacro(Playing,int);
87 
89 
94  virtual void SetFrameSize(int x, int y, int z);
95  virtual void SetFrameSize(int dim[3]) {
96  this->SetFrameSize(dim[0], dim[1], dim[2]); };
97  vtkGetVector3Macro(FrameSize,int);
99 
101 
102  virtual void SetFrameRate(float rate);
103  vtkGetMacro(FrameRate,float);
105 
107 
109  virtual void SetOutputFormat(int format);
110  void SetOutputFormatToLuminance() { this->SetOutputFormat(VTK_LUMINANCE); };
111  void SetOutputFormatToRGB() { this->SetOutputFormat(VTK_RGB); };
112  void SetOutputFormatToRGBA() { this->SetOutputFormat(VTK_RGBA); };
113  vtkGetMacro(OutputFormat,int);
115 
117 
119  virtual void SetFrameBufferSize(int FrameBufferSize);
120  vtkGetMacro(FrameBufferSize,int);
122 
124 
127  vtkSetMacro(NumberOfOutputFrames,int);
128  vtkGetMacro(NumberOfOutputFrames,int);
130 
132 
134  vtkBooleanMacro(AutoAdvance,int);
135  vtkSetMacro(AutoAdvance,int)
136  vtkGetMacro(AutoAdvance,int);
138 
140 
144  virtual void SetClipRegion(int r[6]) {
145  this->SetClipRegion(r[0],r[1],r[2],r[3],r[4],r[5]); };
146  virtual void SetClipRegion(int x0, int x1, int y0, int y1, int z0, int z1);
147  vtkGetVector6Macro(ClipRegion,int);
149 
151 
158  vtkSetVector6Macro(OutputWholeExtent,int);
159  vtkGetVector6Macro(OutputWholeExtent,int);
161 
163 
164  vtkSetVector3Macro(DataSpacing,double);
165  vtkGetVector3Macro(DataSpacing,double);
167 
169 
171  vtkSetVector3Macro(DataOrigin,double);
172  vtkGetVector3Macro(DataOrigin,double);
174 
176 
179  vtkSetMacro(Opacity,float);
180  vtkGetMacro(Opacity,float);
182 
184 
186  vtkGetMacro(FrameCount, int);
187  vtkSetMacro(FrameCount, int);
189 
191 
193  vtkGetMacro(FrameIndex, int);
195 
200  virtual double GetFrameTimeStamp(int frame);
201 
205  double GetFrameTimeStamp() { return this->FrameTimeStamp; };
206 
208 
210  virtual void Initialize();
211  virtual int GetInitialized() { return this->Initialized; };
213 
216  virtual void ReleaseSystemResources();
217 
221  virtual void InternalGrab();
222 
224 
226  void SetStartTimeStamp(double t) { this->StartTimeStamp = t; };
227  double GetStartTimeStamp() { return this->StartTimeStamp; };
229 
230 protected:
231  vtkVideoSource();
232  ~vtkVideoSource();
234 
236 
237  int FrameSize[3];
238  int ClipRegion[6];
239  int OutputWholeExtent[6];
240  double DataSpacing[3];
241  double DataOrigin[3];
243  // set according to the OutputFormat
245  // The FrameOutputExtent is the WholeExtent for a single output frame.
246  // It is initialized in ExecuteInformation.
247  int FrameOutputExtent[6];
248 
249  // save this information from the output so that we can see if the
250  // output scalars have changed
252  int LastOutputExtent[6];
253 
255  int Playing;
256  float FrameRate;
261 
264 
265  float Opacity;
266 
267  // true if Execute() must apply a vertical flip to each frame
269 
270  // set if output needs to be cleared to be cleared before being written
272 
273  // An example of asynchrony
276 
277  // A mutex for the frame buffer: must be applied when any of the
278  // below data is modified.
280 
281  // set according to the needs of the hardware:
282  // number of bits per framebuffer pixel
284  // byte alignment of each row in the framebuffer
286  // FrameBufferExtent is the extent of frame after it has been clipped
287  // with ClipRegion. It is initialized in CheckBuffer().
288  int FrameBufferExtent[6];
289 
292  void **FrameBuffer;
294 
296 
297  virtual void UpdateFrameBuffer();
298  virtual void AdvanceFrameBuffer(int n);
300  // if some component conversion is required, it is done here:
301  virtual void UnpackRasterLine(char *outPtr, char *rowPtr,
302  int start, int count);
304 
305 private:
306  vtkVideoSource(const vtkVideoSource&); // Not implemented.
307  void operator=(const vtkVideoSource&); // Not implemented.
308 };
309 
310 #endif
311 
312 
313 
314 
315