ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkImageSource.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  *
20  * Portions of this file are subject to the VTK Toolkit Version 3 copyright.
21  *
22  * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
23  *
24  * For complete copyright, license and disclaimer of warranty information
25  * please refer to the NOTICE file at the top of the ITK source tree.
26  *
27  *=========================================================================*/
28 #ifndef itkImageSource_h
29 #define itkImageSource_h
30 
31 #include "itkProcessObject.h"
32 #include "itkImage.h"
34 #include "itkImageSourceCommon.h"
35 
36 namespace itk
37 {
38 
66 template< typename TOutputImage >
67 class ITK_TEMPLATE_EXPORT ImageSource
68  : public ProcessObject, private ImageSourceCommon
69 {
70 public:
72  typedef ImageSource Self;
76 
79 
80  typedef Superclass::DataObjectIdentifierType DataObjectIdentifierType;
81  typedef Superclass::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
82 
84  itkTypeMacro(ImageSource, ProcessObject);
85 
87  typedef TOutputImage OutputImageType;
88  typedef typename OutputImageType::Pointer OutputImagePointer;
89  typedef typename OutputImageType::RegionType OutputImageRegionType;
90  typedef typename OutputImageType::PixelType OutputImagePixelType;
91 
93  itkStaticConstMacro(OutputImageDimension, unsigned int,
94  TOutputImage::ImageDimension);
95 
143  OutputImageType * GetOutput();
144  const OutputImageType * GetOutput() const;
146 
147  OutputImageType * GetOutput(unsigned int idx);
148 
187  virtual void GraftOutput(DataObject *output);
189 
195  virtual void GraftOutput(const DataObjectIdentifierType & key, DataObject *output);
196 
203  virtual void GraftNthOutput(unsigned int idx, DataObject *output);
204 
219  virtual ProcessObject::DataObjectPointer MakeOutput(const ProcessObject::DataObjectIdentifierType &) ITK_OVERRIDE;
221 
222 protected:
223  ImageSource();
224  virtual ~ImageSource() ITK_OVERRIDE {}
225 
241  virtual void GenerateData() ITK_OVERRIDE;
242 
265  virtual void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
266  ThreadIdType threadId);
267 
273  virtual void AllocateOutputs();
274 
285  virtual void BeforeThreadedGenerateData() {}
286 
297  virtual void AfterThreadedGenerateData() {}
298 
305  {
307  }
308 
319  virtual const ImageRegionSplitterBase* GetImageRegionSplitter() const;
320 
335  virtual
336  unsigned int SplitRequestedRegion(unsigned int i, unsigned int pieces, OutputImageRegionType & splitRegion);
337 
341  static ITK_THREAD_RETURN_TYPE ThreaderCallback(void *arg);
342 
345  struct ThreadStruct {
347  };
348 
349 private:
350  ITK_DISALLOW_COPY_AND_ASSIGN(ImageSource);
351 };
352 } // end namespace itk
353 
354 #ifndef ITK_MANUAL_INSTANTIATION
355 #include "itkImageSource.hxx"
356 #endif
357 
358 #endif
ProcessObject Superclass
DataObject::DataObjectIdentifierType DataObjectIdentifierType
Superclass::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
static const ImageRegionSplitterBase * GetGlobalDefaultSplitter()
ImageSource Self
DataObject::Pointer DataObjectPointer
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
#define ITK_THREAD_RETURN_TYPE
OutputImageType::Pointer OutputImagePointer
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Divide an image region into several pieces.
SmartPointer< const Self > ConstPointer
Secondary base class of ImageSource common between templates.
static const ImageRegionSplitterBase * GetGlobalDefaultSplitter()
Returns the default image region splitter.
OutputImageType::PixelType OutputImagePixelType
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
Superclass::DataObjectIdentifierType DataObjectIdentifierType
virtual void AfterThreadedGenerateData()
OutputImageType::RegionType OutputImageRegionType
SmartPointer< Self > Pointer
TOutputImage OutputImageType
Base class for all data objects in ITK.