ITK  4.13.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_TEMPLATE_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;
78  typedef typename TOutputImage::SpacingType SpacingType;
82  typedef SizeValueType SizeValueArrayType[TOutputImage::ImageDimension];
83  typedef typename TOutputImage::SpacingValueType SpacingValueType;
84  typedef SpacingValueType SpacingValueArrayType[TOutputImage::ImageDimension];
85  typedef typename TOutputImage::PointValueType PointValueType;
86  typedef PointValueType PointValueArrayType[TOutputImage::ImageDimension];
87 
89  itkSetMacro(Size, SizeType);
90  virtual void SetSize(SizeValueArrayType sizeArray);
92 
93  virtual const SizeValueType * GetSize() const;
94 
96  itkSetMacro(Spacing, SpacingType);
97  virtual void SetSpacing(SpacingValueArrayType spacingArray);
99 
100  virtual const SpacingValueType * GetSpacing() const;
101 
103  itkSetMacro(Origin, PointType);
104  virtual void SetOrigin(PointValueArrayType originArray);
106 
107  virtual const PointValueType * GetOrigin() const;
108 
109  itkSetMacro(Direction, DirectionType);
110  itkGetMacro(Direction, DirectionType);
111 
114  itkSetClampMacro( Min, OutputImagePixelType,
117 
119  itkGetConstMacro(Min, OutputImagePixelType);
120 
123  itkSetClampMacro( Max, OutputImagePixelType,
126 
128  itkGetConstMacro(Max, OutputImagePixelType);
129 
130 protected:
132  ~RandomImageSource() ITK_OVERRIDE;
133  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
134 
135  virtual void
136  ThreadedGenerateData(const OutputImageRegionType &
137  outputRegionForThread, ThreadIdType threadId) ITK_OVERRIDE;
138 
139  virtual void GenerateOutputInformation() ITK_OVERRIDE;
140 
141 private:
142  ITK_DISALLOW_COPY_AND_ASSIGN(RandomImageSource);
143 
144  SizeType m_Size; //size of the output image
145  SpacingType m_Spacing; //spacing
146  PointType m_Origin; //origin
147  DirectionType m_Direction; //direction
148 
149  typename TOutputImage::PixelType m_Min; //minimum possible value
150  typename TOutputImage::PixelType m_Max; //maximum possible value
151 
152  // The following variables are deprecated, and provided here just for
153  // backward compatibility. It use is discouraged.
154  mutable PointValueArrayType m_OriginArray;
155  mutable SpacingValueArrayType m_SpacingArray;
156 };
157 } // end namespace itk
158 
159 #ifndef ITK_MANUAL_INSTANTIATION
160 #include "itkRandomImageSource.hxx"
161 #endif
162 
163 #endif
SizeType::SizeValueType SizeValueType
Represent the size (bounds) of a n-dimensional image.
Definition: itkSize.h:52
TOutputImage::PointValueType PointValueType
SmartPointer< const Self > ConstPointer
Base class for all process objects that output image data.
unsigned long SizeValueType
Definition: itkIntTypes.h:143
TOutputImage::PixelType OutputImagePixelType
TOutputImage::SizeType SizeType
TOutputImage::IndexType IndexType
OutputImageType::PixelType OutputImagePixelType
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
Generate an n-dimensional image of random pixel values.
OutputImageType::RegionType OutputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
ImageSource< TOutputImage > Superclass
TOutputImage::PointType PointType
TOutputImage::SpacingType SpacingType
Define additional traits for native types such as int or float.
TOutputImage::RegionType OutputImageRegionType
TOutputImage::DirectionType DirectionType
SmartPointer< Self > Pointer
TOutputImage::SpacingValueType SpacingValueType