ITK  5.3.0
Insight Toolkit
vidl_itk_istream.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 
39 template <typename TVideoStream>
40 class ITK_TEMPLATE_EXPORT vidl_itk_istream : public vidl_istream
41 {
42 public:
43 
47  using VideoStreamType = TVideoStream;
49  using FrameType = typename VideoStreamType::FrameType;
51  using PixelType = typename FrameType::PixelType;
52  static constexpr unsigned int Dimensions = FrameType::ImageDimension;
53 
56 
58  vidl_itk_istream(VideoStreamType * videoStream);
59 
61  virtual ~vidl_itk_istream() {}
62 
64  // Cannot use as we do not derive from ITK Object with GetNameOfClass itkTypeMacro(vidl_itk_istream, vidl_istream);
65  const char *
67  {
68  return "vidl_itk_istream";
69  }
71 
72 
76  virtual bool
77  open(VideoStreamType * videoStream);
78 
81  virtual void
83  {
84  m_VideoStream = nullptr;
85  }
86 
87 
91  virtual bool
92  is_open() const
93  {
94  return m_VideoStream != nullptr;
95  }
96 
100  virtual bool
101  is_valid() const;
102 
105  virtual bool
106  is_seekable() const;
107 
109  virtual int
110  num_frames() const;
111 
114  virtual unsigned int
115  frame_number() const;
116 
118  virtual unsigned int
119  width() const;
120 
122  virtual unsigned int
123  height() const;
124 
126  virtual vidl_pixel_format
127  format() const;
128 
131  virtual double
132  frame_rate() const
133  {
134  return 0.0;
135  }
136 
138  virtual double
139  duration() const;
140 
141 
145  virtual bool
146  advance();
147 
149  virtual vidl_frame_sptr
150  read_frame();
151 
153  virtual vidl_frame_sptr
154  current_frame();
155 
157  virtual bool
158  seek_frame(unsigned int frameNumber);
159 
160 protected:
163 
166 
167 }; // end class vidl_itk_istream
168 
169 
170 } // end namespace itk
171 
172 #ifndef ITK_MANUAL_INSTANTIATION
173 # include "vidl_itk_istream.hxx"
174 #endif
175 
176 #endif
itkVideoStream.h
itk::vidl_itk_istream::close
virtual void close()
Definition: vidl_itk_istream.h:82
itk::vidl_itk_istream::m_AdvanceCalled
bool m_AdvanceCalled
Definition: vidl_itk_istream.h:165
itk::vidl_itk_istream::FrameOffsetType
::itk::SizeValueType FrameOffsetType
Definition: vidl_itk_istream.h:50
itk::vidl_itk_istream::GetNameOfClass
const char * GetNameOfClass() const
Definition: vidl_itk_istream.h:66
itk::vidl_itk_istream::~vidl_itk_istream
virtual ~vidl_itk_istream()
Definition: vidl_itk_istream.h:61
itk::vidl_itk_istream::m_VideoStream
VideoStreamType * m_VideoStream
Definition: vidl_itk_istream.h:162
itk::vidl_itk_istream::PixelType
typename FrameType::PixelType PixelType
Definition: vidl_itk_istream.h:51
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::vidl_itk_istream::is_open
virtual bool is_open() const
Definition: vidl_itk_istream.h:92
itk::vidl_itk_istream::VideoStreamType
TVideoStream VideoStreamType
Definition: vidl_itk_istream.h:47
itk::vidl_itk_istream::frame_rate
virtual double frame_rate() const
Definition: vidl_itk_istream.h:132
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itk::vidl_itk_istream
implementation of VXL's vidl_istream using an itk VideoStream
Definition: vidl_itk_istream.h:40
itk::vidl_itk_istream::FrameType
typename VideoStreamType::FrameType FrameType
Definition: vidl_itk_istream.h:49