ITK  4.3.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"
33 
34 namespace itk
35 {
63 template< class TOutputImage >
64 class ITK_EXPORT ImageSource:public ProcessObject
65 {
66 public:
68  typedef ImageSource Self;
72 
75 
76  typedef Superclass::DataObjectIdentifierType DataObjectIdentifierType;
77  typedef Superclass::DataObjectPointerArraySizeType DataObjectPointerArraySizeType;
78 
80  itkTypeMacro(ImageSource, ProcessObject);
81 
83  typedef TOutputImage OutputImageType;
84  typedef typename OutputImageType::Pointer OutputImagePointer;
85  typedef typename OutputImageType::RegionType OutputImageRegionType;
86  typedef typename OutputImageType::PixelType OutputImagePixelType;
87 
89  itkStaticConstMacro(OutputImageDimension, unsigned int,
90  TOutputImage::ImageDimension);
91 
139  OutputImageType * GetOutput(void);
140  const OutputImageType * GetOutput(void) const;
142 
143  OutputImageType * GetOutput(unsigned int idx);
144 
180  virtual void GraftOutput(DataObject *output);
181 
187  virtual void GraftOutput(const DataObjectIdentifierType & key, DataObject *output);
188 
195  virtual void GraftNthOutput(unsigned int idx, DataObject *output);
196 
210  using Superclass::MakeOutput;
213 
214 protected:
215  ImageSource();
216  virtual ~ImageSource() {}
217 
233  virtual void GenerateData();
234 
257  virtual
258  void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread,
259  ThreadIdType threadId);
260 
266  virtual void AllocateOutputs();
267 
278  virtual void BeforeThreadedGenerateData() {}
279 
290  virtual void AfterThreadedGenerateData() {}
291 
297  virtual
298  unsigned int SplitRequestedRegion(unsigned int i, unsigned int num, OutputImageRegionType & splitRegion);
299 
303  static ITK_THREAD_RETURN_TYPE ThreaderCallback(void *arg);
304 
307  struct ThreadStruct {
309  };
310 
311 private:
312  ImageSource(const Self &); //purposely not implemented
313  void operator=(const Self &); //purposely not implemented
314 };
315 } // end namespace itk
316 
317 #ifndef ITK_MANUAL_INSTANTIATION
318 #include "itkImageSource.hxx"
319 #endif
320 
321 #endif
322