ITK  4.10.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 >
68  : public ProcessObject, private ImageSourceCommon
69 {
70 public:
72  typedef ImageSource Self;
76 
79 
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 
221 
222 protected:
223  ImageSource();
224  virtual ~ImageSource() {}
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 {
346  Pointer Filter;
347  };
348 
349 private:
350  ImageSource(const Self &) ITK_DELETE_FUNCTION;
351  void operator=(const Self &) ITK_DELETE_FUNCTION;
352 };
353 } // end namespace itk
354 
355 #ifndef ITK_MANUAL_INSTANTIATION
356 #include "itkImageSource.hxx"
357 #endif
358 
359 #endif
static ITK_THREAD_RETURN_TYPE ThreaderCallback(void *arg)
ProcessObject Superclass
DataObject::DataObjectIdentifierType DataObjectIdentifierType
Superclass::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
static const ImageRegionSplitterBase * GetGlobalDefaultSplitter()
virtual ProcessObject::DataObjectPointer MakeOutput(ProcessObject::DataObjectPointerArraySizeType idx) override
ImageSource Self
virtual void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, ThreadIdType threadId)
virtual void GenerateData() override
virtual void GraftNthOutput(unsigned int idx, DataObject *output)
virtual void BeforeThreadedGenerateData()
DataObject::Pointer DataObjectPointer
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes...
Definition: itkArray.h:30
virtual const ImageRegionSplitterBase * GetImageRegionSplitter() const
Get the image splitter to split the image for multi-threading.
Base class for all process objects that output image data.
static const unsigned int OutputImageDimension
#define ITK_THREAD_RETURN_TYPE
virtual void GraftOutput(DataObject *output)
virtual unsigned int SplitRequestedRegion(unsigned int i, unsigned int pieces, OutputImageRegionType &splitRegion)
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 * GetOutput()
OutputImageType::RegionType OutputImageRegionType
SmartPointer< Self > Pointer
TOutputImage OutputImageType
Base class for all data objects in ITK.
virtual void AllocateOutputs()