ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkFileListVideoIO.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkFileListVideoIO_h
00019 #define __itkFileListVideoIO_h
00020 
00021 #include "itkVideoIOBase.h"
00022 
00023 namespace itk
00024 {
00038 class ITK_EXPORT FileListVideoIO : public VideoIOBase
00039 {
00040 public:
00042   typedef FileListVideoIO      Self;
00043   typedef VideoIOBase          Superclass;
00044   typedef SmartPointer< Self > Pointer;
00045 
00047   itkNewMacro(Self);
00048 
00050   itkTypeMacro(FileListVideoIO, Superclass);
00051 
00053   virtual void FinishReadingOrWriting();
00054 
00058   static std::vector<std::string> SplitFileNames(const std::string& fileList);
00059 
00060   /*-------- This part of the interface deals with reading data. ------ */
00061 
00063   virtual void SetReadFromFile();
00064 
00066   virtual void SetReadFromCamera();
00067 
00070   virtual bool CanReadFile(const char *);
00071 
00073   virtual bool CanReadCamera( CameraIDType cameraID )const;
00074 
00076   virtual void ReadImageInformation();
00077 
00079   virtual void Read(void *buffer);
00080 
00083   virtual bool SetNextFrameToRead(FrameOffsetType frameNumber);
00084 
00086   itkGetConstMacro(PositionInMSec,TemporalOffsetType);
00087   itkGetConstMacro(Ratio,TemporalRatioType);
00088   itkGetConstMacro(FrameTotal,FrameOffsetType);
00089   itkGetConstMacro(FramesPerSecond,TemporalRatioType);
00090   itkGetConstMacro(CurrentFrame,FrameOffsetType);
00091   itkGetConstMacro(IFrameInterval,FrameOffsetType);
00092   itkGetConstMacro(LastIFrame,FrameOffsetType);
00094 
00096   virtual void SetFileName(const std::string& fileList);
00097   virtual void SetFileName(const char* fileList);
00099 
00101   virtual double GetSpacing(unsigned int i) const;
00102 
00103   virtual double GetOrigin(unsigned int i) const;
00104 
00105   virtual std::vector< double > GetDirection(unsigned int i) const;
00106 
00107   /*-------- This part of the interfaces deals with writing data. ----- */
00108 
00111   virtual bool CanWriteFile(const char *);
00112 
00115   virtual void WriteImageInformation();
00116 
00119   virtual void Write(const void *buffer);
00120 
00122   virtual void SetWriterParameters( TemporalRatioType framesPerSecond,
00123                                     const std::vector<SizeValueType>& dim,
00124                                     const char* fourCC,
00125                                     unsigned int nChannels,
00126                                     IOComponentType componentType );
00127 
00128 protected:
00129   FileListVideoIO();
00130   ~FileListVideoIO();
00131 
00132   void PrintSelf(std::ostream & os, Indent indent) const;
00133 
00135   void ResetMembers();
00136 
00138   void OpenReader();
00139 
00141   void OpenWriter();
00142 
00144   bool VerifyExtensions( const std::vector<std::string>& fileList ) const;
00145 
00146 private:
00147   FileListVideoIO(const Self &); //purposely not implemented
00148   void operator=(const Self &);  //purposely not implemented
00149 
00151   ImageIOBase::Pointer m_ImageIO;
00152 
00154   std::vector<std::string> m_FileNames;
00155 
00156 };
00157 } // end namespace itk
00158 
00159 #endif // __itkFileListVideoIO_h
00160