ITK  5.4.0
Insight Toolkit
itkFileListVideoIO.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  * https://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 itkFileListVideoIO_h
19 #define itkFileListVideoIO_h
20 
21 #include "itkVideoIOBase.h"
22 #include "ITKVideoIOExport.h"
23 
24 namespace itk
25 {
40 class ITKVideoIO_EXPORT FileListVideoIO : public VideoIOBase
41 {
42 public:
43  ITK_DISALLOW_COPY_AND_MOVE(FileListVideoIO);
44 
50 
52  itkNewMacro(Self);
53 
55  itkOverrideGetNameOfClassMacro(FileListVideoIO);
56 
58  itkGetConstObjectMacro(ImageIO, ImageIOBase);
59 
61  itkGetConstMacro(FileNames, std::vector<std::string>);
62 
64  void
65  SetFileName(const std::string & fileList) override;
66  void
67  SetFileName(const char * fileList) override;
71  void
72  FinishReadingOrWriting() override;
73 
77  static std::vector<std::string>
78  SplitFileNames(const std::string & fileList);
79 
81  void
82  SetReadFromFile() override;
83 
85  void
86  SetReadFromCamera() override;
87 
90  bool
91  CanReadFile(const char *) override;
92 
94  bool
95  CanReadCamera(CameraIDType cameraID) const override;
96 
98  void
99  ReadImageInformation() override;
100 
102  void
103  Read(void * buffer) override;
104 
107  bool
108  SetNextFrameToRead(FrameOffsetType frameNumber) override;
109 
112  GetPositionInMSec() const override
113  {
114  return this->m_PositionInMSec;
115  }
116  TemporalOffsetType
117  GetRatio() const override
118  {
119  return this->m_Ratio;
120  }
121  FrameOffsetType
122  GetFrameTotal() const override
123  {
124  return this->m_FrameTotal;
125  }
126  TemporalRatioType
127  GetFramesPerSecond() const override
128  {
129  return this->m_FramesPerSecond;
130  }
131  FrameOffsetType
132  GetCurrentFrame() const override
133  {
134  return this->m_CurrentFrame;
135  }
136  itkGetConstMacro(IFrameInterval, FrameOffsetType);
137  FrameOffsetType
138  GetLastIFrame() const override
139  {
140  return this->m_LastIFrame;
141  }
145  double
146  GetSpacing(unsigned int i) const override;
147 
148  double
149  GetOrigin(unsigned int i) const override;
150 
151  std::vector<double>
152  GetDirection(unsigned int i) const override;
153 
156  bool
157  CanWriteFile(const char *) override;
158 
161  void
162  WriteImageInformation() override;
163 
166  void
167  Write(const void * buffer) override;
168 
170  void
171  SetWriterParameters(TemporalRatioType framesPerSecond,
172  const std::vector<SizeValueType> & dim,
173  const char * fourCC,
174  unsigned int nChannels,
175  IOComponentEnum componentType) override;
176 
177 protected:
178  FileListVideoIO();
179  ~FileListVideoIO() override;
180 
181  void
182  PrintSelf(std::ostream & os, Indent indent) const override;
183 
185  void
186  ResetMembers();
187 
189  void
190  OpenReader();
191 
193  void
194  OpenWriter();
195 
197  bool
198  VerifyExtensions(const std::vector<std::string> & fileList) const;
199 
200 private:
201  ImageIOBase::Pointer m_ImageIO{};
202 
203  std::vector<std::string> m_FileNames{};
204 };
205 } // end namespace itk
206 
207 #endif // itkFileListVideoIO_h
itk::FileListVideoIO::GetFramesPerSecond
TemporalRatioType GetFramesPerSecond() const override
Definition: itkFileListVideoIO.h:127
itk::ImageIOBase
Abstract superclass defines image IO interface.
Definition: itkImageIOBase.h:77
itk::FileListVideoIO
VideoIO object for reading and writing videos as a sequence of frame files.
Definition: itkFileListVideoIO.h:40
itk::SmartPointer< Self >
itk::CommonEnums::IOComponent
IOComponent
Definition: itkCommonEnums.h:76
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::FileListVideoIO::GetLastIFrame
FrameOffsetType GetLastIFrame() const override
Definition: itkFileListVideoIO.h:138
itk::FileListVideoIO::GetRatio
TemporalOffsetType GetRatio() const override
Definition: itkFileListVideoIO.h:117
itkVideoIOBase.h
itk::FileListVideoIO::GetFrameTotal
FrameOffsetType GetFrameTotal() const override
Definition: itkFileListVideoIO.h:122
itk::FileListVideoIO::GetPositionInMSec
TemporalOffsetType GetPositionInMSec() const override
Definition: itkFileListVideoIO.h:112
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:55
itk::VideoIOBase::TemporalOffsetType
double TemporalOffsetType
Definition: itkVideoIOBase.h:82
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::VideoIOBase::CameraIDType
SizeValueType CameraIDType
Definition: itkVideoIOBase.h:87
itk::FileListVideoIO::GetCurrentFrame
FrameOffsetType GetCurrentFrame() const override
Definition: itkFileListVideoIO.h:132
itk::VideoIOBase::FrameOffsetType
SizeValueType FrameOffsetType
Definition: itkVideoIOBase.h:83
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61
itk::VideoIOBase
Abstract superclass defines video IO interface.
Definition: itkVideoIOBase.h:70