ITK  4.3.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< class TOutputVideoStream >
43 class ITK_EXPORT VideoSource : public TemporalProcessObject
44 {
45 public:
46 
47  /*-TYPEDEFS----------------------------------------------------------------*/
48 
50  typedef VideoSource Self;
55  typedef TOutputVideoStream OutputVideoStreamType;
56 
65 
66  itkNewMacro(Self);
67 
69  itkTypeMacro(VideoSource, TemporalProcessObject);
70 
71  /*-PUBLIC METHODS----------------------------------------------------------*/
72 
74  itkStaticConstMacro(OutputFrameDimension, unsigned int, OutputFrameType::ImageDimension);
75  static unsigned int GetOutputFrameDimension()
76  {
77  return OutputFrameType::ImageDimension;
78  }
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  virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
104 
105 protected:
106 
118  virtual void GenerateOutputRequestedTemporalRegion(TemporalDataObject* output);
119 
125  virtual void TemporalStreamingGenerateData();
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_TYPE ThreaderCallback(void* arg);
168 
171  struct ThreadStruct {
173  };
174 
175  VideoSource();
176  virtual ~VideoSource();
177  virtual void PrintSelf(std::ostream & os, Indent indent) const;
178 
179 private:
180 
181  VideoSource(const Self &); //purposely not implemented
182  void operator=(const Self &); //purposely not implemented
183 
184 }; // end class VideoSource
185 
186 } // end namespace itk
187 
188 #ifndef ITK_MANUAL_INSTANTIATION
189 #include "itkVideoSource.hxx"
190 #endif
191 
192 #endif
193