ITK  4.9.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:
46 
48  itkNewMacro(Self);
49 
51  itkTypeMacro(FileListVideoIO, Superclass);
52 
54  virtual void FinishReadingOrWriting() ITK_OVERRIDE;
55 
59  static std::vector<std::string> SplitFileNames(const std::string& fileList);
60 
61  /*-------- This part of the interface deals with reading data. ------ */
62 
64  virtual void SetReadFromFile() ITK_OVERRIDE;
65 
67  virtual void SetReadFromCamera() ITK_OVERRIDE;
68 
71  virtual bool CanReadFile(const char *) ITK_OVERRIDE;
72 
74  virtual bool CanReadCamera( CameraIDType cameraID )const ITK_OVERRIDE;
75 
77  virtual void ReadImageInformation() ITK_OVERRIDE;
78 
80  virtual void Read(void *buffer) ITK_OVERRIDE;
81 
84  virtual bool SetNextFrameToRead(FrameOffsetType frameNumber) ITK_OVERRIDE;
85 
87  virtual TemporalOffsetType GetPositionInMSec() const ITK_OVERRIDE
88  {
89  return this->m_PositionInMSec;
90  }
91  virtual TemporalOffsetType GetRatio() const ITK_OVERRIDE
92  {
93  return this->m_Ratio;
94  }
95  virtual FrameOffsetType GetFrameTotal() const ITK_OVERRIDE
96  {
97  return this->m_FrameTotal;
98  }
99  virtual TemporalRatioType GetFramesPerSecond() const ITK_OVERRIDE
100  {
101  return this->m_FramesPerSecond;
102  }
103  virtual FrameOffsetType GetCurrentFrame() const ITK_OVERRIDE
104  {
105  return this->m_CurrentFrame;
106  }
107  itkGetConstMacro(IFrameInterval,FrameOffsetType);
108  virtual FrameOffsetType GetLastIFrame() const ITK_OVERRIDE
109  {
110  return this->m_LastIFrame;
111  }
113 
115  virtual void SetFileName(const std::string& fileList) ITK_OVERRIDE;
116  virtual void SetFileName(const char* fileList) ITK_OVERRIDE;
118 
120  virtual double GetSpacing(unsigned int i) const ITK_OVERRIDE;
121 
122  virtual double GetOrigin(unsigned int i) const ITK_OVERRIDE;
123 
124  virtual std::vector< double > GetDirection(unsigned int i) const ITK_OVERRIDE;
125 
126  /*-------- This part of the interfaces deals with writing data. ----- */
127 
130  virtual bool CanWriteFile(const char *) ITK_OVERRIDE;
131 
134  virtual void WriteImageInformation() ITK_OVERRIDE;
135 
138  virtual void Write(const void *buffer) ITK_OVERRIDE;
139 
141  virtual void SetWriterParameters( TemporalRatioType framesPerSecond,
142  const std::vector<SizeValueType>& dim,
143  const char* fourCC,
144  unsigned int nChannels,
145  IOComponentType componentType ) ITK_OVERRIDE;
146 
147 protected:
148  FileListVideoIO();
149  ~FileListVideoIO();
150 
151  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
152 
154  void ResetMembers();
155 
157  void OpenReader();
158 
160  void OpenWriter();
161 
163  bool VerifyExtensions( const std::vector<std::string>& fileList ) const;
164 
165 private:
166  FileListVideoIO(const Self &) ITK_DELETE_FUNCTION;
167  void operator=(const Self &) ITK_DELETE_FUNCTION;
168 
170  ImageIOBase::Pointer m_ImageIO;
171 
173  std::vector<std::string> m_FileNames;
174 
175 };
176 } // end namespace itk
177 
178 #endif // itkFileListVideoIO_h
Light weight base class for most itk classes.
virtual TemporalRatioType GetFramesPerSecond() const override
Abstract superclass defines video IO interface.
Abstract superclass defines image IO interface.
virtual TemporalOffsetType GetRatio() const override
unsigned long SizeValueType
Definition: itkIntTypes.h:143
VideoIO object for reading and writing videos as a sequence of frame files.
virtual FrameOffsetType GetCurrentFrame() const override
SizeValueType FrameOffsetType
SmartPointer< Self > Pointer
SizeValueType CameraIDType
virtual FrameOffsetType GetLastIFrame() const override
virtual FrameOffsetType GetFrameTotal() const override
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for most ITK classes.
Definition: itkObject.h:57
double TemporalRatioType
double TemporalOffsetType