ITK  5.2.0
Insight Toolkit
itkVideoIOBase.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 "ITKVideoIOExport.h"
23 #include "vnl/vnl_vector.h"
24 
25 #include <string>
26 
27 namespace itk
28 {
34 {
35 public:
40  enum class ReadFrom : uint8_t
41  {
44  };
45 };
46 // Define how to print enumeration
47 extern ITKVideoIO_EXPORT std::ostream &
48  operator<<(std::ostream & out, const VideoIOBaseEnums::ReadFrom value);
49 
70 class ITKVideoIO_EXPORT VideoIOBase : public ImageIOBase
71 {
72 public:
73  ITK_DISALLOW_COPY_AND_MOVE(VideoIOBase);
74 
76  using Self = VideoIOBase;
80 
82  using TemporalOffsetType = double;
84  using TemporalRatioType = double;
85 
88 
90  itkTypeMacro(VideoIOBase, Superclass);
91 
93  virtual void
94  FinishReadingOrWriting() = 0;
95 
96  /*-------- This part of the interface deals with reading data. ------ */
97 
99 #if !defined(ITK_LEGACY_REMOVE)
100  // We need to expose the enum values at the class level
101  // for backwards compatibility
102  static constexpr ReadFromEnum ReadFromFile = ReadFromEnum::ReadFromFile;
103  static constexpr ReadFromEnum ReadFromCamera = ReadFromEnum::ReadFromCamera;
104 #endif
105 
107  virtual void
108  SetReadFromFile() = 0;
109 
111  virtual void
112  SetReadFromCamera() = 0;
113 
117  {
118  return this->m_ReadFrom;
119  }
120 
123  virtual bool
124  CanReadCamera(CameraIDType cameraID) const = 0;
125 
128  virtual bool
129  SetNextFrameToRead(FrameOffsetType frameNumber) = 0;
130 
132  virtual TemporalOffsetType
133  GetPositionInMSec() const = 0;
134  virtual TemporalRatioType
135  GetRatio() const = 0;
136  virtual FrameOffsetType
137  GetFrameTotal() const = 0;
138  virtual TemporalRatioType
139  GetFramesPerSecond() const = 0;
140  virtual FrameOffsetType
141  GetCurrentFrame() const = 0;
142  virtual FrameOffsetType
143  GetLastIFrame() const = 0;
145 
146  /*-------- This part of the interfaces deals with writing data. ----- */
147 
149  virtual void
150  SetWriterParameters(TemporalRatioType framesPerSecond,
151  const std::vector<SizeValueType> & dim,
152  const char * fourCC,
153  unsigned int nChannels,
154  IOComponentEnum componentType) = 0;
155 
156 protected:
157  VideoIOBase();
158  ~VideoIOBase() override;
159 
160  void
161  PrintSelf(std::ostream & os, Indent indent) const override;
162 
164  ReadFromEnum m_ReadFrom{ ReadFromEnum::ReadFromFile };
165  TemporalRatioType m_FramesPerSecond{ 0.0 };
170  TemporalRatioType m_Ratio{ 0.0 };
171  TemporalOffsetType m_PositionInMSec{ 0.0 };
172  bool m_WriterOpen{ false };
173  bool m_ReaderOpen{ false };
174 };
175 } // end namespace itk
176 
177 #endif // itkVideoIOBase_h
itk::VideoIOBaseEnums::ReadFrom::ReadFromFile
itk::ImageIOBase
Abstract superclass defines image IO interface.
Definition: itkImageIOBase.h:77
itk::uint8_t
::uint8_t uint8_t
Definition: itkIntTypes.h:29
itk::VideoIOBase::SizeValueType
::itk::SizeValueType SizeValueType
Definition: itkVideoIOBase.h:79
itk::VideoIOBaseEnums::ReadFrom::ReadFromCamera
itk::operator<<
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
Definition: itkArray.h:218
itk::SmartPointer< Self >
itk::CommonEnums::IOComponent
IOComponent
Definition: itkCommonEnums.h:76
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::VideoIOBase::m_FrameTotal
FrameOffsetType m_FrameTotal
Definition: itkVideoIOBase.h:166
itk::VideoIOBaseEnums
This contains all enum classes used from VideoIOBase class.
Definition: itkVideoIOBase.h:33
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::VideoIOBase::TemporalRatioType
double TemporalRatioType
Definition: itkVideoIOBase.h:84
itk::VideoIOBase::m_CurrentFrame
FrameOffsetType m_CurrentFrame
Definition: itkVideoIOBase.h:167
itk::VideoIOBase::TemporalOffsetType
double TemporalOffsetType
Definition: itkVideoIOBase.h:82
itkImageIOBase.h
itk::VideoIOBase::m_IFrameInterval
FrameOffsetType m_IFrameInterval
Definition: itkVideoIOBase.h:168
ReadFrom
itk::VideoIOBaseEnums::ReadFrom
ReadFrom
Definition: itkVideoIOBase.h:40
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::VideoIOBase::CameraIDType
SizeValueType CameraIDType
Definition: itkVideoIOBase.h:87
itk::VideoIOBase::FrameOffsetType
SizeValueType FrameOffsetType
Definition: itkVideoIOBase.h:83
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:62
itk::VideoIOBase
Abstract superclass defines video IO interface.
Definition: itkVideoIOBase.h:70
itk::VideoIOBase::GetReadFrom
ReadFromEnum GetReadFrom()
Definition: itkVideoIOBase.h:116
itk::VideoIOBase::m_LastIFrame
FrameOffsetType m_LastIFrame
Definition: itkVideoIOBase.h:169
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83