ITK  5.2.0
Insight Toolkit
itkVideoFileReader.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 itkVideoFileReader_h
19 #define itkVideoFileReader_h
20 
21 #include "itkVideoSource.h"
22 #include "itkVideoIOFactory.h"
24 
25 namespace itk
26 {
27 
41 template <typename TOutputVideoStream>
42 class ITK_TEMPLATE_EXPORT VideoFileReader : public VideoSource<TOutputVideoStream>
43 {
44 public:
45  ITK_DISALLOW_COPY_AND_MOVE(VideoFileReader);
46 
51  using VideoStreamType = TOutputVideoStream;
52  using VideoStreamPointer = typename VideoStreamType::Pointer;
53 
54  using FrameType = typename VideoStreamType::FrameType;
55  using PixelType = typename FrameType::PixelType;
57  using SizeType = typename FrameType::SizeType;
58  using IndexType = typename FrameType::IndexType;
59  using PointType = typename FrameType::PointType;
60  using SpacingType = typename FrameType::SpacingType;
62 
66 
67  static constexpr unsigned int FrameDimension = FrameType::ImageDimension;
68 
71 
73  itkNewMacro(Self);
74 
76  itkTypeMacro(VideoFileReader, VideoSource);
77 
78 
80  itkSetStringMacro(FileName);
81  itkGetStringMacro(FileName);
83 
86  itkSetMacro(IFrameSafe, bool);
87  itkGetMacro(IFrameSafe, bool);
89 
91  void
92  UpdateOutputInformation() override;
93 
96  void
97  SetVideoIO(VideoIOBase * videoIO);
98 
101  GetCurrentPositionFrame();
102 
104  GetCurrentPositionRatio();
105 
107  GetCurrentPositionMSec();
108 
111  GetNumberOfFrames();
112 
115  GetFramesPerSecond();
116 
117 protected:
118  VideoFileReader();
119  ~VideoFileReader() override = default;
120  void
121  PrintSelf(std::ostream & os, Indent indent) const override;
122 
126  void
127  TemporalStreamingGenerateData() override;
128 
130  void
131  DoConvertBuffer(void * inputData, FrameOffsetType frameNumber);
132 
135  void
136  InitializeVideoIO();
137 
138 private:
140  std::string m_FileName;
141 
145 
148 
152 };
153 
154 } // end namespace itk
155 
156 #ifndef ITK_MANUAL_INSTANTIATION
157 # include "itkVideoFileReader.hxx"
158 #endif
159 
160 #endif
itk::GTest::TypedefsAndConstructors::Dimension2::DirectionType
ImageBaseType::DirectionType DirectionType
Definition: itkGTestTypedefsAndConstructors.h:52
itk::VideoFileReader::FrameOffsetType
typename VideoIOBase::FrameOffsetType FrameOffsetType
Definition: itkVideoFileReader.h:64
itk::VideoFileReader::PixelType
typename FrameType::PixelType PixelType
Definition: itkVideoFileReader.h:55
itkVideoIOFactory.h
itk::VideoFileReader::SpacingType
typename FrameType::SpacingType SpacingType
Definition: itkVideoFileReader.h:60
itk::VideoFileReader::m_IFrameSafe
bool m_IFrameSafe
Definition: itkVideoFileReader.h:151
itk::VideoFileReader::FrameType
typename VideoStreamType::FrameType FrameType
Definition: itkVideoFileReader.h:54
itk::VideoFileReader::RegionType
typename FrameType::RegionType RegionType
Definition: itkVideoFileReader.h:56
itk::VideoFileReader
Reader that creates a VideoStream.
Definition: itkVideoFileReader.h:42
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::VideoFileReader::m_VideoIO
VideoIOBase::Pointer m_VideoIO
Definition: itkVideoFileReader.h:144
itk::VideoFileReader::m_PixelConversionNeeded
bool m_PixelConversionNeeded
Definition: itkVideoFileReader.h:147
itk::VideoFileReader::TemporalOffsetType
typename VideoIOBase::TemporalOffsetType TemporalOffsetType
Definition: itkVideoFileReader.h:63
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itkDefaultConvertPixelTraits.h
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::DefaultConvertPixelTraits
Traits class used to by ConvertPixels to convert blocks of pixels.
Definition: itkDefaultConvertPixelTraits.h:41
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::VideoIOBase::TemporalRatioType
double TemporalRatioType
Definition: itkVideoIOBase.h:84
itk::VideoFileReader::DirectionType
typename FrameType::DirectionType DirectionType
Definition: itkVideoFileReader.h:61
itk::VideoIOBase::TemporalOffsetType
double TemporalOffsetType
Definition: itkVideoIOBase.h:82
itk::VideoFileReader::PointType
typename FrameType::PointType PointType
Definition: itkVideoFileReader.h:59
itk::VideoFileReader::IndexType
typename FrameType::IndexType IndexType
Definition: itkVideoFileReader.h:58
itk::VideoFileReader::TemporalRatioType
typename VideoIOBase::TemporalRatioType TemporalRatioType
Definition: itkVideoFileReader.h:65
itk::VideoFileReader::SizeType
typename FrameType::SizeType SizeType
Definition: itkVideoFileReader.h:57
itk::VideoFileReader::VideoStreamType
TOutputVideoStream VideoStreamType
Definition: itkVideoFileReader.h:51
itk::VideoFileReader::m_FileName
std::string m_FileName
Definition: itkVideoFileReader.h:140
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::VideoIOBase::FrameOffsetType
SizeValueType FrameOffsetType
Definition: itkVideoIOBase.h:83
itk::VideoIOBase
Abstract superclass defines video IO interface.
Definition: itkVideoIOBase.h:70
itk::VideoFileReader::VideoStreamPointer
typename VideoStreamType::Pointer VideoStreamPointer
Definition: itkVideoFileReader.h:52
itkVideoSource.h
itk::VideoSource
A TemporalProcessObject that produces a VideoStream.
Definition: itkVideoSource.h:44