VTK
dox/Hybrid/vtkMILVideoSource.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkMILVideoSource.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00031 #ifndef __vtkMILVideoSource_h
00032 #define __vtkMILVideoSource_h
00033 
00034 #include "vtkVideoSource.h"
00035 
00036 // digitizer hardware
00037 #define VTK_MIL_DEFAULT        0
00038 #define VTK_MIL_METEOR         "M_SYSTEM_METEOR"
00039 #define VTK_MIL_METEOR_II      "M_SYSTEM_METEOR_II"
00040 #define VTK_MIL_METEOR_II_DIG  "M_SYSTEM_METEOR_II_DIG"
00041 #define VTK_MIL_METEOR_II_CL   "M_SYSTEM_METEOR_II_CL"
00042 #define VTK_MIL_METEOR_II_1394 "M_SYSTEM_METEOR_II_1394"
00043 #define VTK_MIL_CORONA         "M_SYSTEM_CORONA"
00044 #define VTK_MIL_CORONA_II      "M_SYSTEM_CORONA_II"
00045 #define VTK_MIL_PULSAR         "M_SYSTEM_PULSAR"
00046 #define VTK_MIL_GENESIS        "M_SYSTEM_GENESIS"
00047 #define VTK_MIL_GENESIS_PLUS   "M_SYSTEM_GENESIS_PLUS"
00048 #define VTK_MIL_ORION          "M_SYSTEM_ORION"
00049 #define VTK_MIL_CRONOS         "M_SYSTEM_CRONOS"
00050 #define VTK_MIL_ODYSSEY        "M_SYSTEM_ODYSSEY"
00051 
00052 // video inputs: 
00053 #define VTK_MIL_MONO          0
00054 #define VTK_MIL_COMPOSITE     1
00055 #define VTK_MIL_YC            2
00056 #define VTK_MIL_RGB           3
00057 #define VTK_MIL_DIGITAL       4
00058 
00059 // video formats:
00060 #define VTK_MIL_RS170         0
00061 #define VTK_MIL_NTSC          1
00062 #define VTK_MIL_CCIR          2 
00063 #define VTK_MIL_PAL           3 
00064 #define VTK_MIL_SECAM         4
00065 #define VTK_MIL_NONSTANDARD   5       
00066 
00067 class VTK_HYBRID_EXPORT vtkMILVideoSource : public vtkVideoSource
00068 {
00069 public:
00070   static vtkMILVideoSource *New();
00071   vtkTypeMacro(vtkMILVideoSource,vtkVideoSource);
00072   void PrintSelf(ostream& os, vtkIndent indent);   
00073 
00075   void Record();
00076 
00078   void Play();
00079 
00081   void Stop();
00082 
00084   void Grab();
00085  
00087   void SetFrameSize(int x, int y, int z);
00088   
00090   void SetOutputFormat(int format);
00091 
00093 
00094   virtual void SetVideoChannel(int channel);
00095   vtkGetMacro(VideoChannel, int);
00097 
00099 
00100   virtual void SetVideoFormat(int format);
00101   void SetVideoFormatToNTSC() { this->SetVideoFormat(VTK_MIL_NTSC); };
00102   void SetVideoFormatToPAL() { this->SetVideoFormat(VTK_MIL_PAL); };
00103   void SetVideoFormatToSECAM() { this->SetVideoFormat(VTK_MIL_SECAM); };
00104   void SetVideoFormatToRS170() { this->SetVideoFormat(VTK_MIL_RS170); };
00105   void SetVideoFormatToCCIR() { this->SetVideoFormat(VTK_MIL_CCIR); };
00106   void SetVideoFormatToNonStandard() { 
00107     this->SetVideoFormat(VTK_MIL_NONSTANDARD); };
00108   vtkGetMacro(VideoFormat,int);
00110   
00112 
00113   virtual void SetVideoInput(int input);
00114   void SetVideoInputToMono() { this->SetVideoInput(VTK_MIL_MONO); };
00115   void SetVideoInputToComposite() {this->SetVideoInput(VTK_MIL_COMPOSITE);};
00116   void SetVideoInputToYC() { this->SetVideoInput(VTK_MIL_YC); };
00117   void SetVideoInputToRGB() { this->SetVideoInput(VTK_MIL_RGB); };
00118   void SetVideoInputToDigital() { this->SetVideoInput(VTK_MIL_DIGITAL); };
00119   vtkGetMacro(VideoInput,int);
00121 
00123 
00126   virtual void SetContrastLevel(float contrast);
00127   vtkGetMacro(ContrastLevel,float);
00128   virtual void SetBrightnessLevel(float brightness);
00129   vtkGetMacro(BrightnessLevel,float);
00130   virtual void SetHueLevel(float hue);
00131   vtkGetMacro(HueLevel,float);
00132   virtual void SetSaturationLevel(float saturation);
00133   vtkGetMacro(SaturationLevel,float);
00135 
00137 
00139   virtual void SetBlackLevel(float value);
00140   virtual float GetBlackLevel() {
00141     return this->BlackLevel; };
00142   virtual void SetWhiteLevel(float value);
00143   virtual float GetWhiteLevel() {
00144     return this->WhiteLevel; };
00146 
00148 
00150   vtkSetStringMacro(MILSystemType);
00151   vtkGetStringMacro(MILSystemType);
00152   void SetMILSystemTypeToMeteor() { this->SetMILSystemType(VTK_MIL_METEOR); };
00153   void SetMILSystemTypeToMeteorII() { this->SetMILSystemType(VTK_MIL_METEOR_II); };
00154   void SetMILSystemTypeToMeteorIIDig() { this->SetMILSystemType(VTK_MIL_METEOR_II_DIG); };
00155   void SetMILSystemTypeToMeteorIICL() { this->SetMILSystemType(VTK_MIL_METEOR_II_CL); };
00156   void SetMILSystemTypeToMeteorII1394() { this->SetMILSystemType(VTK_MIL_METEOR_II_1394); };
00157   void SetMILSystemTypeToCorona() { this->SetMILSystemType(VTK_MIL_CORONA); };
00158   void SetMILSystemTypeToCoronaII() { this->SetMILSystemType(VTK_MIL_CORONA_II); };
00159   void SetMILSystemTypeToPulsar() { this->SetMILSystemType(VTK_MIL_PULSAR); };
00160   void SetMILSystemTypeToGenesis() { this->SetMILSystemType(VTK_MIL_GENESIS); };
00161   void SetMILSystemTypeToGenesisPlus() { this->SetMILSystemType(VTK_MIL_GENESIS_PLUS); };
00162   void SetMILSystemTypeToOrion() { this->SetMILSystemType(VTK_MIL_ORION); };
00163   void SetMILSystemTypeToCronos() { this->SetMILSystemType(VTK_MIL_CRONOS); };
00164   void SetMILSystemTypeToOdyssey() { this->SetMILSystemType(VTK_MIL_ODYSSEY); };
00166 
00167 
00168   vtkSetMacro(MILSystemNumber,int);
00169   vtkGetMacro(MILSystemNumber,int);
00171 
00173 
00174   vtkSetStringMacro(MILDigitizerDCF);
00175   vtkGetStringMacro(MILDigitizerDCF);
00177 
00179 
00180   vtkSetMacro(MILDigitizerNumber,int);
00181   vtkGetMacro(MILDigitizerNumber,int);
00183 
00185 
00186   virtual void SetMILErrorMessages(int yesno);
00187   vtkBooleanMacro(MILErrorMessages,int);
00188   vtkGetMacro(MILErrorMessages,int);
00190 
00192 
00193   vtkSetMacro(MILAppID,long);
00194   vtkGetMacro(MILAppID,long);
00195   vtkSetMacro(MILSysID,long);
00196   vtkGetMacro(MILSysID,long);
00197   vtkGetMacro(MILDigID,long);
00198   vtkGetMacro(MILBufID,long);
00200 
00203   void Initialize();
00204 
00206   void ReleaseSystemResources();
00207 
00209 
00210   void *OldHookFunction;
00211   void *OldUserDataPtr;
00212   int FrameCounter;
00213   int ForceGrab;
00214   void InternalGrab();
00216 
00217 protected:
00218   vtkMILVideoSource();
00219   ~vtkMILVideoSource();
00220 
00221   virtual void AllocateMILDigitizer();
00222   virtual void AllocateMILBuffer();
00223 
00224   virtual char *MILInterpreterForSystem(const char *system);
00225   char *MILInterpreterDLL;
00226 
00227   int VideoChannel;
00228   int VideoInput;
00229   int VideoInputForColor;
00230   int VideoFormat;
00231 
00232   float ContrastLevel;
00233   float BrightnessLevel;
00234   float HueLevel;
00235   float SaturationLevel;
00236 
00237   float BlackLevel;
00238   float WhiteLevel;
00239 
00240   int FrameMaxSize[2];
00241 
00242   long MILAppID;
00243   long MILSysID;
00244   long MILDigID;
00245   long MILBufID;
00246   // long MILDispBufID;
00247   // long MILDispID;
00248 
00249   char *MILSystemType;
00250   int MILSystemNumber;
00251 
00252   int MILDigitizerNumber;
00253   char *MILDigitizerDCF;
00254 
00255   int MILErrorMessages;
00256 
00257   int MILAppInternallyAllocated;
00258   int MILSysInternallyAllocated;
00259 
00260   int FatalMILError;
00261 
00265   double CreateTimeStampForFrame(unsigned long frame);
00266 
00267   double LastTimeStamp;
00268   unsigned long LastFrameCount;
00269   double EstimatedFramePeriod;
00270   double NextFramePeriod;
00271 
00272 private:
00273   vtkMILVideoSource(const vtkMILVideoSource&);  // Not implemented.
00274   void operator=(const vtkMILVideoSource&);  // Not implemented.
00275 };
00276 
00277 #endif