ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkFileListVideoIO.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 itkFileListVideoIO_h
19 #define itkFileListVideoIO_h
20 
21 #include "itkVideoIOBase.h"
22 #include "ITKVideoIOExport.h"
23 
24 namespace itk
25 {
39 class ITKVideoIO_EXPORT FileListVideoIO : public VideoIOBase
40 {
41 public:
42  ITK_DISALLOW_COPY_AND_ASSIGN(FileListVideoIO);
43 
49 
51  itkNewMacro(Self);
52 
54  itkTypeMacro(FileListVideoIO, VideoIOBase);
55 
57  itkGetConstObjectMacro(ImageIO, ImageIOBase);
58 
60  itkGetConstMacro(FileNames, std::vector<std::string>);
61 
63  void SetFileName(const std::string& fileList) override;
64  void SetFileName(const char* fileList) override;
66 
68  void FinishReadingOrWriting() override;
69 
73  static std::vector<std::string> SplitFileNames(const std::string& fileList);
74 
76  void SetReadFromFile() override;
77 
79  void SetReadFromCamera() override;
80 
83  bool CanReadFile(const char *) override;
84 
86  bool CanReadCamera( CameraIDType cameraID )const override;
87 
89  void ReadImageInformation() override;
90 
92  void Read(void *buffer) override;
93 
96  bool SetNextFrameToRead(FrameOffsetType frameNumber) override;
97 
100  {
101  return this->m_PositionInMSec;
102  }
103  TemporalOffsetType GetRatio() const override
104  {
105  return this->m_Ratio;
106  }
108  {
109  return this->m_FrameTotal;
110  }
112  {
113  return this->m_FramesPerSecond;
114  }
116  {
117  return this->m_CurrentFrame;
118  }
119  itkGetConstMacro(IFrameInterval,FrameOffsetType);
121  {
122  return this->m_LastIFrame;
123  }
125 
127  double GetSpacing(unsigned int i) const override;
128 
129  double GetOrigin(unsigned int i) const override;
130 
131  std::vector< double > GetDirection(unsigned int i) const override;
132 
135  bool CanWriteFile(const char *) override;
136 
139  void WriteImageInformation() override;
140 
143  void Write(const void *buffer) override;
144 
146  void SetWriterParameters( TemporalRatioType framesPerSecond,
147  const std::vector<SizeValueType>& dim,
148  const char* fourCC,
149  unsigned int nChannels,
150  IOComponentType componentType ) override;
151 
152 protected:
153  FileListVideoIO();
154  ~FileListVideoIO() override;
155 
156  void PrintSelf(std::ostream & os, Indent indent) const override;
157 
159  void ResetMembers();
160 
162  void OpenReader();
163 
165  void OpenWriter();
166 
168  bool VerifyExtensions( const std::vector<std::string>& fileList ) const;
169 
170 private:
172 
173  std::vector<std::string> m_FileNames;
174 
175 };
176 } // end namespace itk
177 
178 #endif // itkFileListVideoIO_h
double TemporalOffsetType
Light weight base class for most itk classes.
Abstract superclass defines video IO interface.
TemporalOffsetType GetPositionInMSec() const override
SizeValueType FrameOffsetType
Abstract superclass defines image IO interface.
TemporalOffsetType GetRatio() const override
double TemporalRatioType
VideoIO object for reading and writing videos as a sequence of frame files.
FrameOffsetType GetCurrentFrame() const override
TemporalRatioType GetFramesPerSecond() const override
std::vector< std::string > m_FileNames
ImageIOBase::Pointer m_ImageIO
SizeValueType CameraIDType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for most ITK classes.
Definition: itkObject.h:60
FrameOffsetType GetLastIFrame() const override
FrameOffsetType GetFrameTotal() const override