ITK  6.0.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 * https://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
27namespace itk
28{
34{
35public:
40 enum class ReadFrom : uint8_t
41 {
42 ReadFromFile,
43 ReadFromCamera
44 };
45};
46// Define how to print enumeration
47extern ITKVideoIO_EXPORT std::ostream &
48 operator<<(std::ostream & out, const VideoIOBaseEnums::ReadFrom value);
49
70class ITKVideoIO_EXPORT VideoIOBase : public ImageIOBase
71{
72public:
73 ITK_DISALLOW_COPY_AND_MOVE(VideoIOBase);
74
80
82 using TemporalOffsetType = double;
84 using TemporalRatioType = double;
85
88
90 itkOverrideGetNameOfClassMacro(VideoIOBase);
91
93 virtual void
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
109
111 virtual void
113
117 {
118 return this->m_ReadFrom;
119 }
120
123 virtual bool
124 CanReadCamera(CameraIDType cameraID) const = 0;
125
128 virtual bool
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
140 virtual FrameOffsetType
141 GetCurrentFrame() const = 0;
142 virtual FrameOffsetType
143 GetLastIFrame() const = 0;
146 /*-------- This part of the interfaces deals with writing data. ----- */
147
149 virtual void
151 const std::vector<SizeValueType> & dim,
152 const char * fourCC,
153 unsigned int nChannels,
154 IOComponentEnum componentType) = 0;
155
156protected:
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 };
166 FrameOffsetType m_FrameTotal{};
167 FrameOffsetType m_CurrentFrame{};
168 FrameOffsetType m_IFrameInterval{};
169 FrameOffsetType m_LastIFrame{};
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
Abstract superclass defines image IO interface.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Base class for most ITK classes.
Definition: itkObject.h:62
This contains all enum classes used from VideoIOBase class.
Abstract superclass defines video IO interface.
virtual void SetReadFromCamera()=0
ReadFromEnum GetReadFrom()
itk::SizeValueType SizeValueType
virtual TemporalRatioType GetFramesPerSecond() const =0
void PrintSelf(std::ostream &os, Indent indent) const override
SizeValueType CameraIDType
virtual TemporalRatioType GetRatio() const =0
virtual void SetReadFromFile()=0
SizeValueType FrameOffsetType
virtual FrameOffsetType GetFrameTotal() const =0
~VideoIOBase() override
virtual FrameOffsetType GetLastIFrame() const =0
virtual bool SetNextFrameToRead(FrameOffsetType frameNumber)=0
double TemporalRatioType
virtual void SetWriterParameters(TemporalRatioType framesPerSecond, const std::vector< SizeValueType > &dim, const char *fourCC, unsigned int nChannels, IOComponentEnum componentType)=0
double TemporalOffsetType
virtual void FinishReadingOrWriting()=0
virtual FrameOffsetType GetCurrentFrame() const =0
virtual TemporalOffsetType GetPositionInMSec() const =0
virtual bool CanReadCamera(CameraIDType cameraID) const =0
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)
unsigned long SizeValueType
Definition: itkIntTypes.h:86