ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkVideoSource.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 #ifndef itkVideoSource_h
19 #define itkVideoSource_h
20 
22 #include "itkVideoStream.h"
23 
24 namespace itk
25 {
26 
42 template< typename TOutputVideoStream >
43 class ITK_TEMPLATE_EXPORT VideoSource : public TemporalProcessObject
44 {
45 public:
46  ITK_DISALLOW_COPY_AND_ASSIGN(VideoSource);
47 
48  /*-TYPEDEFS----------------------------------------------------------------*/
49 
51  using Self = VideoSource;
56  using OutputVideoStreamType = TOutputVideoStream;
57 
66 
67  itkNewMacro(Self);
68 
70  itkTypeMacro(VideoSource, TemporalProcessObject);
71 
72  /*-PUBLIC METHODS----------------------------------------------------------*/
73 
75  static constexpr unsigned int OutputFrameDimension = OutputFrameType::ImageDimension;
76  static unsigned int GetOutputFrameDimension()
77  {
78  return OutputFrameType::ImageDimension;
79  }
80 
85  OutputVideoStreamType* GetOutput();
86 
87  OutputVideoStreamType* GetOutput(unsigned int idx);
88 
91  virtual void GraftNthOutput(unsigned int idx, OutputVideoStreamType* output);
92 
96  virtual void GraftOutput(OutputVideoStreamType* output);
97 
102  using Superclass::MakeOutput;
103  DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) override;
104 
105 protected:
106 
118  void GenerateOutputRequestedTemporalRegion(TemporalDataObject* output) override;
119 
125  void TemporalStreamingGenerateData() override;
126 
138  virtual void ThreadedGenerateData(
139  const OutputFrameSpatialRegionType& outputRegionForThread,
140  int threadId);
141 
147  virtual void AllocateOutputs();
148 
151  virtual void BeforeThreadedGenerateData() {
152  }
153 
156  virtual void AfterThreadedGenerateData() {
157  }
158 
162  virtual int SplitRequestedSpatialRegion(int i, int num,
163  OutputFrameSpatialRegionType& splitRegion);
164 
167  static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION ThreaderCallback(void* arg);
168 
171  struct ThreadStruct {
173  };
174 
175  VideoSource();
176  ~VideoSource() override = default;
177  void PrintSelf(std::ostream & os, Indent indent) const override;
178 
179 private:
180 
181 }; // end class VideoSource
182 
183 } // end namespace itk
184 
185 #ifndef ITK_MANUAL_INSTANTIATION
186 #include "itkVideoSource.hxx"
187 #endif
188 
189 #endif
typename FrameType::SpacingType SpacingType
typename FrameType::PixelType PixelType
Light weight base class for most itk classes.
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
static unsigned int GetOutputFrameDimension()
typename OutputVideoStreamType::SpatialRegionType OutputFrameSpatialRegionType
virtual void BeforeThreadedGenerateData()
itk::ITK_THREAD_RETURN_TYPE ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
TFrameType FrameType
Implements a weak reference to an object.
A TemporalProcessObject that produces a VideoStream.
TemporalProcessObject implements a ProcessObject for the itk pipeline with the notion of a temporal r...
A DataObject that holds a buffered portion of a video.
typename OutputVideoStreamType::DirectionType OutputFrameDirectionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
DataObject subclass with knowledge of temporal region.
virtual void AfterThreadedGenerateData()
typename FrameType::RegionType SpatialRegionType