ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkVideoFileWriter.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 
00019 #ifndef __itkVideoFileWriter_h
00020 #define __itkVideoFileWriter_h
00021 
00022 #include "itkTemporalProcessObject.h"
00023 #include "itkVideoIOFactory.h"
00024 
00025 namespace itk
00026 {
00027 
00038 template< class TInputVideoStream >
00039 class ITK_EXPORT VideoFileWriter : public TemporalProcessObject
00040 {
00041 public:
00042 
00044   typedef VideoFileWriter< TInputVideoStream>         Self;
00045   typedef TemporalProcessObject                       Superclass;
00046   typedef SmartPointer<Self>                          Pointer;
00047 
00048   typedef VideoIOBase                                 IOBaseType;
00049   typedef typename VideoIOBase::Pointer               IOBasePointer;
00050   typedef typename IOBaseType::SizeValueType          SizeValueType;
00051   typedef typename IOBaseType::TemporalRatioType      TemporalRatioType;
00052 
00053   typedef TInputVideoStream                           VideoStreamType;
00054   typedef typename VideoStreamType::Pointer           VideoStreamPointer;
00055   typedef typename VideoStreamType::FrameType         FrameType;
00056   typedef typename FrameType::PixelType               PixelType;
00057 
00059   itkNewMacro(Self);
00060 
00062   itkTypeMacro(VideoFileWriter, TemporalProcessObject);
00063 
00067   itkSetStringMacro(FileName);
00068   itkGetStringMacro(FileName);
00070 
00072   itkSetMacro(FramesPerSecond, TemporalRatioType);
00073   itkGetMacro(FramesPerSecond, TemporalRatioType);
00075 
00080   itkSetStringMacro(FourCC);
00081   itkGetStringMacro(FourCC);
00083 
00085   itkSetMacro(OutputTemporalRegion, TemporalRegion);
00086   itkGetMacro(OutputTemporalRegion, TemporalRegion);
00088 
00090   using Superclass::SetInput;
00091   void SetInput( const VideoStreamType* input );
00092   const VideoStreamType* GetInput();
00094 
00096   void SetVideoIO( IOBasePointer videoIO );
00097 
00101   void Write();
00102 
00104   void FinishWriting();
00105 
00108   virtual void Update();
00109 
00112   virtual void UpdateLargestPossibleRegion();
00113 
00114 protected:
00115 
00118   VideoFileWriter();
00119   virtual ~VideoFileWriter();
00120   void PrintSelf(std::ostream &os, Indent indent) const;
00121 
00123   bool InitializeOutputParameters();
00124 
00128   bool InitializeVideoIO();
00129 
00131   virtual void TemporalStreamingGenerateData();
00132 
00136   std::string m_FileName;
00137 
00139   IOBasePointer m_VideoIO;
00140 
00142   TemporalRegion     m_OutputTemporalRegion;
00143 
00145   TemporalRatioType            m_FramesPerSecond;
00146   std::string                  m_FourCC;
00147   std::vector<SizeValueType>   m_Dimensions;
00148   SizeValueType                m_NumberOfComponents;
00149   ImageIOBase::IOComponentType m_ComponentType;
00150 private:
00151   VideoFileWriter(const Self &); // purposely not implemented
00152   void operator=(const Self &);  // purposely not implemented
00154 
00155 };
00156 
00157 } // end namespace itk
00158 
00159 #if ITK_TEMPLATE_TXX
00160 #include "itkVideoFileWriter.hxx"
00161 #endif
00162 
00163 #endif
00164