ITK  4.4.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< class TOutputVideoStream >
41 class ITK_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;
59  typedef typename FrameType::DirectionType DirectionType;
60 
64 
65  itkStaticConstMacro(FrameDimension,unsigned int,FrameType::ImageDimension);
66 
69 
71  itkNewMacro(Self);
72 
74  itkTypeMacro(VideoFileReader, VideoSource);
75 
79  itkSetStringMacro(FileName);
80  itkGetStringMacro(FileName);
82 
85  itkSetMacro(IFrameSafe, bool);
86  itkGetMacro(IFrameSafe, bool);
88 
90  virtual void UpdateOutputInformation();
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 
112  VideoFileReader();
113  virtual ~VideoFileReader();
114  void PrintSelf(std::ostream &os, Indent indent) const;
116 
120  virtual void TemporalStreamingGenerateData();
121 
123  void DoConvertBuffer(void* inputData, FrameOffsetType frameNumber);
124 
127  void InitializeVideoIO();
128 
132  std::string m_FileName;
133 
137 
140 
144 
145 private:
146  VideoFileReader(const Self &); // purposely not implemented
147  void operator=(const Self &); // purposely not implemented
148 
149 };
150 
151 } // end namespace itk
152 
153 #ifndef ITK_MANUAL_INSTANTIATION
154 #include "itkVideoFileReader.hxx"
155 #endif
156 
157 #endif
158