ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkVideoFileReader.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 itkVideoFileReader_h
19 #define itkVideoFileReader_h
20 
21 #include "itkVideoSource.h"
22 #include "itkVideoIOFactory.h"
24 
25 namespace itk
26 {
27 
40 template< typename TOutputVideoStream >
41 class ITK_TEMPLATE_EXPORT VideoFileReader : public VideoSource< TOutputVideoStream >
42 {
43 public:
44  ITK_DISALLOW_COPY_AND_ASSIGN(VideoFileReader);
45 
50  using VideoStreamType = TOutputVideoStream;
51  using VideoStreamPointer = typename VideoStreamType::Pointer;
52 
53  using FrameType = typename VideoStreamType::FrameType;
54  using PixelType = typename FrameType::PixelType;
56  using SizeType = typename FrameType::SizeType;
57  using IndexType = typename FrameType::IndexType;
58  using PointType = typename FrameType::PointType;
59  using SpacingType = typename FrameType::SpacingType;
61 
65 
66  static constexpr unsigned int FrameDimension = FrameType::ImageDimension;
67 
70 
72  itkNewMacro(Self);
73 
75  itkTypeMacro(VideoFileReader, VideoSource);
76 
77 
79  itkSetStringMacro(FileName);
80  itkGetStringMacro(FileName);
82 
85  itkSetMacro(IFrameSafe, bool);
86  itkGetMacro(IFrameSafe, bool);
88 
90  void UpdateOutputInformation() override;
91 
94  void SetVideoIO(VideoIOBase* videoIO);
95 
97  FrameOffsetType GetCurrentPositionFrame();
98 
99  TemporalRatioType GetCurrentPositionRatio();
100 
101  TemporalOffsetType GetCurrentPositionMSec();
102 
104  FrameOffsetType GetNumberOfFrames();
105 
107  TemporalRatioType GetFramesPerSecond();
108 
109 protected:
110 
111  VideoFileReader();
112  ~VideoFileReader() override = default;
113  void PrintSelf(std::ostream & os, Indent indent) const override;
114 
118  void TemporalStreamingGenerateData() override;
119 
121  void DoConvertBuffer(void* inputData, FrameOffsetType frameNumber);
122 
125  void InitializeVideoIO();
126 
127 private:
129  std::string m_FileName;
130 
134 
137 
141 };
142 
143 } // end namespace itk
144 
145 #ifndef ITK_MANUAL_INSTANTIATION
146 #include "itkVideoFileReader.hxx"
147 #endif
148 
149 #endif
typename FrameType::PointType PointType
double TemporalOffsetType
Light weight base class for most itk classes.
Abstract superclass defines video IO interface.
SizeValueType FrameOffsetType
typename FrameType::DirectionType DirectionType
typename FrameType::SizeType SizeType
double TemporalRatioType
Traits class used to by ConvertPixels to convert blocks of pixels.
typename VideoStreamType::Pointer VideoStreamPointer
typename FrameType::IndexType IndexType
TOutputVideoStream VideoStreamType
typename VideoIOBase::TemporalRatioType TemporalRatioType
A TemporalProcessObject that produces a VideoStream.
typename VideoIOBase::FrameOffsetType FrameOffsetType
typename VideoStreamType::FrameType FrameType
typename FrameType::PixelType PixelType
typename FrameType::SpacingType SpacingType
VideoIOBase::Pointer m_VideoIO
Reader that creates a VideoStream.
typename FrameType::RegionType RegionType
typename VideoIOBase::TemporalOffsetType TemporalOffsetType
Control indentation during Print() invocation.
Definition: itkIndent.h:49