ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkVideoIOBase.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkVideoIOBase_h
19 #define itkVideoIOBase_h
20 
21 #include "itkImageIOBase.h"
22 #include "itkExceptionObject.h"
23 #include "ITKVideoIOExport.h"
24 #include "vnl/vnl_vector.h"
25 
26 #include <string>
27 
28 namespace itk
29 {
49 class ITKVideoIO_EXPORT VideoIOBase : public ImageIOBase
50 {
51 public:
52  ITK_DISALLOW_COPY_AND_ASSIGN(VideoIOBase);
53 
55  using Self = VideoIOBase;
59 
61  using TemporalOffsetType = double;
63  using TemporalRatioType = double;
64 
67 
69  itkTypeMacro(VideoIOBase, Superclass);
70 
72  virtual void FinishReadingOrWriting() = 0;
73 
74  /*-------- This part of the interface deals with reading data. ------ */
75 
77  typedef enum {ReadFromFile, ReadFromCamera} ReadType;
78 
80  virtual void SetReadFromFile() = 0;
81 
83  virtual void SetReadFromCamera() = 0;
84 
87  return this->m_ReadType;
88  }
89 
92  virtual bool CanReadCamera( CameraIDType cameraID ) const = 0;
93 
96  virtual bool SetNextFrameToRead( FrameOffsetType frameNumber ) = 0;
97 
99  virtual TemporalOffsetType GetPositionInMSec() const = 0;
100  virtual TemporalRatioType GetRatio() const = 0;
101  virtual FrameOffsetType GetFrameTotal() const = 0;
102  virtual TemporalRatioType GetFramesPerSecond() const = 0;
103  virtual FrameOffsetType GetCurrentFrame() const = 0;
104  virtual FrameOffsetType GetLastIFrame() const = 0;
106 
107  /*-------- This part of the interfaces deals with writing data. ----- */
108 
110  virtual void SetWriterParameters( TemporalRatioType framesPerSecond,
111  const std::vector<SizeValueType>& dim,
112  const char* fourCC,
113  unsigned int nChannels,
114  IOComponentType componentType) = 0;
115 
116 protected:
117 
118  VideoIOBase();
119  ~VideoIOBase() override;
120 
121  void PrintSelf(std::ostream & os, Indent indent) const override;
122 
124  ReadType m_ReadType{ReadFromFile};
125  TemporalRatioType m_FramesPerSecond{0.0};
130  TemporalRatioType m_Ratio{0.0};
131  TemporalOffsetType m_PositionInMSec{0.0};
132  bool m_WriterOpen{false};
133  bool m_ReaderOpen{false};
134 };
135 
136 } // end namespace itk
137 
138 #endif // itkVideoIOBase_h
::itk::SizeValueType SizeValueType
double TemporalOffsetType
Light weight base class for most itk classes.
Abstract superclass defines video IO interface.
FrameOffsetType m_IFrameInterval
SizeValueType FrameOffsetType
FrameOffsetType m_FrameTotal
Abstract superclass defines image IO interface.
FrameOffsetType m_LastIFrame
unsigned long SizeValueType
Definition: itkIntTypes.h:83
double TemporalRatioType
ReadType GetReadType()
FrameOffsetType m_CurrentFrame
SizeValueType CameraIDType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for most ITK classes.
Definition: itkObject.h:60