ITK  4.4.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 
23 namespace itk
24 {
38 class ITK_EXPORT FileListVideoIO : public VideoIOBase
39 {
40 public:
45 
47  itkNewMacro(Self);
48 
50  itkTypeMacro(FileListVideoIO, Superclass);
51 
53  virtual void FinishReadingOrWriting();
54 
58  static std::vector<std::string> SplitFileNames(const std::string& fileList);
59 
60  /*-------- This part of the interface deals with reading data. ------ */
61 
63  virtual void SetReadFromFile();
64 
66  virtual void SetReadFromCamera();
67 
70  virtual bool CanReadFile(const char *);
71 
73  virtual bool CanReadCamera( CameraIDType cameraID )const;
74 
76  virtual void ReadImageInformation();
77 
79  virtual void Read(void *buffer);
80 
83  virtual bool SetNextFrameToRead(FrameOffsetType frameNumber);
84 
86  itkGetConstMacro(PositionInMSec,TemporalOffsetType);
87  itkGetConstMacro(Ratio,TemporalRatioType);
88  itkGetConstMacro(FrameTotal,FrameOffsetType);
89  itkGetConstMacro(FramesPerSecond,TemporalRatioType);
90  itkGetConstMacro(CurrentFrame,FrameOffsetType);
91  itkGetConstMacro(IFrameInterval,FrameOffsetType);
92  itkGetConstMacro(LastIFrame,FrameOffsetType);
94 
96  virtual void SetFileName(const std::string& fileList);
97  virtual void SetFileName(const char* fileList);
99 
101  virtual double GetSpacing(unsigned int i) const;
102 
103  virtual double GetOrigin(unsigned int i) const;
104 
105  virtual std::vector< double > GetDirection(unsigned int i) const;
106 
107  /*-------- This part of the interfaces deals with writing data. ----- */
108 
111  virtual bool CanWriteFile(const char *);
112 
115  virtual void WriteImageInformation();
116 
119  virtual void Write(const void *buffer);
120 
122  virtual void SetWriterParameters( TemporalRatioType framesPerSecond,
123  const std::vector<SizeValueType>& dim,
124  const char* fourCC,
125  unsigned int nChannels,
126  IOComponentType componentType );
127 
128 protected:
129  FileListVideoIO();
130  ~FileListVideoIO();
131 
132  void PrintSelf(std::ostream & os, Indent indent) const;
133 
135  void ResetMembers();
136 
138  void OpenReader();
139 
141  void OpenWriter();
142 
144  bool VerifyExtensions( const std::vector<std::string>& fileList ) const;
145 
146 private:
147  FileListVideoIO(const Self &); //purposely not implemented
148  void operator=(const Self &); //purposely not implemented
149 
152 
154  std::vector<std::string> m_FileNames;
155 
156 };
157 } // end namespace itk
158 
159 #endif // __itkFileListVideoIO_h
160