ITK  4.9.0
Insight Segmentation and Registration Toolkit
vidl_itk_istream.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 __vidl_itk_istream_h
19 #define __vidl_itk_istream_h
20 
21 #include "vidl/vidl_istream.h"
22 #include "itkVideoStream.h"
23 
24 namespace itk
25 {
26 
38 template< typename TVideoStream >
39 class vidl_itk_istream : public vidl_istream
40 {
41 public:
42 
46  typedef TVideoStream VideoStreamType;
48  typedef typename VideoStreamType::FrameType FrameType;
50  typedef typename FrameType::PixelType PixelType;
51  static const unsigned int Dimensions = FrameType::ImageDimension;
52 
55 
57  vidl_itk_istream(VideoStreamType* videoStream);
58 
60  virtual ~vidl_itk_istream() {}
61 
63  itkTypeMacro(vidl_itk_istream, vidl_istream);
64 
65 
69  virtual bool open(VideoStreamType* videoStream);
70 
73  virtual void close() { m_VideoStream = ITK_NULLPTR; }
74 
75 
79  virtual bool is_open() const { return m_VideoStream != ITK_NULLPTR; }
80 
84  virtual bool is_valid() const;
85 
88  virtual bool is_seekable() const;
89 
91  virtual int num_frames() const;
92 
95  virtual unsigned int frame_number() const;
96 
98  virtual unsigned int width() const;
99 
101  virtual unsigned int height() const;
102 
104  virtual vidl_pixel_format format() const;
105 
108  virtual double frame_rate() const { return 0.0; }
109 
111  virtual double duration() const;
112 
113 
117  virtual bool advance();
118 
120  virtual vidl_frame_sptr read_frame();
121 
123  virtual vidl_frame_sptr current_frame();
124 
126  virtual bool seek_frame(unsigned int frameNumber);
127 
128 protected:
129 
132 
135 
136 }; // end class vidl_itk_istream
137 
138 
139 } // end namespace itk
140 
141 #ifndef ITK_MANUAL_INSTANTIATION
142 #include "vidl_itk_istream.hxx"
143 #endif
144 
145 #endif
vidl_itk_istream< VideoStreamType > Self
virtual unsigned int height() const
virtual vidl_frame_sptr current_frame()
FrameType::PixelType PixelType
TVideoStream VideoStreamType
implementation of VXL&#39;s vidl_istream using an itk VideoStream
unsigned long SizeValueType
Definition: itkIntTypes.h:143
virtual vidl_pixel_format format() const
virtual unsigned int width() const
virtual unsigned int frame_number() const
virtual bool is_open() const
VideoStreamType * m_VideoStream
VideoStreamType::FrameType FrameType
::itk::SizeValueType FrameOffsetType
virtual double duration() const
virtual bool is_seekable() const
virtual vidl_frame_sptr read_frame()
virtual bool is_valid() const
virtual bool open(VideoStreamType *videoStream)
static const unsigned int Dimensions
virtual double frame_rate() const
virtual bool seek_frame(unsigned int frameNumber)
virtual int num_frames() const
virtual bool advance()