ITK  4.13.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 
49  typedef TOutputVideoStream VideoStreamType;
50  typedef typename VideoStreamType::Pointer VideoStreamPointer;
51 
52  typedef typename VideoStreamType::FrameType FrameType;
53  typedef typename FrameType::PixelType PixelType;
54  typedef typename FrameType::RegionType RegionType;
55  typedef typename FrameType::SizeType SizeType;
56  typedef typename FrameType::IndexType IndexType;
57  typedef typename FrameType::PointType PointType;
58  typedef typename FrameType::SpacingType SpacingType;
60 
64 
65  itkStaticConstMacro(FrameDimension,unsigned int,FrameType::ImageDimension);
66 
69 
71  itkNewMacro(Self);
72 
74  itkTypeMacro(VideoFileReader, VideoSource);
75 
76 
78  itkSetStringMacro(FileName);
79  itkGetStringMacro(FileName);
81 
84  itkSetMacro(IFrameSafe, bool);
85  itkGetMacro(IFrameSafe, bool);
87 
89  virtual void UpdateOutputInformation() ITK_OVERRIDE;
90 
93  void SetVideoIO(VideoIOBase* videoIO);
94 
96  FrameOffsetType GetCurrentPositionFrame();
97 
98  TemporalRatioType GetCurrentPositionRatio();
99 
100  TemporalOffsetType GetCurrentPositionMSec();
101 
103  FrameOffsetType GetNumberOfFrames();
104 
106  TemporalRatioType GetFramesPerSecond();
107 
108 protected:
109 
110  VideoFileReader();
111  virtual ~VideoFileReader() ITK_OVERRIDE;
112  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
113 
117  virtual void TemporalStreamingGenerateData() ITK_OVERRIDE;
118 
120  void DoConvertBuffer(void* inputData, FrameOffsetType frameNumber);
121 
124  void InitializeVideoIO();
125 
126 private:
127  ITK_DISALLOW_COPY_AND_ASSIGN(VideoFileReader);
128 
130  std::string m_FileName;
131 
134  VideoIOBase::Pointer m_VideoIO;
135 
137  bool m_PixelConversionNeeded;
138 
141  bool m_IFrameSafe;
142 };
143 
144 } // end namespace itk
145 
146 #ifndef ITK_MANUAL_INSTANTIATION
147 #include "itkVideoFileReader.hxx"
148 #endif
149 
150 #endif
Light weight base class for most itk classes.
Abstract superclass defines video IO interface.
DefaultConvertPixelTraits< PixelType > ConvertPixelTraits
VideoStreamType::FrameType FrameType
FrameType::SizeType SizeType
Traits class used to by ConvertPixels to convert blocks of pixels.
FrameType::SpacingType SpacingType
A TemporalProcessObject that produces a VideoStream.
FrameType::DirectionType DirectionType
VideoIOBase::FrameOffsetType FrameOffsetType
SizeValueType FrameOffsetType
TOutputVideoStream VideoStreamType
FrameType::PixelType PixelType
FrameType::PointType PointType
VideoStreamType::Pointer VideoStreamPointer
SmartPointer< Self > Pointer
VideoIOBase::TemporalRatioType TemporalRatioType
VideoIOBase::TemporalOffsetType TemporalOffsetType
Reader that creates a VideoStream.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
double TemporalRatioType
VideoSource< TOutputVideoStream > Superclass
FrameType::RegionType RegionType
double TemporalOffsetType
FrameType::IndexType IndexType