VTK
dox/IO/Video/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 "vtkIOVideoModule.h" // For export macro
00035 #include "vtkVideoSource.h"
00036 
00037 // digitizer hardware
00038 #define VTK_MIL_DEFAULT        0
00039 #define VTK_MIL_METEOR         "M_SYSTEM_METEOR"
00040 #define VTK_MIL_METEOR_II      "M_SYSTEM_METEOR_II"
00041 #define VTK_MIL_METEOR_II_DIG  "M_SYSTEM_METEOR_II_DIG"
00042 #define VTK_MIL_METEOR_II_CL   "M_SYSTEM_METEOR_II_CL"
00043 #define VTK_MIL_METEOR_II_1394 "M_SYSTEM_METEOR_II_1394"
00044 #define VTK_MIL_CORONA         "M_SYSTEM_CORONA"
00045 #define VTK_MIL_CORONA_II      "M_SYSTEM_CORONA_II"
00046 #define VTK_MIL_PULSAR         "M_SYSTEM_PULSAR"
00047 #define VTK_MIL_GENESIS        "M_SYSTEM_GENESIS"
00048 #define VTK_MIL_GENESIS_PLUS   "M_SYSTEM_GENESIS_PLUS"
00049 #define VTK_MIL_ORION          "M_SYSTEM_ORION"
00050 #define VTK_MIL_CRONOS         "M_SYSTEM_CRONOS"
00051 #define VTK_MIL_ODYSSEY        "M_SYSTEM_ODYSSEY"
00052 
00053 // video inputs:
00054 #define VTK_MIL_MONO          0
00055 #define VTK_MIL_COMPOSITE     1
00056 #define VTK_MIL_YC            2
00057 #define VTK_MIL_RGB           3
00058 #define VTK_MIL_DIGITAL       4
00059 
00060 // video formats:
00061 #define VTK_MIL_RS170         0
00062 #define VTK_MIL_NTSC          1
00063 #define VTK_MIL_CCIR          2
00064 #define VTK_MIL_PAL           3
00065 #define VTK_MIL_SECAM         4
00066 #define VTK_MIL_NONSTANDARD   5
00067 
00068 class VTKIOVIDEO_EXPORT vtkMILVideoSource : public vtkVideoSource
00069 {
00070 public:
00071   static vtkMILVideoSource *New();
00072   vtkTypeMacro(vtkMILVideoSource,vtkVideoSource);
00073   void PrintSelf(ostream& os, vtkIndent indent);
00074 
00076   void Record();
00077 
00079   void Play();
00080 
00082   void Stop();
00083 
00085   void Grab();
00086 
00088   void SetFrameSize(int x, int y, int z);
00089 
00091   void SetOutputFormat(int format);
00092 
00094 
00095   virtual void SetVideoChannel(int channel);
00096   vtkGetMacro(VideoChannel, int);
00098 
00100 
00101   virtual void SetVideoFormat(int format);
00102   void SetVideoFormatToNTSC() { this->SetVideoFormat(VTK_MIL_NTSC); };
00103   void SetVideoFormatToPAL() { this->SetVideoFormat(VTK_MIL_PAL); };
00104   void SetVideoFormatToSECAM() { this->SetVideoFormat(VTK_MIL_SECAM); };
00105   void SetVideoFormatToRS170() { this->SetVideoFormat(VTK_MIL_RS170); };
00106   void SetVideoFormatToCCIR() { this->SetVideoFormat(VTK_MIL_CCIR); };
00107   void SetVideoFormatToNonStandard() {
00108     this->SetVideoFormat(VTK_MIL_NONSTANDARD); };
00109   vtkGetMacro(VideoFormat,int);
00111 
00113 
00114   virtual void SetVideoInput(int input);
00115   void SetVideoInputToMono() { this->SetVideoInput(VTK_MIL_MONO); };
00116   void SetVideoInputToComposite() {this->SetVideoInput(VTK_MIL_COMPOSITE);};
00117   void SetVideoInputToYC() { this->SetVideoInput(VTK_MIL_YC); };
00118   void SetVideoInputToRGB() { this->SetVideoInput(VTK_MIL_RGB); };
00119   void SetVideoInputToDigital() { this->SetVideoInput(VTK_MIL_DIGITAL); };
00120   vtkGetMacro(VideoInput,int);
00122 
00124 
00127   virtual void SetContrastLevel(float contrast);
00128   vtkGetMacro(ContrastLevel,float);
00129   virtual void SetBrightnessLevel(float brightness);
00130   vtkGetMacro(BrightnessLevel,float);
00131   virtual void SetHueLevel(float hue);
00132   vtkGetMacro(HueLevel,float);
00133   virtual void SetSaturationLevel(float saturation);
00134   vtkGetMacro(SaturationLevel,float);
00136 
00138 
00140   virtual void SetBlackLevel(float value);
00141   virtual float GetBlackLevel() {
00142     return this->BlackLevel; };
00143   virtual void SetWhiteLevel(float value);
00144   virtual float GetWhiteLevel() {
00145     return this->WhiteLevel; };
00147 
00149 
00151   vtkSetStringMacro(MILSystemType);
00152   vtkGetStringMacro(MILSystemType);
00153   void SetMILSystemTypeToMeteor() { this->SetMILSystemType(VTK_MIL_METEOR); };
00154   void SetMILSystemTypeToMeteorII() { this->SetMILSystemType(VTK_MIL_METEOR_II); };
00155   void SetMILSystemTypeToMeteorIIDig() { this->SetMILSystemType(VTK_MIL_METEOR_II_DIG); };
00156   void SetMILSystemTypeToMeteorIICL() { this->SetMILSystemType(VTK_MIL_METEOR_II_CL); };
00157   void SetMILSystemTypeToMeteorII1394() { this->SetMILSystemType(VTK_MIL_METEOR_II_1394); };
00158   void SetMILSystemTypeToCorona() { this->SetMILSystemType(VTK_MIL_CORONA); };
00159   void SetMILSystemTypeToCoronaII() { this->SetMILSystemType(VTK_MIL_CORONA_II); };
00160   void SetMILSystemTypeToPulsar() { this->SetMILSystemType(VTK_MIL_PULSAR); };
00161   void SetMILSystemTypeToGenesis() { this->SetMILSystemType(VTK_MIL_GENESIS); };
00162   void SetMILSystemTypeToGenesisPlus() { this->SetMILSystemType(VTK_MIL_GENESIS_PLUS); };
00163   void SetMILSystemTypeToOrion() { this->SetMILSystemType(VTK_MIL_ORION); };
00164   void SetMILSystemTypeToCronos() { this->SetMILSystemType(VTK_MIL_CRONOS); };
00165   void SetMILSystemTypeToOdyssey() { this->SetMILSystemType(VTK_MIL_ODYSSEY); };
00167 
00168 
00169   vtkSetMacro(MILSystemNumber,int);
00170   vtkGetMacro(MILSystemNumber,int);
00172 
00174 
00175   vtkSetStringMacro(MILDigitizerDCF);
00176   vtkGetStringMacro(MILDigitizerDCF);
00178 
00180 
00181   vtkSetMacro(MILDigitizerNumber,int);
00182   vtkGetMacro(MILDigitizerNumber,int);
00184 
00186 
00187   virtual void SetMILErrorMessages(int yesno);
00188   vtkBooleanMacro(MILErrorMessages,int);
00189   vtkGetMacro(MILErrorMessages,int);
00191 
00193 
00194   vtkSetMacro(MILAppID,long);
00195   vtkGetMacro(MILAppID,long);
00196   vtkSetMacro(MILSysID,long);
00197   vtkGetMacro(MILSysID,long);
00198   vtkGetMacro(MILDigID,long);
00199   vtkGetMacro(MILBufID,long);
00201 
00204   void Initialize();
00205 
00207   void ReleaseSystemResources();
00208 
00210 
00211   void *OldHookFunction;
00212   void *OldUserDataPtr;
00213   int FrameCounter;
00214   int ForceGrab;
00215   void InternalGrab();
00217 
00218 protected:
00219   vtkMILVideoSource();
00220   ~vtkMILVideoSource();
00221 
00222   virtual void AllocateMILDigitizer();
00223   virtual void AllocateMILBuffer();
00224 
00225   virtual char *MILInterpreterForSystem(const char *system);
00226   char *MILInterpreterDLL;
00227 
00228   int VideoChannel;
00229   int VideoInput;
00230   int VideoInputForColor;
00231   int VideoFormat;
00232 
00233   float ContrastLevel;
00234   float BrightnessLevel;
00235   float HueLevel;
00236   float SaturationLevel;
00237 
00238   float BlackLevel;
00239   float WhiteLevel;
00240 
00241   int FrameMaxSize[2];
00242 
00243   long MILAppID;
00244   long MILSysID;
00245   long MILDigID;
00246   long MILBufID;
00247   // long MILDispBufID;
00248   // long MILDispID;
00249 
00250   char *MILSystemType;
00251   int MILSystemNumber;
00252 
00253   int MILDigitizerNumber;
00254   char *MILDigitizerDCF;
00255 
00256   int MILErrorMessages;
00257 
00258   int MILAppInternallyAllocated;
00259   int MILSysInternallyAllocated;
00260 
00261   int FatalMILError;
00262 
00266   double CreateTimeStampForFrame(unsigned long frame);
00267 
00268   double LastTimeStamp;
00269   unsigned long LastFrameCount;
00270   double EstimatedFramePeriod;
00271   double NextFramePeriod;
00272 
00273 private:
00274   vtkMILVideoSource(const vtkMILVideoSource&);  // Not implemented.
00275   void operator=(const vtkMILVideoSource&);  // Not implemented.
00276 };
00277 
00278 #endif