ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef __itkVideoIOBase_h 00019 #define __itkVideoIOBase_h 00020 00021 #include "itkImageIOBase.h" 00022 #include "itkExceptionObject.h" 00023 #include "vnl/vnl_vector.h" 00024 00025 #include <string> 00026 00027 namespace itk 00028 { 00048 class ITK_EXPORT VideoIOBase : public ImageIOBase 00049 { 00050 00051 public: 00053 typedef VideoIOBase Self; 00054 typedef ImageIOBase Superclass; 00055 typedef SmartPointer< Self > Pointer; 00056 typedef ::itk::SizeValueType SizeValueType; 00057 00059 typedef double TemporalOffsetType; 00060 typedef SizeValueType FrameOffsetType; 00061 typedef double TemporalRatioType; 00062 00064 typedef SizeValueType CameraIDType; 00065 00067 itkTypeMacro(VideoIOBase, Superclass); 00068 00070 virtual void FinishReadingOrWriting() = 0; 00071 00072 /*-------- This part of the interface deals with reading data. ------ */ 00073 00075 typedef enum {ReadFromFile, ReadFromCamera} ReadType; 00076 00078 virtual void SetReadFromFile() = 0; 00079 00081 virtual void SetReadFromCamera() = 0; 00082 00084 ReadType GetReadType() { 00085 return this->m_ReadType; 00086 } 00087 00090 virtual bool CanReadCamera( CameraIDType cameraID ) const = 0; 00091 00094 virtual bool SetNextFrameToRead( FrameOffsetType frameNumber ) = 0; 00095 00097 virtual TemporalOffsetType GetPositionInMSec() const = 0; 00098 virtual TemporalRatioType GetRatio() const = 0; 00099 virtual FrameOffsetType GetFrameTotal() const = 0; 00100 virtual TemporalRatioType GetFramesPerSecond() const = 0; 00101 virtual FrameOffsetType GetCurrentFrame() const = 0; 00102 virtual FrameOffsetType GetLastIFrame() const = 0; 00104 00105 /*-------- This part of the interfaces deals with writing data. ----- */ 00106 00108 virtual void SetWriterParameters( TemporalRatioType framesPerSecond, 00109 const std::vector<SizeValueType>& dim, 00110 const char* fourCC, 00111 unsigned int nChannels, 00112 IOComponentType componentType) = 0; 00113 00114 protected: 00115 00116 VideoIOBase(); 00117 virtual ~VideoIOBase(); 00118 00119 void PrintSelf(std::ostream & os, Indent indent) const; 00120 00122 ReadType m_ReadType; 00123 TemporalRatioType m_FramesPerSecond; 00124 FrameOffsetType m_FrameTotal; 00125 FrameOffsetType m_CurrentFrame; 00126 FrameOffsetType m_IFrameInterval; 00127 FrameOffsetType m_LastIFrame; 00128 TemporalRatioType m_Ratio; 00129 TemporalOffsetType m_PositionInMSec; 00130 bool m_WriterOpen; 00131 bool m_ReaderOpen; 00132 00133 private: 00134 VideoIOBase(const Self &); //purposely not implemented 00135 void operator=(const Self &); //purposely not implemented 00136 00137 }; 00138 00139 } // end namespace itk 00140 00141 #endif // __itkVideoIOBase_h 00142