ITK  4.6.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 
35 namespace itk
36 {
37 
50 struct ITKCommon_EXPORT ImageSourceCommon
51 {
55  static const ImageRegionSplitterBase* GetGlobalDefaultSplitter(void);
56 };
57 
85 template< typename TOutputImage >
87  : public ProcessObject, private ImageSourceCommon
88 {
89 public:
91  typedef ImageSource Self;
95 
98 
101 
103  itkTypeMacro(ImageSource, ProcessObject);
104 
106  typedef TOutputImage OutputImageType;
107  typedef typename OutputImageType::Pointer OutputImagePointer;
108  typedef typename OutputImageType::RegionType OutputImageRegionType;
109  typedef typename OutputImageType::PixelType OutputImagePixelType;
110 
112  itkStaticConstMacro(OutputImageDimension, unsigned int,
113  TOutputImage::ImageDimension);
114 
162  OutputImageType * GetOutput(void);
163  const OutputImageType * GetOutput(void) const;
165 
166  OutputImageType * GetOutput(unsigned int idx);
167 
203  virtual void GraftOutput(DataObject *output);
204 
210  virtual void GraftOutput(const DataObjectIdentifierType & key, DataObject *output);
211 
218  virtual void GraftNthOutput(unsigned int idx, DataObject *output);
219 
236 
237 protected:
238  ImageSource();
239  virtual ~ImageSource() {}
240 
256  virtual void GenerateData() ITK_OVERRIDE;
257 
280  virtual
281  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
282  ThreadIdType threadId);
283 
289  virtual void AllocateOutputs();
290 
301  virtual void BeforeThreadedGenerateData() {}
302 
313  virtual void AfterThreadedGenerateData() {}
314 
321  {
323  }
324 
335  virtual const ImageRegionSplitterBase* GetImageRegionSplitter(void) const;
336 
351  virtual
352  unsigned int SplitRequestedRegion(unsigned int i, unsigned int pieces, OutputImageRegionType & splitRegion);
353 
357  static ITK_THREAD_RETURN_TYPE ThreaderCallback(void *arg);
358 
361  struct ThreadStruct {
363  };
364 
365 private:
366  ImageSource(const Self &); //purposely not implemented
367  void operator=(const Self &); //purposely not implemented
368 };
369 } // end namespace itk
370 
371 #ifndef ITK_MANUAL_INSTANTIATION
372 #include "itkImageSource.hxx"
373 #endif
374 
375 #endif
static ITK_THREAD_RETURN_TYPE ThreaderCallback(void *arg)
ProcessObject Superclass
DataObject::DataObjectIdentifierType DataObjectIdentifierType
virtual const ImageRegionSplitterBase * GetImageRegionSplitter(void) const
Get the image splitter to split the image for multi-threading.
Superclass::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
ImageSource Self
virtual void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, ThreadIdType threadId)
virtual ~ImageSource()
virtual void GraftNthOutput(unsigned int idx, DataObject *output)
virtual void BeforeThreadedGenerateData()
DataObject::Pointer DataObjectPointer
virtual ProcessObject::DataObjectPointer MakeOutput(ProcessObject::DataObjectPointerArraySizeType idx) ITK_OVERRIDE
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.
static const unsigned int OutputImageDimension
#define ITK_THREAD_RETURN_TYPE
OutputImageType * GetOutput(void)
virtual void GraftOutput(DataObject *output)
virtual unsigned int SplitRequestedRegion(unsigned int i, unsigned int pieces, OutputImageRegionType &splitRegion)
OutputImageType::Pointer OutputImagePointer
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
void operator=(const Self &)
Divide an image region into several pieces.
SmartPointer< const Self > ConstPointer
Secondary bass class of ImageSource common between templates.
static const ImageRegionSplitterBase * GetGlobalDefaultSplitter()
Returns the default image region splitter.
OutputImageType::PixelType OutputImagePixelType
virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx)
Superclass::DataObjectIdentifierType DataObjectIdentifierType
virtual void AfterThreadedGenerateData()
OutputImageType::RegionType OutputImageRegionType
static const ImageRegionSplitterBase * GetGlobalDefaultSplitter(void)
SmartPointer< Self > Pointer
TOutputImage OutputImageType
virtual void GenerateData() ITK_OVERRIDE
Base class for all data objects in ITK.
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
virtual void AllocateOutputs()