ITK  5.4.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  * https://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;
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);
73  itkSetMacro(FramesPerSecond, TemporalRatioType);
74  itkGetMacro(FramesPerSecond, TemporalRatioType);
81  itkSetStringMacro(FourCC);
82  itkGetStringMacro(FourCC);
86  itkSetMacro(OutputTemporalRegion, TemporalRegion);
87  itkGetMacro(OutputTemporalRegion, TemporalRegion);
91  using Superclass::SetInput;
92  void
93  SetInput(const VideoStreamType * input);
94  const VideoStreamType *
95  GetInput();
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 
147  IOBasePointer m_VideoIO{};
148 
150  TemporalRegion m_OutputTemporalRegion{};
151 
153  TemporalRatioType m_FramesPerSecond{ 24 };
154  std::string m_FourCC{};
155  std::vector<SizeValueType> m_Dimensions{};
156  SizeValueType m_NumberOfComponents{ 0 };
157  IOComponentEnum m_ComponentType{};
158 };
159 
160 } // end namespace itk
161 
162 #ifndef ITK_MANUAL_INSTANTIATION
163 # include "itkVideoFileWriter.hxx"
164 #endif
165 
166 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
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::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:55
itk::VideoFileWriter
Writer that takes in a VideoStream and writes the frames to a file.
Definition: itkVideoFileWriter.h:40
itkOverrideGetNameOfClassMacro
itkOverrideGetNameOfClassMacro(AddImageFilter)
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::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::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