ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkRandomImageSource.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 __itkRandomImageSource_h
29 #define __itkRandomImageSource_h
30 
31 #include "itkImageSource.h"
32 #include "itkNumericTraits.h"
33 
34 namespace itk
35 {
53 template< typename TOutputImage >
54 class ITK_EXPORT RandomImageSource:public ImageSource< TOutputImage >
55 {
56 public:
62 
64  typedef typename TOutputImage::PixelType OutputImagePixelType;
65 
67  typedef typename TOutputImage::RegionType OutputImageRegionType;
68 
70  itkTypeMacro(RandomImageSource, ImageSource);
71 
73  itkNewMacro(Self);
74 
76  typedef typename TOutputImage::SizeType SizeType;
77  typedef typename TOutputImage::IndexType IndexType;
78  typedef typename TOutputImage::SpacingType SpacingType;
79  typedef typename TOutputImage::PointType PointType;
81  typedef SizeValueType SizeValueArrayType[TOutputImage::ImageDimension];
82  typedef typename TOutputImage::SpacingValueType SpacingValueType;
83  typedef SpacingValueType SpacingValueArrayType[TOutputImage::ImageDimension];
84  typedef typename TOutputImage::PointValueType PointValueType;
85  typedef PointValueType PointValueArrayType[TOutputImage::ImageDimension];
86 
88  itkSetMacro(Size, SizeType);
89  virtual void SetSize(SizeValueArrayType sizeArray);
91 
92  virtual const SizeValueType * GetSize() const;
93 
95  itkSetMacro(Spacing, SpacingType);
96  virtual void SetSpacing(SpacingValueArrayType spacingArray);
98 
99  virtual const SpacingValueType * GetSpacing() const;
100 
102  itkSetMacro(Origin, PointType);
103  virtual void SetOrigin(PointValueArrayType originArray);
105 
106  virtual const PointValueType * GetOrigin() const;
107 
110  itkSetClampMacro( Min, OutputImagePixelType,
113 
115  itkGetConstMacro(Min, OutputImagePixelType);
116 
119  itkSetClampMacro( Max, OutputImagePixelType,
122 
124  itkGetConstMacro(Max, OutputImagePixelType);
125 protected:
128  void PrintSelf(std::ostream & os, Indent indent) const;
130 
131  virtual void
132  ThreadedGenerateData(const OutputImageRegionType &
133  outputRegionForThread, ThreadIdType threadId);
134 
135  virtual void GenerateOutputInformation();
136 
137 private:
138  RandomImageSource(const RandomImageSource &); //purposely not implemented
139  void operator=(const RandomImageSource &); //purposely not implemented
140 
141  SizeType m_Size; //size of the output image
143  PointType m_Origin; //origin
144 
145  typename TOutputImage::PixelType m_Min; //minimum possible value
146  typename TOutputImage::PixelType m_Max; //maximum possible value
147 
148  // The following variables are deprecated, and provided here just for
149  // backward compatibility. It use is discouraged.
150  mutable PointValueArrayType m_OriginArray;
151  mutable SpacingValueArrayType m_SpacingArray;
152 };
153 } // end namespace itk
154 
155 #ifndef ITK_MANUAL_INSTANTIATION
156 #include "itkRandomImageSource.hxx"
157 #endif
158 
159 #endif
160