ITK  5.0.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 ITK_TEMPLATE_EXPORT vidl_itk_istream : public vidl_istream
40 {
41 public:
42 
46  using VideoStreamType = TVideoStream;
48  using FrameType = typename VideoStreamType::FrameType;
50  using PixelType = typename FrameType::PixelType;
51  static constexpr unsigned int Dimensions = FrameType::ImageDimension;
52 
55 
57  vidl_itk_istream(VideoStreamType* videoStream);
58 
60  virtual ~vidl_itk_istream() {}
61 
63  // Cannot use as we do not derive from ITK Object with GetNameOfClass itkTypeMacro(vidl_itk_istream, vidl_istream);
64  const char *GetNameOfClass() const
65  {
66  return "vidl_itk_istream";
67  }
69 
70 
74  virtual bool open(VideoStreamType* videoStream);
75 
78  virtual void close() { m_VideoStream = nullptr; }
79 
80 
84  virtual bool is_open() const { return m_VideoStream != nullptr; }
85 
89  virtual bool is_valid() const;
90 
93  virtual bool is_seekable() const;
94 
96  virtual int num_frames() const;
97 
100  virtual unsigned int frame_number() const;
101 
103  virtual unsigned int width() const;
104 
106  virtual unsigned int height() const;
107 
109  virtual vidl_pixel_format format() const;
110 
113  virtual double frame_rate() const { return 0.0; }
114 
116  virtual double duration() const;
117 
118 
122  virtual bool advance();
123 
125  virtual vidl_frame_sptr read_frame();
126 
128  virtual vidl_frame_sptr current_frame();
129 
131  virtual bool seek_frame(unsigned int frameNumber);
132 
133 protected:
134 
137 
140 
141 }; // end class vidl_itk_istream
142 
143 
144 } // end namespace itk
145 
146 #ifndef ITK_MANUAL_INSTANTIATION
147 #include "vidl_itk_istream.hxx"
148 #endif
149 
150 #endif
typename VideoStreamType::FrameType FrameType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
typename FrameType::PixelType PixelType
implementation of VXL&#39;s vidl_istream using an itk VideoStream
const char * GetNameOfClass() const
virtual bool is_open() const
VideoStreamType * m_VideoStream
TVideoStream VideoStreamType
virtual double frame_rate() const
::itk::SizeValueType FrameOffsetType