ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkVideoFileWriter.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 
19 #ifndef itkVideoFileWriter_h
20 #define itkVideoFileWriter_h
21 
23 #include "itkVideoIOFactory.h"
24 
25 namespace itk
26 {
27 
38 template< typename TInputVideoStream >
39 class ITK_TEMPLATE_EXPORT VideoFileWriter : public TemporalProcessObject
40 {
41 public:
42  ITK_DISALLOW_COPY_AND_ASSIGN(VideoFileWriter);
43 
48 
53 
54  using VideoStreamType = TInputVideoStream;
55  using VideoStreamPointer = typename VideoStreamType::Pointer;
56  using FrameType = typename VideoStreamType::FrameType;
57  using PixelType = typename FrameType::PixelType;
58 
60  itkNewMacro(Self);
61 
64 
65 
67  itkSetStringMacro(FileName);
68  itkGetStringMacro(FileName);
70 
72  itkSetMacro(FramesPerSecond, TemporalRatioType);
73  itkGetMacro(FramesPerSecond, TemporalRatioType);
75 
80  itkSetStringMacro(FourCC);
81  itkGetStringMacro(FourCC);
83 
85  itkSetMacro(OutputTemporalRegion, TemporalRegion);
86  itkGetMacro(OutputTemporalRegion, TemporalRegion);
88 
90  using Superclass::SetInput;
91  void SetInput( const VideoStreamType* input );
92  const VideoStreamType* GetInput();
94 
96  void SetVideoIO( IOBasePointer videoIO );
97 
101  void Write();
102 
104  void FinishWriting();
105 
108  void Update() override;
109 
112  void UpdateLargestPossibleRegion() override;
113 
114 protected:
115 
116  VideoFileWriter();
117  ~VideoFileWriter() override;
118  void PrintSelf(std::ostream &os, Indent indent) const override;
119 
121  bool InitializeOutputParameters();
122 
126  bool InitializeVideoIO();
127 
129  void TemporalStreamingGenerateData() override;
130 
131 private:
133  std::string m_FileName;
134 
137 
140 
142  TemporalRatioType m_FramesPerSecond{24};
143  std::string m_FourCC;
144  std::vector<SizeValueType> m_Dimensions;
145  SizeValueType m_NumberOfComponents{0};
147 };
148 
149 } // end namespace itk
150 
151 #ifndef ITK_MANUAL_INSTANTIATION
152 #include "itkVideoFileWriter.hxx"
153 #endif
154 
155 #endif
Light weight base class for most itk classes.
Abstract superclass defines video IO interface.
unsigned long SizeValueType
Definition: itkIntTypes.h:83
SmartPointer< Self > Pointer
double TemporalRatioType
typename FrameType::PixelType PixelType
Writer that takes in a VideoStream and writes the frames to a file.
TemporalRegion m_OutputTemporalRegion
TemporalProcessObject implements a ProcessObject for the itk pipeline with the notion of a temporal r...
typename IOBaseType::TemporalRatioType TemporalRatioType
Region subclass that holds a region in time.
std::vector< SizeValueType > m_Dimensions
TInputVideoStream VideoStreamType
typename VideoStreamType::FrameType FrameType
typename VideoStreamType::Pointer VideoStreamPointer
typename VideoIOBase::Pointer IOBasePointer
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename IOBaseType::SizeValueType SizeValueType
ImageIOBase::IOComponentType m_ComponentType