ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef __itkVideoSource_h 00019 #define __itkVideoSource_h 00020 00021 #include "itkTemporalProcessObject.h" 00022 #include "itkVideoStream.h" 00023 00024 namespace itk 00025 { 00026 00042 template< class TOutputVideoStream > 00043 class ITK_EXPORT VideoSource : public TemporalProcessObject 00044 { 00045 public: 00046 00047 /*-TYPEDEFS----------------------------------------------------------------*/ 00048 00050 typedef VideoSource Self; 00051 typedef TemporalProcessObject Superclass; 00052 typedef SmartPointer< Self > Pointer; 00053 typedef SmartPointer< const Self > ConstPointer; 00054 typedef WeakPointer< const Self > ConstWeakPointer; 00055 typedef TOutputVideoStream OutputVideoStreamType; 00056 00057 typedef typename OutputVideoStreamType::FrameType OutputFrameType; 00058 typedef typename OutputVideoStreamType::SpatialRegionType OutputFrameSpatialRegionType; 00059 typedef typename OutputVideoStreamType::IndexType OutputFrameIndexType; 00060 typedef typename OutputVideoStreamType::PixelType OutputFramePixelType; 00061 typedef typename OutputVideoStreamType::PointType OutputFramePointType; 00062 typedef typename OutputVideoStreamType::SpacingType OutputFrameSpacingType; 00063 typedef typename OutputVideoStreamType::SizeType OutputFrameSizeType; 00064 typedef typename OutputVideoStreamType::DirectionType OutputFrameDirectionType; 00065 00066 itkNewMacro(Self); 00067 00069 itkTypeMacro(VideoSource, TemporalProcessObject); 00070 00071 /*-PUBLIC METHODS----------------------------------------------------------*/ 00072 00074 itkStaticConstMacro(OutputFrameDimension, unsigned int, OutputFrameType::ImageDimension); 00075 static unsigned int GetOutputFrameDimension() 00076 { 00077 return OutputFrameType::ImageDimension; 00078 } 00080 00085 OutputVideoStreamType* GetOutput(); 00086 00087 OutputVideoStreamType* GetOutput(unsigned int idx); 00088 00091 virtual void GraftNthOutput(unsigned int idx, OutputVideoStreamType* output); 00092 00096 virtual void GraftOutput(OutputVideoStreamType* output); 00097 00101 typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; 00102 using Superclass::MakeOutput; 00103 virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); 00104 00105 protected: 00106 00118 virtual void GenerateOutputRequestedTemporalRegion(TemporalDataObject* output); 00119 00125 virtual void TemporalStreamingGenerateData(); 00126 00138 virtual void ThreadedGenerateData( 00139 const OutputFrameSpatialRegionType& outputRegionForThread, 00140 int threadId); 00141 00147 virtual void AllocateOutputs(); 00148 00151 virtual void BeforeThreadedGenerateData() { 00152 } 00153 00156 virtual void AfterThreadedGenerateData() { 00157 } 00158 00162 virtual int SplitRequestedSpatialRegion(int i, int num, 00163 OutputFrameSpatialRegionType& splitRegion); 00164 00167 static ITK_THREAD_RETURN_TYPE ThreaderCallback(void* arg); 00168 00171 struct ThreadStruct { 00172 Pointer Filter; 00173 }; 00174 00175 VideoSource(); 00176 virtual ~VideoSource(); 00177 virtual void PrintSelf(std::ostream & os, Indent indent) const; 00178 00179 private: 00180 00181 VideoSource(const Self &); //purposely not implemented 00182 void operator=(const Self &); //purposely not implemented 00183 00184 }; // end class VideoSource 00185 00186 } // end namespace itk 00187 00188 #if ITK_TEMPLATE_TXX 00189 #include "itkVideoSource.hxx" 00190 #endif 00191 00192 #endif 00193