ITK  5.2.0
Insight Toolkit
itkVideoFileWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 
19 #ifndef itkVideoFileWriter_h
20 #define itkVideoFileWriter_h
21 
23 #include "itkVideoIOFactory.h"
24 
25 namespace itk
26 {
27 
39 template <typename TInputVideoStream>
40 class ITK_TEMPLATE_EXPORT VideoFileWriter : public TemporalProcessObject
41 {
42 public:
43  ITK_DISALLOW_COPY_AND_MOVE(VideoFileWriter);
44 
49 
54 
55  using VideoStreamType = TInputVideoStream;
56  using VideoStreamPointer = typename VideoStreamType::Pointer;
57  using FrameType = typename VideoStreamType::FrameType;
58  using PixelType = typename FrameType::PixelType;
59 
61  itkNewMacro(Self);
62 
65 
66 
68  itkSetStringMacro(FileName);
69  itkGetStringMacro(FileName);
71 
73  itkSetMacro(FramesPerSecond, TemporalRatioType);
74  itkGetMacro(FramesPerSecond, TemporalRatioType);
76 
81  itkSetStringMacro(FourCC);
82  itkGetStringMacro(FourCC);
84 
86  itkSetMacro(OutputTemporalRegion, TemporalRegion);
87  itkGetMacro(OutputTemporalRegion, TemporalRegion);
89 
91  using Superclass::SetInput;
92  void
93  SetInput(const VideoStreamType * input);
94  const VideoStreamType *
95  GetInput();
97 
99  void
100  SetVideoIO(IOBasePointer videoIO);
101 
105  void
106  Write();
107 
109  void
110  FinishWriting();
111 
114  void
115  Update() override;
116 
119  void
120  UpdateLargestPossibleRegion() override;
121 
122 protected:
123  VideoFileWriter();
124  ~VideoFileWriter() override;
125  void
126  PrintSelf(std::ostream & os, Indent indent) const override;
127 
129  bool
130  InitializeOutputParameters();
131 
135  bool
136  InitializeVideoIO();
137 
139  void
140  TemporalStreamingGenerateData() override;
141 
142 private:
144  std::string m_FileName;
145 
148 
151 
153  TemporalRatioType m_FramesPerSecond{ 24 };
154  std::string m_FourCC;
155  std::vector<SizeValueType> m_Dimensions;
156  SizeValueType m_NumberOfComponents{ 0 };
158 };
159 
160 } // end namespace itk
161 
162 #ifndef ITK_MANUAL_INSTANTIATION
163 # include "itkVideoFileWriter.hxx"
164 #endif
165 
166 #endif
itk::VideoFileWriter::m_Dimensions
std::vector< SizeValueType > m_Dimensions
Definition: itkVideoFileWriter.h:155
itk::VideoFileWriter::m_FileName
std::string m_FileName
Definition: itkVideoFileWriter.h:144
itk::VideoFileWriter::m_OutputTemporalRegion
TemporalRegion m_OutputTemporalRegion
Definition: itkVideoFileWriter.h:150
itkVideoIOFactory.h
itk::VideoFileWriter::VideoStreamType
TInputVideoStream VideoStreamType
Definition: itkVideoFileWriter.h:55
itk::SmartPointer< Self >
itk::CommonEnums::IOComponent
IOComponent
Definition: itkCommonEnums.h:76
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::TemporalProcessObject
TemporalProcessObject implements a ProcessObject for the itk pipeline with the notion of a temporal r...
Definition: itkTemporalProcessObject.h:66
itkTemporalProcessObject.h
itk::VideoFileWriter::m_ComponentType
IOComponentEnum m_ComponentType
Definition: itkVideoFileWriter.h:157
itk::VideoFileWriter::VideoStreamPointer
typename VideoStreamType::Pointer VideoStreamPointer
Definition: itkVideoFileWriter.h:56
itk::TemporalRegion
Region subclass that holds a region in time.
Definition: itkTemporalRegion.h:43
itk::VideoFileWriter::PixelType
typename FrameType::PixelType PixelType
Definition: itkVideoFileWriter.h:58
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::VideoFileWriter
Writer that takes in a VideoStream and writes the frames to a file.
Definition: itkVideoFileWriter.h:40
itk::VideoFileWriter::IOBasePointer
typename VideoIOBase::Pointer IOBasePointer
Definition: itkVideoFileWriter.h:51
itk::VideoFileWriter::TemporalRatioType
typename IOBaseType::TemporalRatioType TemporalRatioType
Definition: itkVideoFileWriter.h:53
itk::VideoIOBase::TemporalRatioType
double TemporalRatioType
Definition: itkVideoIOBase.h:84
itk::VideoFileWriter::FrameType
typename VideoStreamType::FrameType FrameType
Definition: itkVideoFileWriter.h:57
itk::VideoFileWriter::m_FourCC
std::string m_FourCC
Definition: itkVideoFileWriter.h:154
itk::VideoIOBase::Pointer
SmartPointer< Self > Pointer
Definition: itkVideoIOBase.h:78
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::VideoFileWriter::m_VideoIO
IOBasePointer m_VideoIO
Definition: itkVideoFileWriter.h:147
itk::VideoIOBase
Abstract superclass defines video IO interface.
Definition: itkVideoIOBase.h:70
itk::VideoFileWriter::SizeValueType
typename IOBaseType::SizeValueType SizeValueType
Definition: itkVideoFileWriter.h:52
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83